diff --git a/nms-patches/BlockEnderPortal.patch b/nms-patches/BlockEnderPortal.patch index 478cb6af0d..52f8b812b0 100644 --- a/nms-patches/BlockEnderPortal.patch +++ b/nms-patches/BlockEnderPortal.patch @@ -12,7 +12,7 @@ @@ -37,6 +39,10 @@ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) { - if (!entity.isPassenger() && !entity.isVehicle() && entity.bf() && !world.isClientSide && entity.getBoundingBox().c(iblockdata.e(world, blockposition).a(blockposition))) { + if (!world.isClientSide && !entity.isPassenger() && !entity.isVehicle() && entity.bf() && entity.getBoundingBox().c(iblockdata.e(world, blockposition).a(blockposition))) { + // CraftBukkit start - Entity in portal + EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ())); + world.getServer().getPluginManager().callEvent(event); diff --git a/nms-patches/BlockSoil.patch b/nms-patches/BlockSoil.patch index 33fdfe06c8..bb670a3691 100644 --- a/nms-patches/BlockSoil.patch +++ b/nms-patches/BlockSoil.patch @@ -12,7 +12,7 @@ public class BlockSoil extends Block { public static final BlockStateInteger MOISTURE = BlockStateInteger.of("moisture", 0, 7); -@@ -35,6 +40,12 @@ +@@ -36,6 +41,12 @@ if (i > 0) { world.setTypeAndData(blockposition, iblockdata.set(BlockSoil.MOISTURE, Integer.valueOf(i - 1)), 2); } else if (!this.c(world, blockposition)) { @@ -22,10 +22,10 @@ + return; + } + // CraftBukkit end - this.b(world, blockposition); + b(world, blockposition); } } else if (i < 7) { -@@ -44,11 +55,29 @@ +@@ -45,11 +56,29 @@ } public void fallOn(World world, BlockPosition blockposition, Entity entity, float f) { @@ -48,11 +48,11 @@ + return; + } + // CraftBukkit end - this.b(world, blockposition); + b(world, blockposition); } - super.fallOn(world, blockposition, entity, f); + // super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved up } - private void b(World world, BlockPosition blockposition) { + protected static void b(World world, BlockPosition blockposition) { diff --git a/nms-patches/Container.patch b/nms-patches/Container.patch index 0a505a2c93..26daef6366 100644 --- a/nms-patches/Container.patch +++ b/nms-patches/Container.patch @@ -17,7 +17,7 @@ + public abstract class Container { - public NonNullList b = NonNullList.a(); + public NonNullList items = NonNullList.a(); @@ -18,6 +29,18 @@ protected List listeners = Lists.newArrayList(); private final Set i = Sets.newHashSet(); diff --git a/nms-patches/ContainerAnvil.patch b/nms-patches/ContainerAnvil.patch index 904745b30c..e32f857e29 100644 --- a/nms-patches/ContainerAnvil.patch +++ b/nms-patches/ContainerAnvil.patch @@ -74,7 +74,7 @@ @@ -301,6 +311,7 @@ } - public boolean a(EntityHuman entityhuman) { + public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return this.i.getType(this.j).getBlock() != Blocks.ANVIL ? false : entityhuman.d((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D; } diff --git a/nms-patches/ContainerBeacon.patch b/nms-patches/ContainerBeacon.patch index 13196bb70c..bd8adc0223 100644 --- a/nms-patches/ContainerBeacon.patch +++ b/nms-patches/ContainerBeacon.patch @@ -22,7 +22,7 @@ @@ -48,6 +55,7 @@ } - public boolean a(EntityHuman entityhuman) { + public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return this.beacon.a(entityhuman); } diff --git a/nms-patches/ContainerBrewingStand.patch b/nms-patches/ContainerBrewingStand.patch index 6bacb345ef..aa2b973733 100644 --- a/nms-patches/ContainerBrewingStand.patch +++ b/nms-patches/ContainerBrewingStand.patch @@ -28,7 +28,7 @@ @@ -54,6 +65,7 @@ } - public boolean a(EntityHuman entityhuman) { + public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return this.brewingStand.a(entityhuman); } diff --git a/nms-patches/ContainerChest.patch b/nms-patches/ContainerChest.patch index 9535a08097..43f85e757b 100644 --- a/nms-patches/ContainerChest.patch +++ b/nms-patches/ContainerChest.patch @@ -53,7 +53,7 @@ @@ -33,6 +66,7 @@ } - public boolean a(EntityHuman entityhuman) { + public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return this.container.a(entityhuman); } diff --git a/nms-patches/ContainerDispenser.patch b/nms-patches/ContainerDispenser.patch index 9b8b1ad258..fb1f4f1a81 100644 --- a/nms-patches/ContainerDispenser.patch +++ b/nms-patches/ContainerDispenser.patch @@ -28,7 +28,7 @@ @@ -29,6 +42,7 @@ } - public boolean a(EntityHuman entityhuman) { + public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return this.items.a(entityhuman); } diff --git a/nms-patches/ContainerEnchantTable.patch b/nms-patches/ContainerEnchantTable.patch index 4fd8a19a27..6b4c4a70f6 100644 --- a/nms-patches/ContainerEnchantTable.patch +++ b/nms-patches/ContainerEnchantTable.patch @@ -181,7 +181,7 @@ } } - public boolean a(EntityHuman entityhuman) { + public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return this.world.getType(this.position).getBlock() != Blocks.ENCHANTING_TABLE ? false : entityhuman.d((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D; } diff --git a/nms-patches/ContainerFurnace.patch b/nms-patches/ContainerFurnace.patch index e64b781864..51ddf578ee 100644 --- a/nms-patches/ContainerFurnace.patch +++ b/nms-patches/ContainerFurnace.patch @@ -43,7 +43,7 @@ @@ -63,6 +85,7 @@ } - public boolean a(EntityHuman entityhuman) { + public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return this.furnace.a(entityhuman); } diff --git a/nms-patches/ContainerHopper.patch b/nms-patches/ContainerHopper.patch index 54117f6294..3475a2c6d4 100644 --- a/nms-patches/ContainerHopper.patch +++ b/nms-patches/ContainerHopper.patch @@ -37,7 +37,7 @@ @@ -28,6 +50,7 @@ } - public boolean a(EntityHuman entityhuman) { + public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return this.hopper.a(entityhuman); } diff --git a/nms-patches/ContainerWorkbench.patch b/nms-patches/ContainerWorkbench.patch index 6b1c4cb0bd..153d2c6473 100644 --- a/nms-patches/ContainerWorkbench.patch +++ b/nms-patches/ContainerWorkbench.patch @@ -35,7 +35,7 @@ @@ -47,6 +62,7 @@ } - public boolean a(EntityHuman entityhuman) { + public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return this.g.getType(this.h).getBlock() != Blocks.CRAFTING_TABLE ? false : entityhuman.d((double) this.h.getX() + 0.5D, (double) this.h.getY() + 0.5D, (double) this.h.getZ() + 0.5D) <= 64.0D; } diff --git a/nms-patches/DedicatedServer.patch b/nms-patches/DedicatedServer.patch index 86e8cad2f3..9cd3444c51 100644 --- a/nms-patches/DedicatedServer.patch +++ b/nms-patches/DedicatedServer.patch @@ -98,7 +98,7 @@ + thread.setDaemon(true); thread.start(); - DedicatedServer.LOGGER.info("Starting minecraft server version 1.12.1"); + DedicatedServer.LOGGER.info("Starting minecraft server version 1.12.2"); @@ -79,7 +126,7 @@ } diff --git a/nms-patches/EntityEnderPearl.patch b/nms-patches/EntityEnderPearl.patch index e209aab0a4..d61d7c6729 100644 --- a/nms-patches/EntityEnderPearl.patch +++ b/nms-patches/EntityEnderPearl.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/server/EntityEnderPearl.java +++ b/net/minecraft/server/EntityEnderPearl.java -@@ -1,5 +1,12 @@ +@@ -1,6 +1,12 @@ package net.minecraft.server; + import javax.annotation.Nullable; +// CraftBukkit start +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.event.CraftEventFactory; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +// CraftBukkit end -+ + public class EntityEnderPearl extends EntityProjectile { - private EntityLiving d; -@@ -59,21 +66,35 @@ +@@ -61,21 +67,35 @@ EntityPlayer entityplayer = (EntityPlayer) entityliving; if (entityplayer.playerConnection.a().isConnected() && entityplayer.world == this.world && !entityplayer.isSleeping()) { @@ -23,6 +23,10 @@ - entityendermite.a(true); - entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); - this.world.addEntity(entityendermite); +- } +- +- if (entityliving.isPassenger()) { +- entityliving.stopRiding(); + // CraftBukkit start - Fire PlayerTeleportEvent + org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity(); + org.bukkit.Location location = getBukkitEntity().getLocation(); @@ -52,10 +56,6 @@ + CraftEventFactory.entityDamage = null; } - -- if (entityliving.isPassenger()) { -- entityliving.stopRiding(); -- } -- - entityliving.enderTeleportTo(this.locX, this.locY, this.locZ); - entityliving.fallDistance = 0.0F; - entityliving.damageEntity(DamageSource.FALL, 5.0F); diff --git a/nms-patches/EntityProjectile.patch b/nms-patches/EntityProjectile.patch index f2c9c7f370..af70eb1b00 100644 --- a/nms-patches/EntityProjectile.patch +++ b/nms-patches/EntityProjectile.patch @@ -10,11 +10,11 @@ protected void i() {} @@ -127,7 +128,7 @@ if (entity1.isInteractable()) { - if (entity1 == this.c) { + if (entity1 == this.d) { flag = true; -- } else if (this.shooter != null && this.ticksLived < 2 && this.c == null) { -+ } else if (this.shooter != null && this.ticksLived < 2 && this.c == null && this.shooter == entity1) { // CraftBukkit - MC-88491 - this.c = entity1; +- } else if (this.shooter != null && this.ticksLived < 2 && this.d == null) { ++ } else if (this.shooter != null && this.ticksLived < 2 && this.d == null && this.shooter == entity1) { // CraftBukkit - MC-88491 + this.d = entity1; flag = true; } else { @@ -164,6 +165,11 @@ diff --git a/nms-patches/EntitySheep.patch b/nms-patches/EntitySheep.patch index a9b69caf7f..2f4845dba4 100644 --- a/nms-patches/EntitySheep.patch +++ b/nms-patches/EntitySheep.patch @@ -14,7 +14,7 @@ private static final DataWatcherObject bx = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.a); @@ -12,6 +18,13 @@ - public boolean a(EntityHuman entityhuman) { + public boolean canUse(EntityHuman entityhuman) { return false; } + diff --git a/nms-patches/HandshakeListener.patch b/nms-patches/HandshakeListener.patch index dc8c023f74..8799f9f098 100644 --- a/nms-patches/HandshakeListener.patch +++ b/nms-patches/HandshakeListener.patch @@ -57,8 +57,8 @@ + } + // CraftBukkit end + - if (packethandshakinginsetprotocol.b() > 338) { - chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[] { "1.12.1"}); + if (packethandshakinginsetprotocol.b() > 340) { + chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[] { "1.12.2"}); this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage)); @@ -26,6 +71,7 @@ this.b.close(chatmessage); diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index fa397aaef5..3ce25e5903 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -51,8 +51,8 @@ private static final Logger LOGGER = LogManager.getLogger(); @@ -25,7 +68,10 @@ - private int f; - private long g; + private long f; + private boolean g; private long h; - private int chatThrottle; + // CraftBukkit start - multithreaded fields @@ -97,7 +97,7 @@ public void e() { this.syncPosition(); -@@ -110,15 +183,21 @@ +@@ -116,15 +189,21 @@ } this.minecraftServer.methodProfiler.b(); @@ -119,7 +119,7 @@ this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0])); } -@@ -137,18 +216,48 @@ +@@ -143,18 +222,48 @@ return this.networkManager; } @@ -174,7 +174,7 @@ } public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) { -@@ -187,7 +296,34 @@ +@@ -193,7 +302,34 @@ double d9 = entity.motX * entity.motX + entity.motY * entity.motY + entity.motZ * entity.motZ; double d10 = d6 * d6 + d7 * d7 + d8 * d8; @@ -210,7 +210,7 @@ PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName(), this.player.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8)); this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); return; -@@ -225,6 +361,62 @@ +@@ -231,6 +367,62 @@ return; } @@ -273,7 +273,7 @@ this.minecraftServer.getPlayerList().d(this.player); this.player.checkMovement(this.player.locX - d0, this.player.locY - d1, this.player.locZ - d2); this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && !worldserver.c(entity.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -283,7 +475,7 @@ +@@ -289,7 +481,7 @@ } else { WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); @@ -282,7 +282,7 @@ if (this.e == 0) { this.syncPosition(); } -@@ -293,13 +485,21 @@ +@@ -299,13 +491,21 @@ this.A = this.e; this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); } @@ -305,7 +305,7 @@ double d0 = this.player.locX; double d1 = this.player.locY; double d2 = this.player.locZ; -@@ -324,15 +524,33 @@ +@@ -330,15 +530,33 @@ ++this.receivedMovePackets; int i = this.receivedMovePackets - this.processedMovePackets; @@ -341,7 +341,7 @@ PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9)); this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch); return; -@@ -378,6 +596,69 @@ +@@ -384,6 +602,69 @@ } } @@ -411,7 +411,7 @@ this.B = d12 >= -0.03125D; this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly; this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.cP() && !worldserver.c(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -395,10 +676,76 @@ +@@ -401,10 +682,76 @@ } public void a(double d0, double d1, double d2, float f, float f1) { @@ -489,7 +489,7 @@ double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX : 0.0D; double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY : 0.0D; double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ : 0.0D; -@@ -415,6 +762,14 @@ +@@ -421,6 +768,14 @@ f3 = f1 + this.player.pitch; } @@ -504,7 +504,7 @@ if (++this.teleportAwait == Integer.MAX_VALUE) { this.teleportAwait = 0; } -@@ -426,6 +781,7 @@ +@@ -432,6 +787,7 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.x()); @@ -512,7 +512,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinblockdig.a(); -@@ -435,7 +791,15 @@ +@@ -441,7 +797,15 @@ if (!this.player.isSpectator()) { ItemStack itemstack = this.player.b(EnumHand.OFF_HAND); @@ -529,7 +529,7 @@ this.player.a(EnumHand.MAIN_HAND, itemstack); } -@@ -443,6 +807,21 @@ +@@ -449,6 +813,21 @@ case DROP_ITEM: if (!this.player.isSpectator()) { @@ -551,7 +551,7 @@ this.player.a(false); } -@@ -476,7 +855,15 @@ +@@ -482,7 +861,15 @@ if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b()); } else { @@ -567,7 +567,7 @@ } } else { if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -496,10 +883,12 @@ +@@ -502,10 +889,12 @@ default: throw new IllegalArgumentException("Invalid player action"); } @@ -580,7 +580,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); EnumHand enumhand = packetplayinuseitem.c(); ItemStack itemstack = this.player.b(enumhand); -@@ -513,6 +902,13 @@ +@@ -519,6 +908,13 @@ chatmessage.getChatModifier().setColor(EnumChatFormat.RED); this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage, ChatMessageType.GAME_INFO)); } else if (this.teleportPos == null && this.player.d((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { @@ -594,7 +594,7 @@ this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.d(), packetplayinuseitem.e(), packetplayinuseitem.f()); } -@@ -522,13 +918,52 @@ +@@ -528,13 +924,52 @@ public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x()); @@ -648,7 +648,7 @@ } } -@@ -539,8 +974,8 @@ +@@ -545,8 +980,8 @@ WorldServer[] aworldserver = this.minecraftServer.worldServer; int i = aworldserver.length; @@ -659,7 +659,7 @@ if (worldserver != null) { entity = packetplayinspectate.a(worldserver); -@@ -553,6 +988,8 @@ +@@ -559,6 +994,8 @@ if (entity != null) { this.player.setSpectatorTarget(this.player); this.player.stopRiding(); @@ -668,7 +668,7 @@ if (entity.world == this.player.world) { this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ); } else { -@@ -578,12 +1015,20 @@ +@@ -584,12 +1021,20 @@ this.minecraftServer.getPlayerList().b(this.player, worldserver2); this.minecraftServer.getPlayerList().updateClient(this.player); } @@ -690,7 +690,7 @@ public void a(PacketPlayInBoatMove packetplayinboatmove) { PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.x()); -@@ -596,14 +1041,29 @@ +@@ -602,14 +1047,29 @@ } public void a(IChatBaseComponent ichatbasecomponent) { @@ -721,7 +721,7 @@ if (this.minecraftServer.R() && this.player.getName().equals(this.minecraftServer.Q())) { PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out"); this.minecraftServer.safeShutdown(); -@@ -625,6 +1085,15 @@ +@@ -631,6 +1091,15 @@ } } @@ -737,7 +737,7 @@ try { this.networkManager.sendPacket(packet); } catch (Throwable throwable) { -@@ -646,17 +1115,32 @@ +@@ -652,17 +1121,32 @@ public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x()); @@ -772,7 +772,7 @@ ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); chatmessage.getChatModifier().setColor(EnumChatFormat.RED); -@@ -669,39 +1153,249 @@ +@@ -675,39 +1159,249 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -1029,7 +1029,7 @@ this.player.resetIdleTimer(); IJumpable ijumpable; -@@ -773,6 +1467,7 @@ +@@ -779,6 +1473,7 @@ public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.x()); @@ -1037,7 +1037,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -788,20 +1483,68 @@ +@@ -794,20 +1489,68 @@ if (this.player.h(entity) < d0) { EnumHand enumhand; @@ -1107,7 +1107,7 @@ } } } -@@ -817,7 +1560,8 @@ +@@ -823,7 +1566,8 @@ case PERFORM_RESPAWN: if (this.player.viewingCredits) { this.player.viewingCredits = false; @@ -1117,7 +1117,7 @@ CriterionTriggers.u.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD); } else { if (this.player.getHealth() > 0.0F) { -@@ -840,14 +1584,20 @@ +@@ -846,14 +1590,20 @@ public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x()); @@ -1134,13 +1134,13 @@ this.player.resetIdleTimer(); - if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player)) { - if (this.player.isSpectator()) { -+ if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player) && this.player.activeContainer.a(this.player)) { // CraftBukkit ++ if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player) && this.player.activeContainer.canUse(this.player)) { // CraftBukkit + boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if + if (false/*this.player.isSpectator()*/) { // CraftBukkit NonNullList nonnulllist = NonNullList.a(); - for (int i = 0; i < this.player.activeContainer.c.size(); ++i) { -@@ -856,8 +1606,274 @@ + for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) { +@@ -862,8 +1612,274 @@ this.player.a(this.player.activeContainer, nonnulllist); } else { @@ -1416,7 +1416,7 @@ if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); this.player.f = true; -@@ -894,6 +1910,7 @@ +@@ -900,6 +1916,7 @@ public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.x()); @@ -1424,7 +1424,7 @@ this.player.resetIdleTimer(); if (this.player.activeContainer.windowId == packetplayinenchantitem.a() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { this.player.activeContainer.a(this.player, packetplayinenchantitem.b()); -@@ -927,7 +1944,45 @@ +@@ -933,7 +1950,45 @@ } boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45; @@ -1471,7 +1471,7 @@ if (flag1 && flag2) { if (itemstack.isEmpty()) { -@@ -951,6 +2006,7 @@ +@@ -957,6 +2012,7 @@ public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x()); @@ -1479,7 +1479,7 @@ Short oshort = (Short) this.k.get(this.player.activeContainer.windowId); if (oshort != null && packetplayintransaction.b() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.a() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { -@@ -961,6 +2017,7 @@ +@@ -967,6 +2023,7 @@ public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x()); @@ -1487,7 +1487,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.a(); -@@ -977,14 +2034,30 @@ +@@ -983,14 +2040,30 @@ if (!tileentitysign.a() || tileentitysign.e() != this.player) { this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); @@ -1519,7 +1519,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -1007,11 +2080,27 @@ +@@ -1016,11 +2089,27 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x()); @@ -1548,7 +1548,7 @@ ArrayList arraylist = Lists.newArrayList(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator(); -@@ -1037,6 +2126,13 @@ +@@ -1046,6 +2135,13 @@ ItemStack itemstack1; if ("MC|BEdit".equals(s)) { @@ -1562,7 +1562,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1055,15 +2151,25 @@ +@@ -1064,15 +2160,25 @@ } if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { @@ -1588,7 +1588,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1097,10 +2203,11 @@ +@@ -1106,10 +2212,11 @@ } itemstack2.a("pages", (NBTBase) nbttaglist); @@ -1601,7 +1601,7 @@ } } else if ("MC|TrSel".equals(s)) { try { -@@ -1112,6 +2219,7 @@ +@@ -1121,6 +2228,7 @@ } } catch (Exception exception2) { PlayerConnection.LOGGER.error("Couldn\'t select trade", exception2); @@ -1609,7 +1609,7 @@ } } else { TileEntity tileentity; -@@ -1161,6 +2269,7 @@ +@@ -1170,6 +2278,7 @@ } } catch (Exception exception3) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception3); @@ -1617,7 +1617,7 @@ } } else if ("MC|AutoCmd".equals(s)) { if (!this.minecraftServer.getEnableCommandBlock()) { -@@ -1228,6 +2337,7 @@ +@@ -1237,6 +2346,7 @@ } } catch (Exception exception4) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception4); @@ -1625,7 +1625,7 @@ } } else { int k; -@@ -1251,6 +2361,7 @@ +@@ -1260,6 +2370,7 @@ } } catch (Exception exception5) { PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5); @@ -1633,7 +1633,7 @@ } } } else if ("MC|ItemName".equals(s)) { -@@ -1337,6 +2448,7 @@ +@@ -1346,6 +2457,7 @@ } } catch (Exception exception6) { PlayerConnection.LOGGER.error("Couldn\'t set structure block", exception6); @@ -1641,7 +1641,7 @@ } } else if ("MC|PickItem".equals(s)) { packetdataserializer = packetplayincustompayload.b(); -@@ -1349,11 +2461,49 @@ +@@ -1358,11 +2470,49 @@ this.player.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex)); } catch (Exception exception7) { PlayerConnection.LOGGER.error("Couldn\'t pick item", exception7); diff --git a/nms-patches/World.patch b/nms-patches/World.patch index ddda6510f7..1c43e8666c 100644 --- a/nms-patches/World.patch +++ b/nms-patches/World.patch @@ -387,35 +387,7 @@ this.c(entity); } -@@ -1138,6 +1371,13 @@ - - this.methodProfiler.c("blockEntities"); - this.O = true; -+ // CraftBukkit start - From below, clean up tile entities before ticking them -+ if (!this.tileEntityListUnload.isEmpty()) { -+ this.tileEntityListTick.removeAll(this.tileEntityListUnload); -+ this.tileEntityList.removeAll(this.tileEntityListUnload); -+ this.tileEntityListUnload.clear(); -+ } -+ // CraftBukkit end - Iterator iterator = this.tileEntityListTick.iterator(); - - while (iterator.hasNext()) { -@@ -1172,11 +1412,13 @@ - } - - this.O = false; -+ /* CraftBukkit start - Moved up - if (!this.tileEntityListUnload.isEmpty()) { - this.tileEntityListTick.removeAll(this.tileEntityListUnload); - this.tileEntityList.removeAll(this.tileEntityListUnload); - this.tileEntityListUnload.clear(); - } -+ // CraftBukkit end */ - - this.methodProfiler.c("pendingBlockEntities"); - if (!this.b.isEmpty()) { -@@ -1184,9 +1426,11 @@ +@@ -1184,9 +1417,11 @@ TileEntity tileentity1 = (TileEntity) this.b.get(i1); if (!tileentity1.y()) { @@ -427,7 +399,7 @@ if (this.isLoaded(tileentity1.getPosition())) { Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition()); -@@ -1194,6 +1438,12 @@ +@@ -1194,6 +1429,12 @@ chunk.a(tileentity1.getPosition(), tileentity1); this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3); @@ -440,7 +412,7 @@ } } } -@@ -1247,15 +1497,13 @@ +@@ -1247,15 +1488,13 @@ int i; int j; @@ -462,7 +434,7 @@ entity.M = entity.locX; entity.N = entity.locY; -@@ -1268,6 +1516,7 @@ +@@ -1268,6 +1507,7 @@ entity.aE(); } else { entity.B_(); @@ -470,7 +442,7 @@ } } -@@ -1559,11 +1808,18 @@ +@@ -1559,11 +1799,18 @@ } } @@ -489,7 +461,7 @@ TileEntity tileentity = null; if (this.O) { -@@ -1598,6 +1854,14 @@ +@@ -1598,6 +1845,14 @@ public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) { if (!this.E(blockposition)) { if (tileentity != null && !tileentity.y()) { @@ -504,7 +476,7 @@ if (this.O) { tileentity.setPosition(blockposition); Iterator iterator = this.b.iterator(); -@@ -1757,6 +2021,14 @@ +@@ -1757,6 +2012,14 @@ } this.o = MathHelper.a(this.o, 0.0F, 1.0F); @@ -519,7 +491,7 @@ } } } -@@ -1894,7 +2166,10 @@ +@@ -1894,7 +2157,10 @@ } public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { @@ -531,7 +503,7 @@ return false; } else { int i = 0; -@@ -2061,7 +2336,7 @@ +@@ -2061,7 +2327,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -540,7 +512,7 @@ arraylist.add(entity); } } -@@ -2076,7 +2351,7 @@ +@@ -2076,7 +2342,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -549,7 +521,7 @@ arraylist.add(entity); } } -@@ -2125,7 +2400,7 @@ +@@ -2125,7 +2391,7 @@ } } @@ -558,7 +530,7 @@ } @Nullable -@@ -2146,8 +2421,17 @@ +@@ -2146,8 +2412,17 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -577,7 +549,7 @@ ++i; } } -@@ -2156,12 +2440,18 @@ +@@ -2156,12 +2431,18 @@ } public void a(Collection collection) { @@ -597,7 +569,7 @@ this.b(entity); } -@@ -2175,7 +2465,13 @@ +@@ -2175,7 +2456,13 @@ IBlockData iblockdata = this.getType(blockposition); AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().d(this, blockposition); @@ -612,7 +584,7 @@ } public int getSeaLevel() { -@@ -2285,6 +2581,11 @@ +@@ -2285,6 +2572,11 @@ for (int i = 0; i < this.players.size(); ++i) { EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); @@ -624,7 +596,7 @@ if (predicate.apply(entityhuman1)) { double d5 = entityhuman1.d(d0, d1, d2); -@@ -2453,6 +2754,16 @@ +@@ -2453,6 +2745,16 @@ public void everyoneSleeping() {} @@ -641,7 +613,7 @@ public float h(float f) { return (this.p + (this.q - this.p) * f) * this.j(f); } -@@ -2670,7 +2981,7 @@ +@@ -2670,7 +2972,7 @@ int l = j * 16 + 8 - blockposition.getZ(); boolean flag = true; diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch index 57a5ae8568..b5178ece23 100644 --- a/nms-patches/WorldServer.patch +++ b/nms-patches/WorldServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/WorldServer.java +++ b/net/minecraft/server/WorldServer.java -@@ -19,14 +19,26 @@ +@@ -20,14 +20,26 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -29,7 +29,7 @@ private final Map entitiesByUUID = Maps.newHashMap(); public boolean savingDisabled; private boolean Q; -@@ -38,14 +50,22 @@ +@@ -39,14 +51,22 @@ private int V; private final List W = Lists.newArrayList(); @@ -55,7 +55,7 @@ this.J(); this.K(); this.getWorldBorder().a(minecraftserver.aE()); -@@ -64,6 +84,7 @@ +@@ -65,6 +85,7 @@ this.villages.a((World) this); } @@ -63,7 +63,7 @@ this.scoreboard = new ScoreboardServer(this.server); PersistentScoreboard persistentscoreboard = (PersistentScoreboard) this.worldMaps.get(PersistentScoreboard.class, "scoreboard"); -@@ -74,9 +95,21 @@ +@@ -75,9 +96,21 @@ persistentscoreboard.a(this.scoreboard); ((ScoreboardServer) this.scoreboard).a((Runnable) (new RunnableSaveScoreboard(persistentscoreboard))); @@ -87,7 +87,7 @@ this.getWorldBorder().setCenter(this.worldData.B(), this.worldData.C()); this.getWorldBorder().setDamageAmount(this.worldData.H()); this.getWorldBorder().setDamageBuffer(this.worldData.G()); -@@ -88,9 +121,146 @@ +@@ -89,9 +122,146 @@ this.getWorldBorder().setSize(this.worldData.D()); } @@ -234,7 +234,7 @@ public void doTick() { super.doTick(); if (this.getWorldData().isHardcore() && this.getDifficulty() != EnumDifficulty.HARD) { -@@ -109,8 +279,11 @@ +@@ -110,8 +280,11 @@ } this.methodProfiler.a("mobSpawner"); @@ -248,7 +248,7 @@ } this.methodProfiler.c("chunkSource"); -@@ -139,6 +312,8 @@ +@@ -140,6 +313,8 @@ this.portalTravelAgent.a(this.getTime()); this.methodProfiler.b(); this.aq(); @@ -257,7 +257,7 @@ } @Nullable -@@ -166,7 +341,7 @@ +@@ -167,7 +342,7 @@ if (entityhuman.isSpectator()) { ++i; diff --git a/pom.xml b/pom.xml index d2e840098d..e7311e2563 100644 --- a/pom.xml +++ b/pom.xml @@ -4,14 +4,14 @@ org.bukkit craftbukkit jar - 1.12.1-R0.1-SNAPSHOT + 1.12.2-R0.1-SNAPSHOT CraftBukkit http://www.bukkit.org UTF-8 unknown - 1.12.1 + 1.12.2 1_12_R1 git-Bukkit- @@ -55,13 +55,13 @@ org.xerial sqlite-jdbc - 3.19.3 + 3.20.0 compile mysql mysql-connector-java - 5.1.43 + 5.1.44 compile @@ -153,7 +153,7 @@ org.codehaus.mojo animal-sniffer-maven-plugin - 1.15 + 1.16 process-classes @@ -173,7 +173,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.0.0 + 3.1.0 package @@ -218,7 +218,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.6.2 + 3.7.0 eclipse diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java index f4e1ca79ee..4467eee91d 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -169,7 +169,7 @@ public class Main { useConsole = false; } - if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { + if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { Date buildDate = new SimpleDateFormat("yyyyMMdd-HHmm").parse(Main.class.getPackage().getImplementationVendor()); Calendar deadline = Calendar.getInstance(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java index 7ce7d60063..97a5143fd8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java @@ -93,8 +93,8 @@ public class CraftContainer extends Container { String type = getNotchInventoryType(cachedType); IInventory top = ((CraftInventory) view.getTopInventory()).getInventory(); PlayerInventory bottom = (PlayerInventory) ((CraftInventory) view.getBottomInventory()).getInventory(); - this.b.clear(); - this.c.clear(); + this.items.clear(); + this.slots.clear(); if (typeChanged) { setupSlots(top, bottom, player.getHandle()); } @@ -172,18 +172,18 @@ public class CraftContainer extends Container { } if (delegate != null) { - this.b = delegate.b; // PAIL: items - this.c = delegate.c; // PAIL: slots + this.items = delegate.items; + this.slots = delegate.slots; } } @Override - public ItemStack b(EntityHuman entityhuman, int i) { // PAIL: shiftClick - return (delegate != null) ? delegate.b(entityhuman, i) : super.b(entityhuman, i); + public ItemStack shiftClick(EntityHuman entityhuman, int i) { + return (delegate != null) ? delegate.shiftClick(entityhuman, i) : super.shiftClick(entityhuman, i); } @Override - public boolean a(EntityHuman entity) { // PAIL: canUse + public boolean canUse(EntityHuman entity) { return true; } }