Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.arnemix.Moderation;
- import java.util.ArrayList;
- import org.bukkit.Bukkit;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import fr.arnemix.main.Main;
- public class Report implements CommandExecutor{
- public Main main;
- public Report(Main main) {
- this.main = main;
- }
- String prefix = "§3Oparia §b» ";
- public static ArrayList<Player> cooldown = new ArrayList<>();
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if(cmd.getName().equalsIgnoreCase("report")) {
- Player player = (Player) sender;
- if(!cooldown.contains(player)) {
- if(args.length == 0) {
- player.sendMessage(prefix + "§c/report <joueur> <raison>");
- }
- if(args.length == 1) {
- player.sendMessage(prefix + "§c/report <joueur> <raison>");
- }
- if(args.length > 1) {
- Player target = Bukkit.getPlayer(args[0]);
- if(target != player) {
- if(target != null) {
- player.sendMessage(prefix + "§7Votre report sera bientôt §apris en compte");
- cooldown.add(player);
- String raison = "";
- for (int i = 1; i < args.length; ++i) {
- raison = String.valueOf(raison) + args[i] + " ";
- }
- for (final Player all : Bukkit.getOnlinePlayers()) {
- if (all.hasPermission("staff")) {
- all.sendMessage(prefix + "§c" + sender.getName() + " §7a report§c " + target.getName() + "§7 pour §c" + raison);
- }
- }
- int delay = 1;
- main.getServer().getScheduler().scheduleSyncDelayedTask(main, new Runnable() {
- @Override
- public void run() {
- cooldown.remove(player);
- }
- }, 1200*delay);
- return true;
- }else {
- player.sendMessage(prefix + "§cCe joueur n'est pas connecté");
- }
- }
- player.sendMessage(prefix + "§cVous souhaitez vous report vous-mêmes ?");
- }
- }else {
- player.sendMessage(prefix + "§cVeuillez patienter entre chaque utilisation (1 minute)");
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement