use of com.earth2me.essentials.commands.Commandrepair in project Essentials by drtshock.
the class SignRepair method onSignInteract.
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException {
final Trade charge = getTrade(sign, 2, ess);
charge.isAffordableFor(player);
Commandrepair command = new Commandrepair();
command.setEssentials(ess);
try {
if (sign.getLine(1).equalsIgnoreCase("hand")) {
command.repairHand(player);
} else if (sign.getLine(1).equalsIgnoreCase("all")) {
command.repairAll(player);
} else {
throw new NotEnoughArgumentsException();
}
} catch (Exception ex) {
throw new SignException(ex.getMessage(), ex);
}
charge.charge(player);
Trade.log("Sign", "Repair", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess);
return true;
}
Aggregations