Advertisement
Guest User

Untitled

a guest
Feb 1st, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. package me.smartguy27.FUMute;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.EventHandler;
  7. import org.bukkit.event.Listener;
  8. import org.bukkit.event.player.AsyncPlayerChatEvent;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10.  
  11. public class Main extends JavaPlugin implements Listener {
  12.    
  13.    
  14.     @EventHandler
  15.     public void onPlayerChat(AsyncPlayerChatEvent event) {
  16.         Player player = event.getPlayer();
  17.         for (String s: getConfig()
  18.                 .getStringList("msgprefixes")) {
  19.             if (event.getMessage().toLowerCase().contains(s)) {
  20.                 player.sendMessage(ChatColor.AQUA + "[Minetime] " + ChatColor.LIGHT_PURPLE + "Please do not attempt to send fake messages.");
  21.                 event.setCancelled(true);
  22.             }
  23.         }
  24.     }      
  25.    
  26.     //smartguy27
  27.    
  28.     public void onEnable() {
  29.         getConfig().options().copyDefaults(true);
  30.         saveConfig();
  31.         Bukkit.getServer().getPluginManager().registerEvents(this, this);
  32.        
  33.     }
  34.  
  35. }
  36.  
  37. //TODO Actually get the plugin to work.
  38. //TODO Configurable warning message
  39. //TODO Tie into MineMute to mute somebody for a configurable amount of time.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement