Merge branch 'master' of https://git.recorehosting.com/git/webadmin/kingdomExample
This commit is contained in:
commit
21f1f20efd
|
@ -16,5 +16,6 @@
|
|||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.27" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: me.map:ultimatekingdom:0.18.0-BETA-SNAPSHOT" level="project" />
|
||||
</component>
|
||||
</module>
|
4
pom.xml
4
pom.xml
|
@ -36,8 +36,8 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.map.ultimatekingdom</groupId>
|
||||
<artifactId>UltimateKingdom</artifactId>
|
||||
<groupId>me.map</groupId>
|
||||
<artifactId>ultimatekingdom</artifactId>
|
||||
<version>0.18.0-BETA-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -13,6 +16,29 @@ public class Example extends JavaPlugin implements Listener {
|
|||
|
||||
if (event.getPlayer() == null) return;
|
||||
KingdomPlayer player = UltimateKingdom.Players().getPlayer(event.getPlayer());
|
||||
|
||||
if (player.getKingdom() == null) {
|
||||
System.out.println("Player has no kingdom");
|
||||
}else {
|
||||
System.out.println("Player has kingdom " + player.getKingdom().getName());
|
||||
|
||||
|
||||
//checking for a kingdom
|
||||
if (UltimateKingdom.Kingdoms().getKingdom("MyKingdom") != null) {
|
||||
|
||||
// get the kingdom
|
||||
Kingdom kingdom = UltimateKingdom.Kingdoms().getKingdom("MyKingdom");
|
||||
|
||||
// set user in kingdom
|
||||
player.setKingdom(kingdom);
|
||||
System.out.println("Player is now member of kingdom " + kingdom.getName());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 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