String formatPNF(String playerNotFound) { return (Messanger.addColour( Messanger.format("") + " " + plugin.getLocale().getOption("player") + " &e" + playerNotFound + " &4" + plugin.getLocale().getOption("notFound"))); }
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 void save() { try { plugin.censor = config; plugin.censor.save(plugin.censorF); Messanger.log( plugin .getLocale() .getOption(LocaleType.CONFIG_UPDATED) .replace("%config%", "censor.yml")); } catch (Exception ignored) { } }
void formatWho(CommandSender sender, Player recipient) { String recipientName = plugin.getAPI().ParsePlayerName(recipient.getName(), recipient.getWorld().getName()); Integer locX = (int) recipient.getLocation().getX(); Integer locY = (int) recipient.getLocation().getY(); Integer locZ = (int) recipient.getLocation().getZ(); String loc = ("X: " + locX + ", " + "Y: " + locY + ", " + "Z: " + locZ); String world = recipient.getWorld().getName(); sender.sendMessage( Messanger.addColour( plugin.getLocale().getOption("player") + " Name: " + recipient.getName())); sender.sendMessage(Messanger.addColour("Display Name: " + recipient.getDisplayName())); sender.sendMessage(Messanger.addColour("Formatted Name: " + recipientName)); sender.sendMessage( Messanger.addColour( plugin.getLocale().getOption("player") + "'s Location: [ " + loc + " ]")); sender.sendMessage( Messanger.addColour(plugin.getLocale().getOption("player") + "'s World: " + world)); sender.sendMessage( Messanger.addColour( plugin.getLocale().getOption("player") + "'s Health: " + plugin.getAPI().healthBar(recipient) + " " + recipient.getHealth() + "/20")); sender.sendMessage( Messanger.addColour( plugin.getLocale().getOption("player") + "'s IP: " + recipient.getAddress().getHostString())); sender.sendMessage( Messanger.addColour("Current Item: " + recipient.getItemInHand().getType().name())); sender.sendMessage(Messanger.addColour("Entity ID: #" + recipient.getEntityId())); }
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; }