Search in sources :

Example 11 with NoChargeException

use of com.earth2me.essentials.commands.NoChargeException in project Essentials by EssentialsX.

the class Commandspawn method run.

@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
    final Trade charge = new Trade(this.getName(), ess);
    charge.isAffordableFor(user);
    if (args.length > 0 && user.isAuthorized("essentials.spawn.others")) {
        final User otherUser = getPlayer(server, user, args, 0);
        respawn(user.getSource(), user, otherUser, charge);
        if (!otherUser.equals(user)) {
            otherUser.sendMessage(tl("teleportAtoB", user.getDisplayName(), "spawn"));
        }
    } else {
        respawn(user.getSource(), user, user, charge);
    }
    throw new NoChargeException();
}
Also used : Trade(com.earth2me.essentials.Trade) NoChargeException(com.earth2me.essentials.commands.NoChargeException) User(com.earth2me.essentials.User)

Example 12 with NoChargeException

use of com.earth2me.essentials.commands.NoChargeException in project Essentials by drtshock.

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) {
    }
}
Also used : NoChargeException(com.earth2me.essentials.commands.NoChargeException) IEssentialsCommand(com.earth2me.essentials.commands.IEssentialsCommand) CommandSender(org.bukkit.command.CommandSender)

Example 13 with NoChargeException

use of com.earth2me.essentials.commands.NoChargeException in project Essentials by drtshock.

the class Commandspawn method run.

@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
    final Trade charge = new Trade(this.getName(), ess);
    charge.isAffordableFor(user);
    if (args.length > 0 && user.isAuthorized("essentials.spawn.others")) {
        final User otherUser = getPlayer(server, user, args, 0);
        respawn(user.getSource(), user, otherUser, charge);
        if (!otherUser.equals(user)) {
            otherUser.sendMessage(tl("teleportAtoB", user.getDisplayName(), "spawn"));
        }
    } else {
        respawn(user.getSource(), user, user, charge);
    }
    throw new NoChargeException();
}
Also used : Trade(com.earth2me.essentials.Trade) NoChargeException(com.earth2me.essentials.commands.NoChargeException) User(com.earth2me.essentials.User)

Example 14 with NoChargeException

use of com.earth2me.essentials.commands.NoChargeException in project Essentials by drtshock.

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) {
    }
}
Also used : NoChargeException(com.earth2me.essentials.commands.NoChargeException) IEssentialsCommand(com.earth2me.essentials.commands.IEssentialsCommand)

Example 15 with NoChargeException

use of com.earth2me.essentials.commands.NoChargeException in project Essentials by EssentialsX.

the class EconomyTest 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) {
    }
}
Also used : NoChargeException(com.earth2me.essentials.commands.NoChargeException) IEssentialsCommand(com.earth2me.essentials.commands.IEssentialsCommand)

Aggregations

NoChargeException (com.earth2me.essentials.commands.NoChargeException)16 IEssentialsCommand (com.earth2me.essentials.commands.IEssentialsCommand)12 CommandSender (org.bukkit.command.CommandSender)6 Trade (com.earth2me.essentials.Trade)4 ChargeException (com.earth2me.essentials.ChargeException)2 Kit (com.earth2me.essentials.Kit)2 User (com.earth2me.essentials.User)2