use of com.earth2me.essentials.commands.NoChargeException in project Essentials by EssentialsX.
the class SignKit method onSignInteract.
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException {
final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH).trim();
final String group = sign.getLine(2).trim();
if ((!group.isEmpty() && ("ยง2Everyone".equals(group) || player.inGroup(group))) || (group.isEmpty() && (player.isAuthorized("essentials.kits." + kitName)))) {
final Trade charge = getTrade(sign, 3, ess);
charge.isAffordableFor(player);
try {
final Kit kit = new Kit(kitName, ess);
kit.checkDelay(player);
kit.setTime(player);
kit.expandItems(player);
charge.charge(player);
Trade.log("Sign", "Kit", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess);
} catch (NoChargeException ex) {
return false;
} catch (Exception ex) {
throw new SignException(ex.getMessage(), ex);
}
return true;
} else {
if (group.isEmpty()) {
throw new SignException(tl("noKitPermission", "essentials.kits." + kitName));
} else {
throw new SignException(tl("noKitGroup", group));
}
}
}
use of com.earth2me.essentials.commands.NoChargeException in project Essentials by EssentialsX.
the class ToggleTest method runCommand.
private void runCommand(String command, User user, String[] args) throws Exception {
IEssentialsCommand cmd;
try {
cmd = (IEssentialsCommand) Essentials.class.getClassLoader().loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
cmd.setEssentials(ess);
cmd.run(server, user, command, null, args);
} catch (NoChargeException ex) {
}
}
use of com.earth2me.essentials.commands.NoChargeException in project Essentials by EssentialsX.
the class ToggleTest method runConsoleCommand.
private void runConsoleCommand(String command, String[] args) throws Exception {
IEssentialsCommand cmd;
CommandSender sender = server.getConsoleSender();
try {
cmd = (IEssentialsCommand) Essentials.class.getClassLoader().loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
cmd.setEssentials(ess);
cmd.run(server, new CommandSource(sender), command, null, args);
} catch (NoChargeException ex) {
}
}
use of com.earth2me.essentials.commands.NoChargeException in project Essentials by EssentialsX.
the class EconomyTest method runConsoleCommand.
private void runConsoleCommand(String command, String[] args) throws Exception {
IEssentialsCommand cmd;
CommandSender sender = server.getConsoleSender();
try {
cmd = (IEssentialsCommand) Essentials.class.getClassLoader().loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
cmd.setEssentials(ess);
cmd.run(server, new CommandSource(sender), command, null, args);
} catch (NoChargeException ex) {
}
}
use of com.earth2me.essentials.commands.NoChargeException in project Essentials by EssentialsX.
the class MessagingTest method runCommand.
private void runCommand(String command, User user, String[] args) throws Exception {
IEssentialsCommand cmd;
try {
cmd = (IEssentialsCommand) Essentials.class.getClassLoader().loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
cmd.setEssentials(ess);
cmd.run(server, user, command, null, args);
} catch (NoChargeException ex) {
}
}
Aggregations