This commit is contained in:
webadmin 2021-05-28 14:22:50 +02:00
commit 21f1f20efd
3 changed files with 30 additions and 3 deletions

View File

@ -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: 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: 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: 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> </component>
</module> </module>

View File

@ -36,8 +36,8 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>me.map.ultimatekingdom</groupId> <groupId>me.map</groupId>
<artifactId>UltimateKingdom</artifactId> <artifactId>ultimatekingdom</artifactId>
<version>0.18.0-BETA-SNAPSHOT</version> <version>0.18.0-BETA-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>

View File

@ -1,5 +1,8 @@
package me.map.example; 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.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -13,6 +16,29 @@ public class Example extends JavaPlugin implements Listener {
if (event.getPlayer() == null) return; if (event.getPlayer() == null) return;
KingdomPlayer player = UltimateKingdom.Players().getPlayer(event.getPlayer()); 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");
}
} }