Guest User

Untitled

a guest
Apr 15th, 2015
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.48 KB | None | 0 0
  1. package main;
  2.  
  3. import ngx.interfaces.IAddonCommand;
  4. import ngx.loader.NGXaddon;
  5. import ngx.main.MainClass;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.event.EventHandler;
  10. import org.bukkit.event.Listener;
  11. import org.bukkit.event.player.PlayerJoinEvent;
  12.  
  13. public class Addon extends NGXaddon implements Listener, IAddonCommand {
  14.     MainClass m;
  15.     Addon a;
  16.  
  17.     public void settings() {
  18.         this.setName("Test-Addon");
  19.         this.setVersion("0.0.1");
  20.     }
  21.  
  22.     public void onLoad() {
  23.         a = this;
  24.         m = MainClass.getMain();
  25.         this.log("was successfully loaded");
  26.     }
  27.  
  28.     public void onEnable() {
  29.         this.log("was successfully enable");
  30.         this.register(this);
  31.         this.register(this, "test");
  32.     }
  33.  
  34.     public void onEnabled() {
  35.         this.log("was successfully enabled");
  36.     }
  37.  
  38.     public void onDisable() {
  39.         a = null;
  40.         this.log("was successfully disabled");
  41.     }
  42.  
  43.     @EventHandler
  44.     public void onJoin(PlayerJoinEvent e) {
  45.         e.getPlayer().sendMessage("ABC ABC ABC ABC");
  46.     }
  47.  
  48.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  49.         if (cmd.getName().equalsIgnoreCase("test")) {
  50.             if (sender instanceof Player) {
  51.                 Player p = (Player) sender;
  52.                 p.sendMessage("test");
  53.             }
  54.         }
  55.         return false;
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment