Guest User

Untitled

a guest
Jun 16th, 2015
13
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 true;
  29. }
  30. if(args.length == 1) {
  31. }
  32. else
  33. {
  34. sender.sendMessage(ChatColor.GREEN + "Use /report <player> <reason>");
  35.  
  36. String targetName = args[0];
  37. Player player = (Player) sender;
  38. Player target = Bukkit.getPlayer(targetName);
  39. if (target == null) {
  40. player.sendMessage(targetName + " is offline!");
  41. }
  42. StringBuilder sb = new StringBuilder();
  43. for (int i = 1; i < args.length; i++) {
  44. sb.append(args[i]);
  45. if (i < args.length) {
  46. sb.append(" ");
  47. }
  48. }
  49. player.sendMessage("Player " + targetName + ChatColor.RED + " reported for " + sb.toString());
  50.  
  51. }
  52. }
  53. return true;
  54. }
  55. }
RAW Paste Data