From bd079421a37fe34bc07d6ed7aa13220f391fc9f4 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 10 Jan 2021 12:37:41 +0000 Subject: [PATCH] fix wna/loading on non-paper servers --- .../adapter/mc1_15_2/FAWEWorldNativeAccess_1_15_2.java | 7 +++++-- .../adapter/mc1_16_1/FAWEWorldNativeAccess_1_16_R1.java | 7 +++++-- .../adapter/mc1_16_2/FAWEWorldNativeAccess_1_16_R2.java | 7 +++++-- .../adapter/mc1_16_4/FAWEWorldNativeAccess_1_16_R3.java | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15_2/FAWEWorldNativeAccess_1_15_2.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15_2/FAWEWorldNativeAccess_1_15_2.java index 714108b38..b27357132 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15_2/FAWEWorldNativeAccess_1_15_2.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15_2/FAWEWorldNativeAccess_1_15_2.java @@ -18,6 +18,7 @@ import net.minecraft.server.v1_15_R1.Chunk; import net.minecraft.server.v1_15_R1.ChunkProviderServer; import net.minecraft.server.v1_15_R1.EnumDirection; import net.minecraft.server.v1_15_R1.IBlockData; +import net.minecraft.server.v1_15_R1.MinecraftServer; import net.minecraft.server.v1_15_R1.NBTBase; import net.minecraft.server.v1_15_R1.NBTTagCompound; import net.minecraft.server.v1_15_R1.PlayerChunk; @@ -47,7 +48,9 @@ public class FAWEWorldNativeAccess_1_15_2 implements WorldNativeAccess world) { this.adapter = adapter; this.world = world; - this.lastTick = new AtomicInteger(getWorld().getServer().getCurrentTick()); + // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging. + // - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway. + this.lastTick = new AtomicInteger(MinecraftServer.currentTick); } private World getWorld() { @@ -80,7 +83,7 @@ public class FAWEWorldNativeAccess_1_15_2 implements WorldNativeAccess currentTick) { lastTick.set(currentTick); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/FAWEWorldNativeAccess_1_16_R1.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/FAWEWorldNativeAccess_1_16_R1.java index 4b70be046..af912ed52 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/FAWEWorldNativeAccess_1_16_R1.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/FAWEWorldNativeAccess_1_16_R1.java @@ -19,6 +19,7 @@ import net.minecraft.server.v1_16_R1.Chunk; import net.minecraft.server.v1_16_R1.ChunkProviderServer; import net.minecraft.server.v1_16_R1.EnumDirection; import net.minecraft.server.v1_16_R1.IBlockData; +import net.minecraft.server.v1_16_R1.MinecraftServer; import net.minecraft.server.v1_16_R1.NBTBase; import net.minecraft.server.v1_16_R1.NBTTagCompound; import net.minecraft.server.v1_16_R1.PlayerChunk; @@ -48,7 +49,9 @@ public class FAWEWorldNativeAccess_1_16_R1 implements WorldNativeAccess world) { this.adapter = adapter; this.world = world; - this.lastTick = new AtomicInteger(getWorld().getServer().getCurrentTick()); + // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging. + // - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway. + this.lastTick = new AtomicInteger(MinecraftServer.currentTick); } private World getWorld() { @@ -81,7 +84,7 @@ public class FAWEWorldNativeAccess_1_16_R1 implements WorldNativeAccess currentTick) { lastTick.set(currentTick); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_2/FAWEWorldNativeAccess_1_16_R2.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_2/FAWEWorldNativeAccess_1_16_R2.java index 78f0c7988..a4db85360 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_2/FAWEWorldNativeAccess_1_16_R2.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_2/FAWEWorldNativeAccess_1_16_R2.java @@ -19,6 +19,7 @@ import net.minecraft.server.v1_16_R2.Chunk; import net.minecraft.server.v1_16_R2.ChunkProviderServer; import net.minecraft.server.v1_16_R2.EnumDirection; import net.minecraft.server.v1_16_R2.IBlockData; +import net.minecraft.server.v1_16_R2.MinecraftServer; import net.minecraft.server.v1_16_R2.NBTBase; import net.minecraft.server.v1_16_R2.NBTTagCompound; import net.minecraft.server.v1_16_R2.PlayerChunk; @@ -48,7 +49,9 @@ public class FAWEWorldNativeAccess_1_16_R2 implements WorldNativeAccess world) { this.adapter = adapter; this.world = world; - this.lastTick = new AtomicInteger(getWorld().getServer().getCurrentTick()); + // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging. + // - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway. + this.lastTick = new AtomicInteger(MinecraftServer.currentTick); } private World getWorld() { @@ -81,7 +84,7 @@ public class FAWEWorldNativeAccess_1_16_R2 implements WorldNativeAccess currentTick) { lastTick.set(currentTick); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_4/FAWEWorldNativeAccess_1_16_R3.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_4/FAWEWorldNativeAccess_1_16_R3.java index 06b12d52d..cfb18dd17 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_4/FAWEWorldNativeAccess_1_16_R3.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_4/FAWEWorldNativeAccess_1_16_R3.java @@ -19,6 +19,7 @@ import net.minecraft.server.v1_16_R3.Chunk; import net.minecraft.server.v1_16_R3.ChunkProviderServer; import net.minecraft.server.v1_16_R3.EnumDirection; import net.minecraft.server.v1_16_R3.IBlockData; +import net.minecraft.server.v1_16_R3.MinecraftServer; import net.minecraft.server.v1_16_R3.NBTBase; import net.minecraft.server.v1_16_R3.NBTTagCompound; import net.minecraft.server.v1_16_R3.PlayerChunk; @@ -48,7 +49,9 @@ public class FAWEWorldNativeAccess_1_16_R3 implements WorldNativeAccess world) { this.adapter = adapter; this.world = world; - this.lastTick = new AtomicInteger(getWorld().getServer().getCurrentTick()); + // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging. + // - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway. + this.lastTick = new AtomicInteger(MinecraftServer.currentTick); } private World getWorld() { @@ -81,7 +84,7 @@ public class FAWEWorldNativeAccess_1_16_R3 implements WorldNativeAccess currentTick) { lastTick.set(currentTick);