/* * (non-Javadoc) * * @see * be.Balor.Manager.ACCommands#execute(org.bukkit.command.CommandSender, * java.lang.String[]) */ @Override public void execute(final CommandSender sender, final CommandArgs args) throws ActionNotPermitedException, PlayerNotFound { final String timeOut = args.getValueFlag('t'); final Player player = Utils.getUser(sender, args, permNode); if (player != null) { final HashMap<String, String> replace = new HashMap<String, String>(); replace.put("player", Utils.getPlayerName(player)); final ACPlayer acp = ACPlayer.getPlayer(player); if (acp.hasPower(Type.GOD)) { acp.removePower(Type.GOD); Utils.sI18n(player, "godDisabled"); if (!player.equals(sender)) { Utils.sI18n(sender, "godDisabledTarget", replace); } } else { acp.setPower(Type.GOD); Utils.sI18n(player, "godEnabled"); if (!player.equals(sender)) { Utils.sI18n(sender, "godEnabledTarget", replace); } if (timeOut == null) { return; } int timeOutValue; try { timeOutValue = Integer.parseInt(timeOut); } catch (final Exception e) { Utils.sI18n(sender, "NaN", "number", timeOut); return; } ACPluginManager.getScheduler() .runTaskLaterAsynchronously( ACPluginManager.getCorePlugin(), new RemovePowerTask(acp, Type.GOD, sender), Utils.secInTick * ConfigEnum.SCALE_TIMEOUT.getInt() * timeOutValue); } } }