Intégration complète de la calculatrice

This commit is contained in:
Marc Baloup 2014-12-27 09:31:30 -05:00
parent 5990672dfb
commit 073ce55f8d
5 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jardesc>
<jar path="PandacraftUtils/jar_export/PandacraftUtils-2.5.jar"/>
<jar path="PandacraftUtils/jar_export/PandacraftUtils-2.6.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/PandacraftUtils/make_jar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>

View File

@ -1,6 +1,6 @@
name: PandacraftUtils
main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils
version: 2.5
version: 2.6

View File

@ -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;

View File

@ -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());

View File

@ -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 {