From 75a2fb8e0be1be0351966f9824648eeb58167b44 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 17 Jul 2020 08:56:56 +1000 Subject: [PATCH] SPIGOT-5901: Improve multiworld support --- nms-patches/EntityPlayer.patch | 8 +++++++- nms-patches/PlayerList.patch | 7 ++++++- nms-patches/WorldServer.patch | 18 ++++++++++++++++-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch index 606b7d1bec..a3f17636a8 100644 --- a/nms-patches/EntityPlayer.patch +++ b/nms-patches/EntityPlayer.patch @@ -49,7 +49,7 @@ public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { super(worldserver, worldserver.getSpawn(), gameprofile); this.spawnDimension = World.OVERWORLD; -@@ -66,7 +101,51 @@ +@@ -66,12 +101,56 @@ this.advancementDataPlayer = minecraftserver.getPlayerList().f(this); this.G = 1.0F; this.b(worldserver); @@ -101,6 +101,12 @@ private void b(WorldServer worldserver) { BlockPosition blockposition = worldserver.getSpawn(); + +- if (worldserver.getDimensionManager().hasSkyLight() && worldserver.getMinecraftServer().getSaveData().getGameType() != EnumGamemode.ADVENTURE) { ++ if (worldserver.getDimensionManager().hasSkyLight() && worldserver.worldDataServer.getGameType() != EnumGamemode.ADVENTURE) { // CraftBukkit + int i = Math.max(0, this.server.a(worldserver)); + int j = MathHelper.floor(worldserver.getWorldBorder().b((double) blockposition.getX(), (double) blockposition.getZ())); + @@ -137,11 +216,20 @@ if (nbttagcompound.hasKeyOfType("recipeBook", 10)) { this.recipeBook.a(nbttagcompound.getCompound("recipeBook"), this.server.getCraftingManager()); diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index de63fc806b..ab94d33202 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -655,7 +655,12 @@ } public int getPlayerCount() { -@@ -747,27 +1035,50 @@ +@@ -743,31 +1031,54 @@ + entityplayer.playerInteractManager.a(this.u, EnumGamemode.NOT_SET); + } + +- entityplayer.playerInteractManager.b(worldserver.getMinecraftServer().getSaveData().getGameType()); ++ entityplayer.playerInteractManager.b(worldserver.worldDataServer.getGameType()); // CraftBukkit } public void shutdown() { diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch index 19c80dadb6..b02f3f7a1a 100644 --- a/nms-patches/WorldServer.patch +++ b/nms-patches/WorldServer.patch @@ -73,7 +73,15 @@ this.portalTravelAgent = new PortalTravelAgent(this); this.N(); this.O(); -@@ -97,8 +131,42 @@ +@@ -91,14 +125,48 @@ + iworlddataserver.setGameType(minecraftserver.getGamemode()); + } + +- this.structureManager = new StructureManager(this, minecraftserver.getSaveData().getGeneratorSettings()); ++ this.structureManager = new StructureManager(this, this.worldDataServer.getGeneratorSettings()); // CraftBukkit + if (this.getDimensionManager().isCreateDragonBattle()) { +- this.dragonBattle = new EnderDragonBattle(this, minecraftserver.getSaveData().getGeneratorSettings().getSeed(), minecraftserver.getSaveData().B()); ++ this.dragonBattle = new EnderDragonBattle(this, this.worldDataServer.getGeneratorSettings().getSeed(), this.worldDataServer.B()); // CraftBukkit } else { this.dragonBattle = null; } @@ -301,7 +309,7 @@ if (iprogressupdate != null) { iprogressupdate.a(new ChatMessage("menu.savingLevel")); } -@@ -626,6 +740,14 @@ +@@ -626,11 +740,19 @@ chunkproviderserver.save(flag); } @@ -316,6 +324,12 @@ } private void ag() { + if (this.dragonBattle != null) { +- this.server.getSaveData().a(this.dragonBattle.a()); ++ this.worldDataServer.a(this.dragonBattle.a()); // CraftBukkit + } + + this.getChunkProvider().getWorldPersistentData().a(); @@ -691,11 +813,24 @@ @Override