/* * (non-Javadoc) * * @see * be.Balor.Manager.CoreCommand#execute(org.bukkit.command.CommandSender, * java.lang.String[]) */ @Override public void execute(final CommandSender sender, final CommandArgs args) { final Player target = Utils.getUser(sender, args, permNode); if (target != null) { final String playername = Utils.getPlayerName(target, sender); final long total = ACPlayer.getPlayer(target).getCurrentPlayedTime(); final Long[] time = Utils.transformToElapsedTime(total); final HashMap<String, String> replace = new HashMap<String, String>(); replace.put("d", time[0].toString()); replace.put("h", time[1].toString()); replace.put("m", time[2].toString()); replace.put("s", time[3].toString()); replace.put("player", playername); Utils.sI18n(sender, "playedTime", replace); } }
/* * (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); } } }