From 073ce55f8d23d7c37cf7e365d6db9285b7e0e72a Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Sat, 27 Dec 2014 09:31:30 -0500 Subject: [PATCH] =?UTF-8?q?Int=C3=A9gration=20compl=C3=A8te=20de=20la=20ca?= =?UTF-8?q?lculatrice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- make_jar.jardesc | 2 +- resources/plugin.yml | 2 +- .../java/plugin/pandacraftutils/PandacraftUtils.java | 4 ++++ .../pandacraftutils/calculator/CalculatorManager.java | 7 ++++--- .../pandacraftutils/chat_analyzer/ChatAnalysisManager.java | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/make_jar.jardesc b/make_jar.jardesc index 548fd15..a1a00d0 100644 --- a/make_jar.jardesc +++ b/make_jar.jardesc @@ -1,6 +1,6 @@ - + diff --git a/resources/plugin.yml b/resources/plugin.yml index 678c557..d18d7d8 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -1,6 +1,6 @@ name: PandacraftUtils main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils -version: 2.5 +version: 2.6 diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java index 9f8120c..b0a42bb 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java @@ -4,6 +4,7 @@ package net.mc_pandacraft.java.plugin.pandacraftutils; import java.sql.SQLException; import net.mc_pandacraft.java.plugin.pandacraftutils.afk.CommandAfk; +import net.mc_pandacraft.java.plugin.pandacraftutils.calculator.CalculatorManager; import net.mc_pandacraft.java.plugin.pandacraftutils.chat_analyzer.ChatAnalysisManager; import net.mc_pandacraft.java.plugin.pandacraftutils.cheat_protect.creative.CreativCheatManager; import net.mc_pandacraft.java.plugin.pandacraftutils.cheat_protect.no_pvp.NoPvpProtectManager; @@ -45,6 +46,7 @@ public class PandacraftUtils extends JavaPlugin { public CreativCheatManager creativCheatManager; public NoPvpProtectManager noPvpProtectManager; public LoginLogoutManager loginLogoutManager; + public CalculatorManager calculatorManager; public PacketOutServerInfoListener serverPingListener; @@ -80,6 +82,7 @@ public class PandacraftUtils extends JavaPlugin { creativCheatManager = new CreativCheatManager(this); noPvpProtectManager = new NoPvpProtectManager(this); loginLogoutManager = new LoginLogoutManager(this); + calculatorManager = new CalculatorManager(this); serverPingListener = new PacketOutServerInfoListener(this); } @@ -99,6 +102,7 @@ public class PandacraftUtils extends JavaPlugin { chatAnalysisManager = null; creativCheatManager = null; noPvpProtectManager = null; + calculatorManager = null; serverPingListener = null; diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/calculator/CalculatorManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/calculator/CalculatorManager.java index 64e1bbf..1403336 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/calculator/CalculatorManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/calculator/CalculatorManager.java @@ -39,7 +39,7 @@ public class CalculatorManager implements Listener { - @EventHandler(priority=EventPriority.HIGHEST) + @EventHandler(priority=EventPriority.LOWEST) public void onAsyncPlayerChat(AsyncPlayerChatEvent event) { String message = event.getMessage(); @@ -52,7 +52,7 @@ public class CalculatorManager implements Listener { int i = history.get(event.getPlayer()).size(); for(HistoryElement el : history.get(event.getPlayer())) { - event.getPlayer().sendMessage(ChatColor.GRAY+"res"+i+ChatColor.RESET+"="+ChatColor.GRAY+el.value+ChatColor.RESET+"="+ChatColor.GRAY+el.expression); + event.getPlayer().sendMessage(ChatColor.GRAY+"res"+i+ChatColor.RESET+" : "+ChatColor.GRAY+el.expression+ChatColor.RESET+"="+ChatColor.GRAY+el.value); i--; } } @@ -75,7 +75,8 @@ public class CalculatorManager implements Listener { if (history.get(event.getPlayer()).size() > 5) history.get(event.getPlayer()).remove(0); - event.getPlayer().sendMessage("="+ChatColor.GRAY+calcul.value); + event.getPlayer().sendMessage(ChatColor.GRAY+calcul.expression+ChatColor.RESET+"="+ChatColor.GRAY+calcul.value); + } catch (IllegalArgumentException e) { event.getPlayer().sendMessage(ChatColor.RED+e.getMessage()); diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/chat_analyzer/ChatAnalysisManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/chat_analyzer/ChatAnalysisManager.java index cc97af1..efc7af7 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/chat_analyzer/ChatAnalysisManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/chat_analyzer/ChatAnalysisManager.java @@ -31,7 +31,7 @@ public class ChatAnalysisManager implements Listener { onPlayerJoin(new PlayerJoinEvent(p, "")); // simule l'évènement d'arrivé d'un joueur, pour le rajouter } - @EventHandler(priority=EventPriority.HIGH,ignoreCancelled=true) + @EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void onAsyncPlayerChat(AsyncPlayerChatEvent event) { try { @@ -39,7 +39,7 @@ public class ChatAnalysisManager implements Listener { } catch (NullPointerException e) { } } - @EventHandler(priority=EventPriority.HIGH) + @EventHandler(priority=EventPriority.HIGHEST) public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event) { try {