@Override public void onCommand(CommandSender sender, String[] args, boolean confirmedCmd) throws IllegalArgumentException { final ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]); final String reason = Utils.getFinalArg(args, 1); if(target == null){ if(!confirmedCmd && Core.getPlayerIP(args[0]).equals("0.0.0.0")){ mustConfirmCommand(sender, getName() + " " + Joiner.on(' ').join(args), _("operationUnknownPlayer", new String[] {args[0]})); return; } } if(sender instanceof ProxiedPlayer){ checkArgument(PermissionManager.canExecuteAction(Action.WARN , sender, ((ProxiedPlayer)sender).getServer().getInfo().getName()), _("noPerm")); } checkArgument(comment.hasLastcommentCooledDown(args[0]), _("cooldownUnfinished")); comment.insertComment(args[0], reason, Type.WARNING, sender.getName()); if(target != null){ target.sendMessage(__("wasWarnedNotif", new String[] {reason})); } BAT.broadcast(_("warnBroadcast", new String[]{args[0], sender.getName(), reason}), Action.WARN_BROADCAST.getPermission()); return; }
public static void startLockDown(String sender, Long expiryTime, String msg) { setExpiryTime(expiryTime); setOptionalMessage(msg); setLockedDown(true); CommandSender target = getSender(sender); if (LockDownManager.isLockedDown()) { if (target != null) { PlayerManager.sendMessageToTarget( target, ChatColor.RED + "Server is locked down until: " + LockDownManager.getExpiryTimeString()); if (!optionalMessage.isEmpty()) { PlayerManager.sendMessageToTarget( target, ChatColor.RED + "Msg shown to unknown (blocked) players: " + optionalMessage); } LoggingManager.log( "Lockdown start by " + target.getName() + " ON." + " Expiry in " + Utilities.buildShortTimeDiffString(expiryTime - System.currentTimeMillis(), 2) + " Msg shown to unknown (blocked) players: " + optionalMessage); } } else { if (target != null) { PlayerManager.sendMessageToTarget(target, ChatColor.RED + "Lockdown failed to start"); } } }
private void summon(ProxiedPlayer player, ServerInfo target, CommandSender sender) { if ((player.getServer() != null) && (!player.getServer().getInfo().equals(target))) { player.connect(target); player.sendMessage( ChatColor.GOLD + "Summoned to " + target.getName() + " by " + sender.getName()); } }
@Override public void execute(CommandSender sender, String[] args) { if (Tickets.getTickets(sender.getName(), "open").length != 0) { sender.sendMessage(ChatColor.RED + "Je hebt al een open ticket."); return; } if (Tickets.inTicket(sender.getName())) { sender.sendMessage(ChatColor.RED + "Je wordt al geholpen."); return; } boolean adminsOnline = false; for (ProxiedPlayer player : Main.instance.getProxy().getPlayers()) if (Permissions.hasPermission(player.getName(), "bs.bungee.tickets.receive_broadcast")) adminsOnline = true; if (!adminsOnline) { sender.sendMessage( ChatColor.RED + "Er zijn op dit moment geen admins online om je te helpen. Probeer het later nog eens."); return; } String question = ""; for (int i = 0; i < args.length; i++) { if (!args[i].equals("create")) question += ((question.equals("")) ? "" : " ") + args[i]; } Ticket ticket = new Ticket(); ticket.username = sender.getName(); ticket.server = Main.instance.getProxy().getPlayer(sender.getName()).getServer().getInfo().getName(); ticket.question = question; Tickets.createTicket(ticket); for (ProxiedPlayer player : Main.instance.getProxy().getPlayers()) if (Permissions.hasPermission(player.getName(), "bs.bungee.tickets.receive_broadcast")) player.sendMessage( ChatColor.AQUA + ticket.username + " heeft een ticket aangemaakt: " + ticket.question); sender.sendMessage( ChatColor.GREEN + "Je ticket is aangemaakt. Je wordt zo snel mogelijk geholpen!"); }
@Override public void onCommand(final CommandSender sender, final String[] args, final boolean confirmedCmd) throws IllegalArgumentException { if (args[0].equals("help")) { try { FormatUtils.showFormattedHelp(BAT.getInstance().getModules().getModule("comment").getCommands(), sender, "COMMENT"); } catch (final InvalidModuleException e) { e.printStackTrace(); } return; } if(args.length < 2){ throw new IllegalArgumentException(); } if(!confirmedCmd && Core.getPlayerIP(args[0]).equals("0.0.0.0")){ mustConfirmCommand(sender, "bat " + getName() + " " + Joiner.on(' ').join(args), _("operationUnknownPlayer", new String[] {args[0]})); return; } checkArgument(comment.hasLastcommentCooledDown(args[0]), _("cooldownUnfinished")); comment.insertComment(args[0], Utils.getFinalArg(args, 1), Type.NOTE, sender.getName()); sender.sendMessage(__("commentAdded")); }