mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-05 23:11:48 +01:00
[Fix] Potion erroring and duration/power fix
This commit is contained in:
parent
5ea1bdec56
commit
2f96ef1e97
@ -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())
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user