to working plugin
This commit is contained in:
parent
ddeb709ed6
commit
969b6efa06
|
@ -3,14 +3,30 @@ package me.map.example;
|
|||
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.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Example extends JavaPlugin implements Listener {
|
||||
|
||||
private Plugin main;
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
HandlerList.unregisterAll(this.main);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
this.main = this;
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Example(), this);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onJoin(PlayerJoinEvent event) {
|
||||
|
||||
|
@ -20,8 +36,8 @@ public class Example extends JavaPlugin implements Listener {
|
|||
if (player.getKingdom() == null) {
|
||||
System.out.println("Player has no kingdom");
|
||||
}else {
|
||||
System.out.println("Player has kingdom " + player.getKingdom().getName());
|
||||
|
||||
System.out.println("Player has kingdom " + player.getKingdom().getName());
|
||||
|
||||
//checking for a kingdom
|
||||
if (UltimateKingdom.Kingdoms().getKingdom("MyKingdom") != null) {
|
||||
|
@ -39,6 +55,5 @@ public class Example extends JavaPlugin implements Listener {
|
|||
// teleport player in a few seconds to spawn
|
||||
UltimateKingdom.getKingdomServer().TeleportManager().TelePortPlayer(player.getPlayer(), player.getKingdom().getSpawn(),
|
||||
"Kingdom Spawn");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user