mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 02:47: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
@@ -1,5 +1,18 @@
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -459,6 +_,12 @@
|
||||
if (d < 0.0) {
|
||||
double damagePerBlock = this.level().getWorldBorder().getDamagePerBlock();
|
||||
if (damagePerBlock > 0.0) {
|
||||
+ // Purpur start - Add option to teleport to spawn if outside world border
|
||||
+ if (this.level().purpurConfig.teleportIfOutsideBorder && this instanceof ServerPlayer serverPlayer) {
|
||||
+ serverPlayer.teleport(io.papermc.paper.util.MCUtil.toLocation(this.level(), this.level().getSharedSpawnPos()));
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end - Add option to teleport to spawn if outside world border
|
||||
this.hurtServer(serverLevel1, this.damageSources().outOfBorder(), Math.max(1, Mth.floor(-d * damagePerBlock)));
|
||||
}
|
||||
}
|
||||
@@ -1788,6 +_,7 @@
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
this.dropEquipment(level); // CraftBukkit - from below
|
||||
|
||||
Reference in New Issue
Block a user