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 1403336..b39cb26 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/calculator/CalculatorManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/calculator/CalculatorManager.java @@ -55,6 +55,10 @@ public class CalculatorManager implements Listener { event.getPlayer().sendMessage(ChatColor.GRAY+"res"+i+ChatColor.RESET+" : "+ChatColor.GRAY+el.expression+ChatColor.RESET+"="+ChatColor.GRAY+el.value); i--; } + if (history.get(event.getPlayer()).size() == 0) + { + event.getPlayer().sendMessage(ChatColor.RED+"Utilisez le symbole "+ChatColor.GRAY+"="+ChatColor.RED+" dans le chat pour faire un calcul mathématique"); + } } else { @@ -80,7 +84,7 @@ public class CalculatorManager implements Listener { } catch (IllegalArgumentException e) { event.getPlayer().sendMessage(ChatColor.RED+e.getMessage()); - + event.getPlayer().sendMessage(ChatColor.RED+"Utilisez le symbole "+ChatColor.GRAY+"="+ChatColor.RED+" dans le chat pour faire un calcul mathématique"); } } diff --git a/src/net/mc_pandacraft/java/util/JArithmeticInterpreter.java b/src/net/mc_pandacraft/java/util/JArithmeticInterpreter.java index ff8e6f9..2230f6f 100644 --- a/src/net/mc_pandacraft/java/util/JArithmeticInterpreter.java +++ b/src/net/mc_pandacraft/java/util/JArithmeticInterpreter.java @@ -735,7 +735,11 @@ public class JArithmeticInterpreter { { StringBuffer input = new StringBuffer(expr); - JArithmeticInterpreter jai = JArithmeticInterpreter.constructTree(input,input.length(),0); + JArithmeticInterpreter jai = null; + + try { + jai = JArithmeticInterpreter.constructTree(input,input.length(),0); + } catch (Exception e) { } if (jai==null) throw new IllegalArgumentException("Le calcul passé en paramètre est invalide");