From 2f96ef1e978cb8ac2f43c6861fd099b0f3a43da2 Mon Sep 17 00:00:00 2001 From: GunfighterJ Date: Sun, 17 Mar 2013 11:35:40 -0500 Subject: [Fix] Potion erroring and duration/power fix --- Essentials/src/com/earth2me/essentials/MetaItemStack.java | 14 +++++++++++++- .../com/earth2me/essentials/commands/Commandpotion.java | 5 +++++ Essentials/src/messages.properties | 2 +- Essentials/src/messages_cs.properties | 2 +- Essentials/src/messages_da.properties | 2 +- Essentials/src/messages_de.properties | 2 +- Essentials/src/messages_en.properties | 2 +- Essentials/src/messages_es.properties | 2 +- Essentials/src/messages_fi.properties | 2 +- Essentials/src/messages_fr.properties | 2 +- Essentials/src/messages_it.properties | 2 +- Essentials/src/messages_nl.properties | 2 +- Essentials/src/messages_pl.properties | 2 +- Essentials/src/messages_pt.properties | 2 +- Essentials/src/messages_se.properties | 2 +- 15 files changed, 31 insertions(+), 14 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/MetaItemStack.java b/Essentials/src/com/earth2me/essentials/MetaItemStack.java index 1642041f7..5958839b5 100644 --- a/Essentials/src/com/earth2me/essentials/MetaItemStack.java +++ b/Essentials/src/com/earth2me/essentials/MetaItemStack.java @@ -362,7 +362,7 @@ public class MetaItemStack } else { - throw new Exception(_("invalidPotionEffect", split[1])); + throw new Exception(_("invalidPotionMeta", split[1])); } } else if (split[0].equalsIgnoreCase("power") || (allowShortName && split[0].equalsIgnoreCase("p"))) @@ -371,6 +371,14 @@ public class MetaItemStack { validPotionPower = true; power = Integer.parseInt(split[1]); + if (power > 0 && power < 4) + { + power -= 1; + } + } + else + { + throw new Exception(_("invalidPotionMeta", split[1])); } } else if (split[0].equalsIgnoreCase("duration") || (allowShortName && split[0].equalsIgnoreCase("d"))) @@ -380,6 +388,10 @@ public class MetaItemStack validPotionDuration = true; duration = Integer.parseInt(split[1]) * 20; //Duration is in ticks by default, converted to seconds } + else + { + throw new Exception(_("invalidPotionMeta", split[1])); + } } if (isValidPotion()) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java index 3ba0080f8..257509d4f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java @@ -42,6 +42,11 @@ public class Commandpotion extends EssentialsCommand } throw new NotEnoughArgumentsException(_("potions", Util.joinList(potionslist.toArray()))); } + + if (args.length < 3) + { + throw new NotEnoughArgumentsException(); + } if (stack.getType() == Material.POTION) { diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index bf0a3d9bd..d9a96bf91 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index 223e4c515..0876a19c4 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -523,4 +523,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 4335c8648..99ab37172 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index f6cba1319..f2f0f454f 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index bf0a3d9bd..d9a96bf91 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 1d73209ff..398704ed9 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index fc2bdfccb..dbe35b5a2 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index b6132d78d..77630a4ad 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index e6c07f472..6e6253df0 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index bc2c03a3e..cb140acd4 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index e3800d3d4..1861e8116 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a77Gracz\u00a7c {0} \u00a77zostal zbanowany na adres IP {1}\u00a77. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 51d505a17..bc85e54ee 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect: \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index 47cb19e60..57c098d16 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -520,4 +520,4 @@ playerUnbanned=\u00a76Player\u00a7c {0} \u00a76unbanned {1}. playerUnbanIpAddress=\u00a76Player\u00a7c {0} \u00a76unbanned IP: {1}. playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address {1}\u00a76. noPotionEffectPerm=\u00a74You do not have permission to apply potion effect \u00a7c{0} \u00a74to this potion. -invalidPotionEffect=\u00a74Invalid potion effect \u00a7c{0}\u00a74. +invalidPotionMeta=\u00a74Invalid potion meta: \u00a7c{0}\u00a74. -- cgit v1.2.3