From 397352840a3a41a12c56bbc1cef7cb28327466da Mon Sep 17 00:00:00 2001 From: Robotia Date: Sat, 30 Jan 2016 17:42:55 -0500 Subject: [PATCH] Fix #39 : Call DimensionChange then Respawn --- .../ServerConfigurationManager.java.patch | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch index 3e68e14..686c61a 100644 --- a/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -303,15 +303,15 @@ } else if (this.bannedIPs.func_152708_a(p_148542_1_)) { -@@ -368,9 +512,74 @@ +@@ -368,10 +512,75 @@ } else { - return this.playerEntityList.size() >= this.maxPlayers ? "The server is full!" : null; + return this.playerEntityList.size() >= this.maxPlayers ? org.spigotmc.SpigotConfig.serverFullMessage : null; -+ } -+ } -+ + } + } + + // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer + public EntityPlayerMP attemptLogin(NetHandlerLoginServer loginlistener, GameProfile gameprofile, String hostname) + { @@ -363,7 +363,7 @@ + { + event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot + } - } ++ } + + this.cserver.getPluginManager().callEvent(event); + @@ -374,12 +374,13 @@ + } + + return entity; - } ++ } + // CraftBukkit end - ++ public EntityPlayerMP createPlayerForUser(GameProfile p_148545_1_) { -@@ -410,80 +619,204 @@ + UUID uuid = EntityPlayer.func_146094_a(p_148545_1_); +@@ -410,80 +619,207 @@ return new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(0), p_148545_1_, (ItemInWorldManager)object); } @@ -518,7 +519,8 @@ + { + chunkcoordinates1 = EntityPlayer.verifyRespawnCoordinates(this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), + bedSpawnChunkCoords, spawnForced); -+ + +- if (chunkcoordinates1 != null) + if (chunkcoordinates1 != null) + { + isBedSpawn = true; @@ -535,8 +537,7 @@ + location = new Location(toWorld, toWorld.getSpawnLocation().getX(), toWorld.getSpawnLocation().getY(), toWorld.getSpawnLocation().getZ()); // use the spawnpoint as location + } + } - -- if (chunkcoordinates1 != null) ++ + if (location == null) { - entityplayermp1.setLocationAndAngles((double)((float)chunkcoordinates1.posX + 0.5F), (double)((float)chunkcoordinates1.posY + 0.1F), (double)((float)chunkcoordinates1.posZ + 0.5F), 0.0F, 0.0F); @@ -617,14 +618,17 @@ - FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); + // If world changed then fire the appropriate change world event else respawn + if (fromWorld != location.getWorld()) ++ { + FMLCommonHandler.instance().firePlayerChangedDimensionEvent(entityplayermp1, ((CraftWorld) fromWorld).getHandle().provider.dimensionId, + ((CraftWorld) location.getWorld()).getHandle().provider.dimensionId, (CraftWorld) fromWorld); // Cauldron - fire forge changed dimension event ++ FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); ++ } + else + FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); return entityplayermp1; } -@@ -492,34 +825,112 @@ +@@ -492,34 +828,112 @@ transferPlayerToDimension(p_72356_1_, p_72356_2_, mcServer.worldServerForDimension(p_72356_2_).getDefaultTeleporter()); } @@ -756,7 +760,7 @@ } public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, Teleporter teleporter) -@@ -605,6 +1016,109 @@ +@@ -605,6 +1019,109 @@ p_82448_1_.setWorld(p_82448_4_); } @@ -866,7 +870,7 @@ public void sendPlayerInfoToAllPlayers() { if (++this.playerPingIndex > 600) -@@ -612,11 +1126,13 @@ +@@ -612,11 +1129,13 @@ this.playerPingIndex = 0; } @@ -880,7 +884,7 @@ } public void sendPacketToAllPlayers(Packet p_148540_1_) -@@ -877,13 +1393,24 @@ +@@ -877,13 +1396,24 @@ for (int j = 0; j < this.playerEntityList.size(); ++j) { EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(j); @@ -907,7 +911,7 @@ if (d4 * d4 + d5 * d5 + d6 * d6 < p_148543_8_ * p_148543_8_) { entityplayermp.playerNetServerHandler.sendPacket(p_148543_11_); -@@ -941,13 +1468,16 @@ +@@ -941,13 +1471,16 @@ p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F)); p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, p_72354_2_.getRainStrength(1.0F))); p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, p_72354_2_.getWeightedThunderStrength(1.0F))); @@ -925,7 +929,7 @@ p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem)); } -@@ -961,9 +1491,17 @@ +@@ -961,9 +1494,17 @@ return this.maxPlayers; } @@ -944,7 +948,7 @@ } public void setWhiteListEnabled(boolean p_72371_1_) -@@ -1032,11 +1570,29 @@ +@@ -1032,11 +1573,29 @@ public void removeAllPlayers() { @@ -976,7 +980,7 @@ public void sendChatMsgImpl(IChatComponent p_148544_1_, boolean p_148544_2_) { -@@ -1103,4 +1659,4 @@ +@@ -1103,4 +1662,4 @@ { return this.whiteListEnforced; }