geforkt von Mirrors/Paper
5c7081fecc
* Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories CraftBukkit Changes:4090d01f
SPIGOT-5047: Correct slot types for 1.14 inventoriese8c08362
SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.d445af3b
SPIGOT-5067: Add item meta for 1.14 spawn eggs * Bring Chunk load checks in-line with spigot As of the last upstream merge spigot now checks ticket level status when returning loaded chunks for a world from api. Now our checks will respect that decision. * Fix spawn ticket levels Vanilla would keep the inner chunks of spawn available for ticking, however my changes made all chunks non-ticking. Resolve by changing ticket levels for spawn chunks inside the border to respect this behavior. * Make World#getChunkIfLoadedImmediately return only entity ticking chunks Mojang appears to be using chunks with level > 33 (non-ticking chunks) as cached chunks and not actually loaded chunks. * Bring all loaded checks in line with spigot Loaded chunks must be at least border chunks, or level <= 33
69 Zeilen
4.3 KiB
Diff
69 Zeilen
4.3 KiB
Diff
From cf85ce0bc68ae3d516f2cf9ff996f0e62ad7ab9c Mon Sep 17 00:00:00 2001
|
|
From: Gabriele C <sgdc3.mail@gmail.com>
|
|
Date: Mon, 22 Oct 2018 17:34:10 +0200
|
|
Subject: [PATCH] Add option to prevent players from moving into unloaded
|
|
chunks #1551
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index fb44fccc92..ad793ffa38 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -434,4 +434,9 @@ public class PaperWorldConfig {
|
|
this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick);
|
|
log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default");
|
|
}
|
|
+
|
|
+ public boolean preventMovingIntoUnloadedChunks = false;
|
|
+ private void preventMovingIntoUnloadedChunks() {
|
|
+ preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
index 0aa1e2a057..ce0e93fffa 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -347,6 +347,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
}
|
|
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
|
|
|
|
+ // Paper start - Prevent moving into unloaded chunks
|
|
+ if (player.world.paperConfig.preventMovingIntoUnloadedChunks && !worldserver.isChunkLoaded((int) Math.floor(packetplayinvehiclemove.getX()) >> 4, (int) Math.floor(packetplayinvehiclemove.getZ()) >> 4)) {
|
|
+ this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) {
|
|
// CraftBukkit end
|
|
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8);
|
|
@@ -891,9 +898,9 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
double d1 = this.player.locY;
|
|
double d2 = this.player.locZ;
|
|
double d3 = this.player.locY;
|
|
- double d4 = packetplayinflying.a(this.player.locX);
|
|
+ double d4 = packetplayinflying.a(this.player.locX);double toX = d4; // Paper - OBFHELPER
|
|
double d5 = packetplayinflying.b(this.player.locY);
|
|
- double d6 = packetplayinflying.c(this.player.locZ);
|
|
+ double d6 = packetplayinflying.c(this.player.locZ);double toZ = d6; // Paper - OBFHELPER
|
|
float f = packetplayinflying.a(this.player.yaw);
|
|
float f1 = packetplayinflying.b(this.player.pitch);
|
|
double d7 = d4 - this.l;
|
|
@@ -933,6 +940,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
speed = player.abilities.walkSpeed * 10f;
|
|
}
|
|
|
|
+ // Paper start - Prevent moving into unloaded chunks
|
|
+ if (player.world.paperConfig.preventMovingIntoUnloadedChunks && (this.player.locX != toX || this.player.locZ != toZ) && !worldserver.isChunkLoaded((int) Math.floor(toX) >> 4, (int) Math.floor(toZ) >> 4)) {
|
|
+ this.internalTeleport(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch, Collections.emptySet());
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
if (!this.player.H() && (!this.player.getWorldServer().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.isGliding())) {
|
|
float f2 = this.player.isGliding() ? 300.0F : 100.0F;
|
|
|
|
--
|
|
2.21.0
|
|
|