Guest User

Untitled

a guest
Jun 16th, 2015
290
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.euromancy2;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9.  
  10. public class Suggestions extends JavaPlugin{
  11.  
  12. @Override
  13. public void onEnable() {
  14. getLogger().info("Successfully enabled v1.0");
  15. }
  16.  
  17. @Override
  18. public void onDisable() {
  19.  
  20. }
  21. @Override
  22. public boolean onCommand(CommandSender sender, Command cmd,String label, String[] args) {
  23. if (cmd.getName().equalsIgnoreCase("report")) {
  24. if (!sender.hasPermission("test.test")) {
  25. sender.sendMessage(ChatColor.RED + "No permissions.");
  26. }
  27. if (args.length == 0) {
  28. return false;
  29. }
  30. if(args.length == 1) {
  31. sender.sendMessage(ChatColor.GREEN + "Use /report <player> <reason>");
  32. }
  33. if(args.length >= 2) {
  34. String targetName = args[0];
  35. Player player = (Player) sender;
  36. Player target = Bukkit.getPlayer(targetName);
  37. if (target == null) {
  38. player.sendMessage(targetName + " is offline!");
  39. }
  40. StringBuilder sb = new StringBuilder();
  41. for (int i = 1; i < args.length; i++) {
  42. sb.append(args[i]);
  43. if (i < args.length) {
  44. sb.append(" ");
  45. }
  46. }
  47. player.sendMessage("Player " + targetName + ChatColor.RED + " reported for " + sb.toString());
  48.  
  49. }
  50. }
  51. return true;
  52. }
  53. }
RAW Paste Data