From 130b9a0a360dc3d7733ed25da0b11c57619bbf2c Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Wed, 18 Jul 2018 01:08:13 +0100 Subject: [PATCH] NOT FINISHED! 1.13-pre7 - even more patches! Patches, patches everywhere! --- ...patch => 0178-Cap-Entity-Collisions.patch} | 18 +- ...-CraftScheduler-Async-Task-Debugger.patch} | 2 +- .../0180-Shame-on-you-Mojang.patch | 38 + ...ore-aggressive-in-the-chunk-unload-.patch} | 8 +- ...> 0182-Do-not-let-armorstands-drown.patch} | 26 +- ...e-async-calls-to-restart-the-server.patch} | 38 +- ...roperty-to-disable-book-size-limits.patch} | 4 +- ...e-parrots-stay-on-shoulders-despite.patch} | 18 +- ...-option-to-prevent-player-names-fro.patch} | 6 +- ...leAppender-for-console-improvements.patch} | 89 +- ...rable-option-to-disable-creeper-lin.patch} | 12 +- ....patch => 0189-Item-canEntityPickup.patch} | 33 +- ...layerPickupItemEvent-setFlyAtPlayer.patch} | 15 +- ...> 0191-PlayerAttemptPickupItemEvent.patch} | 12 +- ...tch => 0192-Add-UnknownCommandEvent.patch} | 10 +- ...tch => 0193-Basic-PlayerProfile-API.patch} | 32 +- ... 0194-Shoulder-Entities-Release-API.patch} | 10 +- ...patch => 0195-Profile-Lookup-Events.patch} | 2 +- ...layer-logins-during-server-shutdown.patch} | 8 +- ...patch => 0197-Entity-fromMobSpawner.patch} | 20 +- ...0198-Fix-Anvil-Level-sync-to-client.patch} | 10 +- ...ages-for-getTileEntity-in-order-to-.patch} | 6 +- ...0-Improve-the-Saddle-API-for-Horses.patch} | 2 +- ...plement-ensureServerConversions-API.patch} | 11 +- ...> 0202-Implement-getI18NDisplayName.patch} | 6 +- .../0202-Shame-on-you-Mojang.patch | 59 - ...ving-disabled-before-unloading-all-.patch} | 10 +- ...=> 0204-ProfileWhitelistVerifyEvent.patch} | 16 +- ...n-attempting-to-read-EMPTY-ItemStack.patch | 23 - ...ch => 0205-Fix-this-stupid-bullshit.patch} | 8 +- ...wns-should-honor-nametags-and-leash.patch} | 6 +- ...mer-when-spawner-event-is-cancelled.patch} | 8 +- ...8-Fix-MC-117075-TE-Unload-Lag-Spike.patch} | 6 +- ...a-custom-authentication-servers-dow.patch} | 6 +- ...atch => 0210-LivingEntity-setKiller.patch} | 6 +- Spigot-Server-Patches/0211-Anti-Xray.patch | 1173 +++++++++++++++++ ...ms-to-redirect-System.out-err-to-lo.patch} | 10 +- ...-prefixes-using-Log4J-configuration.patch} | 10 +- ...Include-Log4J2-SLF4J-implementation.patch} | 6 +- ...efix-for-various-plugins-bypassing-.patch} | 2 +- ...t.patch => 0216-Add-PlayerJumpEvent.patch} | 31 +- ...-handle-PacketPlayInKeepAlive-async.patch} | 20 +- ...t-protocol-version-and-virtual-host.patch} | 26 +- ...t-serverside-behavior-of-keepalives.patch} | 34 +- ...ith-fastutil-s-ObjectOpenHashSet-in.patch} | 2 +- ...Effects-only-to-players-who-can-see.patch} | 52 +- ...maximum-exp-value-when-merging-orbs.patch} | 10 +- ... => 0223-Add-PlayerArmorChangeEvent.patch} | 6 +- ...om-being-processed-when-the-player-.patch} | 6 +- ...-implementations-for-captured-block.patch} | 13 +- ...get-a-BlockState-without-a-snapshot.patch} | 41 +- .../0252-AsyncTabCompleteEvent.patch | 143 -- ...253-Avoid-NPE-in-PathfinderGoalTempt.patch | 22 - ...low-a-zero-max-height-in-BiomeJungle.patch | 0 ...ix-dragon-egg-falling-in-lazy-chunks.patch | 0 .../0235-Anti-Xray.patch | 0 .../0248-Improve-Structures-Checking.patch | 0 57 files changed, 1571 insertions(+), 620 deletions(-) rename Spigot-Server-Patches/{0199-Cap-Entity-Collisions.patch => 0178-Cap-Entity-Collisions.patch} (80%) rename Spigot-Server-Patches/{0201-Remove-CraftScheduler-Async-Task-Debugger.patch => 0179-Remove-CraftScheduler-Async-Task-Debugger.patch} (97%) create mode 100644 Spigot-Server-Patches/0180-Shame-on-you-Mojang.patch rename Spigot-Server-Patches/{0203-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch => 0181-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch} (80%) rename Spigot-Server-Patches/{0204-Do-not-let-armorstands-drown.patch => 0182-Do-not-let-armorstands-drown.patch} (55%) rename Spigot-Server-Patches/{0206-Properly-handle-async-calls-to-restart-the-server.patch => 0183-Properly-handle-async-calls-to-restart-the-server.patch} (91%) rename Spigot-Server-Patches/{0207-Add-system-property-to-disable-book-size-limits.patch => 0184-Add-system-property-to-disable-book-size-limits.patch} (96%) rename Spigot-Server-Patches/{0208-Add-option-to-make-parrots-stay-on-shoulders-despite.patch => 0185-Add-option-to-make-parrots-stay-on-shoulders-despite.patch} (86%) rename Spigot-Server-Patches/{0209-Add-configuration-option-to-prevent-player-names-fro.patch => 0186-Add-configuration-option-to-prevent-player-names-fro.patch} (89%) rename Spigot-Server-Patches/{0210-Use-TerminalConsoleAppender-for-console-improvements.patch => 0187-Use-TerminalConsoleAppender-for-console-improvements.patch} (91%) rename Spigot-Server-Patches/{0211-provide-a-configurable-option-to-disable-creeper-lin.patch => 0188-provide-a-configurable-option-to-disable-creeper-lin.patch} (85%) rename Spigot-Server-Patches/{0212-Item-canEntityPickup.patch => 0189-Item-canEntityPickup.patch} (70%) rename Spigot-Server-Patches/{0213-PlayerPickupItemEvent-setFlyAtPlayer.patch => 0190-PlayerPickupItemEvent-setFlyAtPlayer.patch} (74%) rename Spigot-Server-Patches/{0214-PlayerAttemptPickupItemEvent.patch => 0191-PlayerAttemptPickupItemEvent.patch} (81%) rename Spigot-Server-Patches/{0215-Add-UnknownCommandEvent.patch => 0192-Add-UnknownCommandEvent.patch} (80%) rename Spigot-Server-Patches/{0216-Basic-PlayerProfile-API.patch => 0193-Basic-PlayerProfile-API.patch} (95%) rename Spigot-Server-Patches/{0217-Shoulder-Entities-Release-API.patch => 0194-Shoulder-Entities-Release-API.patch} (93%) rename Spigot-Server-Patches/{0218-Profile-Lookup-Events.patch => 0195-Profile-Lookup-Events.patch} (98%) rename Spigot-Server-Patches/{0219-Block-player-logins-during-server-shutdown.patch => 0196-Block-player-logins-during-server-shutdown.patch} (82%) rename Spigot-Server-Patches/{0220-Entity-fromMobSpawner.patch => 0197-Entity-fromMobSpawner.patch} (80%) rename Spigot-Server-Patches/{0221-Fix-Anvil-Level-sync-to-client.patch => 0198-Fix-Anvil-Level-sync-to-client.patch} (87%) rename Spigot-Server-Patches/{0222-Add-missing-coverages-for-getTileEntity-in-order-to-.patch => 0199-Add-missing-coverages-for-getTileEntity-in-order-to-.patch} (84%) rename Spigot-Server-Patches/{0223-Improve-the-Saddle-API-for-Horses.patch => 0200-Improve-the-Saddle-API-for-Horses.patch} (97%) rename Spigot-Server-Patches/{0224-Implement-ensureServerConversions-API.patch => 0201-Implement-ensureServerConversions-API.patch} (71%) rename Spigot-Server-Patches/{0225-Implement-getI18NDisplayName.patch => 0202-Implement-getI18NDisplayName.patch} (88%) delete mode 100644 Spigot-Server-Patches/0202-Shame-on-you-Mojang.patch rename Spigot-Server-Patches/{0226-GH-806-Respect-saving-disabled-before-unloading-all-.patch => 0203-GH-806-Respect-saving-disabled-before-unloading-all-.patch} (78%) rename Spigot-Server-Patches/{0227-ProfileWhitelistVerifyEvent.patch => 0204-ProfileWhitelistVerifyEvent.patch} (80%) delete mode 100644 Spigot-Server-Patches/0205-Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch rename Spigot-Server-Patches/{0228-Fix-this-stupid-bullshit.patch => 0205-Fix-this-stupid-bullshit.patch} (88%) rename Spigot-Server-Patches/{0229-Ocelot-despawns-should-honor-nametags-and-leash.patch => 0206-Ocelot-despawns-should-honor-nametags-and-leash.patch} (82%) rename Spigot-Server-Patches/{0230-Reset-spawner-timer-when-spawner-event-is-cancelled.patch => 0207-Reset-spawner-timer-when-spawner-event-is-cancelled.patch} (82%) rename Spigot-Server-Patches/{0232-Fix-MC-117075-TE-Unload-Lag-Spike.patch => 0208-Fix-MC-117075-TE-Unload-Lag-Spike.patch} (84%) rename Spigot-Server-Patches/{0233-Allow-specifying-a-custom-authentication-servers-dow.patch => 0209-Allow-specifying-a-custom-authentication-servers-dow.patch} (93%) rename Spigot-Server-Patches/{0234-LivingEntity-setKiller.patch => 0210-LivingEntity-setKiller.patch} (87%) create mode 100644 Spigot-Server-Patches/0211-Anti-Xray.patch rename Spigot-Server-Patches/{0236-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch => 0212-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch} (89%) rename Spigot-Server-Patches/{0237-Handle-plugin-prefixes-using-Log4J-configuration.patch => 0213-Handle-plugin-prefixes-using-Log4J-configuration.patch} (94%) rename Spigot-Server-Patches/{0238-Include-Log4J2-SLF4J-implementation.patch => 0214-Include-Log4J2-SLF4J-implementation.patch} (84%) rename Spigot-Server-Patches/{0239-Disable-logger-prefix-for-various-plugins-bypassing-.patch => 0215-Disable-logger-prefix-for-various-plugins-bypassing-.patch} (97%) rename Spigot-Server-Patches/{0240-Add-PlayerJumpEvent.patch => 0216-Add-PlayerJumpEvent.patch} (81%) rename Spigot-Server-Patches/{0241-handle-PacketPlayInKeepAlive-async.patch => 0217-handle-PacketPlayInKeepAlive-async.patch} (65%) rename Spigot-Server-Patches/{0242-Expose-client-protocol-version-and-virtual-host.patch => 0218-Expose-client-protocol-version-and-virtual-host.patch} (90%) rename Spigot-Server-Patches/{0243-revert-serverside-behavior-of-keepalives.patch => 0219-revert-serverside-behavior-of-keepalives.patch} (86%) rename Spigot-Server-Patches/{0244-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch => 0220-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch} (95%) rename Spigot-Server-Patches/{0245-Send-attack-SoundEffects-only-to-players-who-can-see.patch => 0221-Send-attack-SoundEffects-only-to-players-who-can-see.patch} (64%) rename Spigot-Server-Patches/{0246-Option-for-maximum-exp-value-when-merging-orbs.patch => 0222-Option-for-maximum-exp-value-when-merging-orbs.patch} (90%) rename Spigot-Server-Patches/{0247-Add-PlayerArmorChangeEvent.patch => 0223-Add-PlayerArmorChangeEvent.patch} (93%) rename Spigot-Server-Patches/{0249-Prevent-logins-from-being-processed-when-the-player-.patch => 0224-Prevent-logins-from-being-processed-when-the-player-.patch} (85%) rename Spigot-Server-Patches/{0250-use-CB-BlockState-implementations-for-captured-block.patch => 0225-use-CB-BlockState-implementations-for-captured-block.patch} (66%) rename Spigot-Server-Patches/{0251-API-to-get-a-BlockState-without-a-snapshot.patch => 0226-API-to-get-a-BlockState-without-a-snapshot.patch} (80%) delete mode 100644 Spigot-Server-Patches/0252-AsyncTabCompleteEvent.patch delete mode 100644 Spigot-Server-Patches/0253-Avoid-NPE-in-PathfinderGoalTempt.patch rename {Spigot-Server-Patches => removed}/0200-Do-not-allow-a-zero-max-height-in-BiomeJungle.patch (100%) rename {Spigot-Server-Patches => removed}/0231-MC-94186-Fix-dragon-egg-falling-in-lazy-chunks.patch (100%) rename {Spigot-Server-Patches => removed}/0235-Anti-Xray.patch (100%) rename {Spigot-Server-Patches => removed}/0248-Improve-Structures-Checking.patch (100%) diff --git a/Spigot-Server-Patches/0199-Cap-Entity-Collisions.patch b/Spigot-Server-Patches/0178-Cap-Entity-Collisions.patch similarity index 80% rename from Spigot-Server-Patches/0199-Cap-Entity-Collisions.patch rename to Spigot-Server-Patches/0178-Cap-Entity-Collisions.patch index 7e698f0058..5e24c5218f 100644 --- a/Spigot-Server-Patches/0199-Cap-Entity-Collisions.patch +++ b/Spigot-Server-Patches/0178-Cap-Entity-Collisions.patch @@ -1,4 +1,4 @@ -From a30098615015d5b407960dfe74033d7545d7eb12 Mon Sep 17 00:00:00 2001 +From a5b81e93f93c2ec4cb9b7ea55d5c20a40d3da2c4 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 22 Jan 2017 18:07:56 -0500 Subject: [PATCH] Cap Entity Collisions @@ -12,12 +12,12 @@ just as it does in Vanilla, but entity pushing logic will be capped. You can set this to 0 to disable collisions. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 5f06d4e5e..29b4bdb47 100644 +index 5df8b1143..0b748d402 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -413,4 +413,10 @@ public class PaperWorldConfig { - private void armorStandEntityLookups() { - armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); +@@ -343,4 +343,10 @@ public class PaperWorldConfig { + log("Treasure Maps will return already discovered locations"); + } } + + public int maxCollisionsPerEntity; @@ -27,10 +27,10 @@ index 5f06d4e5e..29b4bdb47 100644 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 20324deeb..b4233df5f 100644 +index b47bf9738..db7e37aee 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -170,6 +170,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -168,6 +168,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public final boolean defaultActivationState; public long activatedTick = Integer.MIN_VALUE; public boolean fromMobSpawner; @@ -39,10 +39,10 @@ index 20324deeb..b4233df5f 100644 // Spigot end diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 38c043375..c97ee68a5 100644 +index 3a38f384e..8e45b557e 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2191,8 +2191,11 @@ public abstract class EntityLiving extends Entity { +@@ -2239,8 +2239,11 @@ public abstract class EntityLiving extends Entity { } } diff --git a/Spigot-Server-Patches/0201-Remove-CraftScheduler-Async-Task-Debugger.patch b/Spigot-Server-Patches/0179-Remove-CraftScheduler-Async-Task-Debugger.patch similarity index 97% rename from Spigot-Server-Patches/0201-Remove-CraftScheduler-Async-Task-Debugger.patch rename to Spigot-Server-Patches/0179-Remove-CraftScheduler-Async-Task-Debugger.patch index 4f1b21564b..80c5fb5fa2 100644 --- a/Spigot-Server-Patches/0201-Remove-CraftScheduler-Async-Task-Debugger.patch +++ b/Spigot-Server-Patches/0179-Remove-CraftScheduler-Async-Task-Debugger.patch @@ -1,4 +1,4 @@ -From a962c34610bc172ff3076bf986b38c2c09c29c33 Mon Sep 17 00:00:00 2001 +From cebe88d5b404e9e0e94b3fbec08b59bac8014975 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 5 Feb 2017 00:04:04 -0500 Subject: [PATCH] Remove CraftScheduler Async Task Debugger diff --git a/Spigot-Server-Patches/0180-Shame-on-you-Mojang.patch b/Spigot-Server-Patches/0180-Shame-on-you-Mojang.patch new file mode 100644 index 0000000000..0dc2855510 --- /dev/null +++ b/Spigot-Server-Patches/0180-Shame-on-you-Mojang.patch @@ -0,0 +1,38 @@ +From a4ff835aa4422f15ab43ff2474f6c8ae16088515 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 5 Feb 2017 19:17:28 -0500 +Subject: [PATCH] Shame on you Mojang + +Someone wrote some horrible code that throws a world accessing task +onto the HTTP DOWNLOADER Thread Pool, for an activity that is not even +heavy enough to warrant async operation. + +This then triggers async chunk loads! + +What in the hell were you thinking? + +diff --git a/src/main/java/net/minecraft/server/BlockBeacon.java b/src/main/java/net/minecraft/server/BlockBeacon.java +index 1181d45fa..d081166d8 100644 +--- a/src/main/java/net/minecraft/server/BlockBeacon.java ++++ b/src/main/java/net/minecraft/server/BlockBeacon.java +@@ -49,7 +49,7 @@ public class BlockBeacon extends BlockTileEntity { + } + + public static void a(World world, BlockPosition blockposition) { +- HttpUtilities.a.submit(() -> { ++ //HttpUtilities.a.submit(() -> { // Paper + Chunk chunk = world.getChunkAtWorldCoords(blockposition); + + for (int i = blockposition.getY() - 1; i >= 0; --i) { +@@ -73,7 +73,6 @@ public class BlockBeacon extends BlockTileEntity { + }); + } + } +- +- }); ++ // }); // Paper + } + } +-- +2.18.0 + diff --git a/Spigot-Server-Patches/0203-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch b/Spigot-Server-Patches/0181-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch similarity index 80% rename from Spigot-Server-Patches/0203-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch rename to Spigot-Server-Patches/0181-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch index c8156c5a78..ed93b143ce 100644 --- a/Spigot-Server-Patches/0203-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch +++ b/Spigot-Server-Patches/0181-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch @@ -1,14 +1,14 @@ -From d8a8fcb78cfa437fb01080d88ac256a4dc490140 Mon Sep 17 00:00:00 2001 +From cbb0e17bb9d0d316bb1c8caa8c28d13e1bf74b8e Mon Sep 17 00:00:00 2001 From: Brokkonaut Date: Tue, 7 Feb 2017 16:55:35 -0600 Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 66ff1adf6..de859ffd1 100644 +index ef35eb7ec..70790386e 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -325,7 +325,7 @@ public class ChunkProviderServer implements IChunkProvider { +@@ -328,7 +328,7 @@ public class ChunkProviderServer implements IChunkProvider { // Spigot start org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant; activityAccountant.startActivity(0.5); @@ -16,7 +16,7 @@ index 66ff1adf6..de859ffd1 100644 + int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive // Spigot end - Iterator iterator = this.unloadQueue.iterator(); + LongIterator longiterator = this.unloadQueue.iterator(); -- 2.18.0 diff --git a/Spigot-Server-Patches/0204-Do-not-let-armorstands-drown.patch b/Spigot-Server-Patches/0182-Do-not-let-armorstands-drown.patch similarity index 55% rename from Spigot-Server-Patches/0204-Do-not-let-armorstands-drown.patch rename to Spigot-Server-Patches/0182-Do-not-let-armorstands-drown.patch index b951e8c58e..9a82d7169b 100644 --- a/Spigot-Server-Patches/0204-Do-not-let-armorstands-drown.patch +++ b/Spigot-Server-Patches/0182-Do-not-let-armorstands-drown.patch @@ -1,14 +1,14 @@ -From d93e6f8c98d66ccad03bb24a8f89c3af11a60422 Mon Sep 17 00:00:00 2001 +From 1fb8166d8d2bc377f13189beda50e4b920635325 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sat, 18 Feb 2017 19:29:58 -0600 Subject: [PATCH] Do not let armorstands drown diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index ee3d37a71..df0d66ad0 100644 +index 52a1036fd..26171b343 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -779,5 +779,10 @@ public class EntityArmorStand extends EntityLiving { +@@ -764,5 +764,10 @@ public class EntityArmorStand extends EntityLiving { super.move(moveType, x, y, z); } } @@ -20,24 +20,24 @@ index ee3d37a71..df0d66ad0 100644 // Paper end } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index c97ee68a5..44335fd2d 100644 +index 8e45b557e..f4a766800 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -195,6 +195,7 @@ public abstract class EntityLiving extends Entity { +@@ -200,6 +200,7 @@ public abstract class EntityLiving extends Entity { super.a(d0, flag, iblockdata, blockposition); } -+ public boolean canBreatheUnderwater() { return this.bN(); } // Paper - OBFHELPER - public boolean bN() { - return false; ++ public boolean canBreatheUnderwater() { return this.bZ(); } // Paper - OBFHELPER + public boolean bZ() { + return this.getMonsterType() == EnumMonsterType.UNDEAD; } -@@ -229,7 +230,7 @@ public abstract class EntityLiving extends Entity { +@@ -234,7 +235,7 @@ public abstract class EntityLiving extends Entity { if (this.isAlive()) { - if (this.a(Material.WATER)) { -- if (!this.bN() && !this.hasEffect(MobEffects.WATER_BREATHING) && !flag1) { -+ if (!this.canBreatheUnderwater() && !this.hasEffect(MobEffects.WATER_BREATHING) && !flag1) { - this.setAirTicks(this.d(this.getAirTicks())); + if (this.a(TagsFluid.a) && this.world.getType(new BlockPosition(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ)).getBlock() != Blocks.BUBBLE_COLUMN) { +- if (!this.bZ() && !MobEffectUtil.c(this) && !flag1) { ++ if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER + this.setAirTicks(this.l(this.getAirTicks())); if (this.getAirTicks() == -20) { this.setAirTicks(0); -- diff --git a/Spigot-Server-Patches/0206-Properly-handle-async-calls-to-restart-the-server.patch b/Spigot-Server-Patches/0183-Properly-handle-async-calls-to-restart-the-server.patch similarity index 91% rename from Spigot-Server-Patches/0206-Properly-handle-async-calls-to-restart-the-server.patch rename to Spigot-Server-Patches/0183-Properly-handle-async-calls-to-restart-the-server.patch index 258e3bf5b9..20d570b4ed 100644 --- a/Spigot-Server-Patches/0206-Properly-handle-async-calls-to-restart-the-server.patch +++ b/Spigot-Server-Patches/0183-Properly-handle-async-calls-to-restart-the-server.patch @@ -1,4 +1,4 @@ -From 46b3f0b41023c5857dd0af9997e4f44570c9bedc Mon Sep 17 00:00:00 2001 +From a12f6eee7782c6895adb1a01063a7b0cb1fafa8c Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 12 May 2017 23:34:11 -0500 Subject: [PATCH] Properly handle async calls to restart the server @@ -30,27 +30,27 @@ will have plugins and worlds saving to the disk has a high potential to result in corruption/dataloss. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 13c6b5ccd..908a5d273 100644 +index f81ff5628..f679c6bc2 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -71,6 +71,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -85,6 +85,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati public WorldServer[] worldServer; - private PlayerList v; + private PlayerList s; private boolean isRunning = true; + private boolean isRestarting = false; // Paper - flag to signify we're attempting to restart private boolean isStopped; private int ticks; - protected final Proxy e; -@@ -489,7 +490,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - if (this.v != null) { + protected final Proxy d; +@@ -590,7 +591,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + if (this.s != null) { MinecraftServer.LOGGER.info("Saving players"); - this.v.savePlayers(); -- this.v.u(); -+ this.v.u(isRestarting); + this.s.savePlayers(); +- this.s.u(); ++ this.s.u(isRestarting);; try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets } -@@ -546,10 +547,18 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -649,10 +650,18 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati return this.isRunning; } @@ -69,20 +69,20 @@ index 13c6b5ccd..908a5d273 100644 // Paper start - Further improve server tick loop private static final int TPS = 20; private static final long SEC_IN_NANO = 1000000000; -@@ -1615,6 +1624,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - return this.ab; +@@ -1607,6 +1616,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + return this.aa; } -+ public final Thread getServerThread() { return this.aI(); } // Paper - OBFHELPER - public Thread aI() { ++ public final Thread getServerThread() { return this.aA(); } // Paper - OBFHELPER + public Thread aA() { return this.serverThread; } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index c49711cad..85357a003 100644 +index e41850742..5e833c378 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1378,10 +1378,15 @@ public abstract class PlayerList { - entityplayer.playerInteractManager.b(world.getWorldData().getGameType()); +@@ -1344,10 +1344,15 @@ public abstract class PlayerList { + entityplayer.playerInteractManager.b(generatoraccess.getWorldData().getGameType()); } + // Paper start - Extract method to allow for restarting flag @@ -98,7 +98,7 @@ index c49711cad..85357a003 100644 } // CraftBukkit end // Paper start - Remove collideRule team if it exists -@@ -1392,6 +1397,7 @@ public abstract class PlayerList { +@@ -1358,6 +1363,7 @@ public abstract class PlayerList { } // Paper end } diff --git a/Spigot-Server-Patches/0207-Add-system-property-to-disable-book-size-limits.patch b/Spigot-Server-Patches/0184-Add-system-property-to-disable-book-size-limits.patch similarity index 96% rename from Spigot-Server-Patches/0207-Add-system-property-to-disable-book-size-limits.patch rename to Spigot-Server-Patches/0184-Add-system-property-to-disable-book-size-limits.patch index 8b5a05cbdd..9be13c8b1c 100644 --- a/Spigot-Server-Patches/0207-Add-system-property-to-disable-book-size-limits.patch +++ b/Spigot-Server-Patches/0184-Add-system-property-to-disable-book-size-limits.patch @@ -1,4 +1,4 @@ -From bc0d96c47df073207c45a3ced55f99fc1e1b2381 Mon Sep 17 00:00:00 2001 +From f5d754ba5f4de0b4a9f40cbccdf2f14201bf2058 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sat, 13 May 2017 20:11:21 -0500 Subject: [PATCH] Add system property to disable book size limits @@ -11,7 +11,7 @@ to make books with as much data as they want. Do not use this without limiting incoming data from packets in some other way. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -index a7e51d9f1..ffdb7ec82 100644 +index 6ff1a2dcd..64a939952 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java @@ -40,6 +40,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { diff --git a/Spigot-Server-Patches/0208-Add-option-to-make-parrots-stay-on-shoulders-despite.patch b/Spigot-Server-Patches/0185-Add-option-to-make-parrots-stay-on-shoulders-despite.patch similarity index 86% rename from Spigot-Server-Patches/0208-Add-option-to-make-parrots-stay-on-shoulders-despite.patch rename to Spigot-Server-Patches/0185-Add-option-to-make-parrots-stay-on-shoulders-despite.patch index 373736e54a..7f7aa82e86 100644 --- a/Spigot-Server-Patches/0208-Add-option-to-make-parrots-stay-on-shoulders-despite.patch +++ b/Spigot-Server-Patches/0185-Add-option-to-make-parrots-stay-on-shoulders-despite.patch @@ -1,4 +1,4 @@ -From 0ceac86ec4bac512cd1adfa907020fe976e96fff Mon Sep 17 00:00:00 2001 +From caddde982286e1f722cf4cd8a422b58159e96b31 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 16 May 2017 21:29:08 -0500 Subject: [PATCH] Add option to make parrots stay on shoulders despite movement @@ -11,10 +11,10 @@ I suspect Mojang may switch to this behavior before full release. To be converted into a Paper-API event at some point in the future? diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 29b4bdb47..31aad03c2 100644 +index 0b748d402..99fe720e8 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -419,4 +419,10 @@ public class PaperWorldConfig { +@@ -349,4 +349,10 @@ public class PaperWorldConfig { maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) ); log( "Max Entity Collisions: " + maxCollisionsPerEntity ); } @@ -26,10 +26,10 @@ index 29b4bdb47..31aad03c2 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 0f1d99636..9cda8a177 100644 +index 36a961cb7..0da76b268 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -399,7 +399,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -460,7 +460,7 @@ public abstract class EntityHuman extends EntityLiving { this.j(this.getShoulderEntityLeft()); this.j(this.getShoulderEntityRight()); if (!this.world.isClientSide && (this.fallDistance > 0.5F || this.isInWater() || this.isPassenger()) || this.abilities.isFlying) { @@ -39,11 +39,11 @@ index 0f1d99636..9cda8a177 100644 } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 802008b4e..6d733e153 100644 +index 25e3d6423..128b2beb5 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1515,6 +1515,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - switch (packetplayinentityaction.b()) { +@@ -1746,6 +1746,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + switch (packetplayinentityaction.c()) { case START_SNEAKING: this.player.setSneaking(true); + @@ -57,5 +57,5 @@ index 802008b4e..6d733e153 100644 case STOP_SNEAKING: -- -2.17.1 +2.18.0 diff --git a/Spigot-Server-Patches/0209-Add-configuration-option-to-prevent-player-names-fro.patch b/Spigot-Server-Patches/0186-Add-configuration-option-to-prevent-player-names-fro.patch similarity index 89% rename from Spigot-Server-Patches/0209-Add-configuration-option-to-prevent-player-names-fro.patch rename to Spigot-Server-Patches/0186-Add-configuration-option-to-prevent-player-names-fro.patch index 3b7e714118..d2b5cd3ca6 100644 --- a/Spigot-Server-Patches/0209-Add-configuration-option-to-prevent-player-names-fro.patch +++ b/Spigot-Server-Patches/0186-Add-configuration-option-to-prevent-player-names-fro.patch @@ -1,4 +1,4 @@ -From fc82e20fac8adc748ef554d6de4eab73fb2e2a08 Mon Sep 17 00:00:00 2001 +From 4da4707066e2b1a70a6406e205be0c072c10da99 Mon Sep 17 00:00:00 2001 From: kashike Date: Fri, 9 Jun 2017 07:24:34 -0700 Subject: [PATCH] Add configuration option to prevent player names from being @@ -20,10 +20,10 @@ index ea6fcb39f..dbafef023 100644 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 41357cb0e..27c6caddc 100644 +index f3dfd65d6..6c611c0df 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1908,5 +1908,10 @@ public final class CraftServer implements Server { +@@ -2004,5 +2004,10 @@ public final class CraftServer implements Server { commandMap.registerServerAliases(); return true; } diff --git a/Spigot-Server-Patches/0210-Use-TerminalConsoleAppender-for-console-improvements.patch b/Spigot-Server-Patches/0187-Use-TerminalConsoleAppender-for-console-improvements.patch similarity index 91% rename from Spigot-Server-Patches/0210-Use-TerminalConsoleAppender-for-console-improvements.patch rename to Spigot-Server-Patches/0187-Use-TerminalConsoleAppender-for-console-improvements.patch index 79764a98a2..adac80d7bd 100644 --- a/Spigot-Server-Patches/0210-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/Spigot-Server-Patches/0187-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -1,4 +1,4 @@ -From 0140f0a679cb39eb069e0ea08f22775885ee9a16 Mon Sep 17 00:00:00 2001 +From 161a4fa741fe2a3ac45c495a7966493116048201 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Fri, 9 Jun 2017 19:03:43 +0200 Subject: [PATCH] Use TerminalConsoleAppender for console improvements @@ -20,23 +20,29 @@ Other changes: configuration diff --git a/pom.xml b/pom.xml -index 9d273c6d9..26775156b 100644 +index 17bc80776..4dd5fed25 100644 --- a/pom.xml +++ b/pom.xml -@@ -53,12 +53,6 @@ - 5.0.4 +@@ -41,15 +41,9 @@ compile -- + - jline - jline - 2.12.1 - compile - +- +- org.ow2.asm +- asm +- 6.2 ++ net.sf.jopt-simple ++ jopt-simple ++ 5.0.4 + compile + - org.xerial - sqlite-jdbc -@@ -77,6 +71,32 @@ +@@ -70,6 +64,32 @@ 3.0.3 compile @@ -69,7 +75,7 @@ index 9d273c6d9..26775156b 100644 junit -@@ -210,10 +230,18 @@ +@@ -203,10 +223,18 @@ META-INF/services/java.sql.Driver @@ -179,10 +185,10 @@ index 000000000..626bfeec8 + +} diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 8f2afcc32..b3f1aa999 100644 +index a3d58b5ce..069eb7d68 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -73,7 +73,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -79,7 +79,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer if (!org.bukkit.craftbukkit.Main.useConsole) { return; } @@ -194,10 +200,10 @@ index 8f2afcc32..b3f1aa999 100644 // CraftBukkit end String s; -@@ -81,11 +84,17 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -87,11 +90,17 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer try { // CraftBukkit start - JLine disabling compatibility - while (!isStopped() && isRunning()) { + while (!DedicatedServer.this.isStopped() && DedicatedServer.this.isRunning()) { + // Paper start - code is not used for jline + /* if (org.bukkit.craftbukkit.Main.useJline) { @@ -210,9 +216,9 @@ index 8f2afcc32..b3f1aa999 100644 + // Paper end + if (s != null && s.trim().length() > 0) { // Trim to filter lines which are just spaces - issueCommand(s, DedicatedServer.this); + DedicatedServer.this.issueCommand(s, DedicatedServer.this.getServerCommandListener()); } -@@ -106,6 +115,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -112,6 +121,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler()); @@ -222,7 +228,7 @@ index 8f2afcc32..b3f1aa999 100644 final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()); for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) { if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) { -@@ -114,6 +126,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -120,6 +132,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } new Thread(new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader)).start(); @@ -232,10 +238,10 @@ index 8f2afcc32..b3f1aa999 100644 System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true)); System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true)); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 908a5d273..e8bddc171 100644 +index f679c6bc2..39a8b1d69 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -42,7 +42,6 @@ import org.apache.commons.lang3.Validate; +@@ -57,7 +57,6 @@ import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // CraftBukkit start @@ -243,7 +249,7 @@ index 908a5d273..e8bddc171 100644 import joptsimple.OptionSet; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.CraftServer; -@@ -115,7 +114,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -142,7 +141,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati public OptionSet options; public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.RemoteConsoleCommandSender remoteConsole; @@ -252,8 +258,8 @@ index 908a5d273..e8bddc171 100644 public static int currentTick = 0; // Paper - Further improve tick loop public final Thread primaryThread; public java.util.Queue processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); -@@ -141,7 +140,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - this.dataConverterManager = dataconvertermanager; +@@ -183,7 +182,9 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + this.ac.a((IResourcePackListener) this.al); // CraftBukkit start this.options = options; + // Paper start - Handled by TerminalConsoleAppender @@ -262,7 +268,7 @@ index 908a5d273..e8bddc171 100644 if (System.console() == null && System.getProperty("jline.terminal") == null) { System.setProperty("jline.terminal", "jline.UnsupportedTerminal"); Main.useJline = false; -@@ -162,6 +163,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -204,6 +205,8 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati LOGGER.warn((String) null, ex); } } @@ -271,7 +277,7 @@ index 908a5d273..e8bddc171 100644 Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); this.serverThread = primaryThread = new Thread(this, "Server thread"); // Moved from main -@@ -701,7 +704,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -804,7 +807,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati } finally { // CraftBukkit start - Restore terminal to original settings try { @@ -280,18 +286,17 @@ index 908a5d273..e8bddc171 100644 } catch (Exception ignored) { } // CraftBukkit end -@@ -1229,7 +1232,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -1285,7 +1288,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati } public void sendMessage(IChatBaseComponent ichatbasecomponent) { -- MinecraftServer.LOGGER.info(ichatbasecomponent.toPlainText()); -+ // Paper - Log message with colors -+ MinecraftServer.LOGGER.info(org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(ichatbasecomponent, net.minecraft.server.EnumChatFormat.WHITE)); +- MinecraftServer.LOGGER.info(ichatbasecomponent.getString()); ++ MinecraftServer.LOGGER.info(org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(ichatbasecomponent, net.minecraft.server.EnumChatFormat.WHITE));// Paper - Log message with colors } - public boolean a(int i, String s) { + public KeyPair G() { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 85357a003..3e5122486 100644 +index 5e833c378..0f39fa49f 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -78,8 +78,7 @@ public abstract class PlayerList { @@ -305,18 +310,20 @@ index 85357a003..3e5122486 100644 this.k = new GameProfileBanList(PlayerList.a); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 27c6caddc..539f492e0 100644 +index 6c611c0df..3b10c5e61 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -128,7 +128,6 @@ import io.netty.buffer.ByteBuf; - import io.netty.buffer.ByteBufOutputStream; - import io.netty.buffer.Unpooled; - import io.netty.handler.codec.base64.Base64; +@@ -137,8 +137,8 @@ import java.nio.ByteBuffer; + import java.nio.charset.StandardCharsets; + import java.util.Base64; + import java.util.HashMap; -import jline.console.ConsoleReader; - import org.apache.commons.lang.StringUtils; + import org.bukkit.Keyed; ++import org.apache.commons.lang.StringUtils; import org.bukkit.NamespacedKey; - import org.bukkit.craftbukkit.util.CraftNamespacedKey; -@@ -1094,9 +1093,13 @@ public final class CraftServer implements Server { + import org.bukkit.block.data.BlockData; + import org.bukkit.craftbukkit.block.data.CraftBlockData; +@@ -1140,9 +1140,13 @@ public final class CraftServer implements Server { return logger; } @@ -331,7 +338,7 @@ index 27c6caddc..539f492e0 100644 @Override public PluginCommand getPluginCommand(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index d565a720f..c9e8a8737 100644 +index aad208f47..ac38028d7 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -14,7 +14,7 @@ import java.util.logging.Logger; @@ -343,7 +350,7 @@ index d565a720f..c9e8a8737 100644 public class Main { public static boolean useJline = true; -@@ -170,6 +170,8 @@ public class Main { +@@ -176,6 +176,8 @@ public class Main { } try { @@ -352,7 +359,7 @@ index d565a720f..c9e8a8737 100644 // This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals String jline_UnsupportedTerminal = new String(new char[] {'j','l','i','n','e','.','U','n','s','u','p','p','o','r','t','e','d','T','e','r','m','i','n','a','l'}); String jline_terminal = new String(new char[] {'j','l','i','n','e','.','t','e','r','m','i','n','a','l'}); -@@ -187,10 +189,18 @@ public class Main { +@@ -193,10 +195,18 @@ public class Main { // This ensures the terminal literal will always match the jline implementation System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName()); } @@ -370,7 +377,7 @@ index d565a720f..c9e8a8737 100644 + System.setProperty(TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper } - if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { + if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java deleted file mode 100644 index 26a2fb894..000000000 diff --git a/Spigot-Server-Patches/0211-provide-a-configurable-option-to-disable-creeper-lin.patch b/Spigot-Server-Patches/0188-provide-a-configurable-option-to-disable-creeper-lin.patch similarity index 85% rename from Spigot-Server-Patches/0211-provide-a-configurable-option-to-disable-creeper-lin.patch rename to Spigot-Server-Patches/0188-provide-a-configurable-option-to-disable-creeper-lin.patch index b79ed5202a..dd5cec9238 100644 --- a/Spigot-Server-Patches/0211-provide-a-configurable-option-to-disable-creeper-lin.patch +++ b/Spigot-Server-Patches/0188-provide-a-configurable-option-to-disable-creeper-lin.patch @@ -1,4 +1,4 @@ -From 1450cf36f8663affe1820aada01118156939d236 Mon Sep 17 00:00:00 2001 +From cb3b9596a91e1f987ddd0a50ee318ae0d50daad0 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 11 Jun 2017 21:01:18 +0100 Subject: [PATCH] provide a configurable option to disable creeper lingering @@ -6,10 +6,10 @@ Subject: [PATCH] provide a configurable option to disable creeper lingering diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 31aad03c2..646620d0c 100644 +index 99fe720e8..c80d84b9b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -425,4 +425,10 @@ public class PaperWorldConfig { +@@ -355,4 +355,10 @@ public class PaperWorldConfig { parrotsHangOnBetter = getBoolean("parrots-are-unaffected-by-player-movement", false); log("Parrots are unaffected by player movement: " + parrotsHangOnBetter); } @@ -21,11 +21,11 @@ index 31aad03c2..646620d0c 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java -index c872607fc..8098d4d9f 100644 +index f286b6286..f37169d73 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java -@@ -222,7 +222,7 @@ public class EntityCreeper extends EntityMonster { - private void ds() { +@@ -214,7 +214,7 @@ public class EntityCreeper extends EntityMonster { + private void dF() { Collection collection = this.getEffects(); - if (!collection.isEmpty()) { diff --git a/Spigot-Server-Patches/0212-Item-canEntityPickup.patch b/Spigot-Server-Patches/0189-Item-canEntityPickup.patch similarity index 70% rename from Spigot-Server-Patches/0212-Item-canEntityPickup.patch rename to Spigot-Server-Patches/0189-Item-canEntityPickup.patch index f4011cd32d..9b03960ba4 100644 --- a/Spigot-Server-Patches/0212-Item-canEntityPickup.patch +++ b/Spigot-Server-Patches/0189-Item-canEntityPickup.patch @@ -1,38 +1,37 @@ -From e4e98632b0628b4452d2b266506da9d200a62d4a Mon Sep 17 00:00:00 2001 +From 3582ab1f823cdaaddfb902895911730387101c78 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Fri, 5 May 2017 03:57:17 -0500 Subject: [PATCH] Item#canEntityPickup diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 5ea9f3097..89e878365 100644 +index d29364b01..9dc86e90d 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -514,6 +514,12 @@ public abstract class EntityInsentient extends EntityLiving { - while (iterator.hasNext()) { +@@ -512,6 +512,11 @@ public abstract class EntityInsentient extends EntityLiving { EntityItem entityitem = (EntityItem) iterator.next(); -+ // Paper Start -+ if (!entityitem.canMobPickup) { -+ continue; -+ } -+ // Paper End -+ - if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.t()) { + if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.q()) { ++ // Paper Start ++ if (!entityitem.canMobPickup) { ++ continue; ++ } ++ // Paper End this.a(entityitem); } + } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 6593fc633..99dbb1393 100644 +index 4af09f5cd..f2a4476c5 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -22,6 +22,7 @@ public class EntityItem extends Entity implements HopperPusher { - private static final DataWatcherObject c = DataWatcher.a(EntityItem.class, DataWatcherRegistry.f); +@@ -13,6 +13,7 @@ public class EntityItem extends Entity { + private static final DataWatcherObject b = DataWatcher.a(EntityItem.class, DataWatcherRegistry.g); private int age; public int pickupDelay; + public boolean canMobPickup = true; // Paper - private int f; - private String g; - private String h; + private int e; + private UUID f; + private UUID g; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java index a17a537d6..1df17f09b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java diff --git a/Spigot-Server-Patches/0213-PlayerPickupItemEvent-setFlyAtPlayer.patch b/Spigot-Server-Patches/0190-PlayerPickupItemEvent-setFlyAtPlayer.patch similarity index 74% rename from Spigot-Server-Patches/0213-PlayerPickupItemEvent-setFlyAtPlayer.patch rename to Spigot-Server-Patches/0190-PlayerPickupItemEvent-setFlyAtPlayer.patch index 0048309140..d6ddcbae8c 100644 --- a/Spigot-Server-Patches/0213-PlayerPickupItemEvent-setFlyAtPlayer.patch +++ b/Spigot-Server-Patches/0190-PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -1,14 +1,14 @@ -From e9e0c61c0ea8ce2ae7cbc21c3c2c6b0ea9932237 Mon Sep 17 00:00:00 2001 +From 31fb189f19914490ec51f8e994f3f167540369e0 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sun, 7 May 2017 06:26:09 -0500 Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 99dbb1393..ae4910b4b 100644 +index f2a4476c5..62d1c3d11 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -332,6 +332,7 @@ public class EntityItem extends Entity implements HopperPusher { +@@ -308,6 +308,7 @@ public class EntityItem extends Entity { // CraftBukkit start - fire PlayerPickupItemEvent int canHold = entityhuman.inventory.canHold(itemstack); int remaining = i - canHold; @@ -16,7 +16,7 @@ index 99dbb1393..ae4910b4b 100644 if (this.pickupDelay <= 0 && canHold > 0) { itemstack.setCount(canHold); -@@ -339,7 +340,13 @@ public class EntityItem extends Entity implements HopperPusher { +@@ -315,7 +316,13 @@ public class EntityItem extends Entity { PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); playerEvent.setCancelled(!entityhuman.canPickUpLoot); this.world.getServer().getPluginManager().callEvent(playerEvent); @@ -30,11 +30,10 @@ index 99dbb1393..ae4910b4b 100644 return; } -@@ -359,7 +366,11 @@ public class EntityItem extends Entity implements HopperPusher { - // CraftBukkit end +@@ -336,6 +343,11 @@ public class EntityItem extends Entity { - if (this.pickupDelay == 0 && (this.h == null || 6000 - this.age <= 200 || this.h.equals(entityhuman.getName())) && entityhuman.inventory.pickup(itemstack)) { -- entityhuman.receive(this, i); + if (this.pickupDelay == 0 && (this.g == null || 6000 - this.age <= 200 || this.g.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) { + entityhuman.receive(this, i); + // Paper Start + if (flyAtPlayer) { + entityhuman.receive(this, i); diff --git a/Spigot-Server-Patches/0214-PlayerAttemptPickupItemEvent.patch b/Spigot-Server-Patches/0191-PlayerAttemptPickupItemEvent.patch similarity index 81% rename from Spigot-Server-Patches/0214-PlayerAttemptPickupItemEvent.patch rename to Spigot-Server-Patches/0191-PlayerAttemptPickupItemEvent.patch index 838e31ab46..ddc56bbd41 100644 --- a/Spigot-Server-Patches/0214-PlayerAttemptPickupItemEvent.patch +++ b/Spigot-Server-Patches/0191-PlayerAttemptPickupItemEvent.patch @@ -1,22 +1,22 @@ -From 45b4de7a63937ed0c9c58960e6be049d11b00a52 Mon Sep 17 00:00:00 2001 +From 0caff079245dcf29a713e485c3062dcd45d28167 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sun, 11 Jun 2017 16:30:30 -0500 Subject: [PATCH] PlayerAttemptPickupItemEvent diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index ae4910b4b..0b7fc327f 100644 +index 62d1c3d11..d232bab74 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -8,6 +8,7 @@ import org.apache.logging.log4j.Logger; +@@ -7,6 +7,7 @@ import javax.annotation.Nullable; import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit end +import org.bukkit.event.player.PlayerAttemptPickupItemEvent; // Paper - import com.destroystokyo.paper.HopperPusher; // Paper - // Paper start - implement HopperPusher -@@ -334,6 +335,22 @@ public class EntityItem extends Entity implements HopperPusher { + public class EntityItem extends Entity { + +@@ -310,6 +311,22 @@ public class EntityItem extends Entity { int remaining = i - canHold; boolean flyAtPlayer = false; // Paper diff --git a/Spigot-Server-Patches/0215-Add-UnknownCommandEvent.patch b/Spigot-Server-Patches/0192-Add-UnknownCommandEvent.patch similarity index 80% rename from Spigot-Server-Patches/0215-Add-UnknownCommandEvent.patch rename to Spigot-Server-Patches/0192-Add-UnknownCommandEvent.patch index d4d719e842..f69af1a174 100644 --- a/Spigot-Server-Patches/0215-Add-UnknownCommandEvent.patch +++ b/Spigot-Server-Patches/0192-Add-UnknownCommandEvent.patch @@ -1,14 +1,14 @@ -From 8b6a5b555082c1dd6de30aac296317869d9dcec9 Mon Sep 17 00:00:00 2001 +From 9b1c57eced435652b0ab33f81636733bde8728b8 Mon Sep 17 00:00:00 2001 From: Sweepyoface Date: Sat, 17 Jun 2017 18:48:21 -0400 Subject: [PATCH] Add UnknownCommandEvent diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 539f492e0..77c16fe2c 100644 +index 3b10c5e61..46f86359c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -78,6 +78,7 @@ import org.bukkit.craftbukkit.util.Versioning; +@@ -79,6 +79,7 @@ import org.bukkit.craftbukkit.util.Versioning; import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -16,10 +16,10 @@ index 539f492e0..77c16fe2c 100644 import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerChatTabCompleteEvent; import org.bukkit.event.server.BroadcastMessageEvent; -@@ -675,7 +676,13 @@ public final class CraftServer implements Server { +@@ -719,7 +720,13 @@ public final class CraftServer implements Server { // Spigot start - if (StringUtils.isNotEmpty(org.spigotmc.SpigotConfig.unknownCommandMessage)) { + if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) { - sender.sendMessage(org.spigotmc.SpigotConfig.unknownCommandMessage); + // Paper start + UnknownCommandEvent event = new UnknownCommandEvent(sender, commandLine, org.spigotmc.SpigotConfig.unknownCommandMessage); diff --git a/Spigot-Server-Patches/0216-Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/0193-Basic-PlayerProfile-API.patch similarity index 95% rename from Spigot-Server-Patches/0216-Basic-PlayerProfile-API.patch rename to Spigot-Server-Patches/0193-Basic-PlayerProfile-API.patch index 9b05c74728..467e7a4c54 100644 --- a/Spigot-Server-Patches/0216-Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/0193-Basic-PlayerProfile-API.patch @@ -1,4 +1,4 @@ -From 67efca2ab5f2797aeceff4a62a7b777f2ea616d9 Mon Sep 17 00:00:00 2001 +From 614281018d171ed41567a3abfaac9b589157a9dc Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 15 Jan 2018 22:11:48 -0500 Subject: [PATCH] Basic PlayerProfile API @@ -429,10 +429,10 @@ index 02940d697..4539b5601 100644 * Calculates distance between 2 entities * @param e1 diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e8bddc171..fcf6bac08 100644 +index 39a8b1d69..4654e22c8 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1018,7 +1018,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -1114,7 +1114,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati */ // CraftBukkit end String s1 = "."; // PAIL? @@ -441,16 +441,16 @@ index e8bddc171..fcf6bac08 100644 MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); UserCache usercache = new UserCache(gameprofilerepository, new File(s1, MinecraftServer.a.getName())); -@@ -1538,6 +1538,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - this.H = i; +@@ -1562,6 +1562,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + this.G = i; } -+ public MinecraftSessionService getSessionService() { return az(); } // Paper - OBFHELPER - public MinecraftSessionService az() { - return this.W; ++ public MinecraftSessionService getSessionService() { return ar(); } // Paper - OBFHELPER + public MinecraftSessionService ar() { + return this.V; } diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index 7ce08eb8b..6a750c25e 100644 +index a47a51a41..4c476f757 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -44,7 +44,7 @@ public class UserCache { @@ -462,8 +462,8 @@ index 7ce08eb8b..6a750c25e 100644 private final Map e = Maps.newHashMap(); private final Deque f = new java.util.concurrent.LinkedBlockingDeque(); // CraftBukkit private final GameProfileRepository g; -@@ -173,6 +173,13 @@ public class UserCache { - return (String[]) arraylist.toArray(new String[arraylist.size()]); +@@ -166,6 +166,13 @@ public class UserCache { + return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); } + // Paper start @@ -476,7 +476,7 @@ index 7ce08eb8b..6a750c25e 100644 @Nullable public GameProfile getProfile(UUID uuid) { return a(uuid); } // Paper - OBFHELPER @Nullable public synchronized GameProfile a(UUID uuid) { // Paper - synchronize -@@ -282,7 +289,7 @@ public class UserCache { +@@ -275,7 +282,7 @@ public class UserCache { class UserCacheEntry { @@ -486,10 +486,10 @@ index 7ce08eb8b..6a750c25e 100644 private UserCacheEntry(GameProfile gameprofile, Date date) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 77c16fe2c..2dd7ed96a 100644 +index 46f86359c..26bbb0265 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -135,6 +135,10 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; +@@ -152,6 +152,10 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; import org.bukkit.event.server.TabCompleteEvent; import net.md_5.bungee.api.chat.BaseComponent; @@ -498,9 +498,9 @@ index 77c16fe2c..2dd7ed96a 100644 + + public final class CraftServer implements Server { - private final String serverName = "Paper"; + private final String serverName = "Paper"; // Paper private final String serverVersion; -@@ -1923,5 +1927,21 @@ public final class CraftServer implements Server { +@@ -2020,5 +2024,21 @@ public final class CraftServer implements Server { public boolean suggestPlayerNamesWhenNullTabCompletions() { return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions; } diff --git a/Spigot-Server-Patches/0217-Shoulder-Entities-Release-API.patch b/Spigot-Server-Patches/0194-Shoulder-Entities-Release-API.patch similarity index 93% rename from Spigot-Server-Patches/0217-Shoulder-Entities-Release-API.patch rename to Spigot-Server-Patches/0194-Shoulder-Entities-Release-API.patch index 2ff9afe62a..a969eaa1cc 100644 --- a/Spigot-Server-Patches/0217-Shoulder-Entities-Release-API.patch +++ b/Spigot-Server-Patches/0194-Shoulder-Entities-Release-API.patch @@ -1,14 +1,14 @@ -From 6b016f7c3218f98e813b2bcd764943528f7be99e Mon Sep 17 00:00:00 2001 +From ad7c9344e0fcb1d4b7ce6e78fab6be0b1b2f89b1 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 17 Jun 2017 15:18:30 -0400 Subject: [PATCH] Shoulder Entities Release API diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 9cda8a177..deb0f4a9c 100644 +index 0da76b268..85e617979 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1721,21 +1721,48 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1819,21 +1819,48 @@ public abstract class EntityHuman extends EntityLiving { } // CraftBukkit end } @@ -62,10 +62,10 @@ index 9cda8a177..deb0f4a9c 100644 public abstract boolean isSpectator(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index a54548f02..a0128426f 100644 +index 073c8acf2..9e2fc4947 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -444,6 +444,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -445,6 +445,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { getHandle().getCooldownTracker().a(CraftMagicNumbers.getItem(material), ticks); } diff --git a/Spigot-Server-Patches/0218-Profile-Lookup-Events.patch b/Spigot-Server-Patches/0195-Profile-Lookup-Events.patch similarity index 98% rename from Spigot-Server-Patches/0218-Profile-Lookup-Events.patch rename to Spigot-Server-Patches/0195-Profile-Lookup-Events.patch index be951b876c..413b26478a 100644 --- a/Spigot-Server-Patches/0218-Profile-Lookup-Events.patch +++ b/Spigot-Server-Patches/0195-Profile-Lookup-Events.patch @@ -1,4 +1,4 @@ -From 994ec4bf48918d37128a4497da0c4048d80066c3 Mon Sep 17 00:00:00 2001 +From 6564411af8c8e297d2045b8ad2cb4f9dff87c67c Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 17 Jun 2017 17:00:32 -0400 Subject: [PATCH] Profile Lookup Events diff --git a/Spigot-Server-Patches/0219-Block-player-logins-during-server-shutdown.patch b/Spigot-Server-Patches/0196-Block-player-logins-during-server-shutdown.patch similarity index 82% rename from Spigot-Server-Patches/0219-Block-player-logins-during-server-shutdown.patch rename to Spigot-Server-Patches/0196-Block-player-logins-during-server-shutdown.patch index f9448cb0c6..0c71d8e3a7 100644 --- a/Spigot-Server-Patches/0219-Block-player-logins-during-server-shutdown.patch +++ b/Spigot-Server-Patches/0196-Block-player-logins-during-server-shutdown.patch @@ -1,17 +1,17 @@ -From f36c3440727a1046b873964ca2c36b339cdf09a5 Mon Sep 17 00:00:00 2001 +From 7a52f09bc7a5b4c1f06b5554eabd35d088ac98f6 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 2 Jul 2017 21:35:56 -0500 Subject: [PATCH] Block player logins during server shutdown diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 2158fcd32..c5434e6ba 100644 +index 89a11a496..bab13a4fd 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -53,6 +53,12 @@ public class LoginListener implements PacketLoginInListener, ITickable { +@@ -50,6 +50,12 @@ public class LoginListener implements PacketLoginInListener, ITickable { } - public void e() { + public void X_() { + // Paper start - Do not allow logins while the server is shutting down + if (!MinecraftServer.getServer().isRunning()) { + this.disconnect(new ChatMessage(org.spigotmc.SpigotConfig.restartMessage)); diff --git a/Spigot-Server-Patches/0220-Entity-fromMobSpawner.patch b/Spigot-Server-Patches/0197-Entity-fromMobSpawner.patch similarity index 80% rename from Spigot-Server-Patches/0220-Entity-fromMobSpawner.patch rename to Spigot-Server-Patches/0197-Entity-fromMobSpawner.patch index 571795b26a..e9147026b2 100644 --- a/Spigot-Server-Patches/0220-Entity-fromMobSpawner.patch +++ b/Spigot-Server-Patches/0197-Entity-fromMobSpawner.patch @@ -1,14 +1,14 @@ -From 57ed55129a54deecee7292fd00036b45ac0bd6ed Mon Sep 17 00:00:00 2001 +From 941e2d6ee2fddc3c265f37cc7868f4bcefd2c91b Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sun, 18 Jun 2017 18:17:05 -0500 Subject: [PATCH] Entity#fromMobSpawner() diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b4233df5f..00791faf2 100644 +index db7e37aee..cd1639e26 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -170,6 +170,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -168,6 +168,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public final boolean defaultActivationState; public long activatedTick = Integer.MIN_VALUE; public boolean fromMobSpawner; @@ -16,7 +16,7 @@ index b4233df5f..00791faf2 100644 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1590,6 +1591,10 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -1658,6 +1659,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke if (origin != null) { nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); } @@ -27,7 +27,7 @@ index b4233df5f..00791faf2 100644 // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -1739,6 +1744,8 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -1806,6 +1811,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke if (!originTag.isEmpty()) { origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); } @@ -37,22 +37,22 @@ index b4233df5f..00791faf2 100644 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index a5261d70b..1ed0def1e 100644 +index 61472a0eb..2b6b062c6 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -107,6 +107,7 @@ public abstract class MobSpawnerAbstract { +@@ -115,6 +115,7 @@ public abstract class MobSpawnerAbstract { if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) { - ((EntityInsentient) entity).prepare(world.D(new BlockPosition(entity)), (GroupDataEntity) null); + ((EntityInsentient) entity).prepare(world.getDamageScaler(new BlockPosition(entity)), (GroupDataEntity) null, (NBTTagCompound) null); } + entity.spawnedViaMobSpawner = true; // Paper // Spigot Start if ( entity.world.spigotConfig.nerfSpawnerMobs ) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 3b25b8b73..bf7e6ed3f 100644 +index 03a3328b0..6d4dc539c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -800,5 +800,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -816,5 +816,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { Location origin = getHandle().origin; return origin == null ? null : origin.clone(); } diff --git a/Spigot-Server-Patches/0221-Fix-Anvil-Level-sync-to-client.patch b/Spigot-Server-Patches/0198-Fix-Anvil-Level-sync-to-client.patch similarity index 87% rename from Spigot-Server-Patches/0221-Fix-Anvil-Level-sync-to-client.patch rename to Spigot-Server-Patches/0198-Fix-Anvil-Level-sync-to-client.patch index 34a683a626..8d4e85915c 100644 --- a/Spigot-Server-Patches/0221-Fix-Anvil-Level-sync-to-client.patch +++ b/Spigot-Server-Patches/0198-Fix-Anvil-Level-sync-to-client.patch @@ -1,4 +1,4 @@ -From 217bbba50cbb6ecff5d10e4c02d4e0736121c4ed Mon Sep 17 00:00:00 2001 +From 11cea7c95bac2bf2450c1c93246dad8416d796ce Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 11 Jul 2017 23:17:57 -0400 Subject: [PATCH] Fix Anvil Level sync to client @@ -10,10 +10,10 @@ Was done incorrectly and is now causing level desyncs to client. Always send current level to the client, and instead make setWindowProperty set the level. diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java -index 175753c5a..16ec67569 100644 +index 845ec2250..c252ff6d5 100644 --- a/src/main/java/net/minecraft/server/ContainerAnvil.java +++ b/src/main/java/net/minecraft/server/ContainerAnvil.java -@@ -376,9 +376,9 @@ public class ContainerAnvil extends Container { +@@ -377,9 +377,9 @@ public class ContainerAnvil extends Container { for (int i = 0; i < this.listeners.size(); ++i) { ICrafting icrafting = (ICrafting) this.listeners.get(i); @@ -26,10 +26,10 @@ index 175753c5a..16ec67569 100644 this.lastLevelCost = this.levelCost; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 7ee17b254..f83b16bcd 100644 +index 3c1f02c18..d7eb4af83 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1332,6 +1332,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1378,6 +1378,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (container.getBukkitView().getType() != prop.getType()) { return false; } diff --git a/Spigot-Server-Patches/0222-Add-missing-coverages-for-getTileEntity-in-order-to-.patch b/Spigot-Server-Patches/0199-Add-missing-coverages-for-getTileEntity-in-order-to-.patch similarity index 84% rename from Spigot-Server-Patches/0222-Add-missing-coverages-for-getTileEntity-in-order-to-.patch rename to Spigot-Server-Patches/0199-Add-missing-coverages-for-getTileEntity-in-order-to-.patch index 4980c7e286..b6675c1619 100644 --- a/Spigot-Server-Patches/0222-Add-missing-coverages-for-getTileEntity-in-order-to-.patch +++ b/Spigot-Server-Patches/0199-Add-missing-coverages-for-getTileEntity-in-order-to-.patch @@ -1,4 +1,4 @@ -From 59b994221ae889c52cdbd1e7fd0be8f8109231e2 Mon Sep 17 00:00:00 2001 +From ed98da62a8120c8914c77aa0cf02410343641fd5 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sat, 22 Jul 2017 15:22:59 +0100 Subject: [PATCH] Add missing coverages for getTileEntity in order to attempt @@ -6,10 +6,10 @@ Subject: [PATCH] Add missing coverages for getTileEntity in order to attempt diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 737ade74d..c06158e02 100644 +index e766e2536..c5da2cde3 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -238,6 +238,13 @@ public class WorldServer extends World implements IAsyncTaskHandler { +@@ -234,6 +234,13 @@ public class WorldServer extends World implements IAsyncTaskHandler { result = fixTileEntity(pos, type, result); } } diff --git a/Spigot-Server-Patches/0223-Improve-the-Saddle-API-for-Horses.patch b/Spigot-Server-Patches/0200-Improve-the-Saddle-API-for-Horses.patch similarity index 97% rename from Spigot-Server-Patches/0223-Improve-the-Saddle-API-for-Horses.patch rename to Spigot-Server-Patches/0200-Improve-the-Saddle-API-for-Horses.patch index b34d3bd4b7..c6243275b1 100644 --- a/Spigot-Server-Patches/0223-Improve-the-Saddle-API-for-Horses.patch +++ b/Spigot-Server-Patches/0200-Improve-the-Saddle-API-for-Horses.patch @@ -1,4 +1,4 @@ -From b648f2bd5daae8efe3272869f0e72f133aeeff01 Mon Sep 17 00:00:00 2001 +From c9f1909700cbc7fef19be5167ecd178b35abef4e Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 10 Dec 2016 16:24:06 -0500 Subject: [PATCH] Improve the Saddle API for Horses diff --git a/Spigot-Server-Patches/0224-Implement-ensureServerConversions-API.patch b/Spigot-Server-Patches/0201-Implement-ensureServerConversions-API.patch similarity index 71% rename from Spigot-Server-Patches/0224-Implement-ensureServerConversions-API.patch rename to Spigot-Server-Patches/0201-Implement-ensureServerConversions-API.patch index 17ce798351..c62201da29 100644 --- a/Spigot-Server-Patches/0224-Implement-ensureServerConversions-API.patch +++ b/Spigot-Server-Patches/0201-Implement-ensureServerConversions-API.patch @@ -1,4 +1,4 @@ -From 85f648495e3ba44c78f3f4e31ab8d207baf9d236 Mon Sep 17 00:00:00 2001 +From a267bc488bbe04958b64ce137b2a483737976473 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 4 May 2016 22:43:12 -0400 Subject: [PATCH] Implement ensureServerConversions API @@ -7,14 +7,13 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr to ensure it meets latest minecraft expectations. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 49ebad22e..eb6987338 100644 +index e305d663a..503dd5827 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -194,4 +194,11 @@ public final class CraftItemFactory implements ItemFactory { - public Color getDefaultLeatherColor() { - return DEFAULT_LEATHER_COLOR; +@@ -287,4 +287,10 @@ public final class CraftItemFactory implements ItemFactory { + public Material updateMaterial(ItemMeta meta, Material material) throws IllegalArgumentException { + return ((CraftMetaItem) meta).updateMaterial(material); } -+ + // Paper start + @Override + public ItemStack ensureServerConversions(ItemStack item) { diff --git a/Spigot-Server-Patches/0225-Implement-getI18NDisplayName.patch b/Spigot-Server-Patches/0202-Implement-getI18NDisplayName.patch similarity index 88% rename from Spigot-Server-Patches/0225-Implement-getI18NDisplayName.patch rename to Spigot-Server-Patches/0202-Implement-getI18NDisplayName.patch index e706433a31..e7694c172a 100644 --- a/Spigot-Server-Patches/0225-Implement-getI18NDisplayName.patch +++ b/Spigot-Server-Patches/0202-Implement-getI18NDisplayName.patch @@ -1,4 +1,4 @@ -From c4f9a656097efc7de9f9f5d001aac7fbcd5e7553 Mon Sep 17 00:00:00 2001 +From c49c483e01b88e0baaf6e43ce5732dc16eb85c24 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 4 May 2016 23:59:38 -0400 Subject: [PATCH] Implement getI18NDisplayName @@ -8,10 +8,10 @@ Currently the server only supports the English language. To override this, You must replace the language file embedded in the server jar. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index eb6987338..c2f26577c 100644 +index 503dd5827..73785830f 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -200,5 +200,18 @@ public final class CraftItemFactory implements ItemFactory { +@@ -292,5 +292,18 @@ public final class CraftItemFactory implements ItemFactory { public ItemStack ensureServerConversions(ItemStack item) { return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item)); } diff --git a/Spigot-Server-Patches/0202-Shame-on-you-Mojang.patch b/Spigot-Server-Patches/0202-Shame-on-you-Mojang.patch deleted file mode 100644 index 4cf1c6f40c..0000000000 --- a/Spigot-Server-Patches/0202-Shame-on-you-Mojang.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0c21e9ed61fa981a86ad099aabfe67586e3900e6 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 5 Feb 2017 19:17:28 -0500 -Subject: [PATCH] Shame on you Mojang - -Someone wrote some horrible code that throws a world accessing task -onto the HTTP DOWNLOADER Thread Pool, for an activity that is not even -heavy enough to warrant async operation. - -This then triggers async chunk loads! - -What in the hell were you thinking? - -diff --git a/src/main/java/net/minecraft/server/BlockBeacon.java b/src/main/java/net/minecraft/server/BlockBeacon.java -index f07ac0186..21075974d 100644 ---- a/src/main/java/net/minecraft/server/BlockBeacon.java -+++ b/src/main/java/net/minecraft/server/BlockBeacon.java -@@ -62,8 +62,8 @@ public class BlockBeacon extends BlockTileEntity { - } - - public static void c(final World world, final BlockPosition blockposition) { -- HttpUtilities.a.submit(new Runnable() { -- public void run() { -+ /*HttpUtilities.a.submit(new Runnable() { -+ public void run() {*/ // Paper - Chunk chunk = world.getChunkAtWorldCoords(blockposition); - - for (int i = blockposition.getY() - 1; i >= 0; --i) { -@@ -76,8 +76,8 @@ public class BlockBeacon extends BlockTileEntity { - IBlockData iblockdata = world.getType(blockposition1); - - if (iblockdata.getBlock() == Blocks.BEACON) { -- ((WorldServer) world).postToMainThread(new Runnable() { -- public void run() { -+ /*((WorldServer) world).postToMainThread(new Runnable() { -+ public void run() {*/ // Paper - TileEntity tileentity = world.getTileEntity(blockposition); - - if (tileentity instanceof TileEntityBeacon) { -@@ -85,12 +85,12 @@ public class BlockBeacon extends BlockTileEntity { - world.playBlockAction(blockposition, Blocks.BEACON, 1, 0); - } - -- } -- }); -+ /*} -+ });*/ // Paper - } - } - -- } -- }); -+ /*} -+ });*/ // Paper - } - } --- -2.18.0 - diff --git a/Spigot-Server-Patches/0226-GH-806-Respect-saving-disabled-before-unloading-all-.patch b/Spigot-Server-Patches/0203-GH-806-Respect-saving-disabled-before-unloading-all-.patch similarity index 78% rename from Spigot-Server-Patches/0226-GH-806-Respect-saving-disabled-before-unloading-all-.patch rename to Spigot-Server-Patches/0203-GH-806-Respect-saving-disabled-before-unloading-all-.patch index 8ab3413060..21ec3c7725 100644 --- a/Spigot-Server-Patches/0226-GH-806-Respect-saving-disabled-before-unloading-all-.patch +++ b/Spigot-Server-Patches/0203-GH-806-Respect-saving-disabled-before-unloading-all-.patch @@ -1,4 +1,4 @@ -From 356b716038e7b3ce158de43b3649518a23d50abd Mon Sep 17 00:00:00 2001 +From 33770d32be91ffa84e65d5276198a5023117242c Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 27 Jul 2017 00:06:43 -0400 Subject: [PATCH] GH-806: Respect saving disabled before unloading all chunks @@ -9,15 +9,15 @@ This behavior causes a save to occur even though saving was supposed to be turne It's triggered when Hell/End worlds are empty of players. diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0b10f1684..4af557321 100644 +index cf5c76a78..bfe2d03a5 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -220,7 +220,7 @@ public class PlayerChunkMap { +@@ -194,7 +194,7 @@ public class PlayerChunkMap { try (Timing ignored = world.timings.doChunkMapUnloadChunks.startTiming()) { // Paper WorldProvider worldprovider = this.world.worldProvider; -- if (!worldprovider.e()) { -+ if (!worldprovider.e() && !this.world.savingDisabled) { // Paper - respect saving disabled setting +- if (!worldprovider.p()) { ++ if (!worldprovider.p() && !this.world.savingDisabled) { // Paper - respect saving disabled setting this.world.getChunkProviderServer().b(); } } // Paper timing diff --git a/Spigot-Server-Patches/0227-ProfileWhitelistVerifyEvent.patch b/Spigot-Server-Patches/0204-ProfileWhitelistVerifyEvent.patch similarity index 80% rename from Spigot-Server-Patches/0227-ProfileWhitelistVerifyEvent.patch rename to Spigot-Server-Patches/0204-ProfileWhitelistVerifyEvent.patch index fe2020f158..41811d920a 100644 --- a/Spigot-Server-Patches/0227-ProfileWhitelistVerifyEvent.patch +++ b/Spigot-Server-Patches/0204-ProfileWhitelistVerifyEvent.patch @@ -1,27 +1,27 @@ -From 478ce7dd9077369efd3b2b8e90b8a537e3c0c576 Mon Sep 17 00:00:00 2001 +From a25aa26eb6453f256ec025fd0f2bd4d7e9693dba Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 3 Jul 2017 18:11:10 -0500 Subject: [PATCH] ProfileWhitelistVerifyEvent diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 3e5122486..b478f385a 100644 +index 0f39fa49f..c1de6564a 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -542,9 +542,9 @@ public abstract class PlayerList { - // return s; - if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s); // Spigot + // return chatmessage; + if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot - } else if (!this.isWhitelisted(gameprofile)) { + } else if (!this.isWhitelisted(gameprofile, event)) { // Paper - // return "You are not white-listed on this server!"; + chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted", new Object[0]); - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot + //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) { IpBanEntry ipbanentry = this.l.get(socketaddress); -@@ -1209,9 +1209,25 @@ public abstract class PlayerList { - +@@ -1183,9 +1183,25 @@ public abstract class PlayerList { + this.server.getCommandDispatcher().a(entityplayer); } + // Paper start @@ -46,7 +46,7 @@ index 3e5122486..b478f385a 100644 + // Paper end public boolean isOp(GameProfile gameprofile) { - return this.operators.d(gameprofile) || this.server.R() && this.server.worlds.get(0).getWorldData().u() && this.server.Q().equalsIgnoreCase(gameprofile.getName()) || this.u; // CraftBukkit + return this.operators.d(gameprofile) || this.server.J() && this.server.worlds.get(0).getWorldData().u() && this.server.I().equalsIgnoreCase(gameprofile.getName()) || this.u; // CraftBukkit -- 2.18.0 diff --git a/Spigot-Server-Patches/0205-Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch b/Spigot-Server-Patches/0205-Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch deleted file mode 100644 index 5a40bb6896..0000000000 --- a/Spigot-Server-Patches/0205-Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 070cf38a5cd2ad6ee121d9b8cefff5c0365e62cb Mon Sep 17 00:00:00 2001 -From: kashike -Date: Sun, 9 Apr 2017 23:50:15 -0700 -Subject: [PATCH] Fix NFE when attempting to read EMPTY ItemStack - -Thanks @gabizou - -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 736686bed..d666088f2 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -120,7 +120,7 @@ public final class ItemStack { - - // CraftBukkit - break into own method - public void load(NBTTagCompound nbttagcompound) { -- this.item = Item.b(nbttagcompound.getString("id")); -+ this.item = nbttagcompound.hasKeyOfType("id", 8) ? Item.b(nbttagcompound.getString("id")) : Item.getItemOf(Blocks.AIR); // Paper - fix NumberFormatException caused by attempting to read an EMPTY ItemStack - this.count = nbttagcompound.getByte("Count"); - // CraftBukkit start - Route through setData for filtering - // this.damage = Math.max(0, nbttagcompound.getShort("Damage")); --- -2.18.0 - diff --git a/Spigot-Server-Patches/0228-Fix-this-stupid-bullshit.patch b/Spigot-Server-Patches/0205-Fix-this-stupid-bullshit.patch similarity index 88% rename from Spigot-Server-Patches/0228-Fix-this-stupid-bullshit.patch rename to Spigot-Server-Patches/0205-Fix-this-stupid-bullshit.patch index 1dfa0dbfd9..a648cd26cb 100644 --- a/Spigot-Server-Patches/0228-Fix-this-stupid-bullshit.patch +++ b/Spigot-Server-Patches/0205-Fix-this-stupid-bullshit.patch @@ -1,4 +1,4 @@ -From 2a68cb4cbc3ea0c0286a664799ae43b26a3837be Mon Sep 17 00:00:00 2001 +From 5a776bba23f0a2dbbaff057f807a79d773625065 Mon Sep 17 00:00:00 2001 From: DemonWav Date: Sun, 6 Aug 2017 17:17:53 -0500 Subject: [PATCH] Fix this stupid bullshit @@ -9,12 +9,12 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa and to provide some level of hint without being disruptive. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index c9e8a8737..ae2c51f5d 100644 +index ac38028d7..ad0635925 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -209,10 +209,12 @@ public class Main { +@@ -215,10 +215,12 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -14); + deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/Spigot-Server-Patches/0229-Ocelot-despawns-should-honor-nametags-and-leash.patch b/Spigot-Server-Patches/0206-Ocelot-despawns-should-honor-nametags-and-leash.patch similarity index 82% rename from Spigot-Server-Patches/0229-Ocelot-despawns-should-honor-nametags-and-leash.patch rename to Spigot-Server-Patches/0206-Ocelot-despawns-should-honor-nametags-and-leash.patch index 311d2615ef..5b9aba03f7 100644 --- a/Spigot-Server-Patches/0229-Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/Spigot-Server-Patches/0206-Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -1,14 +1,14 @@ -From cee3ee7d056d74ede8ec145e8028fdff1ba18ec4 Mon Sep 17 00:00:00 2001 +From 2cf62bc719ebd8587ce2ec6971c34c82273e0e63 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Mon, 31 Jul 2017 01:54:40 -0500 Subject: [PATCH] Ocelot despawns should honor nametags and leash diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java -index 5a76821ea..858bbef5b 100644 +index 6ea276aa0..720e7bbf9 100644 --- a/src/main/java/net/minecraft/server/EntityOcelot.java +++ b/src/main/java/net/minecraft/server/EntityOcelot.java -@@ -58,7 +58,7 @@ public class EntityOcelot extends EntityTameableAnimal { +@@ -61,7 +61,7 @@ public class EntityOcelot extends EntityTameableAnimal { } protected boolean isTypeNotPersistent() { diff --git a/Spigot-Server-Patches/0230-Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/Spigot-Server-Patches/0207-Reset-spawner-timer-when-spawner-event-is-cancelled.patch similarity index 82% rename from Spigot-Server-Patches/0230-Reset-spawner-timer-when-spawner-event-is-cancelled.patch rename to Spigot-Server-Patches/0207-Reset-spawner-timer-when-spawner-event-is-cancelled.patch index 070b02d174..00e9ce89ad 100644 --- a/Spigot-Server-Patches/0230-Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ b/Spigot-Server-Patches/0207-Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -1,14 +1,14 @@ -From b6470fed3dcdea14ff3995a385bef6588bcce713 Mon Sep 17 00:00:00 2001 +From 7671826b2ecad3ea76c794af68e6b3c5af3413ce Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Mon, 31 Jul 2017 01:45:19 -0500 Subject: [PATCH] Reset spawner timer when spawner event is cancelled diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 1ed0def1e..87fe4775f 100644 +index 2b6b062c6..c76dbe74a 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -113,6 +113,9 @@ public abstract class MobSpawnerAbstract { +@@ -121,6 +121,9 @@ public abstract class MobSpawnerAbstract { { entity.fromMobSpawner = true; } @@ -18,7 +18,7 @@ index 1ed0def1e..87fe4775f 100644 if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { continue; } -@@ -123,7 +126,7 @@ public abstract class MobSpawnerAbstract { +@@ -131,7 +134,7 @@ public abstract class MobSpawnerAbstract { entityinsentient.doSpawnEffect(); } diff --git a/Spigot-Server-Patches/0232-Fix-MC-117075-TE-Unload-Lag-Spike.patch b/Spigot-Server-Patches/0208-Fix-MC-117075-TE-Unload-Lag-Spike.patch similarity index 84% rename from Spigot-Server-Patches/0232-Fix-MC-117075-TE-Unload-Lag-Spike.patch rename to Spigot-Server-Patches/0208-Fix-MC-117075-TE-Unload-Lag-Spike.patch index fb2e839fae..75c323fa8a 100644 --- a/Spigot-Server-Patches/0232-Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/Spigot-Server-Patches/0208-Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -1,14 +1,14 @@ -From bf2acf1bc8d0a4281451a2bf074bfa3b0b9956ec Mon Sep 17 00:00:00 2001 +From b69d46e941e9c3325ea3d85e3a0a667122ea3081 Mon Sep 17 00:00:00 2001 From: mezz Date: Wed, 9 Aug 2017 17:51:22 -0500 Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index b85c55168..90f946e57 100644 +index 0ba99bcbc..49e7c1589 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1572,7 +1572,11 @@ public abstract class World implements IBlockAccess { +@@ -1275,7 +1275,11 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose this.methodProfiler.c("blockEntities"); timings.tileEntityTick.startTiming(); // Spigot if (!this.tileEntityListUnload.isEmpty()) { diff --git a/Spigot-Server-Patches/0233-Allow-specifying-a-custom-authentication-servers-dow.patch b/Spigot-Server-Patches/0209-Allow-specifying-a-custom-authentication-servers-dow.patch similarity index 93% rename from Spigot-Server-Patches/0233-Allow-specifying-a-custom-authentication-servers-dow.patch rename to Spigot-Server-Patches/0209-Allow-specifying-a-custom-authentication-servers-dow.patch index a01d7bc9bf..6b4201f128 100644 --- a/Spigot-Server-Patches/0233-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/Spigot-Server-Patches/0209-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -1,4 +1,4 @@ -From abc6db5a95b3549c1203ace470c1e17cbb4a9ea3 Mon Sep 17 00:00:00 2001 +From 86fe3712509d345c377af5fd44f3615fc02db11f Mon Sep 17 00:00:00 2001 From: kashike Date: Thu, 17 Aug 2017 16:08:20 -0700 Subject: [PATCH] Allow specifying a custom "authentication servers down" kick @@ -27,10 +27,10 @@ index dbafef023..ec89ecfca 100644 + } } diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index c5434e6ba..75df92836 100644 +index bab13a4fd..d0e719f44 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -250,6 +250,10 @@ public class LoginListener implements PacketLoginInListener, ITickable { +@@ -241,6 +241,10 @@ public class LoginListener implements PacketLoginInListener, ITickable { LoginListener.this.i = LoginListener.this.a(gameprofile); LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; } else { diff --git a/Spigot-Server-Patches/0234-LivingEntity-setKiller.patch b/Spigot-Server-Patches/0210-LivingEntity-setKiller.patch similarity index 87% rename from Spigot-Server-Patches/0234-LivingEntity-setKiller.patch rename to Spigot-Server-Patches/0210-LivingEntity-setKiller.patch index b5fc153497..c48cb75248 100644 --- a/Spigot-Server-Patches/0234-LivingEntity-setKiller.patch +++ b/Spigot-Server-Patches/0210-LivingEntity-setKiller.patch @@ -1,14 +1,14 @@ -From 45af741aba1ed94d65871ea3b47cabac4184a8de Mon Sep 17 00:00:00 2001 +From 19824800f84c6e52c474bff8108d627c3395afec Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Mon, 31 Jul 2017 01:49:48 -0500 Subject: [PATCH] LivingEntity#setKiller diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index d4d51688c..a7b076377 100644 +index 7e3a9eeb2..487bb9ece 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -252,6 +252,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -254,6 +254,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity(); } diff --git a/Spigot-Server-Patches/0211-Anti-Xray.patch b/Spigot-Server-Patches/0211-Anti-Xray.patch new file mode 100644 index 0000000000..077ed7a4cf --- /dev/null +++ b/Spigot-Server-Patches/0211-Anti-Xray.patch @@ -0,0 +1,1173 @@ +From b82dea6633d58d47574612205e7181b4147ef162 Mon Sep 17 00:00:00 2001 +From: stonar96 +Date: Thu, 21 Sep 2017 00:38:47 +0200 +Subject: [PATCH] Anti-Xray + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index c80d84b9b..6344537ec 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -1,7 +1,10 @@ + package com.destroystokyo.paper; + ++import java.util.Arrays; + import java.util.List; + ++import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.ChunkEdgeMode; ++import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode; + import net.minecraft.server.MinecraftServer; + import org.bukkit.Bukkit; + import org.bukkit.configuration.file.YamlConfiguration; +@@ -361,4 +364,27 @@ public class PaperWorldConfig { + disableCreeperLingeringEffect = getBoolean("disable-creeper-lingering-effect", false); + log("Creeper lingering effect: " + disableCreeperLingeringEffect); + } ++ ++ public boolean antiXray; ++ public boolean asynchronous; ++ public EngineMode engineMode; ++ public ChunkEdgeMode chunkEdgeMode; ++ public int maxChunkSectionIndex; ++ public int updateRadius; ++ public List hiddenBlocks; ++ public List replacementBlocks; ++ private void antiXray() { ++ antiXray = getBoolean("anti-xray.enabled", false); ++ asynchronous = true; ++ engineMode = EngineMode.getById(getInt("anti-xray.engine-mode", EngineMode.HIDE.getId())); ++ engineMode = engineMode == null ? EngineMode.HIDE : engineMode; ++ chunkEdgeMode = ChunkEdgeMode.getById(getInt("anti-xray.chunk-edge-mode", ChunkEdgeMode.DEFAULT.getId())); ++ chunkEdgeMode = chunkEdgeMode == null ? ChunkEdgeMode.DEFAULT : chunkEdgeMode; ++ maxChunkSectionIndex = getInt("anti-xray.max-chunk-section-index", 3); ++ maxChunkSectionIndex = maxChunkSectionIndex > 15 ? 15 : maxChunkSectionIndex; ++ updateRadius = getInt("anti-xray.update-radius", 2); ++ hiddenBlocks = getList("anti-xray.hidden-blocks", Arrays.asList((Object) "gold_ore", "iron_ore", "coal_ore", "lapis_ore", "mossy_cobblestone", "obsidian", "chest", "diamond_ore", "redstone_ore", "lit_redstone_ore", "clay", "emerald_ore", "ender_chest")); ++ replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList((Object) "stone", "planks")); ++ log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius); ++ } + } +diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java +new file mode 100644 +index 000000000..6833cfad2 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java +@@ -0,0 +1,36 @@ ++package com.destroystokyo.paper.antixray; ++ ++import net.minecraft.server.BlockPosition; ++import net.minecraft.server.Chunk; ++import net.minecraft.server.IBlockData; ++import net.minecraft.server.PacketPlayOutMapChunk; ++import net.minecraft.server.World; ++ ++public class ChunkPacketBlockController { ++ ++ public static final ChunkPacketBlockController NO_OPERATION_INSTANCE = new ChunkPacketBlockController(); ++ ++ protected ChunkPacketBlockController() { ++ ++ } ++ ++ public IBlockData[] getPredefinedBlockData(Chunk chunk, int chunkSectionIndex) { ++ return null; ++ } ++ ++ public boolean onChunkPacketCreate(Chunk chunk, int chunkSectionSelector, boolean force) { ++ return true; ++ } ++ ++ public PacketPlayOutMapChunkInfo getPacketPlayOutMapChunkInfo(PacketPlayOutMapChunk packetPlayOutMapChunk, Chunk chunk, int chunkSectionSelector) { ++ return null; ++ } ++ ++ public void modifyBlocks(PacketPlayOutMapChunk packetPlayOutMapChunk, PacketPlayOutMapChunkInfo packetPlayOutMapChunkInfo) { ++ packetPlayOutMapChunk.setReady(true); ++ } ++ ++ public void updateNearbyBlocks(World world, BlockPosition blockPosition) { ++ ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java +new file mode 100644 +index 000000000..2dc0655a9 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java +@@ -0,0 +1,640 @@ ++package com.destroystokyo.paper.antixray; ++ ++import java.util.HashSet; ++import java.util.Set; ++import java.util.concurrent.Executors; ++import java.util.concurrent.ExecutorService; ++ ++import com.destroystokyo.paper.PaperWorldConfig; ++ ++import net.minecraft.server.Block; ++import net.minecraft.server.BlockPosition; ++import net.minecraft.server.Blocks; ++import net.minecraft.server.Chunk; ++import net.minecraft.server.ChunkSection; ++import net.minecraft.server.DataPalette; ++import net.minecraft.server.DataPaletteBlock; ++import net.minecraft.server.DataPaletteGlobal; ++import net.minecraft.server.IBlockData; ++import net.minecraft.server.PacketPlayOutMapChunk; ++import net.minecraft.server.World; ++ ++import org.bukkit.World.Environment; ++ ++public class ChunkPacketBlockControllerAntiXray extends ChunkPacketBlockController { ++ ++ private static ExecutorService executorServiceInstance = null; ++ private final ExecutorService executorService; ++ private final boolean asynchronous; ++ private final EngineMode engineMode; ++ private final ChunkEdgeMode chunkEdgeMode; ++ private final int maxChunkSectionIndex; ++ private final int updateRadius; ++ private final IBlockData[] predefinedBlockData; ++ private final IBlockData[] predefinedBlockDataStone; ++ private final IBlockData[] predefinedBlockDataNetherrack; ++ private final IBlockData[] predefinedBlockDataEndStone; ++ private final int[] predefinedBlockDataBits; ++ private final int[] predefinedBlockDataBitsGlobal; ++ private final int[] predefinedBlockDataBitsStoneGlobal; ++ private final int[] predefinedBlockDataBitsNetherrackGlobal; ++ private final int[] predefinedBlockDataBitsEndStoneGlobal; ++ private final boolean[] solidGlobal = new boolean[Block.REGISTRY_ID.size()]; ++ private final boolean[] obfuscateGlobal = new boolean[Block.REGISTRY_ID.size()]; ++ private final ChunkSection[] emptyNearbyChunkSections = {Chunk.EMPTY_CHUNK_SECTION, Chunk.EMPTY_CHUNK_SECTION, Chunk.EMPTY_CHUNK_SECTION, Chunk.EMPTY_CHUNK_SECTION}; ++ ++ public ChunkPacketBlockControllerAntiXray(PaperWorldConfig paperWorldConfig) { ++ asynchronous = paperWorldConfig.asynchronous; ++ engineMode = paperWorldConfig.engineMode; ++ chunkEdgeMode = paperWorldConfig.chunkEdgeMode; ++ maxChunkSectionIndex = paperWorldConfig.maxChunkSectionIndex; ++ updateRadius = paperWorldConfig.updateRadius; ++ ++ if (asynchronous) { ++ executorService = getExecutorServiceInstance(); ++ } else { ++ executorService = null; ++ } ++ ++ if (engineMode == EngineMode.HIDE) { ++ predefinedBlockData = null; ++ predefinedBlockDataStone = new IBlockData[] {Blocks.STONE.getBlockData()}; ++ predefinedBlockDataNetherrack = new IBlockData[] {Blocks.NETHERRACK.getBlockData()}; ++ predefinedBlockDataEndStone = new IBlockData[] {Blocks.END_STONE.getBlockData()}; ++ predefinedBlockDataBits = new int[] {1}; ++ predefinedBlockDataBitsGlobal = null; ++ predefinedBlockDataBitsStoneGlobal = new int[] {Block.REGISTRY_ID.getId(Blocks.STONE.getBlockData())}; ++ predefinedBlockDataBitsNetherrackGlobal = new int[] {Block.REGISTRY_ID.getId(Blocks.NETHERRACK.getBlockData())}; ++ predefinedBlockDataBitsEndStoneGlobal = new int[] {Block.REGISTRY_ID.getId(Blocks.END_STONE.getBlockData())}; ++ } else { ++ Set predefinedBlockDataSet = new HashSet(); ++ ++ for (Object id : paperWorldConfig.hiddenBlocks) { ++ Block block = Block.getByName(String.valueOf(id)); ++ ++ if (block != null && !block.isTileEntity()) { ++ predefinedBlockDataSet.add(block.getBlockData()); ++ } ++ } ++ ++ predefinedBlockData = predefinedBlockDataSet.size() == 0 ? new IBlockData[] {Blocks.DIAMOND_ORE.getBlockData()} : predefinedBlockDataSet.toArray(new IBlockData[predefinedBlockDataSet.size()]); ++ predefinedBlockDataStone = null; ++ predefinedBlockDataNetherrack = null; ++ predefinedBlockDataEndStone = null; ++ predefinedBlockDataBits = new int[predefinedBlockData.length]; ++ predefinedBlockDataBitsGlobal = new int[predefinedBlockData.length]; ++ boolean containsDefaultBlockData = false; ++ ++ for (int i = 0; i < predefinedBlockData.length; i++) { ++ predefinedBlockDataBits[i] = containsDefaultBlockData ? i : (containsDefaultBlockData = predefinedBlockData[i] == DataPaletteBlock.DEFAULT_BLOCK_DATA) ? 0 : i + 1; ++ predefinedBlockDataBitsGlobal[i] = Block.REGISTRY_ID.getId(predefinedBlockData[i]); ++ } ++ ++ predefinedBlockDataBitsStoneGlobal = null; ++ predefinedBlockDataBitsNetherrackGlobal = null; ++ predefinedBlockDataBitsEndStoneGlobal = null; ++ } ++ ++ for (Object id : (engineMode == EngineMode.HIDE) ? paperWorldConfig.hiddenBlocks : paperWorldConfig.replacementBlocks) { ++ Block block = Block.getByName(String.valueOf(id)); ++ ++ if (block != null) { ++ obfuscateGlobal[Block.REGISTRY_ID.getId(block.getBlockData())] = true; ++ } ++ } ++ ++ for (int i = 0; i < solidGlobal.length; i++) { ++ IBlockData blockData = Block.REGISTRY_ID.fromId(i); ++ ++ if (blockData != null) { ++ solidGlobal[i] = blockData.getBlock().isOccluding(blockData) && blockData.getBlock() != Blocks.MOB_SPAWNER && blockData.getBlock() != Blocks.BARRIER; ++ } ++ } ++ } ++ ++ private static ExecutorService getExecutorServiceInstance() { ++ if (executorServiceInstance == null) { ++ executorServiceInstance = Executors.newSingleThreadExecutor(); ++ } ++ ++ return executorServiceInstance; ++ } ++ ++ @Override ++ public IBlockData[] getPredefinedBlockData(Chunk chunk, int chunkSectionIndex) { ++ //Return the block data which should be added to the data palettes so that they can be used for the obfuscation ++ if (chunkSectionIndex <= maxChunkSectionIndex) { ++ switch (engineMode) { ++ case HIDE: ++ switch (chunk.world.getWorld().getEnvironment()) { ++ case NETHER: ++ return predefinedBlockDataNetherrack; ++ case THE_END: ++ return predefinedBlockDataEndStone; ++ default: ++ return predefinedBlockDataStone; ++ } ++ default: ++ return predefinedBlockData; ++ } ++ } ++ ++ return null; ++ } ++ ++ @Override ++ public boolean onChunkPacketCreate(Chunk chunk, int chunkSectionSelector, boolean force) { ++ //Load nearby chunks if necessary ++ if (chunkEdgeMode == ChunkEdgeMode.WAIT && !force) { ++ if (chunk.world.getChunkIfLoaded(chunk.locX - 1, chunk.locZ) == null || chunk.world.getChunkIfLoaded(chunk.locX + 1, chunk.locZ) == null || chunk.world.getChunkIfLoaded(chunk.locX, chunk.locZ - 1) == null || chunk.world.getChunkIfLoaded(chunk.locX, chunk.locZ + 1) == null) { ++ //Don't create the chunk packet now, wait until nearby chunks are loaded and create it later ++ return false; ++ } ++ } else if (chunkEdgeMode == ChunkEdgeMode.LOAD || chunkEdgeMode == ChunkEdgeMode.WAIT) { ++ chunk.world.getChunkAt(chunk.locX - 1, chunk.locZ); ++ chunk.world.getChunkAt(chunk.locX + 1, chunk.locZ); ++ chunk.world.getChunkAt(chunk.locX, chunk.locZ - 1); ++ chunk.world.getChunkAt(chunk.locX, chunk.locZ + 1); ++ } ++ ++ //Create the chunk packet now ++ return true; ++ } ++ ++ @Override ++ public PacketPlayOutMapChunkInfoAntiXray getPacketPlayOutMapChunkInfo(PacketPlayOutMapChunk packetPlayOutMapChunk, Chunk chunk, int chunkSectionSelector) { ++ //Return a new instance to collect data and objects in the right state while creating the chunk packet for thread safe access later ++ PacketPlayOutMapChunkInfoAntiXray packetPlayOutMapChunkInfoAntiXray = new PacketPlayOutMapChunkInfoAntiXray(packetPlayOutMapChunk, chunk, chunkSectionSelector, this); ++ packetPlayOutMapChunkInfoAntiXray.setNearbyChunks(chunk.world.getChunkIfLoaded(chunk.locX - 1, chunk.locZ), chunk.world.getChunkIfLoaded(chunk.locX + 1, chunk.locZ), chunk.world.getChunkIfLoaded(chunk.locX, chunk.locZ - 1), chunk.world.getChunkIfLoaded(chunk.locX, chunk.locZ + 1)); ++ return packetPlayOutMapChunkInfoAntiXray; ++ } ++ ++ @Override ++ public void modifyBlocks(PacketPlayOutMapChunk packetPlayOutMapChunk, PacketPlayOutMapChunkInfo packetPlayOutMapChunkInfo) { ++ if (asynchronous) { ++ executorService.submit((PacketPlayOutMapChunkInfoAntiXray) packetPlayOutMapChunkInfo); ++ } else { ++ obfuscate((PacketPlayOutMapChunkInfoAntiXray) packetPlayOutMapChunkInfo); ++ } ++ } ++ ++ //Actually these fields should be variables inside the obfuscate method but in sync mode or with SingleThreadExecutor in async mode it's okay ++ private final boolean[] solid = new boolean[Block.REGISTRY_ID.size()]; ++ private final boolean[] obfuscate = new boolean[Block.REGISTRY_ID.size()]; ++ //These boolean arrays represent chunk layers, true means don't obfuscate, false means obfuscate ++ private boolean[][] current = new boolean[16][16]; ++ private boolean[][] next = new boolean[16][16]; ++ private boolean[][] nextNext = new boolean[16][16]; ++ private final DataBitsReader dataBitsReader = new DataBitsReader(); ++ private final DataBitsWriter dataBitsWriter = new DataBitsWriter(); ++ private final ChunkSection[] nearbyChunkSections = new ChunkSection[4]; ++ ++ public void obfuscate(PacketPlayOutMapChunkInfoAntiXray packetPlayOutMapChunkInfoAntiXray) { ++ boolean[] solidTemp = null; ++ boolean[] obfuscateTemp = null; ++ dataBitsReader.setDataBits(packetPlayOutMapChunkInfoAntiXray.getData()); ++ dataBitsWriter.setDataBits(packetPlayOutMapChunkInfoAntiXray.getData()); ++ int counter = 0; ++ ++ for (int chunkSectionIndex = 0; chunkSectionIndex <= maxChunkSectionIndex; chunkSectionIndex++) { ++ if (packetPlayOutMapChunkInfoAntiXray.isWritten(chunkSectionIndex) && packetPlayOutMapChunkInfoAntiXray.getPredefinedBlockData(chunkSectionIndex) != null) { ++ int[] predefinedBlockDataBitsTemp = packetPlayOutMapChunkInfoAntiXray.getDataPalette(chunkSectionIndex) instanceof DataPaletteGlobal ? engineMode == EngineMode.HIDE ? packetPlayOutMapChunkInfoAntiXray.getChunk().world.getWorld().getEnvironment() == Environment.NETHER ? predefinedBlockDataBitsNetherrackGlobal : packetPlayOutMapChunkInfoAntiXray.getChunk().world.getWorld().getEnvironment() == Environment.THE_END ? predefinedBlockDataBitsEndStoneGlobal : predefinedBlockDataBitsStoneGlobal : predefinedBlockDataBitsGlobal : predefinedBlockDataBits; ++ dataBitsWriter.setIndex(packetPlayOutMapChunkInfoAntiXray.getDataBitsIndex(chunkSectionIndex)); ++ ++ //Check if the chunk section below was not obfuscated ++ if (chunkSectionIndex == 0 || !packetPlayOutMapChunkInfoAntiXray.isWritten(chunkSectionIndex - 1) || packetPlayOutMapChunkInfoAntiXray.getPredefinedBlockData(chunkSectionIndex - 1) == null) { ++ //If so, initialize some stuff ++ dataBitsReader.setBitsPerValue(packetPlayOutMapChunkInfoAntiXray.getBitsPerValue(chunkSectionIndex)); ++ dataBitsReader.setIndex(packetPlayOutMapChunkInfoAntiXray.getDataBitsIndex(chunkSectionIndex)); ++ solidTemp = readDataPalette(packetPlayOutMapChunkInfoAntiXray.getDataPalette(chunkSectionIndex), solid, solidGlobal); ++ obfuscateTemp = readDataPalette(packetPlayOutMapChunkInfoAntiXray.getDataPalette(chunkSectionIndex), obfuscate, obfuscateGlobal); ++ //Read the blocks of the upper layer of the chunk section below if it exists ++ ChunkSection belowChunkSection = null; ++ boolean skipFirstLayer = chunkSectionIndex == 0 || (belowChunkSection = packetPlayOutMapChunkInfoAntiXray.getChunk().getSections()[chunkSectionIndex - 1]) == Chunk.EMPTY_CHUNK_SECTION; ++ ++ for (int z = 0; z < 16; z++) { ++ for (int x = 0; x < 16; x++) { ++ current[z][x] = true; ++ next[z][x] = skipFirstLayer || !solidGlobal[Block.REGISTRY_ID.getId(belowChunkSection.getType(x, 15, z))]; ++ } ++ } ++ ++ //Abuse the obfuscateLayer method to read the blocks of the first layer of the current chunk section ++ dataBitsWriter.setBitsPerValue(0); ++ obfuscateLayer(-1, dataBitsReader, dataBitsWriter, solidTemp, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, emptyNearbyChunkSections, counter); ++ } ++ ++ dataBitsWriter.setBitsPerValue(packetPlayOutMapChunkInfoAntiXray.getBitsPerValue(chunkSectionIndex)); ++ nearbyChunkSections[0] = packetPlayOutMapChunkInfoAntiXray.getNearbyChunks()[0] == null ? Chunk.EMPTY_CHUNK_SECTION : packetPlayOutMapChunkInfoAntiXray.getNearbyChunks()[0].getSections()[chunkSectionIndex]; ++ nearbyChunkSections[1] = packetPlayOutMapChunkInfoAntiXray.getNearbyChunks()[1] == null ? Chunk.EMPTY_CHUNK_SECTION : packetPlayOutMapChunkInfoAntiXray.getNearbyChunks()[1].getSections()[chunkSectionIndex]; ++ nearbyChunkSections[2] = packetPlayOutMapChunkInfoAntiXray.getNearbyChunks()[2] == null ? Chunk.EMPTY_CHUNK_SECTION : packetPlayOutMapChunkInfoAntiXray.getNearbyChunks()[2].getSections()[chunkSectionIndex]; ++ nearbyChunkSections[3] = packetPlayOutMapChunkInfoAntiXray.getNearbyChunks()[3] == null ? Chunk.EMPTY_CHUNK_SECTION : packetPlayOutMapChunkInfoAntiXray.getNearbyChunks()[3].getSections()[chunkSectionIndex]; ++ ++ //Obfuscate all layers of the current chunk section except the upper one ++ for (int y = 0; y < 15; y++) { ++ boolean[][] temp = current; ++ current = next; ++ next = nextNext; ++ nextNext = temp; ++ counter = obfuscateLayer(y, dataBitsReader, dataBitsWriter, solidTemp, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, nearbyChunkSections, counter); ++ } ++ ++ //Check if the chunk section above doesn't need obfuscation ++ if (chunkSectionIndex == maxChunkSectionIndex || !packetPlayOutMapChunkInfoAntiXray.isWritten(chunkSectionIndex + 1) || packetPlayOutMapChunkInfoAntiXray.getPredefinedBlockData(chunkSectionIndex + 1) == null) { ++ //If so, obfuscate the upper layer of the current chunk section by reading blocks of the first layer from the chunk section above if it exists ++ ChunkSection aboveChunkSection; ++ ++ if (chunkSectionIndex != 15 && (aboveChunkSection = packetPlayOutMapChunkInfoAntiXray.getChunk().getSections()[chunkSectionIndex + 1]) != Chunk.EMPTY_CHUNK_SECTION) { ++ boolean[][] temp = current; ++ current = next; ++ next = nextNext; ++ nextNext = temp; ++ ++ for (int z = 0; z < 16; z++) { ++ for (int x = 0; x < 16; x++) { ++ if (!solidGlobal[Block.REGISTRY_ID.getId(aboveChunkSection.getType(x, 0, z))]) { ++ current[z][x] = true; ++ } ++ } ++ } ++ ++ //There is nothing to read anymore ++ dataBitsReader.setBitsPerValue(0); ++ solid[0] = true; ++ counter = obfuscateLayer(15, dataBitsReader, dataBitsWriter, solid, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, nearbyChunkSections, counter); ++ } ++ } else { ++ //If not, initialize the reader and other stuff for the chunk section above to obfuscate the upper layer of the current chunk section ++ dataBitsReader.setBitsPerValue(packetPlayOutMapChunkInfoAntiXray.getBitsPerValue(chunkSectionIndex + 1)); ++ dataBitsReader.setIndex(packetPlayOutMapChunkInfoAntiXray.getDataBitsIndex(chunkSectionIndex + 1)); ++ solidTemp = readDataPalette(packetPlayOutMapChunkInfoAntiXray.getDataPalette(chunkSectionIndex + 1), solid, solidGlobal); ++ obfuscateTemp = readDataPalette(packetPlayOutMapChunkInfoAntiXray.getDataPalette(chunkSectionIndex + 1), obfuscate, obfuscateGlobal); ++ boolean[][] temp = current; ++ current = next; ++ next = nextNext; ++ nextNext = temp; ++ counter = obfuscateLayer(15, dataBitsReader, dataBitsWriter, solidTemp, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, nearbyChunkSections, counter); ++ } ++ ++ dataBitsWriter.finish(); ++ } ++ } ++ ++ packetPlayOutMapChunkInfoAntiXray.getPacketPlayOutMapChunk().setReady(true); ++ } ++ ++ private int obfuscateLayer(int y, DataBitsReader dataBitsReader, DataBitsWriter dataBitsWriter, boolean[] solid, boolean[] obfuscate, int[] predefinedBlockDataBits, boolean[][] current, boolean[][] next, boolean[][] nextNext, ChunkSection[] nearbyChunkSections, int counter) { ++ //First block of first line ++ int dataBits = dataBitsReader.read(); ++ ++ if (nextNext[0][0] = !solid[dataBits]) { ++ dataBitsWriter.skip(); ++ next[0][1] = true; ++ next[1][0] = true; ++ } else { ++ if (nearbyChunkSections[2] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[2].getType(0, y, 15))] || nearbyChunkSections[0] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[0].getType(15, y, 0))] || current[0][0]) { ++ dataBitsWriter.skip(); ++ } else { ++ if (counter >= predefinedBlockDataBits.length) { ++ counter = 0; ++ } ++ ++ dataBitsWriter.write(predefinedBlockDataBits[counter++]); ++ } ++ } ++ ++ if (!obfuscate[dataBits]) { ++ next[0][0] = true; ++ } ++ ++ //First line ++ for (int x = 1; x < 15; x++) { ++ dataBits = dataBitsReader.read(); ++ ++ if (nextNext[0][x] = !solid[dataBits]) { ++ dataBitsWriter.skip(); ++ next[0][x - 1] = true; ++ next[0][x + 1] = true; ++ next[1][x] = true; ++ } else { ++ if (nearbyChunkSections[2] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[2].getType(x, y, 15))] || current[0][x]) { ++ dataBitsWriter.skip(); ++ } else { ++ if (counter >= predefinedBlockDataBits.length) { ++ counter = 0; ++ } ++ ++ dataBitsWriter.write(predefinedBlockDataBits[counter++]); ++ } ++ } ++ ++ if (!obfuscate[dataBits]) { ++ next[0][x] = true; ++ } ++ } ++ ++ //Last block of first line ++ dataBits = dataBitsReader.read(); ++ ++ if (nextNext[0][15] = !solid[dataBits]) { ++ dataBitsWriter.skip(); ++ next[0][14] = true; ++ next[1][15] = true; ++ } else { ++ if (nearbyChunkSections[2] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[2].getType(15, y, 15))] || nearbyChunkSections[1] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[1].getType(0, y, 0))] || current[0][15]) { ++ dataBitsWriter.skip(); ++ } else { ++ if (counter >= predefinedBlockDataBits.length) { ++ counter = 0; ++ } ++ ++ dataBitsWriter.write(predefinedBlockDataBits[counter++]); ++ } ++ } ++ ++ if (!obfuscate[dataBits]) { ++ next[0][15] = true; ++ } ++ ++ //All inner lines ++ for (int z = 1; z < 15; z++) { ++ //First block ++ dataBits = dataBitsReader.read(); ++ ++ if (nextNext[z][0] = !solid[dataBits]) { ++ dataBitsWriter.skip(); ++ next[z][1] = true; ++ next[z - 1][0] = true; ++ next[z + 1][0] = true; ++ } else { ++ if (nearbyChunkSections[0] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[0].getType(15, y, z))] || current[z][0]) { ++ dataBitsWriter.skip(); ++ } else { ++ if (counter >= predefinedBlockDataBits.length) { ++ counter = 0; ++ } ++ ++ dataBitsWriter.write(predefinedBlockDataBits[counter++]); ++ } ++ } ++ ++ if (!obfuscate[dataBits]) { ++ next[z][0] = true; ++ } ++ ++ //All inner blocks ++ for (int x = 1; x < 15; x++) { ++ dataBits = dataBitsReader.read(); ++ ++ if (nextNext[z][x] = !solid[dataBits]) { ++ dataBitsWriter.skip(); ++ next[z][x - 1] = true; ++ next[z][x + 1] = true; ++ next[z - 1][x] = true; ++ next[z + 1][x] = true; ++ } else { ++ if (current[z][x]) { ++ dataBitsWriter.skip(); ++ } else { ++ if (counter >= predefinedBlockDataBits.length) { ++ counter = 0; ++ } ++ ++ dataBitsWriter.write(predefinedBlockDataBits[counter++]); ++ } ++ } ++ ++ if (!obfuscate[dataBits]) { ++ next[z][x] = true; ++ } ++ } ++ ++ //Last block ++ dataBits = dataBitsReader.read(); ++ ++ if (nextNext[z][15] = !solid[dataBits]) { ++ dataBitsWriter.skip(); ++ next[z][14] = true; ++ next[z - 1][15] = true; ++ next[z + 1][15] = true; ++ } else { ++ if (nearbyChunkSections[1] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[1].getType(0, y, z))] || current[z][15]) { ++ dataBitsWriter.skip(); ++ } else { ++ if (counter >= predefinedBlockDataBits.length) { ++ counter = 0; ++ } ++ ++ dataBitsWriter.write(predefinedBlockDataBits[counter++]); ++ } ++ } ++ ++ if (!obfuscate[dataBits]) { ++ next[z][15] = true; ++ } ++ } ++ ++ //First block of last line ++ dataBits = dataBitsReader.read(); ++ ++ if (nextNext[15][0] = !solid[dataBits]) { ++ dataBitsWriter.skip(); ++ next[15][1] = true; ++ next[14][0] = true; ++ } else { ++ if (nearbyChunkSections[3] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[3].getType(0, y, 0))] || nearbyChunkSections[0] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[0].getType(15, y, 15))] || current[15][0]) { ++ dataBitsWriter.skip(); ++ } else { ++ if (counter >= predefinedBlockDataBits.length) { ++ counter = 0; ++ } ++ ++ dataBitsWriter.write(predefinedBlockDataBits[counter++]); ++ } ++ } ++ ++ if (!obfuscate[dataBits]) { ++ next[15][0] = true; ++ } ++ ++ //Last line ++ for (int x = 1; x < 15; x++) { ++ dataBits = dataBitsReader.read(); ++ ++ if (nextNext[15][x] = !solid[dataBits]) { ++ dataBitsWriter.skip(); ++ next[15][x - 1] = true; ++ next[15][x + 1] = true; ++ next[14][x] = true; ++ } else { ++ if (nearbyChunkSections[3] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[3].getType(x, y, 0))] || current[15][x]) { ++ dataBitsWriter.skip(); ++ } else { ++ if (counter >= predefinedBlockDataBits.length) { ++ counter = 0; ++ } ++ ++ dataBitsWriter.write(predefinedBlockDataBits[counter++]); ++ } ++ } ++ ++ if (!obfuscate[dataBits]) { ++ next[15][x] = true; ++ } ++ } ++ ++ //Last block of last line ++ dataBits = dataBitsReader.read(); ++ ++ if (nextNext[15][15] = !solid[dataBits]) { ++ dataBitsWriter.skip(); ++ next[15][14] = true; ++ next[14][15] = true; ++ } else { ++ if (nearbyChunkSections[3] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[3].getType(15, y, 0))] || nearbyChunkSections[1] == Chunk.EMPTY_CHUNK_SECTION || !solidGlobal[Block.REGISTRY_ID.getId(nearbyChunkSections[1].getType(0, y, 15))] || current[15][15]) { ++ dataBitsWriter.skip(); ++ } else { ++ if (counter >= predefinedBlockDataBits.length) { ++ counter = 0; ++ } ++ ++ dataBitsWriter.write(predefinedBlockDataBits[counter++]); ++ } ++ } ++ ++ if (!obfuscate[dataBits]) { ++ next[15][15] = true; ++ } ++ ++ return counter; ++ } ++ ++ private boolean[] readDataPalette(DataPalette dataPalette, boolean[] temp, boolean[] global) { ++ if (dataPalette instanceof DataPaletteGlobal) { ++ return global; ++ } ++ ++ IBlockData blockData; ++ ++ for (int i = 0; (blockData = dataPalette.getBlockData(i)) != null; i++) { ++ temp[i] = global[Block.REGISTRY_ID.getId(blockData)]; ++ } ++ ++ return temp; ++ } ++ ++ @Override ++ public void updateNearbyBlocks(World world, BlockPosition blockPosition) { ++ if (updateRadius >= 2) { ++ BlockPosition temp = blockPosition.west(); ++ updateBlock(world, temp); ++ updateBlock(world, temp.west()); ++ updateBlock(world, temp.down()); ++ updateBlock(world, temp.up()); ++ updateBlock(world, temp.north()); ++ updateBlock(world, temp.south()); ++ updateBlock(world, temp = blockPosition.east()); ++ updateBlock(world, temp.east()); ++ updateBlock(world, temp.down()); ++ updateBlock(world, temp.up()); ++ updateBlock(world, temp.north()); ++ updateBlock(world, temp.south()); ++ updateBlock(world, temp = blockPosition.down()); ++ updateBlock(world, temp.down()); ++ updateBlock(world, temp.north()); ++ updateBlock(world, temp.south()); ++ updateBlock(world, temp = blockPosition.up()); ++ updateBlock(world, temp.up()); ++ updateBlock(world, temp.north()); ++ updateBlock(world, temp.south()); ++ updateBlock(world, temp = blockPosition.north()); ++ updateBlock(world, temp.north()); ++ updateBlock(world, temp = blockPosition.south()); ++ updateBlock(world, temp.south()); ++ } else if (updateRadius == 1) { ++ updateBlock(world, blockPosition.west()); ++ updateBlock(world, blockPosition.east()); ++ updateBlock(world, blockPosition.down()); ++ updateBlock(world, blockPosition.up()); ++ updateBlock(world, blockPosition.north()); ++ updateBlock(world, blockPosition.south()); ++ } else { ++ //Do nothing if updateRadius <= 0 (test mode) ++ } ++ } ++ ++ private void updateBlock(World world, BlockPosition blockPosition) { ++ if (world.isLoaded(blockPosition)) { ++ IBlockData blockData = world.getType(blockPosition); ++ ++ if (obfuscateGlobal[Block.REGISTRY_ID.getId(blockData)]) { ++ world.notify(blockPosition, blockData, blockData, 3); ++ } ++ } ++ } ++ ++ public enum EngineMode { ++ ++ HIDE(1, "hide ores"), ++ OBFUSCATE(2, "obfuscate"); ++ ++ private final int id; ++ private final String description; ++ ++ EngineMode(int id, String description) { ++ this.id = id; ++ this.description = description; ++ } ++ ++ public static EngineMode getById(int id) { ++ for (EngineMode engineMode : values()) { ++ if (engineMode.id == id) { ++ return engineMode; ++ } ++ } ++ ++ return null; ++ } ++ ++ public int getId() { ++ return id; ++ } ++ ++ public String getDescription() { ++ return description; ++ } ++ } ++ ++ public enum ChunkEdgeMode { ++ ++ DEFAULT(1, "default"), ++ WAIT(2, "wait until nearby chunks are loaded"), ++ LOAD(3, "load nearby chunks"); ++ ++ private final int id; ++ private final String description; ++ ++ ChunkEdgeMode(int id, String description) { ++ this.id = id; ++ this.description = description; ++ } ++ ++ public static ChunkEdgeMode getById(int id) { ++ for (ChunkEdgeMode chunkEdgeMode : values()) { ++ if (chunkEdgeMode.id == id) { ++ return chunkEdgeMode; ++ } ++ } ++ ++ return null; ++ } ++ ++ public int getId() { ++ return id; ++ } ++ ++ public String getDescription() { ++ return description; ++ } ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java +new file mode 100644 +index 000000000..92399318c +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java +@@ -0,0 +1,56 @@ ++package com.destroystokyo.paper.antixray; ++ ++public class DataBitsReader { ++ ++ private byte[] dataBits; ++ private int bitsPerValue; ++ private int mask; ++ private int longInDataBitsIndex; ++ private int bitInLongIndex; ++ private long current; ++ ++ public void setDataBits(byte[] dataBits) { ++ this.dataBits = dataBits; ++ } ++ ++ public void setBitsPerValue(int bitsPerValue) { ++ this.bitsPerValue = bitsPerValue; ++ mask = (1 << bitsPerValue) - 1; ++ } ++ ++ public void setIndex(int index) { ++ this.longInDataBitsIndex = index; ++ bitInLongIndex = 0; ++ init(); ++ } ++ ++ private void init() { ++ if (dataBits.length > longInDataBitsIndex + 7) { ++ current = ((((long) dataBits[longInDataBitsIndex]) << 56) ++ | (((long) dataBits[longInDataBitsIndex + 1] & 0xff) << 48) ++ | (((long) dataBits[longInDataBitsIndex + 2] & 0xff) << 40) ++ | (((long) dataBits[longInDataBitsIndex + 3] & 0xff) << 32) ++ | (((long) dataBits[longInDataBitsIndex + 4] & 0xff) << 24) ++ | (((long) dataBits[longInDataBitsIndex + 5] & 0xff) << 16) ++ | (((long) dataBits[longInDataBitsIndex + 6] & 0xff) << 8) ++ | (((long) dataBits[longInDataBitsIndex + 7] & 0xff))); ++ } ++ } ++ ++ public int read() { ++ int value = (int) (current >>> bitInLongIndex) & mask; ++ bitInLongIndex += bitsPerValue; ++ ++ if (bitInLongIndex > 63) { ++ bitInLongIndex -= 64; ++ longInDataBitsIndex += 8; ++ init(); ++ ++ if (bitInLongIndex > 0) { ++ value |= current << bitsPerValue - bitInLongIndex & mask; ++ } ++ } ++ ++ return value; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java +new file mode 100644 +index 000000000..aca0b9d71 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java +@@ -0,0 +1,84 @@ ++package com.destroystokyo.paper.antixray; ++ ++public class DataBitsWriter { ++ ++ private byte[] dataBits; ++ private int bitsPerValue; ++ private long mask; ++ private int longInDataBitsIndex; ++ private int bitInLongIndex; ++ private long current; ++ private boolean dirty; ++ ++ public void setDataBits(byte[] dataBits) { ++ this.dataBits = dataBits; ++ } ++ ++ public void setBitsPerValue(int bitsPerValue) { ++ this.bitsPerValue = bitsPerValue; ++ mask = (1 << bitsPerValue) - 1; ++ } ++ ++ public void setIndex(int index) { ++ this.longInDataBitsIndex = index; ++ bitInLongIndex = 0; ++ init(); ++ } ++ ++ private void init() { ++ if (dataBits.length > longInDataBitsIndex + 7) { ++ current = ((((long) dataBits[longInDataBitsIndex]) << 56) ++ | (((long) dataBits[longInDataBitsIndex + 1] & 0xff) << 48) ++ | (((long) dataBits[longInDataBitsIndex + 2] & 0xff) << 40) ++ | (((long) dataBits[longInDataBitsIndex + 3] & 0xff) << 32) ++ | (((long) dataBits[longInDataBitsIndex + 4] & 0xff) << 24) ++ | (((long) dataBits[longInDataBitsIndex + 5] & 0xff) << 16) ++ | (((long) dataBits[longInDataBitsIndex + 6] & 0xff) << 8) ++ | (((long) dataBits[longInDataBitsIndex + 7] & 0xff))); ++ } ++ ++ dirty = false; ++ } ++ ++ public void finish() { ++ if (dirty && dataBits.length > longInDataBitsIndex + 7) { ++ dataBits[longInDataBitsIndex] = (byte) (current >> 56 & 0xff); ++ dataBits[longInDataBitsIndex + 1] = (byte) (current >> 48 & 0xff); ++ dataBits[longInDataBitsIndex + 2] = (byte) (current >> 40 & 0xff); ++ dataBits[longInDataBitsIndex + 3] = (byte) (current >> 32 & 0xff); ++ dataBits[longInDataBitsIndex + 4] = (byte) (current >> 24 & 0xff); ++ dataBits[longInDataBitsIndex + 5] = (byte) (current >> 16 & 0xff); ++ dataBits[longInDataBitsIndex + 6] = (byte) (current >> 8 & 0xff); ++ dataBits[longInDataBitsIndex + 7] = (byte) (current & 0xff); ++ } ++ } ++ ++ public void write(int value) { ++ current = current & ~(mask << bitInLongIndex) | (value & mask) << bitInLongIndex; ++ dirty = true; ++ bitInLongIndex += bitsPerValue; ++ ++ if (bitInLongIndex > 63) { ++ finish(); ++ bitInLongIndex -= 64; ++ longInDataBitsIndex += 8; ++ init(); ++ ++ if (bitInLongIndex > 0) { ++ current = current & ~(mask >>> bitsPerValue - bitInLongIndex) | (value & mask) >>> bitsPerValue - bitInLongIndex; ++ dirty = true; ++ } ++ } ++ } ++ ++ public void skip() { ++ bitInLongIndex += bitsPerValue; ++ ++ if (bitInLongIndex > 63) { ++ finish(); ++ bitInLongIndex -= 64; ++ longInDataBitsIndex += 8; ++ init(); ++ } ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/antixray/PacketPlayOutMapChunkInfo.java b/src/main/java/com/destroystokyo/paper/antixray/PacketPlayOutMapChunkInfo.java +new file mode 100644 +index 000000000..0bd269a07 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/antixray/PacketPlayOutMapChunkInfo.java +@@ -0,0 +1,80 @@ ++package com.destroystokyo.paper.antixray; ++ ++import net.minecraft.server.Chunk; ++import net.minecraft.server.DataPalette; ++import net.minecraft.server.IBlockData; ++import net.minecraft.server.PacketPlayOutMapChunk; ++ ++public class PacketPlayOutMapChunkInfo { ++ ++ private final PacketPlayOutMapChunk packetPlayOutMapChunk; ++ private final Chunk chunk; ++ private final int chunkSectionSelector; ++ private byte[] data; ++ private final int[] bitsPerValue = new int[16]; ++ private final DataPalette[] dataPalettes = new DataPalette[16]; ++ private final int[] dataBitsIndexes = new int[16]; ++ private final IBlockData[][] predefinedBlockData = new IBlockData[16][]; ++ ++ public PacketPlayOutMapChunkInfo(PacketPlayOutMapChunk packetPlayOutMapChunk, Chunk chunk, int chunkSectionSelector) { ++ this.packetPlayOutMapChunk = packetPlayOutMapChunk; ++ this.chunk = chunk; ++ this.chunkSectionSelector = chunkSectionSelector; ++ } ++ ++ public PacketPlayOutMapChunk getPacketPlayOutMapChunk() { ++ return packetPlayOutMapChunk; ++ } ++ ++ public Chunk getChunk() { ++ return chunk; ++ } ++ ++ public int getChunkSectionSelector() { ++ return chunkSectionSelector; ++ } ++ ++ public byte[] getData() { ++ return data; ++ } ++ ++ public void setData(byte[] data) { ++ this.data = data; ++ } ++ ++ public int getBitsPerValue(int chunkSectionIndex) { ++ return bitsPerValue[chunkSectionIndex]; ++ } ++ ++ public void setBitsPerValue(int chunkSectionIndex, int bitsPerValue) { ++ this.bitsPerValue[chunkSectionIndex] = bitsPerValue; ++ } ++ ++ public DataPalette getDataPalette(int chunkSectionIndex) { ++ return dataPalettes[chunkSectionIndex]; ++ } ++ ++ public void setDataPalette(int chunkSectionIndex, DataPalette dataPalette) { ++ dataPalettes[chunkSectionIndex] = dataPalette; ++ } ++ ++ public int getDataBitsIndex(int chunkSectionIndex) { ++ return dataBitsIndexes[chunkSectionIndex]; ++ } ++ ++ public void setDataBitsIndex(int chunkSectionIndex, int dataBitsIndex) { ++ dataBitsIndexes[chunkSectionIndex] = dataBitsIndex; ++ } ++ ++ public IBlockData[] getPredefinedBlockData(int chunkSectionIndex) { ++ return predefinedBlockData[chunkSectionIndex]; ++ } ++ ++ public void setPredefinedBlockData(int chunkSectionIndex, IBlockData[] predefinedBlockData) { ++ this.predefinedBlockData[chunkSectionIndex] = predefinedBlockData; ++ } ++ ++ public boolean isWritten(int chunkSectionIndex) { ++ return bitsPerValue[chunkSectionIndex] != 0; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/antixray/PacketPlayOutMapChunkInfoAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/PacketPlayOutMapChunkInfoAntiXray.java +new file mode 100644 +index 000000000..8ea2beb59 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/antixray/PacketPlayOutMapChunkInfoAntiXray.java +@@ -0,0 +1,28 @@ ++package com.destroystokyo.paper.antixray; ++ ++import net.minecraft.server.Chunk; ++import net.minecraft.server.PacketPlayOutMapChunk; ++ ++public class PacketPlayOutMapChunkInfoAntiXray extends PacketPlayOutMapChunkInfo implements Runnable { ++ ++ private Chunk[] nearbyChunks; ++ private final ChunkPacketBlockControllerAntiXray chunkPacketBlockControllerAntiXray; ++ ++ public PacketPlayOutMapChunkInfoAntiXray(PacketPlayOutMapChunk packetPlayOutMapChunk, Chunk chunk, int chunkSectionSelector, ChunkPacketBlockControllerAntiXray chunkPacketBlockControllerAntiXray) { ++ super(packetPlayOutMapChunk, chunk, chunkSectionSelector); ++ this.chunkPacketBlockControllerAntiXray = chunkPacketBlockControllerAntiXray; ++ } ++ ++ public Chunk[] getNearbyChunks() { ++ return nearbyChunks; ++ } ++ ++ public void setNearbyChunks(Chunk... nearbyChunks) { ++ this.nearbyChunks = nearbyChunks; ++ } ++ ++ @Override ++ public void run() { ++ chunkPacketBlockControllerAntiXray.obfuscate(this); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +index fedc38dc1..a96a2a28d 100644 +--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +@@ -862,7 +862,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { + for (int i = 0; i < nbttaglist.size(); ++i) { + NBTTagCompound nbttagcompound = nbttaglist.getCompound(i); + byte b0 = nbttagcompound.getByte("Y"); +- ChunkSection chunksection = new ChunkSection(b0 << 4, flag1); ++ ChunkSection chunksection = new ChunkSection(b0 << 4, flag1, world.chunkPacketBlockController.getPredefinedBlockData(chunk, b0)); // Paper - Anti-Xray - Add predefined block data + + chunksection.getBlocks().a(nbttagcompound, "Palette", "BlockStates"); + chunksection.a(new NibbleArray(nbttagcompound.getByteArray("BlockLight"))); +diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java +index 0fb3162e6..54df71404 100644 +--- a/src/main/java/net/minecraft/server/DataBits.java ++++ b/src/main/java/net/minecraft/server/DataBits.java +@@ -60,6 +60,7 @@ public class DataBits { + } + } + ++ public long[] getDataBits() { return this.a(); } // Paper - Anti-Xray - OBFHELPER + public long[] a() { + return this.a; + } +diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java +index c4a25bd87..b92432d50 100644 +--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +@@ -75,6 +75,7 @@ public class EntityFallingBlock extends Entity { + blockposition = new BlockPosition(this); + if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { + this.world.setAir(blockposition); ++ this.world.chunkPacketBlockController.updateNearbyBlocks(this.world, blockposition); // Paper - Anti-Xray + } else if (!this.world.isClientSide) { + this.die(); + return; +@@ -140,6 +141,7 @@ public class EntityFallingBlock extends Entity { + return; + } + this.world.setTypeAndData(blockposition, this.block, 3); ++ this.world.chunkPacketBlockController.updateNearbyBlocks(this.world, blockposition); // Paper - Anti-Xray + // CraftBukkit end + if (block instanceof BlockFalling) { + ((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata); +diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java +index 2652b1575..09f90450a 100644 +--- a/src/main/java/net/minecraft/server/Explosion.java ++++ b/src/main/java/net/minecraft/server/Explosion.java +@@ -234,6 +234,7 @@ public class Explosion { + blockposition = (BlockPosition) iterator.next(); + IBlockData iblockdata = this.world.getType(blockposition); + Block block = iblockdata.getBlock(); ++ this.world.chunkPacketBlockController.updateNearbyBlocks(this.world, blockposition); // Paper - Anti-Xray + + if (flag) { + double d0 = (double) ((float) blockposition.getX() + this.world.random.nextFloat()); +diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java +index d04afceb7..02ab42a64 100644 +--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java +@@ -33,6 +33,7 @@ public class PacketDataSerializer extends ByteBuf { + this.a = bytebuf; + } + ++ public static int countBytes(int i) { return PacketDataSerializer.a(i); } // Paper - Anti-Xray - OBFHELPER + public static int a(int i) { + for (int j = 1; j < 5; ++j) { + if ((i & -1 << j * 7) == 0) { +diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +index 344b95233..32b790397 100644 +--- a/src/main/java/net/minecraft/server/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/PlayerChunk.java +@@ -108,6 +108,8 @@ public class PlayerChunk { + return false; + } else if (!this.chunk.isReady()) { + return false; ++ } else if (!this.chunk.world.chunkPacketBlockController.onChunkPacketCreate(this.chunk, '\uffff', false)) { // Paper - Anti-Xray - Load nearby chunks if necessary ++ return false; // Paper - Anti-Xray - Wait and try again later + } else { + this.dirtyCount = 0; + this.h = 0; +@@ -128,6 +130,7 @@ public class PlayerChunk { + + public void sendChunk(EntityPlayer entityplayer) { + if (this.done) { ++ this.chunk.world.chunkPacketBlockController.onChunkPacketCreate(this.chunk, '\uffff', true); // Paper - Anti-Xray - Load nearby chunks if necessary + entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(this.chunk, '\uffff')); + this.playerChunkMap.getWorld().getTracker().a(entityplayer, this.chunk); + } +@@ -192,6 +195,8 @@ public class PlayerChunk { + this.a(this.playerChunkMap.getWorld().getTileEntity(blockposition)); + } + } else if (this.dirtyCount == 64) { ++ // Paper - Anti-Xray - Loading chunks here could cause a ConcurrentModificationException #1104 ++ //this.chunk.world.chunkPacketBlockController.onChunkPacketCreate(this.chunk, this.h, true); // Paper - Anti-Xray - Load nearby chunks if necessary + this.a((Packet) (new PacketPlayOutMapChunk(this.chunk, this.h))); + } else { + this.a((Packet) (new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, this.chunk))); +diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java +index e34198e40..ce8f76871 100644 +--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java +@@ -201,6 +201,8 @@ public class PlayerInteractManager { + } + + } ++ ++ this.world.chunkPacketBlockController.updateNearbyBlocks(this.world, blockposition); // Paper - Anti-Xray + } + + public void a(BlockPosition blockposition) { +diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java +index ef332d651..35c3edca4 100644 +--- a/src/main/java/net/minecraft/server/RegistryBlockID.java ++++ b/src/main/java/net/minecraft/server/RegistryBlockID.java +@@ -56,6 +56,7 @@ public class RegistryBlockID implements Registry { + return Iterators.filter(this.c.iterator(), Predicates.notNull()); + } + ++ public int size() { return this.a(); } // Paper - Anti-Xray - OBFHELPER + public int a() { + return this.b.size(); + } +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 49e7c1589..62fd2e503 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -39,6 +39,8 @@ import org.bukkit.generator.ChunkGenerator; + // CraftBukkit end + // Paper start + import java.util.Set; ++import com.destroystokyo.paper.antixray.ChunkPacketBlockController; // Anti-Xray ++import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; // Anti-Xray + import com.google.common.collect.Sets; + // Paper end + public abstract class World implements GeneratorAccess, IIBlockAccess, AutoCloseable { +@@ -136,6 +138,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + + public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper ++ public final ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + + public final co.aikar.timings.WorldTimingsHandler timings; // Paper + private boolean guardEntityList; // Spigot +@@ -161,6 +164,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) { + this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot + this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper ++ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.generator = gen; + this.world = new CraftWorld((WorldServer) this, gen, env); + this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit +@@ -500,6 +504,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + ((IWorldAccess) this.v.get(j)).a(this, blockposition, iblockdata, iblockdata1, i); + } + ++ this.chunkPacketBlockController.updateNearbyBlocks(this, blockposition); // Paper - Anti-Xray + } + + public void update(BlockPosition blockposition, Block block) { +-- +2.18.0 + diff --git a/Spigot-Server-Patches/0236-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch b/Spigot-Server-Patches/0212-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch similarity index 89% rename from Spigot-Server-Patches/0236-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch rename to Spigot-Server-Patches/0212-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch index afe2711a0f..3298fe0a47 100644 --- a/Spigot-Server-Patches/0236-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch +++ b/Spigot-Server-Patches/0212-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch @@ -1,4 +1,4 @@ -From 8ea6c7c92ee771c81f1b19594919eda513a1c96e Mon Sep 17 00:00:00 2001 +From 6cc7c93bda7908b2e6ae798ec6d95e8fc93aab97 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Mon, 18 Sep 2017 12:00:03 +0200 Subject: [PATCH] Use Log4j IOStreams to redirect System.out/err to logger @@ -12,10 +12,10 @@ results in a separate line, even though it should not result in a line break. Log4j's implementation handles it correctly. diff --git a/pom.xml b/pom.xml -index 26775156b..adf79de70 100644 +index 4dd5fed25..1b4877868 100644 --- a/pom.xml +++ b/pom.xml -@@ -97,6 +97,13 @@ +@@ -90,6 +90,13 @@ runtime @@ -30,10 +30,10 @@ index 26775156b..adf79de70 100644 junit diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index b3f1aa999..854455711 100644 +index 069eb7d68..7ff2fa535 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -129,8 +129,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -135,8 +135,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer */ // Paper end diff --git a/Spigot-Server-Patches/0237-Handle-plugin-prefixes-using-Log4J-configuration.patch b/Spigot-Server-Patches/0213-Handle-plugin-prefixes-using-Log4J-configuration.patch similarity index 94% rename from Spigot-Server-Patches/0237-Handle-plugin-prefixes-using-Log4J-configuration.patch rename to Spigot-Server-Patches/0213-Handle-plugin-prefixes-using-Log4J-configuration.patch index 9af6b03502..9a6b2bf25c 100644 --- a/Spigot-Server-Patches/0237-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/Spigot-Server-Patches/0213-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -1,4 +1,4 @@ -From 48096c9ea13e424b5a060679092bc4b7007dfa19 Mon Sep 17 00:00:00 2001 +From 55ceed112f6f100a68cb3e3e57eedcdb352252ac Mon Sep 17 00:00:00 2001 From: Minecrell Date: Thu, 21 Sep 2017 16:14:55 +0200 Subject: [PATCH] Handle plugin prefixes using Log4J configuration @@ -15,10 +15,10 @@ This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. diff --git a/pom.xml b/pom.xml -index adf79de70..1639621d7 100644 +index 1b4877868..a98abca8e 100644 --- a/pom.xml +++ b/pom.xml -@@ -94,7 +94,7 @@ +@@ -87,7 +87,7 @@ org.apache.logging.log4j log4j-core 2.8.1 @@ -28,10 +28,10 @@ index adf79de70..1639621d7 100644 diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 9ce3e1365..cc1f3ac96 100644 +index 9a1ffed07..b39096f04 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -282,7 +282,7 @@ public class SpigotConfig +@@ -286,7 +286,7 @@ public class SpigotConfig private static void playerSample() { playerSample = getInt( "settings.sample-count", 12 ); diff --git a/Spigot-Server-Patches/0238-Include-Log4J2-SLF4J-implementation.patch b/Spigot-Server-Patches/0214-Include-Log4J2-SLF4J-implementation.patch similarity index 84% rename from Spigot-Server-Patches/0238-Include-Log4J2-SLF4J-implementation.patch rename to Spigot-Server-Patches/0214-Include-Log4J2-SLF4J-implementation.patch index 3d0aa63d63..40f5861a19 100644 --- a/Spigot-Server-Patches/0238-Include-Log4J2-SLF4J-implementation.patch +++ b/Spigot-Server-Patches/0214-Include-Log4J2-SLF4J-implementation.patch @@ -1,14 +1,14 @@ -From e0bcbbb023b13d0dfcfd1ee15bb807617cd1973f Mon Sep 17 00:00:00 2001 +From a42bf6eda3c9b215f4cd88153370471bcb7c1588 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Thu, 21 Sep 2017 16:33:35 +0200 Subject: [PATCH] Include Log4J2 SLF4J implementation diff --git a/pom.xml b/pom.xml -index 1639621d7..bf04f6d12 100644 +index a98abca8e..9354f6edf 100644 --- a/pom.xml +++ b/pom.xml -@@ -98,6 +98,12 @@ +@@ -91,6 +91,12 @@ diff --git a/Spigot-Server-Patches/0239-Disable-logger-prefix-for-various-plugins-bypassing-.patch b/Spigot-Server-Patches/0215-Disable-logger-prefix-for-various-plugins-bypassing-.patch similarity index 97% rename from Spigot-Server-Patches/0239-Disable-logger-prefix-for-various-plugins-bypassing-.patch rename to Spigot-Server-Patches/0215-Disable-logger-prefix-for-various-plugins-bypassing-.patch index c605dd3c7f..93ffd4eb0d 100644 --- a/Spigot-Server-Patches/0239-Disable-logger-prefix-for-various-plugins-bypassing-.patch +++ b/Spigot-Server-Patches/0215-Disable-logger-prefix-for-various-plugins-bypassing-.patch @@ -1,4 +1,4 @@ -From 5ffc7918dcf0fcd87916342ddb568352e56ba098 Mon Sep 17 00:00:00 2001 +From b008d0b333f3e32534337fb21f75c9f69ee42298 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Sat, 23 Sep 2017 21:07:20 +0200 Subject: [PATCH] Disable logger prefix for various plugins bypassing the diff --git a/Spigot-Server-Patches/0240-Add-PlayerJumpEvent.patch b/Spigot-Server-Patches/0216-Add-PlayerJumpEvent.patch similarity index 81% rename from Spigot-Server-Patches/0240-Add-PlayerJumpEvent.patch rename to Spigot-Server-Patches/0216-Add-PlayerJumpEvent.patch index e5570e9497..beb39fdc64 100644 --- a/Spigot-Server-Patches/0240-Add-PlayerJumpEvent.patch +++ b/Spigot-Server-Patches/0216-Add-PlayerJumpEvent.patch @@ -1,38 +1,39 @@ -From 1ada468a04f4567237b4180c750ed48915b44997 Mon Sep 17 00:00:00 2001 +From a1241df8d09b0b85541b860c16da86cdd179ecf3 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 28 Sep 2017 17:21:44 -0400 Subject: [PATCH] Add PlayerJumpEvent diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index deb0f4a9c..579996d1e 100644 +index 85e617979..8cf082d2e 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1399,6 +1399,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1460,6 +1460,7 @@ public abstract class EntityHuman extends EntityLiving { + return 0; + } - public void b(List list) {} - -+ public void jump() { this.cu(); } // Paper - OBFHELPER - public void cu() { - super.cu(); - this.b(StatisticList.w); ++ public void jump() { this.cG(); } // Paper - OBFHELPER + public void cG() { + super.cG(); + this.a(StatisticList.JUMP); diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 3104fc0ea..aa57ff8ed 100644 +index 128b2beb5..2255b8ccb 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -57,6 +57,7 @@ import org.bukkit.inventory.EquipmentSlot; +@@ -57,6 +57,8 @@ import org.bukkit.inventory.CraftingInventory; + import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.InventoryView; import org.bukkit.util.NumberConversions; - import com.destroystokyo.paper.event.player.IllegalPacketEvent; // Paper ++import com.destroystokyo.paper.event.player.IllegalPacketEvent; // Paper +import com.destroystokyo.paper.event.player.PlayerJumpEvent; // Paper import co.aikar.timings.MinecraftTimings; // Paper // CraftBukkit end -@@ -584,7 +585,34 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -860,7 +862,34 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { d8 = d5 - this.p; d9 = d6 - this.q; - if (this.player.onGround && !packetplayinflying.a() && d8 > 0.0D) { -- this.player.cu(); + if (this.player.onGround && !packetplayinflying.b() && d8 > 0.0D) { +- this.player.cG(); + // Paper start - Add player jump event + Player player = this.getPlayer(); + Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. diff --git a/Spigot-Server-Patches/0241-handle-PacketPlayInKeepAlive-async.patch b/Spigot-Server-Patches/0217-handle-PacketPlayInKeepAlive-async.patch similarity index 65% rename from Spigot-Server-Patches/0241-handle-PacketPlayInKeepAlive-async.patch rename to Spigot-Server-Patches/0217-handle-PacketPlayInKeepAlive-async.patch index 3f12db1cd2..c9b5679ad6 100644 --- a/Spigot-Server-Patches/0241-handle-PacketPlayInKeepAlive-async.patch +++ b/Spigot-Server-Patches/0217-handle-PacketPlayInKeepAlive-async.patch @@ -1,4 +1,4 @@ -From cab4c50ff2db0b82c32afadb8075dc5e5b3b5bad Mon Sep 17 00:00:00 2001 +From 178e48e8c8947d049eff7f417a7ad7bce60abcf3 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 5 Oct 2017 01:54:07 +0100 Subject: [PATCH] handle PacketPlayInKeepAlive async @@ -15,25 +15,23 @@ also adding some additional logging in order to help work out what is causing random disconnections for clients. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 08211a54c..72474a88e 100644 +index 2255b8ccb..20bac8bc3 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2231,14 +2231,20 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2465,14 +2465,18 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } public void a(PacketPlayInKeepAlive packetplayinkeepalive) { -- PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.x()); // CraftBukkit -+ //PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.x()); // CraftBukkit // Paper - This shouldn't be on the main thread - if (this.g && packetplayinkeepalive.a() == this.h) { - int i = (int) (this.d() - this.f); +- PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.getWorldServer()); // CraftBukkit ++ PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.getWorldServer()); // CraftBukkit // Paper - This shouldn't be on the main thread + if (this.g && packetplayinkeepalive.b() == this.h) { + int i = (int) (SystemUtils.b() - this.f); this.player.ping = (this.player.ping * 3 + i) / 4; this.g = false; - } else if (!this.player.getName().equals(this.minecraftServer.Q())) { + } else if (!this.player.getDisplayName().getString().equals(this.minecraftServer.I())) { - this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); + // Paper start - This needs to be handled on the main thread for plugins -+ PlayerConnection.LOGGER.warn("{} sent an invalid keepalive! pending keepalive: {} got id: {} expected id: {}", -+ this.player.getName(), this.isPendingPing(), packetplayinkeepalive.a(), this.getKeepAliveID()); + minecraftServer.postToMainThread(() -> { + this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); + }); @@ -42,5 +40,5 @@ index 08211a54c..72474a88e 100644 } -- -2.17.1 +2.18.0 diff --git a/Spigot-Server-Patches/0242-Expose-client-protocol-version-and-virtual-host.patch b/Spigot-Server-Patches/0218-Expose-client-protocol-version-and-virtual-host.patch similarity index 90% rename from Spigot-Server-Patches/0242-Expose-client-protocol-version-and-virtual-host.patch rename to Spigot-Server-Patches/0218-Expose-client-protocol-version-and-virtual-host.patch index 2d0c1ab7cd..7d8ec0e044 100644 --- a/Spigot-Server-Patches/0242-Expose-client-protocol-version-and-virtual-host.patch +++ b/Spigot-Server-Patches/0218-Expose-client-protocol-version-and-virtual-host.patch @@ -1,4 +1,4 @@ -From f50072ea408132ad91ddd246ba91c1b7417998ab Mon Sep 17 00:00:00 2001 +From 5b0a2495dcd70a2f5d5930a2d2b77eb42476b696 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Tue, 10 Oct 2017 18:45:20 +0200 Subject: [PATCH] Expose client protocol version and virtual host @@ -61,7 +61,7 @@ index 000000000..5caca6439 + +} diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 309ab18df..c583ab7d9 100644 +index 088ec198e..bc34cd687 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java @@ -15,6 +15,7 @@ public class HandshakeListener implements PacketHandshakingInListener { @@ -73,7 +73,7 @@ index 309ab18df..c583ab7d9 100644 public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { this.a = minecraftserver; @@ -130,6 +131,10 @@ public class HandshakeListener implements PacketHandshakingInListener { - throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.a()); + throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.b()); } + // Paper start - NetworkClient implementation @@ -84,13 +84,13 @@ index 309ab18df..c583ab7d9 100644 public void a(IChatBaseComponent ichatbasecomponent) {} diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 2eddb68d7..b93a26e8f 100644 +index 5b0d83a1d..424464d09 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -75,6 +75,10 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - private IChatBaseComponent n; - private boolean o; - private boolean p; +@@ -63,6 +63,10 @@ public class NetworkManager extends SimpleChannelInboundHandler> { + private float t; + private int u; + private boolean v; + // Paper start - NetworkClient implementation + public int protocolVersion; + public java.net.InetSocketAddress virtualHost; @@ -99,22 +99,22 @@ index 2eddb68d7..b93a26e8f 100644 public NetworkManager(EnumProtocolDirection enumprotocoldirection) { this.h = enumprotocoldirection; diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -index aececa39d..1d4ba3b3d 100644 +index 7acdac55e..f1a3be69d 100644 --- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java @@ -33,6 +33,7 @@ public class PacketHandshakingInSetProtocol implements Packet Date: Sun, 15 Oct 2017 00:29:07 +0100 Subject: [PATCH] revert serverside behavior of keepalives @@ -17,10 +17,10 @@ from networking or during connections flood of chunk packets on slower clients, at the cost of dead connections being kept open for longer. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 869a2b402..284db9b9e 100644 +index 20bac8bc3..4f9b4afdf 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -68,7 +68,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -69,7 +69,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { private final MinecraftServer minecraftServer; public EntityPlayer player; private int e; @@ -30,36 +30,35 @@ index 869a2b402..284db9b9e 100644 private long h; private void setKeepAliveID(long keepAliveID) { this.h = keepAliveID;}; private long getKeepAliveID() {return this.h; }; // Paper - OBFHELPER // CraftBukkit start - multithreaded fields @@ -100,6 +100,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + private int E; private int receivedMovePackets; private int processedMovePackets; - private AutoRecipe H = new AutoRecipe(); + private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { this.minecraftServer = minecraftserver; -@@ -179,18 +180,25 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -179,18 +180,26 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } this.minecraftServer.methodProfiler.a("keepAlive"); -- long i = this.d(); +- long i = SystemUtils.b(); - - if (i - this.f >= 25000L) { // CraftBukkit - if (this.g) { -- this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); ++ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings ++ // This should effectively place the keepalive handling back to "as it was" before 1.12.2 ++ long currentTime = SystemUtils.b(); ++ long elapsedTime = currentTime - this.getLastPing(); ++ ++ if (this.isPendingPing()) { ++ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected ++ PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info + this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); - } else { - this.g = true; - this.f = i; - this.h = i; - this.sendPacket(new PacketPlayOutKeepAlive(this.h)); -+ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings -+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2 -+ long currentTime = this.getCurrentMillis(); -+ long elapsedTime = currentTime - this.getLastPing(); -+ if (this.isPendingPing()) { -+ // We're pending a ping from the client -+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected -+ PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info -+ this.disconnect(new ChatMessage("disconnect.timeout")); + } + } else { + if (elapsedTime >= 15000L) { // 15 seconds @@ -67,11 +66,12 @@ index 869a2b402..284db9b9e 100644 + this.setLastPing(currentTime); + this.setKeepAliveID(currentTime); + this.sendPacket(new PacketPlayOutKeepAlive(this.getKeepAliveID())); ++ } } + // Paper end - this.minecraftServer.methodProfiler.b(); + this.minecraftServer.methodProfiler.e(); // CraftBukkit start -- 2.18.0 diff --git a/Spigot-Server-Patches/0244-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch b/Spigot-Server-Patches/0220-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch similarity index 95% rename from Spigot-Server-Patches/0244-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch rename to Spigot-Server-Patches/0220-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch index 4e5023a433..f422c5388b 100644 --- a/Spigot-Server-Patches/0244-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch +++ b/Spigot-Server-Patches/0220-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch @@ -1,4 +1,4 @@ -From 5cfd4e4387b394d8f49204d8cba5b5f410fb2443 Mon Sep 17 00:00:00 2001 +From e4db85ca803dca548540899a64b1a3cb998a9f34 Mon Sep 17 00:00:00 2001 From: Brokkonaut Date: Fri, 20 Oct 2017 04:33:45 +0200 Subject: [PATCH] Replace HashSet with fastutil's ObjectOpenHashSet in diff --git a/Spigot-Server-Patches/0245-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/Spigot-Server-Patches/0221-Send-attack-SoundEffects-only-to-players-who-can-see.patch similarity index 64% rename from Spigot-Server-Patches/0245-Send-attack-SoundEffects-only-to-players-who-can-see.patch rename to Spigot-Server-Patches/0221-Send-attack-SoundEffects-only-to-players-who-can-see.patch index a33a0b156c..0dbcdc9d44 100644 --- a/Spigot-Server-Patches/0245-Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/Spigot-Server-Patches/0221-Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -1,4 +1,4 @@ -From 446ba2913490acc93574cbe8dab2ad241e3bdfc6 Mon Sep 17 00:00:00 2001 +From 93f41c5654fff04e051aa2e2879a0dc47d58eb36 Mon Sep 17 00:00:00 2001 From: Brokkonaut Date: Tue, 31 Oct 2017 03:26:18 +0100 Subject: [PATCH] Send attack SoundEffects only to players who can see the @@ -6,11 +6,11 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 579996d1e..347237055 100644 +index 8cf082d2e..34e79e7ca 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -939,6 +939,15 @@ public abstract class EntityHuman extends EntityLiving { - this.j = 0; +@@ -981,6 +981,15 @@ public abstract class EntityHuman extends EntityLiving { + this.k = 0; } + // Paper start - send SoundEffect to everyone who can see fromEntity @@ -23,59 +23,59 @@ index 579996d1e..347237055 100644 + // Paper end + public void attack(Entity entity) { - if (entity.bd()) { + if (entity.bk()) { if (!entity.t(this)) { -@@ -963,7 +972,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1005,7 +1014,7 @@ public abstract class EntityHuman extends EntityLiving { int i = b0 + EnchantmentManager.b((EntityLiving) this); if (this.isSprinting() && flag) { -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fw, this.bK(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fw, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.bV(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility ++i; flag1 = true; } -@@ -1041,7 +1050,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1083,7 +1092,7 @@ public abstract class EntityHuman extends EntityLiving { } } -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fz, this.bK(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fz, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility - this.cX(); +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.bV(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility + this.dk(); } -@@ -1071,15 +1080,15 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1113,15 +1122,15 @@ public abstract class EntityHuman extends EntityLiving { } if (flag2) { -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fv, this.bK(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fv, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_CRIT, this.bV(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_CRIT, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility this.a(entity); } if (!flag2 && !flag3) { if (flag) { -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fy, this.bK(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fy, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_STRONG, this.bV(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_STRONG, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility } else { -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fA, this.bK(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fA, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_WEAK, this.bV(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_WEAK, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility } } -@@ -1135,7 +1144,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1177,7 +1186,7 @@ public abstract class EntityHuman extends EntityLiving { this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value } else { -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fx, this.bK(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fx, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_NODAMAGE, this.bV(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_NODAMAGE, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility if (flag4) { entity.extinguish(); } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index ea67b61b2..29dffc3ac 100644 +index 62fd2e503..b9472dddb 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1061,6 +1061,12 @@ public abstract class World implements IBlockAccess { +@@ -921,6 +921,12 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose this.a(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1); } @@ -86,8 +86,8 @@ index ea67b61b2..29dffc3ac 100644 + // Paper end + public void a(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1) { - for (int i = 0; i < this.u.size(); ++i) { - ((IWorldAccess) this.u.get(i)).a(entityhuman, soundeffect, soundcategory, d0, d1, d2, f, f1); + for (int i = 0; i < this.v.size(); ++i) { + ((IWorldAccess) this.v.get(i)).a(entityhuman, soundeffect, soundcategory, d0, d1, d2, f, f1); -- 2.18.0 diff --git a/Spigot-Server-Patches/0246-Option-for-maximum-exp-value-when-merging-orbs.patch b/Spigot-Server-Patches/0222-Option-for-maximum-exp-value-when-merging-orbs.patch similarity index 90% rename from Spigot-Server-Patches/0246-Option-for-maximum-exp-value-when-merging-orbs.patch rename to Spigot-Server-Patches/0222-Option-for-maximum-exp-value-when-merging-orbs.patch index c998118c46..4a1996ab95 100644 --- a/Spigot-Server-Patches/0246-Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/Spigot-Server-Patches/0222-Option-for-maximum-exp-value-when-merging-orbs.patch @@ -1,14 +1,14 @@ -From d3ad905c6a3156cbf9484834eea088efb106b4dd Mon Sep 17 00:00:00 2001 +From c52d751e0ac64d6c3226967fade0c7f8a3477abb Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Fri, 10 Nov 2017 23:03:12 -0500 Subject: [PATCH] Option for maximum exp value when merging orbs diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4d30cdbc8..535a8d3ed 100644 +index 6344537ec..33743f8fd 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -457,4 +457,10 @@ public class PaperWorldConfig { +@@ -387,4 +387,10 @@ public class PaperWorldConfig { replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList((Object) "stone", "planks")); log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius); } @@ -20,10 +20,10 @@ index 4d30cdbc8..535a8d3ed 100644 + } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 29dffc3ac..2c69ae748 100644 +index b9472dddb..d28d4a9a7 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1143,16 +1143,30 @@ public abstract class World implements IBlockAccess { +@@ -999,16 +999,30 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose EntityExperienceOrb xp = (EntityExperienceOrb) entity; double radius = spigotConfig.expMerge; if (radius > 0) { diff --git a/Spigot-Server-Patches/0247-Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/0223-Add-PlayerArmorChangeEvent.patch similarity index 93% rename from Spigot-Server-Patches/0247-Add-PlayerArmorChangeEvent.patch rename to Spigot-Server-Patches/0223-Add-PlayerArmorChangeEvent.patch index 8a04bbb536..d9cea86ad0 100644 --- a/Spigot-Server-Patches/0247-Add-PlayerArmorChangeEvent.patch +++ b/Spigot-Server-Patches/0223-Add-PlayerArmorChangeEvent.patch @@ -1,11 +1,11 @@ -From 967b71010b6429abb9d4c8f2dbc62b2424d510d7 Mon Sep 17 00:00:00 2001 +From 568b43a97065e32c9d26cf7c18f800f92ea1a2e6 Mon Sep 17 00:00:00 2001 From: pkt77 Date: Fri, 10 Nov 2017 23:46:34 -0500 Subject: [PATCH] Add PlayerArmorChangeEvent diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 44335fd2d..9adcabd4f 100644 +index f4a766800..401410b87 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -1,5 +1,6 @@ @@ -15,7 +15,7 @@ index 44335fd2d..9adcabd4f 100644 import com.google.common.base.Objects; import com.google.common.collect.Maps; import java.util.Collection; -@@ -1932,6 +1933,13 @@ public abstract class EntityLiving extends Entity { +@@ -1968,6 +1969,13 @@ public abstract class EntityLiving extends Entity { ItemStack itemstack1 = this.getEquipment(enumitemslot); if (!ItemStack.matches(itemstack1, itemstack)) { diff --git a/Spigot-Server-Patches/0249-Prevent-logins-from-being-processed-when-the-player-.patch b/Spigot-Server-Patches/0224-Prevent-logins-from-being-processed-when-the-player-.patch similarity index 85% rename from Spigot-Server-Patches/0249-Prevent-logins-from-being-processed-when-the-player-.patch rename to Spigot-Server-Patches/0224-Prevent-logins-from-being-processed-when-the-player-.patch index b7e3884261..570605b594 100644 --- a/Spigot-Server-Patches/0249-Prevent-logins-from-being-processed-when-the-player-.patch +++ b/Spigot-Server-Patches/0224-Prevent-logins-from-being-processed-when-the-player-.patch @@ -1,4 +1,4 @@ -From b8d15e70c042d8aea4b93a01c127b6189dedde3b Mon Sep 17 00:00:00 2001 +From 4f82679db4ed81dfc4163a485d432942cf91b666 Mon Sep 17 00:00:00 2001 From: killme Date: Sun, 12 Nov 2017 19:40:01 +0100 Subject: [PATCH] Prevent logins from being processed when the player has @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent logins from being processed when the player has diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 75df92836..eaac25dc3 100644 +index d0e719f44..7dbc6f437 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -60,7 +60,11 @@ public class LoginListener implements PacketLoginInListener, ITickable { +@@ -57,7 +57,11 @@ public class LoginListener implements PacketLoginInListener, ITickable { } // Paper end if (this.g == LoginListener.EnumProtocolState.READY_TO_ACCEPT) { diff --git a/Spigot-Server-Patches/0250-use-CB-BlockState-implementations-for-captured-block.patch b/Spigot-Server-Patches/0225-use-CB-BlockState-implementations-for-captured-block.patch similarity index 66% rename from Spigot-Server-Patches/0250-use-CB-BlockState-implementations-for-captured-block.patch rename to Spigot-Server-Patches/0225-use-CB-BlockState-implementations-for-captured-block.patch index 2b7eea7ff6..a02b098eb8 100644 --- a/Spigot-Server-Patches/0250-use-CB-BlockState-implementations-for-captured-block.patch +++ b/Spigot-Server-Patches/0225-use-CB-BlockState-implementations-for-captured-block.patch @@ -1,4 +1,4 @@ -From 59316f81fc224550436b7d841068d234a68ab9ae Mon Sep 17 00:00:00 2001 +From 2cd84e469938fb0e15b04c28eadcfeadb4c52116 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 16 Nov 2017 12:12:41 +0000 Subject: [PATCH] use CB BlockState implementations for captured blocks @@ -18,16 +18,15 @@ the blockstate that will be valid for restoration, as opposed to dropping information on restoration when the event is cancelled. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 2c69ae748..39b90fb4c 100644 +index d28d4a9a7..069ba83db 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -393,7 +393,8 @@ public abstract class World implements IBlockAccess { +@@ -378,7 +378,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose // CraftBukkit start - capture blockstates - BlockState blockstate = null; + CraftBlockState blockstate = null; if (this.captureBlockStates) { -- blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), i); -+ //blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), i); // Paper -+ blockstate = world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState(); // Paper - use CB getState to get a suitable snapshot +- blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(this, blockposition, i); ++ blockstate = (CraftBlockState) world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState(); // Paper - use CB getState to get a suitable snapshot this.capturedBlockStates.add(blockstate); } // CraftBukkit end diff --git a/Spigot-Server-Patches/0251-API-to-get-a-BlockState-without-a-snapshot.patch b/Spigot-Server-Patches/0226-API-to-get-a-BlockState-without-a-snapshot.patch similarity index 80% rename from Spigot-Server-Patches/0251-API-to-get-a-BlockState-without-a-snapshot.patch rename to Spigot-Server-Patches/0226-API-to-get-a-BlockState-without-a-snapshot.patch index 33ac6f3473..8f3c53032e 100644 --- a/Spigot-Server-Patches/0251-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/Spigot-Server-Patches/0226-API-to-get-a-BlockState-without-a-snapshot.patch @@ -1,4 +1,4 @@ -From 955230d3e8ac631d5b64a60aab4c0c97dc0e95ba Mon Sep 17 00:00:00 2001 +From f8f600aca85e9770c953f6264c789d368377cee3 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 6 Nov 2017 21:08:22 -0500 Subject: [PATCH] API to get a BlockState without a snapshot @@ -13,10 +13,10 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE If Tile Entity was null, correct Sign to return empty lines instead of null diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 358c99227..5b5f102e2 100644 +index 2cfe2202e..909432d51 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -285,7 +285,12 @@ public abstract class TileEntity implements KeyedObject { +@@ -203,7 +203,12 @@ public abstract class TileEntity implements KeyedObject { } // CraftBukkit start - add method @@ -29,7 +29,7 @@ index 358c99227..5b5f102e2 100644 if (world == null) return null; // Spigot start org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()); -@@ -294,7 +299,7 @@ public abstract class TileEntity implements KeyedObject { +@@ -212,7 +217,7 @@ public abstract class TileEntity implements KeyedObject { return null; } // Spigot end @@ -38,28 +38,13 @@ index 358c99227..5b5f102e2 100644 if (state instanceof InventoryHolder) return (InventoryHolder) state; return null; } -diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index 54b719d91..3f2c5b2d5 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySign.java -+++ b/src/main/java/net/minecraft/server/TileEntitySign.java -@@ -60,7 +60,7 @@ public class TileEntitySign extends TileEntity { - } - - public MinecraftServer C_() { -- return TileEntitySign.this.world.getMinecraftServer(); -+ return MinecraftServer.getServer(); // Paper - world may be null - } - }; - diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 46670c346..a9d3f12bc 100644 +index bfed2d988..d1eea2133 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -260,7 +260,22 @@ public class CraftBlock implements Block { - } +@@ -267,6 +267,20 @@ public class CraftBlock implements Block { } -+ public BlockState getState() { + // Paper start - allow disabling the use of snapshots + return getState(true); @@ -79,10 +64,10 @@ index 46670c346..a9d3f12bc 100644 switch (material) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 266f87d7f..fe112812d 100644 +index 0558cafe3..d4d9c5fc5 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -@@ -22,20 +22,40 @@ public class CraftBlockEntityState extends CraftBlockState +@@ -23,20 +23,40 @@ public class CraftBlockEntityState extends CraftBlockState CraftWorld world = (CraftWorld) this.getWorld(); this.tileEntity = tileEntityClass.cast(world.getTileEntityAt(this.getX(), this.getY(), this.getZ())); @@ -91,10 +76,10 @@ index 266f87d7f..fe112812d 100644 + if (DISABLE_SNAPSHOT) { + this.snapshot = this.tileEntity; + } else { -+ this.snapshot = this.createSnapshot(this.tileEntity); ++ this.snapshot = this.createSnapshot(this.tileEntity, world.getHandle()); + } // copy tile entity data: -- this.snapshot = this.createSnapshot(tileEntity); +- this.snapshot = this.createSnapshot(tileEntity, world.getHandle()); - this.load(snapshot); + if(this.snapshot != null) { + this.load(this.snapshot); @@ -116,10 +101,10 @@ index 266f87d7f..fe112812d 100644 + if (DISABLE_SNAPSHOT) { + this.snapshot = this.tileEntity; + } else { -+ this.snapshot = this.createSnapshot(this.tileEntity); ++ this.snapshot = this.createSnapshot(this.tileEntity, null); + } // copy tile entity data: -- this.snapshot = this.createSnapshot(tileEntity); +- this.snapshot = this.createSnapshot(tileEntity, null); - this.load(snapshot); + if(this.snapshot != null) { + this.load(this.snapshot); @@ -127,7 +112,7 @@ index 266f87d7f..fe112812d 100644 + // Paper end } - private T createSnapshot(T tileEntity) { + private T createSnapshot(T tileEntity, World world) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java index 7a8d44529..97b4e6910 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java diff --git a/Spigot-Server-Patches/0252-AsyncTabCompleteEvent.patch b/Spigot-Server-Patches/0252-AsyncTabCompleteEvent.patch deleted file mode 100644 index 23c28acffa..0000000000 --- a/Spigot-Server-Patches/0252-AsyncTabCompleteEvent.patch +++ /dev/null @@ -1,143 +0,0 @@ -From d6b423ce8aea858a4e606fd70e440b302706c6f5 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 26 Nov 2017 13:19:58 -0500 -Subject: [PATCH] AsyncTabCompleteEvent - -Let plugins be able to control tab completion of commands and chat async. - -This will be useful for frameworks like ACF so we can define async safe completion handlers, -and avoid going to main for tab completions. - -Especially useful if you need to query a database in order to obtain the results for tab -completion, such as offline players. - -Also adds isCommand and getLocation to the sync TabCompleteEvent - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index e01013efd..74a665142 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2277,24 +2277,51 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - // CraftBukkit end - } - -- public void a(PacketPlayInTabComplete packetplayintabcomplete) { -- PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.x()); -+ // Paper start - async tab completion -+ public void a(PacketPlayInTabComplete packet) { - // CraftBukkit start - if (chatSpamField.addAndGet(this, 10) > 500 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { -- this.disconnect(new ChatMessage("disconnect.spam", new Object[0])); -+ minecraftServer.postToMainThread(() -> 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(); - -- while (iterator.hasNext()) { -- String s = (String) iterator.next(); -+ com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event; -+ java.util.List completions = new ArrayList<>(); -+ BlockPosition blockpos = packet.b(); -+ String buffer = packet.a(); -+ boolean isCommand = buffer.startsWith("/") || packet.c(); -+ event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getPlayer(), completions, -+ buffer, isCommand, blockpos != null ? MCUtil.toLocation(player.world, blockpos) : null); -+ event.callEvent(); -+ completions = event.isCancelled() ? com.google.common.collect.ImmutableList.of() : event.getCompletions(); -+ if (event.isCancelled() || event.isHandled()) { -+ // Still fire sync event with the provided completions, if someone is listening -+ if (!event.isCancelled() && org.bukkit.event.server.TabCompleteEvent.getHandlerList().getRegisteredListeners().length > 0) { -+ java.util.List finalCompletions = completions; -+ Waitable> syncCompletions = new Waitable>() { -+ @Override -+ protected java.util.List evaluate() { -+ org.bukkit.event.server.TabCompleteEvent syncEvent = new org.bukkit.event.server.TabCompleteEvent(PlayerConnection.this.getPlayer(), buffer, finalCompletions, isCommand, blockpos != null ? MCUtil.toLocation(player.world, blockpos) : null); -+ return syncEvent.callEvent() ? syncEvent.getCompletions() : com.google.common.collect.ImmutableList.of(); -+ } -+ }; -+ server.getServer().processQueue.add(syncCompletions); -+ try { -+ completions = syncCompletions.get(); -+ } catch (InterruptedException | ExecutionException e1) { -+ e1.printStackTrace(); -+ } -+ } - -- arraylist.add(s); -+ this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete(completions.toArray(new String[completions.size()]))); -+ return; - } -- -- this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete((String[]) arraylist.toArray(new String[arraylist.size()]))); -+ minecraftServer.postToMainThread(() -> { -+ java.util.List syncCompletions = this.minecraftServer.tabCompleteCommand(this.player, buffer, blockpos, isCommand); -+ this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete(syncCompletions.toArray(new String[syncCompletions.size()]))); -+ }); -+ // Paper end - } - - public void a(PacketPlayInSettings packetplayinsettings) { -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 2dd7ed96a..e86c16755 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1643,8 +1643,8 @@ public final class CraftServer implements Server { - } else { - offers = tabCompleteChat(player, message); - } -- -- TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers); -+ -+ TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers, message.startsWith("/") || forceCommand, pos != null ? MCUtil.toLocation(((CraftWorld) player.getWorld()).getHandle(), pos) : null); // Paper - getPluginManager().callEvent(tabEvent); - - return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions(); -diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java -index 1e3aae3b8..95d13c146 100644 ---- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java -+++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java -@@ -28,6 +28,39 @@ public class ConsoleCommandCompleter implements Completer { - public void complete(LineReader reader, ParsedLine line, List candidates) { - final CraftServer server = this.server.server; - final String buffer = line.line(); -+ // Async Tab Complete -+ com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event; -+ java.util.List completions = new java.util.ArrayList<>(); -+ event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(server.getConsoleSender(), completions, -+ buffer, true, null); -+ event.callEvent(); -+ completions = event.isCancelled() ? com.google.common.collect.ImmutableList.of() : event.getCompletions(); -+ -+ if (event.isCancelled() || event.isHandled()) { -+ // Still fire sync event with the provided completions, if someone is listening -+ if (!event.isCancelled() && TabCompleteEvent.getHandlerList().getRegisteredListeners().length > 0) { -+ List finalCompletions = completions; -+ Waitable> syncCompletions = new Waitable>() { -+ @Override -+ protected List evaluate() { -+ org.bukkit.event.server.TabCompleteEvent syncEvent = new org.bukkit.event.server.TabCompleteEvent(server.getConsoleSender(), buffer, finalCompletions); -+ return syncEvent.callEvent() ? syncEvent.getCompletions() : com.google.common.collect.ImmutableList.of(); -+ } -+ }; -+ server.getServer().processQueue.add(syncCompletions); -+ try { -+ completions = syncCompletions.get(); -+ } catch (InterruptedException | ExecutionException e1) { -+ e1.printStackTrace(); -+ } -+ } -+ -+ if (!completions.isEmpty()) { -+ candidates.addAll(completions.stream().map(Candidate::new).collect(java.util.stream.Collectors.toList())); -+ } -+ return; -+ } -+ - // Paper end - Waitable> waitable = new Waitable>() { - @Override --- -2.17.1 - diff --git a/Spigot-Server-Patches/0253-Avoid-NPE-in-PathfinderGoalTempt.patch b/Spigot-Server-Patches/0253-Avoid-NPE-in-PathfinderGoalTempt.patch deleted file mode 100644 index bbc853dbd4..0000000000 --- a/Spigot-Server-Patches/0253-Avoid-NPE-in-PathfinderGoalTempt.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 9879e7c10bb47f2cfaa41d001896592517a6b429 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 29 Nov 2017 22:18:54 -0500 -Subject: [PATCH] Avoid NPE in PathfinderGoalTempt - - -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java -index 188825d19..8004f3a3f 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java -@@ -54,7 +54,7 @@ public class PathfinderGoalTempt extends PathfinderGoal { - } - this.target = (event.getTarget() == null) ? null : ((CraftLivingEntity) event.getTarget()).getHandle(); - } -- return tempt; -+ return tempt && this.target != null; // Paper - must have target - plugin might of cancelled - // CraftBukkit end - } - } --- -2.18.0 - diff --git a/Spigot-Server-Patches/0200-Do-not-allow-a-zero-max-height-in-BiomeJungle.patch b/removed/0200-Do-not-allow-a-zero-max-height-in-BiomeJungle.patch similarity index 100% rename from Spigot-Server-Patches/0200-Do-not-allow-a-zero-max-height-in-BiomeJungle.patch rename to removed/0200-Do-not-allow-a-zero-max-height-in-BiomeJungle.patch diff --git a/Spigot-Server-Patches/0231-MC-94186-Fix-dragon-egg-falling-in-lazy-chunks.patch b/removed/0231-MC-94186-Fix-dragon-egg-falling-in-lazy-chunks.patch similarity index 100% rename from Spigot-Server-Patches/0231-MC-94186-Fix-dragon-egg-falling-in-lazy-chunks.patch rename to removed/0231-MC-94186-Fix-dragon-egg-falling-in-lazy-chunks.patch diff --git a/Spigot-Server-Patches/0235-Anti-Xray.patch b/removed/0235-Anti-Xray.patch similarity index 100% rename from Spigot-Server-Patches/0235-Anti-Xray.patch rename to removed/0235-Anti-Xray.patch diff --git a/Spigot-Server-Patches/0248-Improve-Structures-Checking.patch b/removed/0248-Improve-Structures-Checking.patch similarity index 100% rename from Spigot-Server-Patches/0248-Improve-Structures-Checking.patch rename to removed/0248-Improve-Structures-Checking.patch