Potion erroring and duration/power fix

This commit is contained in:
GunfighterJ 2013-03-17 11:35:40 -05:00 committed by KHobbits
parent 5e4659e6ae
commit ce51a07bf1
15 changed files with 31 additions and 14 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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