SHARE
TWEET

Untitled

a guest Jul 20th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class PlayerChat implements Listener {
  2.     private List<Player> cooldown = new ArrayList<>();
  3.      
  4.     @EventHandler
  5.     public void onChat(AsyncPlayerChatEvent e){
  6.         Player player = e.getPlayer();
  7.  
  8.         e.setFormat("§c⚠" + new Grades().getRank(player).getPrefix() + "%1$s: §f%2$s");
  9.        
  10.         if(e.getMessage().startsWith("!") && player.hasPermission("moderation.chat")){
  11.              
  12.             e.setCancelled(true);
  13.  
  14.             Bukkit.getOnlinePlayers().stream().filter(players -> players.hasPermission("moderation.chat")).forEach(players -> players.sendMessage("§7(§bStaffChat§7) §e" + player.getName() + ": §a" + e.getMessage().substring(1)));
  15.  
  16.         }
  17.        
  18.        
  19.        
  20.         if(cooldown.contains(player)) {
  21.             if(Core.getInstance().grades.getRank(player) == ListGrades.Modérateur) {
  22.                 cooldown.remove(player);
  23.             }else {
  24.                 cooldown.add(player);
  25.             }
  26.            
  27.            
  28.             e.setCancelled(true);
  29.             player.sendMessage("§cMerci de patienter entre chaque message.");
  30.             return;
  31.         }
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top