|
23 | 23 | import net.minecraft.entity.Entity; |
24 | 24 | import net.minecraft.entity.player.EntityPlayer; |
25 | 25 | import net.minecraft.network.play.server.S03PacketTimeUpdate; |
| 26 | +import net.minecraft.network.play.server.S41PacketServerDifficulty; |
26 | 27 | import net.minecraft.profiler.Profiler; |
27 | 28 | import net.minecraft.server.management.ServerConfigurationManager; |
28 | 29 | import net.minecraft.util.BlockPos; |
@@ -194,13 +195,12 @@ protected void loadAllWorlds(ISaveHandler isavehandler, String s1, WorldSettings |
194 | 195 | } |
195 | 196 |
|
196 | 197 | this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); |
197 | | - if (!this.isSinglePlayer()) { |
198 | | - this.worldServers[j].getWorldInfo().setGameType(this.getGameType()); |
199 | | - } |
200 | 198 | } |
201 | 199 |
|
202 | 200 | this.serverConfigManager.setPlayerManager(this.worldServers); |
203 | | - this.setDifficultyForAllWorlds(this.getDifficulty()); |
| 201 | + if (this.worldServers[0].getWorldInfo().getDifficulty() == null) { |
| 202 | + this.setDifficultyForAllWorlds(this.getDifficulty()); |
| 203 | + } |
204 | 204 | this.isSpawnChunksLoaded = this.worldServers[0].getWorldInfo().getGameRulesInstance() |
205 | 205 | .getBoolean("loadSpawnChunks"); |
206 | 206 | if (this.isSpawnChunksLoaded) { |
@@ -756,6 +756,17 @@ public void setDifficultyForAllWorlds(EnumDifficulty enumdifficulty) { |
756 | 756 | } |
757 | 757 | } |
758 | 758 | } |
| 759 | + this.getConfigurationManager().sendPacketToAllPlayers(new S41PacketServerDifficulty( |
| 760 | + this.worldServers[0].getDifficulty(), this.worldServers[0].getWorldInfo().isDifficultyLocked())); |
| 761 | + } |
| 762 | + |
| 763 | + public void setDifficultyLockedForAllWorlds(boolean locked) { |
| 764 | + for (int i = 0; i < this.worldServers.length; ++i) { |
| 765 | + WorldServer worldserver = this.worldServers[i]; |
| 766 | + if (worldserver != null) { |
| 767 | + worldserver.getWorldInfo().setDifficultyLocked(locked); |
| 768 | + } |
| 769 | + } |
759 | 770 |
|
760 | 771 | } |
761 | 772 |
|
|
0 commit comments