diff --git a/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch index 610de25..3e68e14 100644 --- a/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -199,7 +199,7 @@ + { + entityplayermp1.playerNetServerHandler.sendPacket(packet); + } - } ++ } + // CraftBukkit end + for (int i = 0; i < this.playerEntityList.size(); ++i) + { @@ -213,7 +213,7 @@ + + // .name -> .listName + p_72377_1_.playerNetServerHandler.sendPacket(new S38PacketPlayerListItem(entityplayermp1.listName, true, entityplayermp1.ping)); -+ } + } + // CraftBukkit end + kcauldron.updater.DefaultUpdateCallback.INSTANCE.onPlayerJoin(playerJoinEvent); } @@ -303,15 +303,15 @@ } else if (this.bannedIPs.func_152708_a(p_148542_1_)) { -@@ -368,10 +512,75 @@ +@@ -368,9 +512,74 @@ } 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,13 +374,12 @@ + } + + return entity; -+ } + } + // CraftBukkit end -+ + public EntityPlayerMP createPlayerForUser(GameProfile p_148545_1_) { - UUID uuid = EntityPlayer.func_146094_a(p_148545_1_); -@@ -410,80 +619,200 @@ +@@ -410,80 +619,204 @@ return new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(0), p_148545_1_, (ItemInWorldManager)object); } @@ -432,15 +431,8 @@ { - object = new ItemInWorldManager(this.mcServer.worldServerForDimension(p_72368_1_.dimension)); + object = new ItemInWorldManager(this.mcServer.worldServerForDimension(0)); - } - -- EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(p_72368_1_.dimension), p_72368_1_.getGameProfile(), (ItemInWorldManager)object); -- entityplayermp1.playerNetServerHandler = p_72368_1_.playerNetServerHandler; -- entityplayermp1.clonePlayer(p_72368_1_, p_72368_3_); -- entityplayermp1.dimension = p_72368_2_; -- entityplayermp1.setEntityId(p_72368_1_.getEntityId()); -- WorldServer worldserver = this.mcServer.worldServerForDimension(p_72368_1_.dimension); -- this.func_72381_a(entityplayermp1, p_72368_1_, worldserver); ++ } ++ + return new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(0), p_148545_1_, (ItemInWorldManager)object); + // */ + return player; @@ -489,8 +481,15 @@ + { + return null; + } -+ } -+ + } + +- EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(p_72368_1_.dimension), p_72368_1_.getGameProfile(), (ItemInWorldManager)object); +- entityplayermp1.playerNetServerHandler = p_72368_1_.playerNetServerHandler; +- entityplayermp1.clonePlayer(p_72368_1_, p_72368_3_); +- entityplayermp1.dimension = p_72368_2_; +- entityplayermp1.setEntityId(p_72368_1_.getEntityId()); +- WorldServer worldserver = this.mcServer.worldServerForDimension(p_72368_1_.dimension); +- this.func_72381_a(entityplayermp1, p_72368_1_, worldserver); + // Phase 3 - remove current player from current dimension + par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP); + // par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removeEntityFromAllTrackingPlayers(par1EntityPlayerMP); // CraftBukkit @@ -519,8 +518,7 @@ + { + chunkcoordinates1 = EntityPlayer.verifyRespawnCoordinates(this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), + bedSpawnChunkCoords, spawnForced); - -- if (chunkcoordinates1 != null) ++ + if (chunkcoordinates1 != null) + { + isBedSpawn = true; @@ -537,7 +535,8 @@ + 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); @@ -549,18 +548,22 @@ + PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn); + this.cserver.getPluginManager().callEvent(respawnEvent); + ++ // Spigot Start ++ if (par1EntityPlayerMP.playerNetServerHandler.isDisconnected()) { return par1EntityPlayerMP; } ++ // Spigot End ++ + if (!spawnForced) // mods override plugins { - entityplayermp1.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(0, 0.0F)); + location = respawnEvent.getRespawnLocation(); } + par1EntityPlayerMP.reset(); - } ++ } + else + // plugin + { + location.setWorld(this.mcServer.worldServerForDimension(targetDimension).getWorld()); -+ } + } - worldserver.theChunkProviderServer.loadChunk((int)entityplayermp1.posX >> 4, (int)entityplayermp1.posZ >> 4); + WorldServer targetWorld = ((CraftWorld) location.getWorld()).getHandle(); @@ -621,12 +624,22 @@ return entityplayermp1; } -@@ -492,34 +821,112 @@ +@@ -492,34 +825,112 @@ transferPlayerToDimension(p_72356_1_, p_72356_2_, mcServer.worldServerForDimension(p_72356_2_).getDefaultTeleporter()); } - public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_, Teleporter teleporter) + public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_, Teleporter teleporter) // mods such as Twilight Forest call this method directly ++ { ++ this.transferPlayerToDimension(p_72356_1_, p_72356_2_, teleporter, TeleportCause.MOD); // use our mod cause ++ } ++ ++ public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2, TeleportCause cause) ++ { ++ this.transferPlayerToDimension(par1EntityPlayerMP, par2, mcServer.worldServerForDimension(par2).getDefaultTeleporter(), cause); ++ } ++ ++ public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int targetDimension, Teleporter teleporter, TeleportCause cause) // Cauldron - add TeleportCause { - int j = p_72356_1_.dimension; - WorldServer worldserver = this.mcServer.worldServerForDimension(p_72356_1_.dimension); @@ -642,16 +655,6 @@ - this.updateTimeAndWeatherForPlayer(p_72356_1_, worldserver1); - this.syncPlayerInventory(p_72356_1_); - Iterator iterator = p_72356_1_.getActivePotionEffects().iterator(); -+ this.transferPlayerToDimension(p_72356_1_, p_72356_2_, teleporter, TeleportCause.MOD); // use our mod cause -+ } - -+ public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2, TeleportCause cause) -+ { -+ this.transferPlayerToDimension(par1EntityPlayerMP, par2, mcServer.worldServerForDimension(par2).getDefaultTeleporter(), cause); -+ } -+ -+ public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int targetDimension, Teleporter teleporter, TeleportCause cause) // Cauldron - add TeleportCause -+ { + // Allow Forge hotloading on teleport + WorldServer fromWorld = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); + WorldServer exitWorld = this.mcServer.worldServerForDimension(targetDimension); @@ -729,7 +732,7 @@ + this.updateTimeAndWeatherForPlayer(par1EntityPlayerMP, exitWorld); + this.syncPlayerInventory(par1EntityPlayerMP); + Iterator iterator = par1EntityPlayerMP.getActivePotionEffects().iterator(); -+ + while (iterator.hasNext()) { - PotionEffect potioneffect = (PotionEffect)iterator.next(); @@ -753,7 +756,7 @@ } public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, Teleporter teleporter) -@@ -605,6 +1012,109 @@ +@@ -605,6 +1016,109 @@ p_82448_1_.setWorld(p_82448_4_); } @@ -863,7 +866,7 @@ public void sendPlayerInfoToAllPlayers() { if (++this.playerPingIndex > 600) -@@ -612,11 +1122,13 @@ +@@ -612,11 +1126,13 @@ this.playerPingIndex = 0; } @@ -877,7 +880,7 @@ } public void sendPacketToAllPlayers(Packet p_148540_1_) -@@ -877,13 +1389,24 @@ +@@ -877,13 +1393,24 @@ for (int j = 0; j < this.playerEntityList.size(); ++j) { EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(j); @@ -904,7 +907,7 @@ if (d4 * d4 + d5 * d5 + d6 * d6 < p_148543_8_ * p_148543_8_) { entityplayermp.playerNetServerHandler.sendPacket(p_148543_11_); -@@ -941,13 +1464,16 @@ +@@ -941,13 +1468,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))); @@ -922,7 +925,7 @@ p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem)); } -@@ -961,9 +1487,17 @@ +@@ -961,9 +1491,17 @@ return this.maxPlayers; } @@ -941,14 +944,13 @@ } public void setWhiteListEnabled(boolean p_72371_1_) -@@ -1032,12 +1566,30 @@ +@@ -1032,11 +1570,29 @@ public void removeAllPlayers() { - for (int i = 0; i < this.playerEntityList.size(); ++i) + while (!this.playerEntityList.isEmpty()) - { -- ((EntityPlayerMP)this.playerEntityList.get(i)).playerNetServerHandler.kickPlayerFromServer("Server closed"); ++ { + // Spigot start + EntityPlayerMP p = (EntityPlayerMP) this.playerEntityList.get(0); + p.playerNetServerHandler.kickPlayerFromServer(this.mcServer.server.getShutdownMessage()); @@ -958,19 +960,25 @@ + this.playerEntityList.remove(0); // Prevent shutdown hang if already disconnected + } + // Spigot end - } - } - ++ } ++ } ++ + // CraftBukkit start - Support multi-line messages + public void sendMessage(IChatComponent[] ichatbasecomponent) + { + for (IChatComponent component : ichatbasecomponent) -+ { + { +- ((EntityPlayerMP)this.playerEntityList.get(i)).playerNetServerHandler.kickPlayerFromServer("Server closed"); + sendChatMsgImpl(component, true); -+ } -+ } + } + } + // CraftBukkit end -+ + public void sendChatMsgImpl(IChatComponent p_148544_1_, boolean p_148544_2_) { - this.mcServer.addChatMessage(p_148544_1_); +@@ -1103,4 +1659,4 @@ + { + return this.whiteListEnforced; + } +-} ++}