stoneharry

Untitled

Apr 11th, 2012
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1.     @EventHandler
  2.     public void onPlayerChat(PlayerChatEvent chat) {
  3.         String message = chat.getMessage();
  4.         if (message.length() > 3)
  5.         {
  6.             char old[] = message.toCharArray();
  7.             char compare[] = message.toUpperCase().toCharArray();
  8.             int count = 0;
  9.             for (int i=0; i<message.length(); i++)
  10.             {
  11.                 if (old[i] == compare[i])
  12.                 {
  13.                     count = count + 1;
  14.                 }
  15.             }
  16.             if (((int)message.length()/100) > 50)
  17.             {
  18.                 chat.setCancelled(true);
  19.                 Player p = chat.getPlayer();
  20.                 p.sendMessage(ChatColor.RED + "Do not send messages in only capital letters." + ChatColor.WHITE + "You have been set on fire for doing this.");
  21.                 p.setFireTicks(5000);
  22.             }
  23.         }
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment