Guest User

Untitled

a guest
Jun 16th, 2015
208
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.euromancy;
  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 Report 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 == 2) {
  31. return false;
  32. }
  33. else
  34. {
  35. sender.sendMessage(ChatColor.GREEN + "Use /report <player> <reason>");
  36.  
  37. String targetName = args[0];
  38. Player player = (Player) sender;
  39. Player target = Bukkit.getPlayer(targetName);
  40. if (target == null) {
  41. player.sendMessage(targetName + " is offline!");
  42. }
  43. StringBuilder sb = new StringBuilder();
  44. for (int i = 1; i < args.length; i++) {
  45. sb.append(args[i]);
  46. if (i < args.length) {
  47. sb.append(" ");
  48. }
  49. }
  50. player.sendMessage("Player " + targetName + ChatColor.RED + " reported for " + sb.toString());
  51.  
  52. }
  53. }
  54. return true;
  55. }
  56. }
RAW Paste Data