public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { String cmd = command.getName(); if (cmd.equalsIgnoreCase("mchatwho")) { if (args.length > 0) { if (sender instanceof Player) { Player player = (Player) sender; if (!plugin .getAPI() .checkPermissions(player.getName(), player.getWorld().getName(), "mchat.who")) { Messanger.sendMessage( sender, plugin.getLocale().getOption("noPermissions") + " " + cmd + "."); return true; } } if (plugin.getServer().getPlayer(args[0]) == null) { sender.sendMessage(formatPNF(args[0])); return true; } else { Player receiver = plugin.getServer().getPlayer(args[0]); formatWho(sender, receiver); return true; } } } return false; }
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { String cmd = command.getName(); if (!(sender instanceof Player)) { sender.sendMessage(formatPMessage(Messanger.addColour("Console's can't send PM's."))); return true; } Player player = (Player) sender; String pName = player.getName(); String world = player.getWorld().getName(); if (cmd.equalsIgnoreCase("pmchatinvite")) { if (args.length < 1) return false; if (!plugin .getAPI() .checkPermissions(player.getName(), player.getWorld().getName(), "mchat.pm.invite")) { player.sendMessage( formatPMessage(Messanger.addColour("You are not allowed to use Invite functions."))); return true; } Player recipient = plugin.getServer().getPlayer(args[0]); String rName = recipient.getName(); String rWorld = recipient.getWorld().getName(); if (recipient == null) { player.sendMessage(formatPNF(args[0])); return true; } if (plugin.getInvite.get(rName) == null) { plugin.getInvite.put(rName, pName); player.sendMessage( formatPMessage( Messanger.addColour( "You have invited &5'&4" + plugin.getAPI().ParsePlayerName(rName, rWorld) + "&5'&4 to have a Convo."))); recipient.sendMessage( formatPMessage( Messanger.addColour( "You have been invited to a Convo by &5'&4" + plugin.getAPI().ParsePlayerName(pName, world) + "&5'&4 use /pmchataccept to accept."))); } else player.sendMessage( formatPMessage( Messanger.addColour( "&5'&4" + plugin.getAPI().ParsePlayerName(rName, rWorld) + "&5'&4 Already has a Convo request."))); return true; } return false; }
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { String cmd = command.getName(); if (cmd.equalsIgnoreCase("mchatme")) { if (args.length > 0) { String message = ""; for (String arg : args) message += " " + arg; message = message.trim(); if (sender instanceof Player) { Player player = (Player) sender; World world = player.getWorld(); if (plugin .getAPI() .checkPermissions(player.getName(), player.getWorld().getName(), "mchat.me")) plugin .getServer() .broadcastMessage( plugin.getParser().parseMe(player.getName(), world.getName(), message)); else Messanger.sendMessage( player, plugin .getLocale() .getOption(LocaleType.NO_PERMS) .replace("%permission%", "mchat.me")); return true; } else { String senderName = "Console"; plugin.getServer().broadcastMessage("* " + senderName + " " + message); Messanger.log("* " + senderName + " " + message); return true; } } } return false; }