summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunfighterJ <joseph.jenniges@gmail.com>2013-03-17 11:35:40 -0500
committerKHobbits <rob@khobbits.co.uk>2013-03-18 06:14:44 +0000
commitce51a07bf18b01fa5b5816ea17b2347eeb89084f (patch)
tree270a8e56c5f9db45f4f4fe0cf1a984207e0c6a1f
parent5e4659e6ae9bd534f8c0c791c1df4f0ed8aca5ff (diff)
downloadEssentials-ce51a07bf18b01fa5b5816ea17b2347eeb89084f.tar
Essentials-ce51a07bf18b01fa5b5816ea17b2347eeb89084f.tar.gz
Essentials-ce51a07bf18b01fa5b5816ea17b2347eeb89084f.tar.lz
Essentials-ce51a07bf18b01fa5b5816ea17b2347eeb89084f.tar.xz
Essentials-ce51a07bf18b01fa5b5816ea17b2347eeb89084f.zip
Potion erroring and duration/power fix
-rw-r--r--Essentials/src/com/earth2me/essentials/MetaItemStack.java14
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandpotion.java5
-rw-r--r--Essentials/src/messages.properties2
-rw-r--r--Essentials/src/messages_cs.properties2
-rw-r--r--Essentials/src/messages_da.properties2
-rw-r--r--Essentials/src/messages_de.properties2
-rw-r--r--Essentials/src/messages_en.properties2
-rw-r--r--Essentials/src/messages_es.properties2
-rw-r--r--Essentials/src/messages_fi.properties2
-rw-r--r--Essentials/src/messages_fr.properties2
-rw-r--r--Essentials/src/messages_it.properties2
-rw-r--r--Essentials/src/messages_nl.properties2
-rw-r--r--Essentials/src/messages_pl.properties2
-rw-r--r--Essentials/src/messages_pt.properties2
-rw-r--r--Essentials/src/messages_se.properties2
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.