Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import ngx.interfaces.IAddonCommand;
- import ngx.loader.NGXaddon;
- import ngx.main.MainClass;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerJoinEvent;
- public class Addon extends NGXaddon implements Listener, IAddonCommand {
- MainClass m;
- Addon a;
- public void settings() {
- this.setName("Test-Addon");
- this.setVersion("0.0.1");
- }
- public void onLoad() {
- a = this;
- m = MainClass.getMain();
- this.log("was successfully loaded");
- }
- public void onEnable() {
- this.log("was successfully enable");
- this.register(this);
- this.register(this, "test");
- }
- public void onEnabled() {
- this.log("was successfully enabled");
- }
- public void onDisable() {
- a = null;
- this.log("was successfully disabled");
- }
- @EventHandler
- public void onJoin(PlayerJoinEvent e) {
- e.getPlayer().sendMessage("ABC ABC ABC ABC");
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if (cmd.getName().equalsIgnoreCase("test")) {
- if (sender instanceof Player) {
- Player p = (Player) sender;
- p.sendMessage("test");
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment