Release 1.0.1

- Suppression de nombreux messages de debug
- Ajout d'indications lors d'erreurs dans certaines commandes (pour éviter les internal error)
This commit is contained in:
leomelki 2020-03-20 00:56:45 +01:00
parent 0960fac4c2
commit 6c9bafd885
18 changed files with 24 additions and 56 deletions

View file

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fr.leomelki</groupId>
<artifactId>LoupGarou</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

View file

@ -230,8 +230,23 @@ public class MainLg extends JavaPlugin{
LGPlayer.thePlayer(Bukkit.getPlayer(args[1])).getGame().broadcastMessage("§cLa partie a été arrêtée de force !");
return true;
}else if(args[0].equalsIgnoreCase("start")) {
if(args.length < 2) {
sender.sendMessage("§4Utilisation : §c/lg start <pseudo>");
return true;
}
Player player = Bukkit.getPlayer(args[1]);
if(player == null) {
sender.sendMessage("§4Erreur : §cLe joueur §4"+args[1]+"§c n'existe pas !");
return true;
}
LGPlayer lgp = LGPlayer.thePlayer(player);
if(MainLg.getInstance().getConfig().getList("spawns").size() < lgp.getGame().getMaxPlayers()) {
sender.sendMessage("§4Erreur : §cIl n'y a pas assez de points de spawn !");
sender.sendMessage("§8§oPour les définir, merci de faire §7/lg addSpawn");
return true;
}
sender.sendMessage("§aVous avez bien démarré une nouvelle partie !");
LGPlayer.thePlayer(Bukkit.getPlayer(args[1])).getGame().updateStart();
lgp.getGame().updateStart();
return true;
}else if(args[0].equalsIgnoreCase("reloadconfig")) {
sender.sendMessage("§aVous avez bien reload la config !");

View file

@ -183,11 +183,9 @@ public class LGGame implements Listener{
}
public void kill(LGPlayer player, Reason reason) {
System.out.println("Kill "+player.getName()+" ("+player.getRole()+") for "+reason+" ("+(!deaths.containsValue(player) && !player.isDead())+")");
if(!deaths.containsValue(player) && !player.isDead()){
LGNightPlayerPreKilledEvent event = new LGNightPlayerPreKilledEvent(this, player, reason);
Bukkit.getPluginManager().callEvent(event);
System.out.println("Mort de "+player.getName()+" cancel:"+event.isCancelled());
if(!event.isCancelled())
deaths.put(event.getReason(), player);
}
@ -320,11 +318,13 @@ public class LGGame implements Listener{
return;
}
if(timeLeft == 5*2-1) {
broadcastMessage("§2Attribution des rôles...");
for(LGPlayer lgp : getInGame()) {
lgp.sendMessage("§8Plugin développé par : §e§lLeomelki§8.\n§8Projet organisé par : §e§lShytoos§8.\n");
lgp.sendTitle("", "§8§8Plugin LoupGarou par §e§lLeomelki§8 & §e§lShytoos", 40);
lgp.getPlayer().getInventory().clear();
lgp.getPlayer().updateInventory();
}
broadcastMessage("§2Attribution des rôles...");
}
if(--actualRole < 0)
@ -339,7 +339,6 @@ public class LGGame implements Listener{
}.runTaskTimer(MainLg.getInstance(), 0, 4);
}
private void _start() {
broadcastMessage("§8Plugin développé par : §e§lLeomelki§8.\n§8Projet organisé par : §e§lShytoos§8.\n");
broadcastMessage("§8§oDébut de la partie...");
//Give roles...
ArrayList<LGPlayer> toGive = (ArrayList<LGPlayer>) inGame.clone();
@ -867,7 +866,6 @@ public class LGGame implements Listener{
Bukkit.getPluginManager().callEvent(event);
if(doEndGame && event.getWinType() != LGWinType.NONE)
endGame(event.getWinType());
System.out.println("Endgame check result > "+event.getWinType()+" ("+doEndGame+")");
return event.getWinType() != LGWinType.NONE;
}
}

View file

@ -265,7 +265,6 @@ public class LGPlayer {
public boolean canSelectDead;
public LGPlayer getPlayerOnCursor(List<LGPlayer> list) {
Location loc = getPlayer().getLocation();
System.out.println("hit > "+blacklistedChoice.size()+" > "+blacklistedChoice+" > "+list);
if(loc.getPitch() > 60)
if(blacklistedChoice.contains(this))
return null;
@ -275,7 +274,6 @@ public class LGPlayer {
loc.add(loc.getDirection());
for(LGPlayer player : list) {
if(player != this && !blacklistedChoice.contains(player) && (!player.isDead() || canSelectDead) && VariousUtils.distanceSquaredXZ(loc, player.getPlayer().getLocation()) < 0.35 && Math.abs(loc.getY()-player.getPlayer().getLocation().getY()) < 2) {
System.out.println("detect");
return player;
}
}

View file

@ -111,7 +111,6 @@ public class LGVote {
boolean equal = false;
for(Entry<LGPlayer, List<LGPlayer>> entry : votes.entrySet())
if(entry.getValue().size() > max) {
System.out.println(entry.getKey()+" has "+entry.getValue().size()+" vote(s)");
equal = false;
max = entry.getValue().size();
choosen = entry.getKey();

View file

@ -18,23 +18,18 @@ public class LGChat {
}
public void sendMessage(LGPlayer sender, String message) {
System.out.println("sendmessage of "+sender.getName()+" "+this);
String sendMessage = getViewers().get(sender).send(sender, message);
for(Entry<LGPlayer, LGChatCallback> entry : viewers.entrySet()) {
System.out.println(" to "+entry.getKey().getName());
for(Entry<LGPlayer, LGChatCallback> entry : viewers.entrySet())
entry.getKey().sendMessage(sendMessage != null ? sendMessage : entry.getValue().receive(sender, message));
}
}
public void join(LGPlayer player, LGChatCallback callback) {
System.out.println("join "+player.getName()+" ! "+this);
if(getViewers().containsKey(player))
getViewers().replace(player, callback);
else
getViewers().put(player, callback);
}
public void leave(LGPlayer player) {
System.out.println("leave "+player.getName()+" ! "+this);
getViewers().remove(player);
}
}

View file

@ -51,12 +51,6 @@ public class CancelListener implements Listener{
@EventHandler
public void onEntitySpawn(EntitySpawnEvent e) {
e.setCancelled(true);
//TODO here
/* System.out.println("\r\n" +
" //TODO here\r\n" +
" //ERREUR : LE LGN PEUT NE PAS AVOIR SON MENU SI IL A LE CHAT OUVERT PAR EX..AVOIR.\r\n" +
" //SI QQN VOIT PLUS SON PERSO -> sneak");
*///TODO : REMPLACER LE MUTE / UNNMUTE PAR UN SYSTEME DE CHAT AVEC UNE LISTE DES PARTICIPANTS DU CHAT DEDANS (ET DU COUP DES SUR CLASSES DE CHAT QUI OVERRIDE LA FONCTION QUI FORMATTE LES MESSAGES DU COUP POSSIBILITE DUTILISER CA POUR FAIRE UN SYSTEME SUR DISCORD (ET FAIRE UN TYPE DE SALON NOCHAT QUAND ON PEUT PAS PARLER))
}
@EventHandler
public void onDrop(PlayerDropItemEvent e) {

View file

@ -79,7 +79,6 @@ public class JoinListener implements Listener{
if(lgp.getRole() != null && !lgp.isDead())
lgp.getGame().kill(lgp, Reason.DISCONNECTED, true);
lgp.getGame().getInGame().remove(lgp);
System.out.println("rem > "+lgp.getGame().getInGame());
lgp.getGame().checkLeave();
}
LGPlayer.removePlayer(p);

View file

@ -86,7 +86,6 @@ public class RAssassin extends Role{
@EventHandler
public void onTour(LGRoleTurnEndEvent e) {
if(e.getGame() == getGame()) {
System.out.println(e.getPreviousRole());
if(e.getPreviousRole() instanceof RLoupGarou) {
for(LGPlayer lgp : getGame().getAlive())
if(lgp.getCache().getBoolean("assassin_protected")) {

View file

@ -87,7 +87,6 @@ public class RBouffon extends Role{
needToPlay.remove(player);
player.showView();
player.getCache().set("bouffon_win", true);
System.out.println(getGame().getVote());
List<LGPlayer> choosable = getGame().getVote().getVotes(player);
StringJoiner sj = new StringJoiner("§6§o, §6§o§l");
for(LGPlayer lgp : choosable)
@ -98,7 +97,6 @@ public class RBouffon extends Role{
player.choose((choosen)->{
if(choosen != null) {
System.out.println(choosable+" / "+getGame().getVote().getVotes()+" "+getGame().getVote());
if(!choosable.contains(choosen))
player.sendMessage("§7§l"+choosen.getName()+"§4 n'a pas voté pour vous.");
else if(choosen.isDead())

View file

@ -66,7 +66,6 @@ public class RChaperonRouge extends Role{
@EventHandler
public void onTour(LGRoleTurnEndEvent e) {
if(e.getGame() == getGame()) {
System.out.println(e.getPreviousRole());
if(e.getPreviousRole() instanceof RLoupGarou) {
for(LGPlayer lgp : getGame().getAlive())
if(lgp.getCache().getBoolean("chaperon_kill")) {

View file

@ -63,7 +63,6 @@ public class RChasseur extends Role{
}, (currentPlayer, secondsLeft)->{
return currentPlayer == player ? "§9§lC'est à ton tour !" : "§6Le Chasseur choisit sa cible (§e"+secondsLeft+" s§6)";
});
System.out.println("tour de "+player.getName());
getGame().broadcastMessage("§9"+getBroadcastedTask());
player.sendMessage("§6"+getTask());
//player.sendTitle("§6C'est à vous de jouer", "§a"+getTask(), 60);
@ -93,31 +92,24 @@ public class RChasseur extends Role{
@EventHandler
public void onPlayerKill(LGPlayerKilledEvent e) {
System.out.println(e.getKilled().getRole()+" "+this);
if(e.getKilled().getRole() == this && e.getReason() != Reason.DISCONNECTED) {
if(e.getKilled().getRole() == this && e.getReason() != Reason.DISCONNECTED)
needToPlay.add(e.getKilled());
System.out.println("added");
}
}
@EventHandler
public void onDayStart(LGDayStartEvent e) {
if(e.getGame() != getGame())return;
System.out.println("day start "+needToPlay.size());
if(needToPlay.size() > 0)
e.setCancelled(true);
if(!e.isCancelled())return;
System.out.println("cancel");
new Runnable() {
public void run() {
if(needToPlay.size() == 0) {
System.out.println("finish");
e.getGame().startDay();
return;
}
LGPlayer player = needToPlay.remove(0);
System.out.println("> "+player.getName());
onNightTurn(player, this);
}
}.run();
@ -126,22 +118,18 @@ public class RChasseur extends Role{
@EventHandler
public void onEndGame(LGGameEndEvent e) {
if(e.getGame() != getGame())return;
System.out.println("game end "+needToPlay.size());
if(needToPlay.size() > 0)
e.setCancelled(true);
if(!e.isCancelled())return;
System.out.println("cancel");
new Runnable() {
public void run() {
if(needToPlay.size() == 0) {
System.out.println("finish game");
e.getGame().checkEndGame(true);
return;
}
LGPlayer player = needToPlay.remove(0);
System.out.println(">>- "+player.getName());
onNightTurn(player, this);
}
}.run();

View file

@ -59,13 +59,11 @@ public class RChienLoupLG extends Role{
@Override
public void join(LGPlayer player, boolean sendMessage) {
super.join(player, sendMessage);
System.out.println(player.getName()+" a rejoint les LG (Chien Loup)");
player.setRole(this);
LGCustomItems.updateItem(player);
for(Role role : getGame().getRoles())
if(role instanceof RLoupGarou) {
role.join(player, false);
System.out.println(player.getName()+" -> Chien LG -> Camp trouvé & join");
for(LGPlayer lgp : role.getPlayers())
if(lgp != player)
lgp.sendMessage("§7§l"+player.getName()+"§6 a rejoint les §c§lLoups-Garous§6.");

View file

@ -61,7 +61,6 @@ public class REnfantSauvageLG extends Role{
@Override
public void join(LGPlayer player, boolean sendMessage) {
super.join(player, sendMessage);
System.out.println(player.getName()+" a rejoint les LG (Enfant Sauvage)");
player.setRole(this);
LGCustomItems.updateItem(player);
RLoupGarou lgRole = null;
@ -81,7 +80,6 @@ public class REnfantSauvageLG extends Role{
}
lgRole.join(player, false);
System.out.println(player.getName()+" -> Enfant Sauvage -> Camp trouvé & join");
for(LGPlayer lgp : lgRole.getPlayers())
if(lgp != player)
lgp.sendMessage("§7§l"+player.getName()+"§6 a rejoint les §c§lLoups-Garous§6.");

View file

@ -117,7 +117,6 @@ public class RLoupGarou extends Role{
boolean equal = false;
for(Entry<LGPlayer, List<LGPlayer>> entry : vote.getVotes().entrySet())
if(entry.getValue().size() > max) {
System.out.println(entry.getKey()+" has "+entry.getValue().size()+" vote(s)");
equal = false;
max = entry.getValue().size();
choosen = entry.getKey();
@ -129,7 +128,6 @@ public class RLoupGarou extends Role{
for(Entry<LGPlayer, List<LGPlayer>> entry : vote.getVotes().entrySet())
if(entry.getValue().size() == max && entry.getKey().getRoleType() != RoleType.LOUP_GAROU)
choosable.add(entry.getKey());
System.out.println("Random choice for LG (removed lg from vote)");
if(choosable.size() > 0)
choosen = choosable.get(getGame().getRandom().nextInt(choosable.size()));
}
@ -175,10 +173,8 @@ public class RLoupGarou extends Role{
@EventHandler(priority = EventPriority.LOWEST)
public void onUpdatePrefix (LGUpdatePrefixEvent e) {
if(e.getGame() == getGame())
if(getPlayers().contains(e.getTo()) && getPlayers().contains(e.getPlayer())) {
System.out.println("Prefix of "+e.getPlayer().getName()+" updated (lg) for "+e.getTo().getName());
if(getPlayers().contains(e.getTo()) && getPlayers().contains(e.getPlayer()))
e.setPrefix(e.getPrefix()+"§c");
}
}
@EventHandler

View file

@ -126,7 +126,6 @@ public class RPretre extends Role{
meta.setEntityID(lgp.getPlayer().getEntityId());
meta.setMetadata(Arrays.asList(new WrappedWatchableObject(invisible, (byte)0)));
meta.sendPacket(player.getPlayer());
System.out.println("Spawning "+lgp.getName()+" for prêtre ("+player.getName()+")");
}
}else
player.getPlayer().hidePlayer(lgp.getPlayer());

View file

@ -133,7 +133,6 @@ public class RPyromane extends Role{
List<LGPlayer> liste = player.getCache().<List<LGPlayer>>get("pyromane_essence");
LGPyromaneGasoilEvent event = new LGPyromaneGasoilEvent(getGame(), first);
Bukkit.getPluginManager().callEvent(event);
System.out.println("Gasoil of "+event.getPlayer().getName()+" cancelled : "+event.isCancelled());
if(event.isCancelled())
player.sendMessage("§7§l"+event.getPlayer().getName()+"§c est immunisé.");
else {
@ -174,9 +173,7 @@ public class RPyromane extends Role{
closeInventory(player);
if(lgp.getCache().<List<LGPlayer>>get("pyromane_essence").size() != 0) {
List<LGPlayer> liste = lgp.getCache().<List<LGPlayer>>get("pyromane_essence");
System.out.println(liste+" < liste des joueurs à kill par le pyro");
for(LGPlayer scndPlayer : liste) {
System.out.println(scndPlayer.getName()+" mort: "+scndPlayer.isDead()+" & player: "+scndPlayer.getPlayer()+" / role:"+scndPlayer.getRole());
if(!scndPlayer.isDead() && scndPlayer.getPlayer() != null) {
getGame().kill(scndPlayer, Reason.PYROMANE);
}
@ -224,7 +221,6 @@ public class RPyromane extends Role{
lgp.stopChoosing();
LGPyromaneGasoilEvent event = new LGPyromaneGasoilEvent(getGame(), choosen);
Bukkit.getPluginManager().callEvent(event);
System.out.println("Gasoil of "+event.getPlayer().getName()+" cancelled : "+event.isCancelled());
if(event.isCancelled())
lgp.sendMessage("§7§l"+event.getPlayer().getName()+"§c est immunisée.");
else {
@ -234,7 +230,6 @@ public class RPyromane extends Role{
if(first != null) {
event = new LGPyromaneGasoilEvent(getGame(), first);
Bukkit.getPluginManager().callEvent(event);
System.out.println("Gasoil of "+event.getPlayer().getName()+" cancelled : "+event.isCancelled());
if(event.isCancelled())
lgp.sendMessage("§7§l"+event.getPlayer().getName()+"§c est immunisée.");
else {

View file

@ -1,5 +1,5 @@
name: LoupGarou
version: 1.0.0
version: 1.0.1
description: Permet de jouer au jeu du loup garou
main: fr.leomelki.loupgarou.MainLg
depend: [ProtocolLib]