diff --git a/nms-patches/BlockSapling.patch b/nms-patches/BlockSapling.patch index e1a4e53867..c5f6c374a8 100644 --- a/nms-patches/BlockSapling.patch +++ b/nms-patches/BlockSapling.patch @@ -21,7 +21,7 @@ + public static TreeType treeType; // CraftBukkit protected BlockSapling() { - this.x(this.blockStateList.getBlockData().set(BlockSapling.TYPE, BlockWood.EnumLogVariant.OAK).set(BlockSapling.STAGE, Integer.valueOf(0))); + this.w(this.blockStateList.getBlockData().set(BlockSapling.TYPE, BlockWood.EnumLogVariant.OAK).set(BlockSapling.STAGE, Integer.valueOf(0))); @@ -25,7 +35,30 @@ if (!world.isClientSide) { super.b(world, blockposition, iblockdata, random); diff --git a/nms-patches/BlockVine.patch b/nms-patches/BlockVine.patch index 949f8e9355..aa2e152b62 100644 --- a/nms-patches/BlockVine.patch +++ b/nms-patches/BlockVine.patch @@ -9,22 +9,22 @@ public class BlockVine extends Block { public static final BlockStateBoolean UP = BlockStateBoolean.of("up"); -@@ -176,7 +178,13 @@ - } - - if (((Boolean) iblockdata1.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.WEST)).booleanValue()) { -- world.setTypeAndData(blockposition1, iblockdata1, 2); -+ // CraftBukkit start - Call BlockSpreadEvent -+ // world.setTypeAndData(blockposition1, iblockdata1, 2); -+ BlockPosition target = blockposition1; -+ org.bukkit.block.Block source = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(target.getX(), target.getY(), target.getZ()); -+ CraftEventFactory.handleBlockSpreadEvent(block, source, this, toLegacyData(iblockdata1)); -+ // CraftBukkit end - } - +@@ -177,7 +179,13 @@ } -@@ -198,17 +206,29 @@ + + if (((Boolean) iblockdata1.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.WEST)).booleanValue()) { +- world.setTypeAndData(blockposition1, iblockdata1, 2); ++ // CraftBukkit start - Call BlockSpreadEvent ++ // world.setTypeAndData(blockposition1, iblockdata1, 2); ++ BlockPosition target = blockposition1; ++ org.bukkit.block.Block source = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(target.getX(), target.getY(), target.getZ()); ++ CraftEventFactory.handleBlockSpreadEvent(block, source, this, toLegacyData(iblockdata1)); ++ // CraftBukkit end + } + + } else { +@@ -198,15 +206,26 @@ BlockPosition blockposition3 = blockposition2.shift(enumdirection2); BlockPosition blockposition4 = blockposition2.shift(enumdirection3); @@ -50,16 +50,12 @@ + // world.setTypeAndData(blockposition4, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2); + bukkitBlock = world.getWorld().getBlockAt(blockposition4.getX(), blockposition4.getY(), blockposition4.getZ()); + CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)))); - } else if (this.a(world, blockposition2.up(), EnumDirection.DOWN)) { -- world.setTypeAndData(blockposition2, this.getBlockData(), 2); -+ // world.setTypeAndData(blockposition2, this.getBlockData(), 2); -+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData())); } + // CraftBukkit end } else if (iblockdata2.d(world, blockposition2, enumdirection) == EnumBlockFaceShape.SOLID) { world.setTypeAndData(blockposition, iblockdata.set(getDirection(enumdirection), Boolean.valueOf(true)), 2); } -@@ -235,7 +255,12 @@ +@@ -233,7 +252,12 @@ } if (((Boolean) iblockdata3.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.WEST)).booleanValue()) { diff --git a/nms-patches/CommandGamerule.patch b/nms-patches/CommandGamerule.patch index 9dceb5c901..6de418190f 100644 --- a/nms-patches/CommandGamerule.patch +++ b/nms-patches/CommandGamerule.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CommandGamerule.java +++ b/net/minecraft/server/CommandGamerule.java -@@ -22,7 +22,7 @@ +@@ -23,7 +23,7 @@ } public void execute(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring) throws CommandException { @@ -9,7 +9,7 @@ String s = astring.length > 0 ? astring[0] : ""; String s1 = astring.length > 1 ? a(astring, 1) : ""; -@@ -87,4 +87,11 @@ +@@ -92,4 +92,11 @@ private GameRules a(MinecraftServer minecraftserver) { return minecraftserver.getWorldServer(0).getGameRules(); } diff --git a/nms-patches/CraftingManager.patch b/nms-patches/CraftingManager.patch index dff26072fc..a619d68fd5 100644 --- a/nms-patches/CraftingManager.patch +++ b/nms-patches/CraftingManager.patch @@ -12,7 +12,7 @@ if (CraftingManager.recipes.d(minecraftkey)) { throw new IllegalStateException("Duplicate recipe ignored with ID " + minecraftkey); } else { -+ irecipe.key = minecraftkey; // CraftBukkit ++ irecipe.setKey(minecraftkey); // CraftBukkit CraftingManager.recipes.a(CraftingManager.c++, minecraftkey, irecipe); } } diff --git a/nms-patches/CustomFunction.patch b/nms-patches/CustomFunction.patch index b0429ae11e..28838ae834 100644 --- a/nms-patches/CustomFunction.patch +++ b/nms-patches/CustomFunction.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CustomFunction.java +++ b/net/minecraft/server/CustomFunction.java -@@ -130,7 +130,7 @@ +@@ -122,7 +122,7 @@ } public void a(CustomFunctionData customfunctiondata, ICommandListener icommandlistener, ArrayDeque arraydeque, int i) { diff --git a/nms-patches/DedicatedServer.patch b/nms-patches/DedicatedServer.patch index 04036d244b..46a58b81ba 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-pre5"); + DedicatedServer.LOGGER.info("Starting minecraft server version 1.12-pre6"); @@ -79,7 +126,7 @@ } diff --git a/nms-patches/EntityEnderCrystal.patch b/nms-patches/EntityEnderCrystal.patch index df8d9a5f64..e8fe828c4a 100644 --- a/nms-patches/EntityEnderCrystal.patch +++ b/nms-patches/EntityEnderCrystal.patch @@ -25,7 +25,7 @@ } } -@@ -75,9 +84,22 @@ +@@ -75,10 +84,23 @@ return false; } else { if (!this.dead && !this.world.isClientSide) { @@ -36,16 +36,17 @@ + // CraftBukkit end this.die(); if (!this.world.isClientSide) { -- this.world.explode((Entity) null, this.locX, this.locY, this.locZ, 6.0F, true); -+ // CraftBukkit start -+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, true); -+ this.world.getServer().getPluginManager().callEvent(event); -+ if (event.isCancelled()) { -+ this.dead = false; -+ return false; -+ } -+ this.world.explode(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire()); -+ // CraftBukkit end + if (!damagesource.isExplosion()) { +- this.world.explode((Entity) null, this.locX, this.locY, this.locZ, 6.0F, true); ++ // CraftBukkit start ++ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, true); ++ this.world.getServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ this.dead = false; ++ return false; ++ } ++ this.world.explode(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire()); ++ // CraftBukkit end + } + this.a(damagesource); - } - } diff --git a/nms-patches/EntityFallingBlock.patch b/nms-patches/EntityFallingBlock.patch index 9780f6c075..afdb8dbb07 100644 --- a/nms-patches/EntityFallingBlock.patch +++ b/nms-patches/EntityFallingBlock.patch @@ -20,7 +20,7 @@ this.die(); @@ -110,7 +112,7 @@ - if (!flag1 && BlockFalling.i(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) { + if (!flag1 && BlockFalling.x(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) { this.onGround = false; - return; + // return; // CraftBukkit @@ -31,9 +31,9 @@ if (iblockdata.getBlock() != Blocks.PISTON_EXTENSION) { this.die(); if (!this.f) { -- if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null) && (flag1 || !BlockFalling.i(this.world.getType(blockposition.down()))) && this.world.setTypeAndData(blockposition, this.block, 3)) { +- if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null) && (flag1 || !BlockFalling.x(this.world.getType(blockposition.down()))) && this.world.setTypeAndData(blockposition, this.block, 3)) { + // CraftBukkit start -+ if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null) && (flag1 || !BlockFalling.i(this.world.getType(blockposition.down())))) { ++ if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null) && (flag1 || !BlockFalling.x(this.world.getType(blockposition.down())))) { + if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.block.getBlock(), this.block.getBlock().toLegacyData(this.block)).isCancelled()) { + return; + } diff --git a/nms-patches/EntityMinecartAbstract.patch b/nms-patches/EntityMinecartAbstract.patch index 3a3251708e..9c55d1e851 100644 --- a/nms-patches/EntityMinecartAbstract.patch +++ b/nms-patches/EntityMinecartAbstract.patch @@ -67,7 +67,7 @@ + return true; + } + // CraftBukkit end - this.aF(); + this.ejectPassengers(); if (flag && !this.hasCustomName()) { this.die(); @@ -146,6 +188,14 @@ diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch index 59802e2b68..32668f0a0c 100644 --- a/nms-patches/EntityPlayer.patch +++ b/nms-patches/EntityPlayer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityPlayer.java +++ b/net/minecraft/server/EntityPlayer.java -@@ -12,10 +12,27 @@ +@@ -11,10 +11,27 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -24,12 +24,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { private static final Logger bV = LogManager.getLogger(); -- private String locale = "en_US"; -+ public String locale = "en_us"; // PAIL: private -> public +- public String locale = "en_US"; ++ public String locale = "en_us"; // CraftBukkit - lowercase public PlayerConnection playerConnection; public final MinecraftServer server; public final PlayerInteractManager playerInteractManager; -@@ -51,6 +68,19 @@ +@@ -50,6 +67,19 @@ public int ping; public boolean viewingCredits; @@ -49,7 +49,7 @@ public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { super(worldserver, gameprofile); playerinteractmanager.player = this; -@@ -82,6 +112,11 @@ +@@ -81,6 +111,11 @@ this.setPosition(this.locX, this.locY + 1.0D, this.locZ); } @@ -61,7 +61,7 @@ } public void a(NBTTagCompound nbttagcompound) { -@@ -104,6 +139,7 @@ +@@ -103,6 +138,7 @@ if (nbttagcompound.hasKeyOfType("recipeBook", 10)) { this.cr.a(nbttagcompound.getCompound("recipeBook")); } @@ -69,10 +69,10 @@ } -@@ -150,8 +186,34 @@ +@@ -149,8 +185,34 @@ } - nbttagcompound.set("recipeBook", this.cr.e()); + nbttagcompound.set("recipeBook", this.cr.c()); + this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit } @@ -104,7 +104,7 @@ public void levelDown(int i) { super.levelDown(i); this.lastSentExp = -1; -@@ -185,6 +247,11 @@ +@@ -184,6 +246,11 @@ } public void B_() { @@ -116,7 +116,7 @@ this.playerInteractManager.a(); --this.invulnerableTicks; if (this.noDamageTicks > 0) { -@@ -250,7 +317,7 @@ +@@ -249,7 +316,7 @@ } if (this.getHealth() != this.lastHealthSent || this.ch != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.ci) { @@ -125,7 +125,7 @@ this.lastHealthSent = this.getHealth(); this.ch = this.foodData.getFoodLevel(); this.ci = this.foodData.getSaturationLevel() == 0.0F; -@@ -271,6 +338,12 @@ +@@ -270,6 +337,12 @@ this.a(IScoreboardCriteria.i, MathHelper.f((float) this.cc)); } @@ -138,7 +138,7 @@ if (this.getArmorStrength() != this.cd) { this.cd = this.getArmorStrength(); this.a(IScoreboardCriteria.j, MathHelper.f((float) this.cd)); -@@ -295,6 +368,16 @@ +@@ -294,6 +367,16 @@ CriterionTriggers.o.a(this); } @@ -155,7 +155,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Ticking player"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked"); -@@ -305,12 +388,11 @@ +@@ -304,12 +387,11 @@ } private void a(IScoreboardCriteria iscoreboardcriteria, int i) { @@ -170,7 +170,7 @@ scoreboardscore.setScore(i); } -@@ -321,32 +403,62 @@ +@@ -320,32 +402,62 @@ boolean flag = this.world.getGameRules().getBoolean("showDeathMessages"); this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag)); @@ -247,7 +247,7 @@ scoreboardscore.incrementScore(); } -@@ -374,29 +486,36 @@ +@@ -373,29 +485,36 @@ if (entity != this) { super.a(entity, i, damagesource); this.addScore(i); @@ -290,8 +290,8 @@ String s = entity instanceof EntityHuman ? entity.getName() : entity.bl(); ScoreboardTeam scoreboardteam = this.getScoreboard().getPlayerTeam(this.getName()); -@@ -421,7 +540,10 @@ - int j = scoreboardteam1.m().b(); +@@ -420,7 +539,10 @@ + int j = scoreboardteam1.getColor().b(); if (j >= 0 && j < IScoreboardCriteria.m.length) { - return this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.m[j]); @@ -302,7 +302,7 @@ } } -@@ -463,12 +585,14 @@ +@@ -462,12 +584,14 @@ } private boolean canPvP() { @@ -319,7 +319,7 @@ if (this.dimension == 0 && i == -1) { this.cv = new Vec3D(this.locX, this.locY, this.locZ); } else if (this.dimension != -1 && i != 0) { -@@ -476,6 +600,7 @@ +@@ -475,6 +599,7 @@ } if (this.dimension == 1 && i == 1) { @@ -327,7 +327,7 @@ this.world.kill(this); if (!this.viewingCredits) { this.viewingCredits = true; -@@ -489,7 +614,10 @@ +@@ -488,7 +613,10 @@ i = 1; } @@ -339,7 +339,7 @@ this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false)); this.lastSentExp = -1; this.lastHealthSent = -1.0F; -@@ -535,6 +663,7 @@ +@@ -534,6 +662,7 @@ } public void a(boolean flag, boolean flag1, boolean flag2) { @@ -347,7 +347,7 @@ if (this.isSleeping()) { this.x().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2)); } -@@ -613,23 +742,55 @@ +@@ -612,23 +741,55 @@ this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition())); } @@ -406,7 +406,7 @@ if (iinventory instanceof ILootable && ((ILootable) iinventory).b() != null && this.isSpectator()) { this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).setChatModifier((new ChatModifier()).setColor(EnumChatFormat.RED)), true); } else { -@@ -643,18 +804,21 @@ +@@ -642,18 +803,21 @@ if (itileinventory.isLocked() && !this.a(itileinventory.getLock()) && !this.isSpectator()) { this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), ChatMessageType.GAME_INFO)); this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ab, SoundCategory.BLOCKS, this.locX, this.locY, this.locZ, 1.0F, 1.0F)); @@ -430,7 +430,7 @@ this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); -@@ -662,8 +826,14 @@ +@@ -661,8 +825,14 @@ } public void openTrade(IMerchant imerchant) { @@ -446,7 +446,7 @@ this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).e(); -@@ -683,13 +853,20 @@ +@@ -682,13 +852,20 @@ } public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) { @@ -468,7 +468,7 @@ this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); } -@@ -730,6 +907,11 @@ +@@ -729,6 +906,11 @@ public void a(Container container, NonNullList nonnulllist) { this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist)); this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried())); @@ -480,7 +480,7 @@ } public void setContainerData(Container container, int i, int j) { -@@ -744,6 +926,7 @@ +@@ -743,6 +925,7 @@ } public void closeInventory() { @@ -488,7 +488,7 @@ this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId)); this.r(); } -@@ -818,7 +1001,7 @@ +@@ -817,7 +1000,7 @@ arraylist.add(CraftingManager.a(minecraftkey)); } @@ -497,7 +497,7 @@ } public void b(List list) { -@@ -840,7 +1023,16 @@ +@@ -839,7 +1022,16 @@ public void triggerHealthUpdate() { this.lastHealthSent = -1.0E8F; @@ -514,7 +514,7 @@ public void a(IChatBaseComponent ichatbasecomponent, boolean flag) { this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT)); -@@ -880,7 +1072,7 @@ +@@ -879,7 +1071,7 @@ this.lastSentExp = -1; this.lastHealthSent = -1.0F; this.ch = -1; @@ -523,7 +523,7 @@ this.removeQueue.addAll(entityplayer.removeQueue); this.cq = entityplayer.cq; this.cv = entityplayer.cv; -@@ -939,6 +1131,18 @@ +@@ -938,6 +1130,18 @@ } public void a(EnumGamemode enumgamemode) { @@ -542,7 +542,7 @@ this.playerInteractManager.setGameMode(enumgamemode); this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId())); if (enumgamemode == EnumGamemode.SPECTATOR) { -@@ -965,6 +1169,7 @@ +@@ -964,6 +1168,7 @@ } public boolean a(int i, String s) { @@ -550,7 +550,7 @@ if ("seed".equals(s) && !this.server.aa()) { return true; } else if (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) && !"trigger".equals(s)) { -@@ -978,6 +1183,15 @@ +@@ -977,6 +1182,15 @@ } else { return true; } @@ -566,7 +566,7 @@ } public String A() { -@@ -989,6 +1203,16 @@ +@@ -988,6 +1202,16 @@ } public void a(PacketPlayInSettings packetplayinsettings) { @@ -583,7 +583,7 @@ this.locale = packetplayinsettings.a(); this.cl = packetplayinsettings.c(); this.cm = packetplayinsettings.d(); -@@ -1054,7 +1278,7 @@ +@@ -1053,7 +1277,7 @@ this.co = (Entity) (entity == null ? this : entity); if (entity1 != this.co) { this.playerConnection.sendPacket(new PacketPlayOutCamera(this.co)); @@ -592,7 +592,7 @@ } } -@@ -1081,7 +1305,7 @@ +@@ -1080,7 +1304,7 @@ @Nullable public IChatBaseComponent getPlayerListName() { @@ -601,7 +601,7 @@ } public void a(EnumHand enumhand) { -@@ -1098,12 +1322,17 @@ +@@ -1097,12 +1321,17 @@ } public void N() { @@ -619,7 +619,7 @@ } public AdvancementDataPlayer getAdvancementData() { -@@ -1114,4 +1343,139 @@ +@@ -1113,4 +1342,139 @@ public Vec3D Q() { return this.cv; } diff --git a/nms-patches/EntitySilverfish.patch b/nms-patches/EntitySilverfish.patch index 8e871c3c78..c631fa4c03 100644 --- a/nms-patches/EntitySilverfish.patch +++ b/nms-patches/EntitySilverfish.patch @@ -3,7 +3,7 @@ @@ -157,6 +157,11 @@ IBlockData iblockdata = world.getType(blockposition); - if (BlockMonsterEggs.i(iblockdata)) { + if (BlockMonsterEggs.x(iblockdata)) { + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition, Blocks.MONSTER_EGG, Block.getId(BlockMonsterEggs.getById(iblockdata.getBlock().toLegacyData(iblockdata)))).isCancelled()) { + return; diff --git a/nms-patches/EntityZombieVillager.patch b/nms-patches/EntityZombieVillager.patch index e8b6e11d88..4bddae697b 100644 --- a/nms-patches/EntityZombieVillager.patch +++ b/nms-patches/EntityZombieVillager.patch @@ -26,6 +26,6 @@ - this.world.addEntity(entityvillager); + this.world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CURED); // CraftBukkit - add SpawnReason - EntityHuman entityhuman = this.world.b(this.by); + if (this.by != null) { + EntityHuman entityhuman = this.world.b(this.by); - if (entityhuman instanceof EntityPlayer) { diff --git a/nms-patches/EnumChatFormat.patch b/nms-patches/EnumChatFormat.patch deleted file mode 100644 index 7c87673d94..0000000000 --- a/nms-patches/EnumChatFormat.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/server/EnumChatFormat.java -+++ b/net/minecraft/server/EnumChatFormat.java -@@ -16,7 +16,7 @@ - private static final Map w = Maps.newHashMap(); - private static final Pattern x = Pattern.compile("(?i)\u00a7[0-9A-FK-OR]"); - private final String y; -- private final char z; -+ public final char z; // PAIL - private final boolean A; - private final String B; - private final int C; diff --git a/nms-patches/HandshakeListener.patch b/nms-patches/HandshakeListener.patch index 99a2fdd969..6d92c5f24e 100644 --- a/nms-patches/HandshakeListener.patch +++ b/nms-patches/HandshakeListener.patch @@ -20,7 +20,7 @@ @@ -16,6 +26,41 @@ this.b.setProtocol(EnumProtocol.LOGIN); - ChatComponentText chatcomponenttext; + ChatMessage chatmessage; + // CraftBukkit start - Connection throttle + try { @@ -31,9 +31,9 @@ + synchronized (throttleTracker) { + if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) { + throttleTracker.put(address, currentTime); -+ chatcomponenttext = new ChatComponentText("Connection throttled! Please wait before reconnecting."); -+ this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext)); -+ this.b.close(chatcomponenttext); ++ chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting."); ++ this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage)); ++ this.b.close(chatmessage); + return; + } + @@ -57,11 +57,11 @@ + } + // CraftBukkit end + - if (packethandshakinginsetprotocol.b() > 332) { - chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.12-pre5"); - this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext)); + if (packethandshakinginsetprotocol.b() > 333) { + chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[] { "1.12-pre6"}); + this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage)); @@ -26,6 +71,7 @@ - this.b.close(chatcomponenttext); + this.b.close(chatmessage); } else { this.b.setPacketListener(new LoginListener(this.a, this.b)); + ((LoginListener) this.b.i()).hostname = packethandshakinginsetprotocol.hostname + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname diff --git a/nms-patches/IRecipe.patch b/nms-patches/IRecipe.patch index 844b91e7e8..c5d8c6b35d 100644 --- a/nms-patches/IRecipe.patch +++ b/nms-patches/IRecipe.patch @@ -1,37 +1,11 @@ --- a/net/minecraft/server/IRecipe.java +++ b/net/minecraft/server/IRecipe.java -@@ -3,6 +3,7 @@ - public abstract class IRecipe implements Comparable { - - protected String a; -+ public MinecraftKey key; // CraftBukkit - - public IRecipe() { - this(""); -@@ -25,10 +26,24 @@ - } - - public int a(IRecipe irecipe) { -- return ((MinecraftKey) CraftingManager.recipes.b(this)).toString().compareTo(((MinecraftKey) CraftingManager.recipes.b(irecipe)).toString()); -+ return this.key.toString().compareTo(irecipe.key.toString()); // CraftBukkit - } - -- public int compareTo(Object object) { -+ public int compareTo(IRecipe object) { // CraftBukkit - decompile error - return this.a((IRecipe) object); +@@ -13,4 +13,8 @@ + default boolean c() { + return false; } + -+ // CraftBukkit start -+ @Override -+ public boolean equals(Object obj) { -+ return obj instanceof IRecipe && key.equals(((IRecipe) obj).key); -+ } -+ -+ @Override -+ public int hashCode() { -+ return key.hashCode(); -+ } -+ -+ public abstract org.bukkit.inventory.Recipe toBukkitRecipe(); -+ // CraftBukkit end ++ org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit ++ ++ void setKey(MinecraftKey key); // CraftBukkit } diff --git a/nms-patches/LoginListener.patch b/nms-patches/LoginListener.patch index 795b5424e3..789331f05a 100644 --- a/nms-patches/LoginListener.patch +++ b/nms-patches/LoginListener.patch @@ -21,7 +21,28 @@ public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { this.g = LoginListener.EnumProtocolState.HELLO; -@@ -82,10 +89,12 @@ +@@ -64,6 +71,20 @@ + + } + ++ // CraftBukkit start ++ @Deprecated ++ public void disconnect(String s) { ++ try { ++ IChatBaseComponent ichatbasecomponent = new ChatComponentText(s); ++ LoginListener.c.info("Disconnecting {}: {}", this.c(), s); ++ this.networkManager.sendPacket(new PacketLoginOutDisconnect(ichatbasecomponent)); ++ this.networkManager.close(ichatbasecomponent); ++ } catch (Exception exception) { ++ LoginListener.c.error("Error whilst disconnecting player", exception); ++ } ++ } ++ // CraftBukkit end ++ + public void disconnect(IChatBaseComponent ichatbasecomponent) { + try { + LoginListener.c.info("Disconnecting {}: {}", this.c(), ichatbasecomponent.toPlainText()); +@@ -80,10 +101,12 @@ this.i = this.a(this.i); } @@ -30,14 +51,14 @@ + EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, hostname); - if (s != null) { -- this.disconnect(s); +- this.disconnect(new ChatMessage(s, new Object[0])); + if (s == null) { -+ // this.disconnect(s); ++ // this.disconnect(new ChatMessage(s, new Object[0])); + // CraftBukkit end } else { this.g = LoginListener.EnumProtocolState.ACCEPTED; if (this.server.aG() >= 0 && !this.networkManager.isLocal()) { -@@ -94,7 +103,7 @@ +@@ -92,7 +115,7 @@ LoginListener.this.networkManager.setCompressionLevel(LoginListener.this.server.aG()); } @@ -46,7 +67,7 @@ this.a((ChannelFuture) future); } }, new GenericFutureListener[0]); -@@ -105,9 +114,9 @@ +@@ -103,9 +126,9 @@ if (entityplayer != null) { this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT; @@ -58,7 +79,7 @@ } } -@@ -152,6 +161,43 @@ +@@ -150,6 +173,43 @@ LoginListener.this.i = LoginListener.this.server.az().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a()); if (LoginListener.this.i != null) { @@ -102,8 +123,8 @@ LoginListener.c.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId()); LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; } else if (LoginListener.this.server.R()) { -@@ -171,6 +217,11 @@ - LoginListener.this.disconnect("Authentication servers are down. Please try again later, sorry!"); +@@ -169,6 +229,11 @@ + LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0])); LoginListener.c.error("Couldn\'t verify username because servers are unavailable"); } + // CraftBukkit start - catch all exceptions diff --git a/nms-patches/NetworkManager.patch b/nms-patches/NetworkManager.patch index 6e69467cae..eac0071a00 100644 --- a/nms-patches/NetworkManager.patch +++ b/nms-patches/NetworkManager.patch @@ -18,7 +18,15 @@ this.n = ichatbasecomponent; } -@@ -313,7 +313,7 @@ +@@ -306,14 +306,14 @@ + if (this.j() != null) { + this.i().a(this.j()); + } else if (this.i() != null) { +- this.i().a(new ChatMessage("multiplayer.disconnect.banned", new Object[0])); ++ this.i().a(new ChatMessage("multiplayer.disconnect.generic", new Object[0])); + } + } + } } diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index ee45a75db9..202b8ac85a 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -123,13 +123,25 @@ if (this.player.J() > 0L && this.minecraftServer.getIdleTimeout() > 0 && MinecraftServer.aw() - this.player.J() > (long) (this.minecraftServer.getIdleTimeout() * 1000 * 60)) { + this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854 - this.disconnect("You have been idle for too long!"); + this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0])); } -@@ -137,19 +216,40 @@ +@@ -136,18 +215,48 @@ + return this.networkManager; } - public void disconnect(String s) { +- public void disconnect(final IChatBaseComponent ichatbasecomponent) { +- this.networkManager.sendPacket(new PacketPlayOutKickDisconnect(ichatbasecomponent), new GenericFutureListener() { +- public void operationComplete(Future future) throws Exception { +- PlayerConnection.this.networkManager.close(ichatbasecomponent); ++ // CraftBukkit start ++ @Deprecated ++ public void disconnect(IChatBaseComponent ichatbasecomponent) { ++ disconnect(CraftChatMessage.fromComponent(ichatbasecomponent, EnumChatFormat.WHITE)); ++ } ++ // CraftBukkit end ++ ++ public void disconnect(String s) { + // CraftBukkit start - fire PlayerKickEvent + if (this.processedDisconnect) { + return; @@ -149,12 +161,11 @@ + // Send the possibly modified leave message + s = event.getReason(); + // CraftBukkit end - final ChatComponentText chatcomponenttext = new ChatComponentText(s); - - this.networkManager.sendPacket(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener() { -- public void operationComplete(Future future) throws Exception { ++ final ChatComponentText chatcomponenttext = new ChatComponentText(s); ++ ++ this.networkManager.sendPacket(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener() { + public void operationComplete(Future future) throws Exception { // CraftBukkit - decompile error - PlayerConnection.this.networkManager.close(chatcomponenttext); ++ PlayerConnection.this.networkManager.close(chatcomponenttext); } }, new GenericFutureListener[0]); + this.a(chatcomponenttext); // CraftBukkit - fire quit instantly @@ -170,7 +181,7 @@ } public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) { -@@ -188,7 +288,34 @@ +@@ -186,7 +295,34 @@ double d9 = entity.motX * entity.motX + entity.motY * entity.motY + entity.motZ * entity.motZ; double d10 = d6 * d6 + d7 * d7 + d8 * d8; @@ -206,7 +217,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; -@@ -226,6 +353,62 @@ +@@ -224,6 +360,62 @@ return; } @@ -269,7 +280,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)); -@@ -284,7 +467,7 @@ +@@ -282,7 +474,7 @@ } else { WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); @@ -278,7 +289,7 @@ if (this.e == 0) { this.syncPosition(); } -@@ -294,13 +477,21 @@ +@@ -292,13 +484,21 @@ this.A = this.e; this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); } @@ -301,7 +312,7 @@ double d0 = this.player.locX; double d1 = this.player.locY; double d2 = this.player.locZ; -@@ -325,15 +516,33 @@ +@@ -323,15 +523,33 @@ ++this.receivedMovePackets; int i = this.receivedMovePackets - this.processedMovePackets; @@ -337,7 +348,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; -@@ -379,6 +588,69 @@ +@@ -377,6 +595,69 @@ } } @@ -407,7 +418,7 @@ this.B = d12 >= -0.03125D; this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly; this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.cN() && !worldserver.c(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -396,10 +668,76 @@ +@@ -394,10 +675,76 @@ } public void a(double d0, double d1, double d2, float f, float f1) { @@ -485,7 +496,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; -@@ -416,6 +754,14 @@ +@@ -414,6 +761,14 @@ f3 = f1 + this.player.pitch; } @@ -500,7 +511,7 @@ if (++this.teleportAwait == Integer.MAX_VALUE) { this.teleportAwait = 0; } -@@ -427,6 +773,7 @@ +@@ -425,6 +780,7 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.x()); @@ -508,7 +519,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinblockdig.a(); -@@ -436,7 +783,15 @@ +@@ -434,7 +790,15 @@ if (!this.player.isSpectator()) { ItemStack itemstack = this.player.b(EnumHand.OFF_HAND); @@ -525,7 +536,7 @@ this.player.a(EnumHand.MAIN_HAND, itemstack); } -@@ -444,6 +799,21 @@ +@@ -442,6 +806,21 @@ case DROP_ITEM: if (!this.player.isSpectator()) { @@ -547,7 +558,7 @@ this.player.a(false); } -@@ -477,7 +847,15 @@ +@@ -475,7 +854,15 @@ if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b()); } else { @@ -563,7 +574,7 @@ } } else { if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -497,10 +875,12 @@ +@@ -495,10 +882,12 @@ default: throw new IllegalArgumentException("Invalid player action"); } @@ -576,7 +587,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); EnumHand enumhand = packetplayinuseitem.c(); ItemStack itemstack = this.player.b(enumhand); -@@ -514,6 +894,13 @@ +@@ -512,6 +901,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)) { @@ -590,7 +601,7 @@ this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.d(), packetplayinuseitem.e(), packetplayinuseitem.f()); } -@@ -523,13 +910,52 @@ +@@ -521,13 +917,52 @@ public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x()); @@ -644,7 +655,7 @@ } } -@@ -540,8 +966,8 @@ +@@ -538,8 +973,8 @@ WorldServer[] aworldserver = this.minecraftServer.worldServer; int i = aworldserver.length; @@ -655,7 +666,7 @@ if (worldserver != null) { entity = packetplayinspectate.a(worldserver); -@@ -554,6 +980,8 @@ +@@ -552,6 +987,8 @@ if (entity != null) { this.player.setSpectatorTarget(this.player); this.player.stopRiding(); @@ -664,7 +675,7 @@ if (entity.world == this.player.world) { this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ); } else { -@@ -579,12 +1007,20 @@ +@@ -577,12 +1014,20 @@ this.minecraftServer.getPlayerList().b(this.player, worldserver2); this.minecraftServer.getPlayerList().updateClient(this.player); } @@ -686,7 +697,7 @@ public void a(PacketPlayInBoatMove packetplayinboatmove) { PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.x()); -@@ -597,14 +1033,29 @@ +@@ -595,14 +1040,29 @@ } public void a(IChatBaseComponent ichatbasecomponent) { @@ -718,7 +729,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(); -@@ -626,6 +1077,15 @@ +@@ -624,6 +1084,15 @@ } } @@ -734,7 +745,7 @@ try { this.networkManager.sendPacket(packet); } catch (Throwable throwable) { -@@ -647,17 +1107,32 @@ +@@ -645,17 +1114,32 @@ public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x()); @@ -769,17 +780,17 @@ ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); chatmessage.getChatModifier().setColor(EnumChatFormat.RED); -@@ -670,39 +1145,249 @@ +@@ -668,39 +1152,249 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { -- this.disconnect("Illegal characters in chat"); +- this.disconnect(new ChatMessage("multiplayer.disconnect.illegal_characters", new Object[0])); + // CraftBukkit start - threadsafety + if (!isSync) { + Waitable waitable = new Waitable() { + @Override + protected Object evaluate() { -+ PlayerConnection.this.disconnect("Illegal characters in chat"); ++ PlayerConnection.this.disconnect(new ChatMessage("multiplayer.disconnect.illegal_characters", new Object[0])); + return null; + } + }; @@ -794,7 +805,7 @@ + throw new RuntimeException(e); + } + } else { -+ this.disconnect("Illegal characters in chat"); ++ this.disconnect(new ChatMessage("multiplayer.disconnect.illegal_characters", new Object[0])); + } + // CraftBukkit end return; @@ -831,7 +842,7 @@ - this.chatThrottle += 20; - if (this.chatThrottle > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { -- this.disconnect("disconnect.spam"); +- this.disconnect(new ChatMessage("disconnect.spam", new Object[0])); + // CraftBukkit start - replaced with thread safe throttle + // this.chatThrottle += 20; + if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { @@ -839,7 +850,7 @@ + Waitable waitable = new Waitable() { + @Override + protected Object evaluate() { -+ PlayerConnection.this.disconnect("disconnect.spam"); ++ PlayerConnection.this.disconnect(new ChatMessage("disconnect.spam", new Object[0])); + return null; + } + }; @@ -854,7 +865,7 @@ + throw new RuntimeException(e); + } + } else { -+ this.disconnect("disconnect.spam"); ++ this.disconnect(new ChatMessage("disconnect.spam", new Object[0])); + } + // CraftBukkit end } @@ -1026,7 +1037,7 @@ this.player.resetIdleTimer(); IJumpable ijumpable; -@@ -774,6 +1459,7 @@ +@@ -772,6 +1466,7 @@ public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.x()); @@ -1034,7 +1045,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -789,20 +1475,68 @@ +@@ -787,20 +1482,68 @@ if (this.player.h(entity) < d0) { EnumHand enumhand; @@ -1089,7 +1100,7 @@ } else if (packetplayinuseentity.a() == PacketPlayInUseEntity.EnumEntityUseAction.ATTACK) { - if (entity instanceof EntityItem || entity instanceof EntityExperienceOrb || entity instanceof EntityArrow || entity == this.player) { + if (entity instanceof EntityItem || entity instanceof EntityExperienceOrb || entity instanceof EntityArrow || (entity == this.player && !player.isSpectator())) { // CraftBukkit - this.disconnect("Attempting to attack an invalid entity"); + this.disconnect(new ChatMessage("multiplayer.disconnect.invalid_entity_attacked", new Object[0])); this.minecraftServer.warning("Player " + this.player.getName() + " tried to attack an invalid entity"); return; } @@ -1104,7 +1115,7 @@ } } } -@@ -818,7 +1552,8 @@ +@@ -816,7 +1559,8 @@ case PERFORM_RESPAWN: if (this.player.viewingCredits) { this.player.viewingCredits = false; @@ -1114,7 +1125,7 @@ CriterionTriggers.u.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD); } else { if (this.player.getHealth() > 0.0F) { -@@ -841,14 +1576,20 @@ +@@ -839,14 +1583,20 @@ public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x()); @@ -1137,7 +1148,7 @@ NonNullList nonnulllist = NonNullList.a(); for (int i = 0; i < this.player.activeContainer.c.size(); ++i) { -@@ -857,8 +1598,274 @@ +@@ -855,8 +1605,274 @@ this.player.a(this.player.activeContainer, nonnulllist); } else { @@ -1413,7 +1424,7 @@ if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); this.player.f = true; -@@ -960,6 +1967,7 @@ +@@ -958,6 +1974,7 @@ public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.x()); @@ -1421,7 +1432,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()); -@@ -993,7 +2001,45 @@ +@@ -991,7 +2008,45 @@ } boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45; @@ -1468,7 +1479,7 @@ if (flag1 && flag2) { if (itemstack.isEmpty()) { -@@ -1017,6 +2063,7 @@ +@@ -1015,6 +2070,7 @@ public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x()); @@ -1476,7 +1487,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()) { -@@ -1027,6 +2074,7 @@ +@@ -1025,6 +2081,7 @@ public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x()); @@ -1484,7 +1495,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.a(); -@@ -1043,14 +2091,30 @@ +@@ -1041,14 +2098,30 @@ if (!tileentitysign.a() || tileentitysign.e() != this.player) { this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); @@ -1516,7 +1527,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -1073,11 +2137,27 @@ +@@ -1071,11 +2144,27 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x()); @@ -1538,14 +1549,14 @@ PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.x()); + // CraftBukkit start + if (chatSpamField.addAndGet(this, 10) > 500 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { -+ this.disconnect("disconnect.spam"); ++ this.disconnect(new ChatMessage("disconnect.spam", new Object[0])); + return; + } + // CraftBukkit end ArrayList arraylist = Lists.newArrayList(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator(); -@@ -1103,6 +2183,13 @@ +@@ -1101,6 +2190,13 @@ ItemStack itemstack1; if ("MC|BEdit".equals(s)) { @@ -1559,7 +1570,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1121,15 +2208,25 @@ +@@ -1119,15 +2215,25 @@ } if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { @@ -1585,7 +1596,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1163,10 +2260,11 @@ +@@ -1161,10 +2267,11 @@ } itemstack2.a("pages", (NBTBase) nbttaglist); @@ -1598,7 +1609,7 @@ } } else if ("MC|TrSel".equals(s)) { try { -@@ -1178,6 +2276,7 @@ +@@ -1176,6 +2283,7 @@ } } catch (Exception exception2) { PlayerConnection.LOGGER.error("Couldn\'t select trade", exception2); @@ -1606,7 +1617,7 @@ } } else { TileEntity tileentity; -@@ -1227,6 +2326,7 @@ +@@ -1225,6 +2333,7 @@ } } catch (Exception exception3) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception3); @@ -1614,7 +1625,7 @@ } } else if ("MC|AutoCmd".equals(s)) { if (!this.minecraftServer.getEnableCommandBlock()) { -@@ -1294,6 +2394,7 @@ +@@ -1292,6 +2401,7 @@ } } catch (Exception exception4) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception4); @@ -1622,7 +1633,7 @@ } } else { int k; -@@ -1317,6 +2418,7 @@ +@@ -1315,6 +2425,7 @@ } } catch (Exception exception5) { PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5); @@ -1630,7 +1641,7 @@ } } } else if ("MC|ItemName".equals(s)) { -@@ -1403,6 +2505,7 @@ +@@ -1401,6 +2512,7 @@ } } catch (Exception exception6) { PlayerConnection.LOGGER.error("Couldn\'t set structure block", exception6); @@ -1638,7 +1649,7 @@ } } else if ("MC|PickItem".equals(s)) { packetdataserializer = packetplayincustompayload.b(); -@@ -1415,11 +2518,49 @@ +@@ -1413,11 +2525,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/PlayerList.patch b/nms-patches/PlayerList.patch index c54c64fa7a..e83e380958 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -294,7 +294,7 @@ + while (iterator.hasNext()) { + entityplayer = (EntityPlayer) iterator.next(); + savePlayerFile(entityplayer); // CraftBukkit - Force the player's inventory to be saved -+ entityplayer.playerConnection.disconnect("You logged in from another location"); ++ entityplayer.playerConnection.disconnect(new ChatMessage("multiplayer.disconnect.duplicate_login", new Object[0])); + } + + // Instead of kicking then returning, we need to store the kick reason @@ -877,7 +877,7 @@ public void u() { - for (int i = 0; i < this.players.size(); ++i) { -- ((EntityPlayer) this.players.get(i)).playerConnection.disconnect("Server closed"); +- ((EntityPlayer) this.players.get(i)).playerConnection.disconnect(new ChatMessage("multiplayer.disconnect.server_shutdown", new Object[0])); + // CraftBukkit start - disconnect safely + for (EntityPlayer player : this.players) { + player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message diff --git a/nms-patches/RecipeArmorDye.patch b/nms-patches/RecipeArmorDye.patch index 864082021f..02407e68bc 100644 --- a/nms-patches/RecipeArmorDye.patch +++ b/nms-patches/RecipeArmorDye.patch @@ -4,8 +4,8 @@ import com.google.common.collect.Lists; import java.util.ArrayList; --public class RecipeArmorDye extends IRecipe { -+public class RecipeArmorDye extends ShapelessRecipes { // CraftBukkit +-public class RecipeArmorDye implements IRecipe { ++public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends - public RecipeArmorDye() {} + // CraftBukkit start - Delegate to new parent class with bogus info diff --git a/nms-patches/RecipeBookClone.patch b/nms-patches/RecipeBookClone.patch index f2260d1bd3..d5417aa5ed 100644 --- a/nms-patches/RecipeBookClone.patch +++ b/nms-patches/RecipeBookClone.patch @@ -3,8 +3,8 @@ @@ -1,8 +1,11 @@ package net.minecraft.server; --public class RecipeBookClone extends IRecipe { -+public class RecipeBookClone extends ShapelessRecipes { // CraftBukkit +-public class RecipeBookClone implements IRecipe { ++public class RecipeBookClone extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends - public RecipeBookClone() {} + public RecipeBookClone() { diff --git a/nms-patches/RecipeFireworks.patch b/nms-patches/RecipeFireworks.patch index 2105cfcf9d..43478e0282 100644 --- a/nms-patches/RecipeFireworks.patch +++ b/nms-patches/RecipeFireworks.patch @@ -4,17 +4,17 @@ import com.google.common.collect.Lists; import java.util.ArrayList; --public class RecipeFireworks extends IRecipe { -+public class RecipeFireworks extends ShapelessRecipes { // CraftBukkit +-public class RecipeFireworks implements IRecipe { ++public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends - private ItemStack b; + private ItemStack a; + // CraftBukkit start - Delegate to new parent class with bogus info public RecipeFireworks() { + super("", new ItemStack(Items.FIREWORKS, 0, 0), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.GUNPOWDER))); - this.b = ItemStack.a; + this.a = ItemStack.a; } + // CraftBukkit end public boolean a(InventoryCrafting inventorycrafting, World world) { - this.b = ItemStack.a; + this.a = ItemStack.a; diff --git a/nms-patches/RecipeMapClone.patch b/nms-patches/RecipeMapClone.patch index 3f2a54264d..0405727243 100644 --- a/nms-patches/RecipeMapClone.patch +++ b/nms-patches/RecipeMapClone.patch @@ -3,8 +3,8 @@ @@ -1,8 +1,12 @@ package net.minecraft.server; --public class RecipeMapClone extends IRecipe { -+public class RecipeMapClone extends ShapelessRecipes { // CraftBukkit +-public class RecipeMapClone implements IRecipe { ++public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends - public RecipeMapClone() {} + // CraftBukkit start - Delegate to new parent class diff --git a/nms-patches/RecipeRepair.patch b/nms-patches/RecipeRepair.patch index 843ea3b919..7deebd5c74 100644 --- a/nms-patches/RecipeRepair.patch +++ b/nms-patches/RecipeRepair.patch @@ -4,8 +4,8 @@ import com.google.common.collect.Lists; import java.util.ArrayList; --public class RecipeRepair extends IRecipe { -+public class RecipeRepair extends ShapelessRecipes { // CraftBukkit +-public class RecipeRepair implements IRecipe { ++public class RecipeRepair extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends - public RecipeRepair() {} + // CraftBukkit start - Delegate to new parent class @@ -26,7 +26,7 @@ + NonNullList ingredients = NonNullList.a(); + ingredients.add(RecipeItemStack.a(new ItemStack[]{itemstack2.cloneItemStack()})); + ingredients.add(RecipeItemStack.a(new ItemStack[]{itemstack.cloneItemStack()})); -+ ShapelessRecipes recipe = new ShapelessRecipes(this.a, result.cloneItemStack(), ingredients); ++ ShapelessRecipes recipe = new ShapelessRecipes("", result.cloneItemStack(), ingredients); + recipe.key = new MinecraftKey("repairitem"); + inventorycrafting.currentRecipe = recipe; + result = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, result, inventorycrafting.container.getBukkitView(), true); diff --git a/nms-patches/RecipeShulkerBox.patch b/nms-patches/RecipeShulkerBox.patch index e38557c729..f3eab88bd6 100644 --- a/nms-patches/RecipeShulkerBox.patch +++ b/nms-patches/RecipeShulkerBox.patch @@ -3,12 +3,12 @@ @@ -1,8 +1,15 @@ package net.minecraft.server; --public class RecipeShulkerBox { public static class Dye extends IRecipe { +-public class RecipeShulkerBox { public static class Dye implements IRecipe { +// CraftBukkit - decompile weirdness +public class RecipeShulkerBox { - public Dye() {} -+ public static class Dye extends ShapelessRecipes { // CraftBukkit ++ public static class Dye extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends + + // CraftBukkit start - Delegate to new parent class with bogus info + public Dye() { diff --git a/nms-patches/RecipeTippedArrow.patch b/nms-patches/RecipeTippedArrow.patch index 79e4312d3f..04840d4f2b 100644 --- a/nms-patches/RecipeTippedArrow.patch +++ b/nms-patches/RecipeTippedArrow.patch @@ -4,8 +4,8 @@ import java.util.Collection; --public class RecipeTippedArrow extends IRecipe { -+public class RecipeTippedArrow extends ShapedRecipes { // CraftBukkit +-public class RecipeTippedArrow implements IRecipe { ++public class RecipeTippedArrow extends ShapedRecipes implements IRecipe { // CraftBukkit - public RecipeTippedArrow() {} + // CraftBukkit start diff --git a/nms-patches/RecipesBanner.patch b/nms-patches/RecipesBanner.patch index 06e3cbee37..293911afe8 100644 --- a/nms-patches/RecipesBanner.patch +++ b/nms-patches/RecipesBanner.patch @@ -4,12 +4,12 @@ import javax.annotation.Nullable; --public class RecipesBanner { public static class AddRecipe extends IRecipe { +-public class RecipesBanner { public static class AddRecipe implements IRecipe { +// CraftBukkit - decompile weirdness +public class RecipesBanner { - public AddRecipe() {} -+ public static class AddRecipe extends ShapelessRecipes { // CraftBukkit ++ public static class AddRecipe extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends + + // CraftBukkit start - Delegate to new parent class with bogus info + public AddRecipe() { @@ -23,8 +23,8 @@ } } -- public static class DuplicateRecipe extends IRecipe { -+ public static class DuplicateRecipe extends ShapelessRecipes { // CraftBukkit - added extends +- public static class DuplicateRecipe implements IRecipe { ++ public static class DuplicateRecipe extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends - public DuplicateRecipe() {} + // CraftBukkit start - Delegate to new parent class with bogus info diff --git a/nms-patches/RecipiesShield.patch b/nms-patches/RecipiesShield.patch index e0c904976e..bfdd5ea222 100644 --- a/nms-patches/RecipiesShield.patch +++ b/nms-patches/RecipiesShield.patch @@ -3,12 +3,12 @@ @@ -1,8 +1,15 @@ package net.minecraft.server; --public class RecipiesShield { public static class Decoration extends IRecipe { +-public class RecipiesShield { public static class Decoration implements IRecipe { +// CraftBukkit - decompile weirdness +public class RecipiesShield { - public Decoration() {} -+ public static class Decoration extends ShapelessRecipes { // CraftBukkit ++ public static class Decoration extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends + + // CraftBukkit start - Delegate to new parent class with bogus info + public Decoration() { diff --git a/nms-patches/ShapedRecipes.patch b/nms-patches/ShapedRecipes.patch index 7ef8d040f2..55e0cb11b7 100644 --- a/nms-patches/ShapedRecipes.patch +++ b/nms-patches/ShapedRecipes.patch @@ -9,9 +9,24 @@ +import org.bukkit.craftbukkit.inventory.CraftShapedRecipe; +// CraftBukkit end - public class ShapedRecipes extends IRecipe { + public class ShapedRecipes implements IRecipe { -@@ -30,6 +34,63 @@ +@@ -22,6 +26,14 @@ + private final NonNullList items; + private final ItemStack result; + private final String e; ++ // CraftBukkit start ++ public MinecraftKey key; ++ ++ @Override ++ public void setKey(MinecraftKey key) { ++ this.key = key; ++ } ++ // CraftBukkit end + + public ShapedRecipes(String s, int i, int j, NonNullList nonnulllist, ItemStack itemstack) { + this.e = s; +@@ -31,6 +43,63 @@ this.result = itemstack; } diff --git a/nms-patches/ShapelessRecipes.patch b/nms-patches/ShapelessRecipes.patch index 914c0af93b..bb54a3d783 100644 --- a/nms-patches/ShapelessRecipes.patch +++ b/nms-patches/ShapelessRecipes.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ShapelessRecipes.java +++ b/net/minecraft/server/ShapelessRecipes.java -@@ -6,6 +6,10 @@ +@@ -6,12 +6,24 @@ import com.google.gson.JsonParseException; import java.util.ArrayList; import java.util.Iterator; @@ -9,9 +9,23 @@ +import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe; +// CraftBukkit end - public class ShapelessRecipes extends IRecipe { + public class ShapelessRecipes implements IRecipe { -@@ -18,6 +22,21 @@ + private final ItemStack result; + private final NonNullList ingredients; + private final String c; ++ // CraftBukkit start ++ public MinecraftKey key; ++ ++ @Override ++ public void setKey(MinecraftKey key) { ++ this.key = key; ++ } ++ // CraftBukkit end + + public ShapelessRecipes(String s, ItemStack itemstack, NonNullList nonnulllist) { + this.c = s; +@@ -19,6 +31,21 @@ this.ingredients = nonnulllist; } diff --git a/nms-patches/World.patch b/nms-patches/World.patch index a123bfb671..377a4ccc38 100644 --- a/nms-patches/World.patch +++ b/nms-patches/World.patch @@ -448,29 +448,37 @@ } } } -@@ -1241,6 +1490,13 @@ - } +@@ -1244,15 +1493,13 @@ + int i; + int j; - public void entityJoinedWorld(Entity entity, boolean flag) { +- if (!(entity instanceof EntityHuman)) { +- i = MathHelper.floor(entity.locX); +- j = MathHelper.floor(entity.locZ); +- boolean flag1 = true; +- +- if (flag && !this.isAreaLoaded(i - 32, 0, j - 32, i + 32, 0, j + 32, true)) { +- return; +- } + // CraftBukkit start - check if chunks are loaded as done in previous versions ++ // TODO: Go back to Vanilla behaviour when comfortable + Chunk startingChunk = this.getChunkIfLoaded(MathHelper.floor(entity.locX) >> 4, MathHelper.floor(entity.locZ) >> 4); + if (flag && !(startingChunk != null && startingChunk.areNeighborsLoaded(2))) { + return; -+ } + } + // CraftBukkit end -+ + entity.M = entity.locX; entity.N = entity.locY; - entity.O = entity.locZ; -@@ -1252,6 +1508,7 @@ - entity.leaveVehicle(); +@@ -1265,6 +1512,7 @@ + entity.aC(); } else { entity.B_(); + entity.postTick(); // CraftBukkit } } -@@ -1543,11 +1800,18 @@ +@@ -1556,11 +1804,18 @@ } } @@ -489,7 +497,7 @@ TileEntity tileentity = null; if (this.O) { -@@ -1582,6 +1846,14 @@ +@@ -1595,6 +1850,14 @@ public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) { if (!this.E(blockposition)) { if (tileentity != null && !tileentity.y()) { @@ -504,7 +512,7 @@ if (this.O) { tileentity.setPosition(blockposition); Iterator iterator = this.b.iterator(); -@@ -1741,6 +2013,14 @@ +@@ -1754,6 +2017,14 @@ } this.o = MathHelper.a(this.o, 0.0F, 1.0F); @@ -519,7 +527,7 @@ } } } -@@ -1878,7 +2158,10 @@ +@@ -1891,7 +2162,10 @@ } public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { @@ -531,7 +539,7 @@ return false; } else { int i = 0; -@@ -2045,7 +2328,7 @@ +@@ -2058,7 +2332,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -540,7 +548,7 @@ arraylist.add(entity); } } -@@ -2060,7 +2343,7 @@ +@@ -2073,7 +2347,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -549,7 +557,7 @@ arraylist.add(entity); } } -@@ -2109,7 +2392,7 @@ +@@ -2122,7 +2396,7 @@ } } @@ -558,7 +566,7 @@ } @Nullable -@@ -2130,8 +2413,17 @@ +@@ -2143,8 +2417,17 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -577,7 +585,7 @@ ++i; } } -@@ -2140,12 +2432,18 @@ +@@ -2153,12 +2436,18 @@ } public void a(Collection collection) { @@ -597,7 +605,7 @@ this.b(entity); } -@@ -2159,7 +2457,13 @@ +@@ -2172,7 +2461,13 @@ IBlockData iblockdata = this.getType(blockposition); AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().d(this, blockposition); @@ -612,7 +620,7 @@ } public int getSeaLevel() { -@@ -2269,6 +2573,11 @@ +@@ -2282,6 +2577,11 @@ for (int i = 0; i < this.players.size(); ++i) { EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); @@ -624,7 +632,7 @@ if (predicate.apply(entityhuman1)) { double d5 = entityhuman1.d(d0, d1, d2); -@@ -2437,6 +2746,16 @@ +@@ -2450,6 +2750,16 @@ public void everyoneSleeping() {} @@ -641,7 +649,7 @@ public float h(float f) { return (this.p + (this.q - this.p) * f) * this.j(f); } -@@ -2654,7 +2973,7 @@ +@@ -2667,7 +2977,7 @@ int l = j * 16 + 8 - blockposition.getZ(); boolean flag = true; diff --git a/pom.xml b/pom.xml index c00f073878..4df53c0bfb 100644 --- a/pom.xml +++ b/pom.xml @@ -4,14 +4,14 @@ org.bukkit craftbukkit jar - 1.12-pre5-SNAPSHOT + 1.12-pre6-SNAPSHOT CraftBukkit http://www.bukkit.org UTF-8 unknown - 1.12-pre5 + 1.12-pre6 1_12_R1 git-Bukkit- diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 6e9ee1afd5..2e81ea8660 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -391,7 +391,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return false; } - getHandle().aF(); // PAIL: rename + getHandle().ejectPassengers(); return true; } diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java index a2496e79d4..a252b91b24 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java @@ -76,7 +76,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { public ChatColor getColor() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); - return CraftChatMessage.getColor(team.m()); // PAIL: rename + return CraftChatMessage.getColor(team.getColor()); // PAIL: rename } @Override @@ -84,7 +84,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { Validate.notNull(color, "Color cannot be null"); CraftScoreboard scoreboard = checkState(); - team.a(CraftChatMessage.getColor(color)); // PAIL: rename + team.setColor(CraftChatMessage.getColor(color)); // PAIL: rename } public boolean allowFriendlyFire() throws IllegalStateException { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java index 598d088f5a..dbbed1be79 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java @@ -36,7 +36,7 @@ public final class CraftChatMessage { } public static ChatColor getColor(EnumChatFormat format) { - return ChatColor.getByChar(format.z); + return ChatColor.getByChar(format.character); } private static class StringMessage {