Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. package fr.arnemix.Moderation;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandExecutor;
  8. import org.bukkit.command.CommandSender;
  9. import org.bukkit.entity.Player;
  10.  
  11. import fr.arnemix.main.Main;
  12.  
  13. public class Report implements CommandExecutor{
  14.  
  15.  
  16. public Main main;
  17.  
  18. public Report(Main main) {
  19. this.main = main;
  20. }
  21.  
  22. String prefix = "§3Oparia §b» ";
  23. public static ArrayList<Player> cooldown = new ArrayList<>();
  24.  
  25. @Override
  26. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  27.  
  28. if(cmd.getName().equalsIgnoreCase("report")) {
  29. Player player = (Player) sender;
  30. if(!cooldown.contains(player)) {
  31.  
  32.  
  33. if(args.length == 0) {
  34. player.sendMessage(prefix + "§c/report <joueur> <raison>");
  35.  
  36. }
  37. if(args.length == 1) {
  38. player.sendMessage(prefix + "§c/report <joueur> <raison>");
  39.  
  40. }
  41. if(args.length > 1) {
  42. Player target = Bukkit.getPlayer(args[0]);
  43. if(target != player) {
  44.  
  45. if(target != null) {
  46. player.sendMessage(prefix + "§7Votre report sera bientôt §apris en compte");
  47. cooldown.add(player);
  48.  
  49.  
  50. String raison = "";
  51. for (int i = 1; i < args.length; ++i) {
  52. raison = String.valueOf(raison) + args[i] + " ";
  53. }
  54. for (final Player all : Bukkit.getOnlinePlayers()) {
  55. if (all.hasPermission("staff")) {
  56. all.sendMessage(prefix + "§c" + sender.getName() + " §7a report§c " + target.getName() + "§7 pour §c" + raison);
  57. }
  58. }
  59.  
  60.  
  61. int delay = 1;
  62. main.getServer().getScheduler().scheduleSyncDelayedTask(main, new Runnable() {
  63.  
  64. @Override
  65. public void run() {
  66. cooldown.remove(player);
  67.  
  68.  
  69. }
  70.  
  71. }, 1200*delay);
  72.  
  73.  
  74.  
  75. return true;
  76. }else {
  77. player.sendMessage(prefix + "§cCe joueur n'est pas connecté");
  78. }
  79. }
  80. player.sendMessage(prefix + "§cVous souhaitez vous report vous-mêmes ?");
  81. }
  82. }else {
  83. player.sendMessage(prefix + "§cVeuillez patienter entre chaque utilisation (1 minute)");
  84. }
  85. }
  86.  
  87.  
  88. return false;
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement