mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Add option to teleport to spawn if outside world border
This commit is contained in:
committed by
granny
parent
d2a0414806
commit
bb8ed69b06
@@ -125,3 +125,30 @@
|
||||
|
||||
public ServerStatsCounter getStats() {
|
||||
return this.stats;
|
||||
@@ -3077,4 +_,26 @@
|
||||
return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
+
|
||||
+ // Purpur start - Add option to teleport to spawn if outside world border
|
||||
+ public void teleport(org.bukkit.Location to) {
|
||||
+ this.ejectPassengers();
|
||||
+ this.stopRiding(true);
|
||||
+
|
||||
+ if (this.isSleeping()) {
|
||||
+ this.stopSleepInBed(true, false);
|
||||
+ }
|
||||
+
|
||||
+ if (this.containerMenu != this.inventoryMenu) {
|
||||
+ this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.TELEPORT);
|
||||
+ }
|
||||
+
|
||||
+ ServerLevel toLevel = ((org.bukkit.craftbukkit.CraftWorld) to.getWorld()).getHandle();
|
||||
+ if (this.level() == toLevel) {
|
||||
+ this.connection.teleport(to);
|
||||
+ } else {
|
||||
+ this.server.getPlayerList().respawn(this, true, RemovalReason.KILLED, org.bukkit.event.player.PlayerRespawnEvent.RespawnReason.DEATH, to);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Add option to teleport to spawn if outside world border
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user