test methode not found
This commit is contained in:
parent
6ffcf98421
commit
147eb100dd
|
@ -4,6 +4,10 @@ import me.map.ultimatekingdom.api.UltimateKingdom;
|
|||
import me.map.ultimatekingdom.api.objects.Kingdom;
|
||||
import me.map.ultimatekingdom.api.objects.KingdomPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
@ -12,7 +16,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Example extends JavaPlugin implements Listener {
|
||||
public class Example extends JavaPlugin implements Listener, CommandExecutor {
|
||||
|
||||
private Plugin main;
|
||||
|
||||
|
@ -25,6 +29,8 @@ public class Example extends JavaPlugin implements Listener {
|
|||
public void onEnable() {
|
||||
this.main = this;
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Example(), this);
|
||||
this.getCommand("test").setExecutor(new Example());
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
@ -56,4 +62,20 @@ public class Example extends JavaPlugin implements Listener {
|
|||
UltimateKingdom.getKingdomServer().TeleportManager().TelePortPlayer(player.getPlayer(), player.getKingdom().getSpawn(),
|
||||
"Kingdom Spawn");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
|
||||
if (!cmd.getName().equalsIgnoreCase("test")) return true;
|
||||
KingdomPlayer kdp = UltimateKingdom.Players().getPlayer((Player ) sender);
|
||||
sender.sendMessage(kdp.getKingdom().getName());
|
||||
|
||||
// if (sender instanceof Player) {
|
||||
// Player player = (Player) sender;
|
||||
|
||||
// Here we need to give items to our player
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user