mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-09 20:41:23 +01:00
More user feedback on enchant sign.
This commit is contained in:
parent
6497db837d
commit
ef7b940e96
@ -17,7 +17,16 @@ public class SignEnchant extends EssentialsSign
|
||||
@Override
|
||||
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException
|
||||
{
|
||||
final ItemStack stack = sign.getLine(1).equals("*") || sign.getLine(1).equalsIgnoreCase("any") ? null : getItemStack(sign.getLine(1), 1, ess);
|
||||
final ItemStack stack;
|
||||
try
|
||||
{
|
||||
stack = sign.getLine(1).equals("*") || sign.getLine(1).equalsIgnoreCase("any") ? null : getItemStack(sign.getLine(1), 1, ess);
|
||||
}
|
||||
catch (SignException e)
|
||||
{
|
||||
sign.setLine(1, "§c<item|any>");
|
||||
throw e;
|
||||
}
|
||||
final String[] enchantLevel = sign.getLine(2).split(":");
|
||||
if (enchantLevel.length != 2)
|
||||
{
|
||||
@ -132,6 +141,16 @@ public class SignEnchant extends EssentialsSign
|
||||
throw new SignException(ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH);
|
||||
if (level == 0)
|
||||
{
|
||||
player.sendMessage(_("enchantmentRemoved", enchantmentName.replace('_', ' ')));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(_("enchantmentApplied", enchantmentName.replace('_', ' ')));
|
||||
}
|
||||
|
||||
charge.charge(player);
|
||||
Trade.log("Sign", "Enchant", "Interact", username, charge, username, charge, sign.getBlock().getLocation(), ess);
|
||||
player.updateInventory();
|
||||
|
Loading…
Reference in New Issue
Block a user