From 8ac3123f9fa1e6a89fe880194adb4b18effa7fae Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Thu, 25 Jun 2020 06:11:48 -0700 Subject: [PATCH] even even more work --- ...> 0142-Do-not-let-armorstands-drown.patch} | 16 ++-- ...e-async-calls-to-restart-the-server.patch} | 22 ++--- ...roperty-to-disable-book-size-limits.patch} | 0 ...e-parrots-stay-on-shoulders-despite.patch} | 8 +- ...-option-to-prevent-player-names-fro.patch} | 4 +- ...leAppender-for-console-improvements.patch} | 60 ++++++------ ...rable-option-to-disable-creeper-lin.patch} | 4 +- ....patch => 0149-Item-canEntityPickup.patch} | 10 +- ...layerPickupItemEvent-setFlyAtPlayer.patch} | 8 +- ...> 0151-PlayerAttemptPickupItemEvent.patch} | 4 +- ...tch => 0152-Add-UnknownCommandEvent.patch} | 10 +- ...tch => 0153-Basic-PlayerProfile-API.patch} | 83 +++++++++-------- ... 0154-Shoulder-Entities-Release-API.patch} | 8 +- ...patch => 0155-Profile-Lookup-Events.patch} | 13 ++- ...layer-logins-during-server-shutdown.patch} | 4 +- ...patch => 0157-Entity-fromMobSpawner.patch} | 14 +-- ...8-Improve-the-Saddle-API-for-Horses.patch} | 4 +- ...plement-ensureServerConversions-API.patch} | 4 +- ...> 0160-Implement-getI18NDisplayName.patch} | 27 ++++-- ...=> 0161-ProfileWhitelistVerifyEvent.patch} | 15 ++- ...ch => 0162-Fix-this-stupid-bullshit.patch} | 4 +- ...wns-should-honor-nametags-and-leash.patch} | 4 +- ...mer-when-spawner-event-is-cancelled.patch} | 2 +- ...5-Fix-MC-117075-TE-Unload-Lag-Spike.patch} | 4 +- ...a-custom-authentication-servers-dow.patch} | 6 +- ...atch => 0167-LivingEntity-setKiller.patch} | 12 +-- ...ms-to-redirect-System.out-err-to-lo.patch} | 6 +- ...-prefixes-using-Log4J-configuration.patch} | 2 +- ...Include-Log4J2-SLF4J-implementation.patch} | 2 +- ...-Log4J-Configuration-Plugin-Loggers.patch} | 0 ...t.patch => 0172-Add-PlayerJumpEvent.patch} | 8 +- ...-handle-PacketPlayInKeepAlive-async.patch} | 7 +- ...t-protocol-version-and-virtual-host.patch} | 18 +--- ...t-serverside-behavior-of-keepalives.patch} | 18 ++-- ...Effects-only-to-players-who-can-see.patch} | 20 ++-- ...maximum-exp-value-when-merging-orbs.patch} | 4 +- .../0178-Add-PlayerArmorChangeEvent.patch | 43 +++++++++ .../0179-Add-PlayerArmorChangeEvent.patch | 43 --------- ...om-being-processed-when-the-player-.patch} | 6 +- ...-implementations-for-captured-block.patch} | 12 +-- ...get-a-BlockState-without-a-snapshot.patch} | 6 +- ...patch => 0182-AsyncTabCompleteEvent.patch} | 32 +++---- ...83-Avoid-NPE-in-PathfinderGoalTempt.patch} | 2 +- ...=> 0184-PlayerPickupExperienceEvent.patch} | 12 +-- ...tch => 0185-ExperienceOrbMergeEvent.patch} | 4 +- ...-Ability-to-apply-mending-to-XP-API.patch} | 14 +-- ...max-squid-spawn-height-configurable.patch} | 4 +- .../0188-PreCreatureSpawnEvent.patch | 92 +++++++++++++++++++ ...-PlayerNaturallySpawnCreaturesEvent.patch} | 22 ++--- .../0189-PreCreatureSpawnEvent.patch | 87 ------------------ ...Add-setPlayerProfile-API-for-Skulls.patch} | 0 ...> 0191-Fill-Profile-Property-Events.patch} | 7 +- ...layerAdvancementCriterionGrantEvent.patch} | 6 +- ...ch => 0193-Add-ArmorStand-Item-Meta.patch} | 4 +- ...Extend-Player-Interact-cancellation.patch} | 23 +++-- ... 0195-Tameable-getOwnerUniqueId-API.patch} | 4 +- ...-crits-helps-mitigate-hacked-client.patch} | 4 +- ...ing-location-from-InventoryEnderChe.patch} | 2 +- ...sted-Ice-from-loading-holding-chunks.patch | 31 +++++++ ...e-Explicit-Network-Manager-Flushing.patch} | 4 +- ...sted-Ice-from-loading-holding-chunks.patch | 30 ------ ...t-extended-PaperServerListPingEvent.patch} | 18 ++-- ... 0201-Improved-Async-Task-Scheduler.patch} | 0 ...-PlayerProfile-in-AsyncPreLoginEven.patch} | 8 +- 64 files changed, 486 insertions(+), 469 deletions(-) rename Spigot-Server-Patches/{0143-Do-not-let-armorstands-drown.patch => 0142-Do-not-let-armorstands-drown.patch} (70%) rename Spigot-Server-Patches/{0144-Properly-handle-async-calls-to-restart-the-server.patch => 0143-Properly-handle-async-calls-to-restart-the-server.patch} (93%) rename Spigot-Server-Patches/{0145-Add-system-property-to-disable-book-size-limits.patch => 0144-Add-system-property-to-disable-book-size-limits.patch} (100%) rename Spigot-Server-Patches/{0146-Add-option-to-make-parrots-stay-on-shoulders-despite.patch => 0145-Add-option-to-make-parrots-stay-on-shoulders-despite.patch} (89%) rename Spigot-Server-Patches/{0147-Add-configuration-option-to-prevent-player-names-fro.patch => 0146-Add-configuration-option-to-prevent-player-names-fro.patch} (91%) rename Spigot-Server-Patches/{0148-Use-TerminalConsoleAppender-for-console-improvements.patch => 0147-Use-TerminalConsoleAppender-for-console-improvements.patch} (91%) rename Spigot-Server-Patches/{0149-provide-a-configurable-option-to-disable-creeper-lin.patch => 0148-provide-a-configurable-option-to-disable-creeper-lin.patch} (91%) rename Spigot-Server-Patches/{0150-Item-canEntityPickup.patch => 0149-Item-canEntityPickup.patch} (85%) rename Spigot-Server-Patches/{0151-PlayerPickupItemEvent-setFlyAtPlayer.patch => 0150-PlayerPickupItemEvent-setFlyAtPlayer.patch} (88%) rename Spigot-Server-Patches/{0152-PlayerAttemptPickupItemEvent.patch => 0151-PlayerAttemptPickupItemEvent.patch} (91%) rename Spigot-Server-Patches/{0153-Add-UnknownCommandEvent.patch => 0152-Add-UnknownCommandEvent.patch} (83%) rename Spigot-Server-Patches/{0154-Basic-PlayerProfile-API.patch => 0153-Basic-PlayerProfile-API.patch} (90%) rename Spigot-Server-Patches/{0155-Shoulder-Entities-Release-API.patch => 0154-Shoulder-Entities-Release-API.patch} (92%) rename Spigot-Server-Patches/{0156-Profile-Lookup-Events.patch => 0155-Profile-Lookup-Events.patch} (90%) rename Spigot-Server-Patches/{0157-Block-player-logins-during-server-shutdown.patch => 0156-Block-player-logins-during-server-shutdown.patch} (85%) rename Spigot-Server-Patches/{0158-Entity-fromMobSpawner.patch => 0157-Entity-fromMobSpawner.patch} (85%) rename Spigot-Server-Patches/{0159-Improve-the-Saddle-API-for-Horses.patch => 0158-Improve-the-Saddle-API-for-Horses.patch} (94%) rename Spigot-Server-Patches/{0160-Implement-ensureServerConversions-API.patch => 0159-Implement-ensureServerConversions-API.patch} (86%) rename Spigot-Server-Patches/{0161-Implement-getI18NDisplayName.patch => 0160-Implement-getI18NDisplayName.patch} (64%) rename Spigot-Server-Patches/{0162-ProfileWhitelistVerifyEvent.patch => 0161-ProfileWhitelistVerifyEvent.patch} (82%) rename Spigot-Server-Patches/{0163-Fix-this-stupid-bullshit.patch => 0162-Fix-this-stupid-bullshit.patch} (91%) rename Spigot-Server-Patches/{0164-Ocelot-despawns-should-honor-nametags-and-leash.patch => 0163-Ocelot-despawns-should-honor-nametags-and-leash.patch} (85%) rename Spigot-Server-Patches/{0165-Reset-spawner-timer-when-spawner-event-is-cancelled.patch => 0164-Reset-spawner-timer-when-spawner-event-is-cancelled.patch} (93%) rename Spigot-Server-Patches/{0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch => 0165-Fix-MC-117075-TE-Unload-Lag-Spike.patch} (87%) rename Spigot-Server-Patches/{0167-Allow-specifying-a-custom-authentication-servers-dow.patch => 0166-Allow-specifying-a-custom-authentication-servers-dow.patch} (91%) rename Spigot-Server-Patches/{0168-LivingEntity-setKiller.patch => 0167-LivingEntity-setKiller.patch} (82%) rename Spigot-Server-Patches/{0169-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch => 0168-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch} (88%) rename Spigot-Server-Patches/{0170-Handle-plugin-prefixes-using-Log4J-configuration.patch => 0169-Handle-plugin-prefixes-using-Log4J-configuration.patch} (97%) rename Spigot-Server-Patches/{0171-Include-Log4J2-SLF4J-implementation.patch => 0170-Include-Log4J2-SLF4J-implementation.patch} (88%) rename Spigot-Server-Patches/{0172-Improve-Log4J-Configuration-Plugin-Loggers.patch => 0171-Improve-Log4J-Configuration-Plugin-Loggers.patch} (100%) rename Spigot-Server-Patches/{0173-Add-PlayerJumpEvent.patch => 0172-Add-PlayerJumpEvent.patch} (90%) rename Spigot-Server-Patches/{0174-handle-PacketPlayInKeepAlive-async.patch => 0173-handle-PacketPlayInKeepAlive-async.patch} (85%) rename Spigot-Server-Patches/{0175-Expose-client-protocol-version-and-virtual-host.patch => 0174-Expose-client-protocol-version-and-virtual-host.patch} (86%) rename Spigot-Server-Patches/{0176-revert-serverside-behavior-of-keepalives.patch => 0175-revert-serverside-behavior-of-keepalives.patch} (93%) rename Spigot-Server-Patches/{0177-Send-attack-SoundEffects-only-to-players-who-can-see.patch => 0176-Send-attack-SoundEffects-only-to-players-who-can-see.patch} (89%) rename Spigot-Server-Patches/{0178-Option-for-maximum-exp-value-when-merging-orbs.patch => 0177-Option-for-maximum-exp-value-when-merging-orbs.patch} (95%) create mode 100644 Spigot-Server-Patches/0178-Add-PlayerArmorChangeEvent.patch delete mode 100644 Spigot-Server-Patches/0179-Add-PlayerArmorChangeEvent.patch rename Spigot-Server-Patches/{0180-Prevent-logins-from-being-processed-when-the-player-.patch => 0179-Prevent-logins-from-being-processed-when-the-player-.patch} (83%) rename Spigot-Server-Patches/{0181-use-CB-BlockState-implementations-for-captured-block.patch => 0180-use-CB-BlockState-implementations-for-captured-block.patch} (87%) rename Spigot-Server-Patches/{0182-API-to-get-a-BlockState-without-a-snapshot.patch => 0181-API-to-get-a-BlockState-without-a-snapshot.patch} (94%) rename Spigot-Server-Patches/{0183-AsyncTabCompleteEvent.patch => 0182-AsyncTabCompleteEvent.patch} (83%) rename Spigot-Server-Patches/{0184-Avoid-NPE-in-PathfinderGoalTempt.patch => 0183-Avoid-NPE-in-PathfinderGoalTempt.patch} (90%) rename Spigot-Server-Patches/{0185-PlayerPickupExperienceEvent.patch => 0184-PlayerPickupExperienceEvent.patch} (70%) rename Spigot-Server-Patches/{0186-ExperienceOrbMergeEvent.patch => 0185-ExperienceOrbMergeEvent.patch} (91%) rename Spigot-Server-Patches/{0187-Ability-to-apply-mending-to-XP-API.patch => 0186-Ability-to-apply-mending-to-XP-API.patch} (87%) rename Spigot-Server-Patches/{0188-Make-max-squid-spawn-height-configurable.patch => 0187-Make-max-squid-spawn-height-configurable.patch} (92%) create mode 100644 Spigot-Server-Patches/0188-PreCreatureSpawnEvent.patch rename Spigot-Server-Patches/{0190-PlayerNaturallySpawnCreaturesEvent.patch => 0189-PlayerNaturallySpawnCreaturesEvent.patch} (82%) delete mode 100644 Spigot-Server-Patches/0189-PreCreatureSpawnEvent.patch rename Spigot-Server-Patches/{0191-Add-setPlayerProfile-API-for-Skulls.patch => 0190-Add-setPlayerProfile-API-for-Skulls.patch} (100%) rename Spigot-Server-Patches/{0192-Fill-Profile-Property-Events.patch => 0191-Fill-Profile-Property-Events.patch} (90%) rename Spigot-Server-Patches/{0193-PlayerAdvancementCriterionGrantEvent.patch => 0192-PlayerAdvancementCriterionGrantEvent.patch} (83%) rename Spigot-Server-Patches/{0194-Add-ArmorStand-Item-Meta.patch => 0193-Add-ArmorStand-Item-Meta.patch} (98%) rename Spigot-Server-Patches/{0195-Extend-Player-Interact-cancellation.patch => 0194-Extend-Player-Interact-cancellation.patch} (73%) rename Spigot-Server-Patches/{0196-Tameable-getOwnerUniqueId-API.patch => 0195-Tameable-getOwnerUniqueId-API.patch} (88%) rename Spigot-Server-Patches/{0197-Toggleable-player-crits-helps-mitigate-hacked-client.patch => 0196-Toggleable-player-crits-helps-mitigate-hacked-client.patch} (91%) rename Spigot-Server-Patches/{0198-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch => 0197-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch} (92%) create mode 100644 Spigot-Server-Patches/0198-Prevent-Frosted-Ice-from-loading-holding-chunks.patch rename Spigot-Server-Patches/{0200-Disable-Explicit-Network-Manager-Flushing.patch => 0199-Disable-Explicit-Network-Manager-Flushing.patch} (90%) delete mode 100644 Spigot-Server-Patches/0199-Prevent-Frosted-Ice-from-loading-holding-chunks.patch rename Spigot-Server-Patches/{0201-Implement-extended-PaperServerListPingEvent.patch => 0200-Implement-extended-PaperServerListPingEvent.patch} (95%) rename Spigot-Server-Patches/{0202-Improved-Async-Task-Scheduler.patch => 0201-Improved-Async-Task-Scheduler.patch} (100%) rename Spigot-Server-Patches/{0203-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch => 0202-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch} (89%) diff --git a/Spigot-Server-Patches/0143-Do-not-let-armorstands-drown.patch b/Spigot-Server-Patches/0142-Do-not-let-armorstands-drown.patch similarity index 70% rename from Spigot-Server-Patches/0143-Do-not-let-armorstands-drown.patch rename to Spigot-Server-Patches/0142-Do-not-let-armorstands-drown.patch index 2be226b13..7d674d774 100644 --- a/Spigot-Server-Patches/0143-Do-not-let-armorstands-drown.patch +++ b/Spigot-Server-Patches/0142-Do-not-let-armorstands-drown.patch @@ -5,7 +5,7 @@ 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 176af6c889fa29d5df7c822f888cdc26f81110e6..992d7bfb0fd26540fbdeaf8d7845e8c2c81d608b 100644 +index 3571ef9ac1299702ad274aad43070abf959bf9d9..0232ffba7b18174e0ce44d91285541a9869d07b9 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java @@ -826,5 +826,10 @@ public class EntityArmorStand extends EntityLiving { @@ -20,22 +20,22 @@ index 176af6c889fa29d5df7c822f888cdc26f81110e6..992d7bfb0fd26540fbdeaf8d7845e8c2 // Paper end } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index f4d68a5f0a6d28f278596cb6787d070bacd792a4..28d873d8fe7bb79d2a84eb9bf234ac8ba0223813 100644 +index 0799f3b025c25204fddfd818b314ec1452a1ba1a..34f2821a64c7893ff0a8c33ae4b77ce883227f0c 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -227,6 +227,7 @@ public abstract class EntityLiving extends Entity { +@@ -244,6 +244,7 @@ public abstract class EntityLiving extends Entity { super.a(d0, flag, iblockdata, blockposition); } -+ public boolean canBreatheUnderwater() { return this.cB(); } // Paper - OBFHELPER - public boolean cB() { ++ public boolean canBreatheUnderwater() { return this.cL(); } // Paper - OBFHELPER + public boolean cL() { return this.getMonsterType() == EnumMonsterType.UNDEAD; } -@@ -266,7 +267,7 @@ public abstract class EntityLiving extends Entity { +@@ -287,7 +288,7 @@ public abstract class EntityLiving extends Entity { if (this.isAlive()) { - if (this.a(TagsFluid.WATER) && this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).getBlock() != Blocks.BUBBLE_COLUMN) { -- if (!this.cB() && !MobEffectUtil.c(this) && !flag1) { + if (this.a((Tag) TagsFluid.WATER) && !this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).a(Blocks.BUBBLE_COLUMN)) { +- if (!this.cL() && !MobEffectUtil.c(this) && !flag1) { + if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER so it can be overridden this.setAirTicks(this.l(this.getAirTicks())); if (this.getAirTicks() == -20) { diff --git a/Spigot-Server-Patches/0144-Properly-handle-async-calls-to-restart-the-server.patch b/Spigot-Server-Patches/0143-Properly-handle-async-calls-to-restart-the-server.patch similarity index 93% rename from Spigot-Server-Patches/0144-Properly-handle-async-calls-to-restart-the-server.patch rename to Spigot-Server-Patches/0143-Properly-handle-async-calls-to-restart-the-server.patch index 778148024..647a8d42d 100644 --- a/Spigot-Server-Patches/0144-Properly-handle-async-calls-to-restart-the-server.patch +++ b/Spigot-Server-Patches/0143-Properly-handle-async-calls-to-restart-the-server.patch @@ -30,18 +30,18 @@ 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 629304c403c596bf81dd8de919f0fcb5c77bd403..80d8b0b0eac47b8d8e62db60da9daf0da8671fb3 100644 +index 800ca2d57295c40853f5f1e58ce15e75f1a5afad..8e47f5f5dcf217169107913cc0c8332ce881c644 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -88,6 +88,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant worldServer = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods +@@ -90,6 +90,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant, WorldServer> worldServer; private PlayerList playerList; - private volatile boolean isRunning = true; + private volatile boolean isRunning; + private volatile boolean isRestarting = false; // Paper - flag to signify we're attempting to restart private boolean isStopped; private int ticks; protected final Proxy proxy; -@@ -723,7 +724,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0.5F || this.isInWater()) || this.abilities.isFlying || this.isSleeping()) { @@ -39,10 +39,10 @@ index 0e8ba05455161883c86df6606104fab3529c3c0c..ad79e4521cee699de86a94885b273563 } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index d6f5f176d4b5a39ddea4a9dc31a2322cc7d9d2d0..26f894c752d623ed082f97fdbffe5a6680a941b7 100644 +index f802bcb386b67e6c59aee68d6bfa507461f522cf..ace3f3e30224c09bdb296e4ac2974fb0bd3e7dbc 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1773,6 +1773,13 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1817,6 +1817,13 @@ public class PlayerConnection implements PacketListenerPlayIn { switch (packetplayinentityaction.c()) { case PRESS_SHIFT_KEY: this.player.setSneaking(true); diff --git a/Spigot-Server-Patches/0147-Add-configuration-option-to-prevent-player-names-fro.patch b/Spigot-Server-Patches/0146-Add-configuration-option-to-prevent-player-names-fro.patch similarity index 91% rename from Spigot-Server-Patches/0147-Add-configuration-option-to-prevent-player-names-fro.patch rename to Spigot-Server-Patches/0146-Add-configuration-option-to-prevent-player-names-fro.patch index 4cbe763be..f76895be1 100644 --- a/Spigot-Server-Patches/0147-Add-configuration-option-to-prevent-player-names-fro.patch +++ b/Spigot-Server-Patches/0146-Add-configuration-option-to-prevent-player-names-fro.patch @@ -20,10 +20,10 @@ index 5a83fc21cb6801d597a01fb4a83d30488f30bdb6..295b8390cbc31fc1fcb225f80ec2ff8f + } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3cb57c3b8ca8f29437bea52e9cf3512985f56eb5..9eb4acf93c65a1473e385be317e5d93cd4571d41 100644 +index a0d1e57ff34dfb36913ff937575bb3c1ad444f54..2cbf143d1a01a34c67b75ab1f7cd35f4a3a2f751 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2137,5 +2137,10 @@ public final class CraftServer implements Server { +@@ -2188,5 +2188,10 @@ public final class CraftServer implements Server { commandMap.registerServerAliases(); return true; } diff --git a/Spigot-Server-Patches/0148-Use-TerminalConsoleAppender-for-console-improvements.patch b/Spigot-Server-Patches/0147-Use-TerminalConsoleAppender-for-console-improvements.patch similarity index 91% rename from Spigot-Server-Patches/0148-Use-TerminalConsoleAppender-for-console-improvements.patch rename to Spigot-Server-Patches/0147-Use-TerminalConsoleAppender-for-console-improvements.patch index 2e701fd66..d8a1a418c 100644 --- a/Spigot-Server-Patches/0148-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/Spigot-Server-Patches/0147-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -19,7 +19,7 @@ Other changes: configuration diff --git a/pom.xml b/pom.xml -index 3554314526b3f33ad02df2adfd42d45118d75526..aeaceac771644ece5365d07be77f4481ced2fe13 100644 +index 7bc5bf271e435e1e0d85af133f1352f319f462b5..2acc2a98bd8df6d81b5865b768265a210597b57b 100644 --- a/pom.xml +++ b/pom.xml @@ -44,10 +44,27 @@ @@ -144,10 +144,10 @@ index 0000000000000000000000000000000000000000..685deaa0e5d1ddc13e3a7c0471b1cfcf + +} diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa67934944 100644 +index b091db5901d75769e406c454b205f102c82ca021..49b5c226dcbd4ef7d2a3418ef2c7e98bb689ccfb 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -86,6 +86,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -62,6 +62,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer if (!org.bukkit.craftbukkit.Main.useConsole) { return; } @@ -157,7 +157,7 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa jline.console.ConsoleReader bufferedreader = reader; // MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return -@@ -125,6 +128,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -101,6 +104,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer DedicatedServer.LOGGER.error("Exception handling console input", ioexception); } @@ -166,7 +166,7 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa } }; -@@ -136,6 +141,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -112,6 +117,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler()); @@ -176,7 +176,7 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa 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) { -@@ -144,6 +152,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -120,6 +128,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader).start(); @@ -186,7 +186,7 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa 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 80d8b0b0eac47b8d8e62db60da9daf0da8671fb3..ed32242bd169e9f28607942aa31aa48a5799b215 100644 +index 8e47f5f5dcf217169107913cc0c8332ce881c644..f2cdf60fd96f94e09a17ad1bdec522d282ccf3e9 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -57,7 +57,7 @@ import org.apache.commons.lang3.Validate; @@ -194,11 +194,11 @@ index 80d8b0b0eac47b8d8e62db60da9daf0da8671fb3..ed32242bd169e9f28607942aa31aa48a import org.apache.logging.log4j.Logger; // CraftBukkit start -import jline.console.ConsoleReader; -+import joptsimple.OptionSet; ++// Paper + import joptsimple.OptionSet; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.Main; -@@ -161,7 +161,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; -@@ -212,7 +212,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant collection = this.getEffects(); diff --git a/Spigot-Server-Patches/0150-Item-canEntityPickup.patch b/Spigot-Server-Patches/0149-Item-canEntityPickup.patch similarity index 85% rename from Spigot-Server-Patches/0150-Item-canEntityPickup.patch rename to Spigot-Server-Patches/0149-Item-canEntityPickup.patch index cfb76ecb2..2f36a0331 100644 --- a/Spigot-Server-Patches/0150-Item-canEntityPickup.patch +++ b/Spigot-Server-Patches/0149-Item-canEntityPickup.patch @@ -5,23 +5,23 @@ 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 1732c1ae9537957c51da5e484b55febb6e9f0091..b5816dc89ede5f5f1780d3086d9b1a41fba2b19d 100644 +index f2cd6824790d7e76f8f10e2630bcd5ebbf2a4238..3997dc6d979bf5a027861397b948aa4e8486fc58 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -521,6 +521,11 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -539,6 +539,11 @@ public abstract class EntityInsentient extends EntityLiving { EntityItem entityitem = (EntityItem) iterator.next(); - if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.p()) { + if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.p() && this.i(entityitem.getItemStack())) { + // Paper Start + if (!entityitem.canMobPickup) { + continue; + } + // Paper End - this.a(entityitem); + this.b(entityitem); } } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 208dad2a34de2b898c3811af6e5363009f97a55f..97c6a8b6bd0bf9738428c2fda24b9e2586a783dd 100644 +index ca1cc67fea6f1607a2d3d7869a0a023616c02ff7..159552192c2a6d62fb205ed5973f89a16e619d94 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -20,6 +20,7 @@ public class EntityItem extends Entity { diff --git a/Spigot-Server-Patches/0151-PlayerPickupItemEvent-setFlyAtPlayer.patch b/Spigot-Server-Patches/0150-PlayerPickupItemEvent-setFlyAtPlayer.patch similarity index 88% rename from Spigot-Server-Patches/0151-PlayerPickupItemEvent-setFlyAtPlayer.patch rename to Spigot-Server-Patches/0150-PlayerPickupItemEvent-setFlyAtPlayer.patch index 5e6f47cba..b3d01ce2d 100644 --- a/Spigot-Server-Patches/0151-PlayerPickupItemEvent-setFlyAtPlayer.patch +++ b/Spigot-Server-Patches/0150-PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -5,10 +5,10 @@ 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 97c6a8b6bd0bf9738428c2fda24b9e2586a783dd..8747dc7075ebe178f3b9ad3cb56f52847fd194b5 100644 +index 159552192c2a6d62fb205ed5973f89a16e619d94..2546a706ef107fd94e4c17c10091d6c0a7241a70 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -322,6 +322,7 @@ public class EntityItem extends Entity { +@@ -331,6 +331,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 97c6a8b6bd0bf9738428c2fda24b9e2586a783dd..8747dc7075ebe178f3b9ad3cb56f5284 if (this.pickupDelay <= 0 && canHold > 0) { itemstack.setCount(canHold); -@@ -329,8 +330,14 @@ public class EntityItem extends Entity { +@@ -338,8 +339,14 @@ 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); @@ -31,7 +31,7 @@ index 97c6a8b6bd0bf9738428c2fda24b9e2586a783dd..8747dc7075ebe178f3b9ad3cb56f5284 return; } -@@ -354,7 +361,11 @@ public class EntityItem extends Entity { +@@ -363,7 +370,11 @@ public class EntityItem extends Entity { // CraftBukkit end if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) { diff --git a/Spigot-Server-Patches/0152-PlayerAttemptPickupItemEvent.patch b/Spigot-Server-Patches/0151-PlayerAttemptPickupItemEvent.patch similarity index 91% rename from Spigot-Server-Patches/0152-PlayerAttemptPickupItemEvent.patch rename to Spigot-Server-Patches/0151-PlayerAttemptPickupItemEvent.patch index ee15d11ed..59b70943d 100644 --- a/Spigot-Server-Patches/0152-PlayerAttemptPickupItemEvent.patch +++ b/Spigot-Server-Patches/0151-PlayerAttemptPickupItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 8747dc7075ebe178f3b9ad3cb56f52847fd194b5..5efcc50ab9e8a99d88a9d2e7f15ecbcc4439b93e 100644 +index 2546a706ef107fd94e4c17c10091d6c0a7241a70..cc173445caa0a064e724bc29b4955232a1dc1816 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -9,6 +9,7 @@ import javax.annotation.Nullable; @@ -16,7 +16,7 @@ index 8747dc7075ebe178f3b9ad3cb56f52847fd194b5..5efcc50ab9e8a99d88a9d2e7f15ecbcc public class EntityItem extends Entity { -@@ -324,6 +325,22 @@ public class EntityItem extends Entity { +@@ -333,6 +334,22 @@ public class EntityItem extends Entity { int remaining = i - canHold; boolean flyAtPlayer = false; // Paper diff --git a/Spigot-Server-Patches/0153-Add-UnknownCommandEvent.patch b/Spigot-Server-Patches/0152-Add-UnknownCommandEvent.patch similarity index 83% rename from Spigot-Server-Patches/0153-Add-UnknownCommandEvent.patch rename to Spigot-Server-Patches/0152-Add-UnknownCommandEvent.patch index 2dfe5a6c9..e6d9d23db 100644 --- a/Spigot-Server-Patches/0153-Add-UnknownCommandEvent.patch +++ b/Spigot-Server-Patches/0152-Add-UnknownCommandEvent.patch @@ -5,18 +5,18 @@ 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 681a84e5b3e7594a43fac0d47f1df2eef310bf81..f01bd38d0b600a69224f610fd77a542ec6d1c322 100644 +index 08bc47fdec472c73493cc1a75bd0d84287b1c811..1d7549e03bc43f1867662acf12ae3cb82a951478 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -80,6 +80,7 @@ import net.minecraft.server.WorldServer; +@@ -104,6 +104,7 @@ import net.minecraft.server.WorldNBTStorage; + import net.minecraft.server.WorldServer; import net.minecraft.server.WorldSettings; - import net.minecraft.server.WorldType; import org.apache.commons.lang.Validate; +import org.apache.commons.lang3.StringUtils; import org.bukkit.BanList; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -@@ -151,6 +152,7 @@ import org.bukkit.craftbukkit.util.Versioning; +@@ -175,6 +176,7 @@ import org.bukkit.craftbukkit.util.Versioning; import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -24,7 +24,7 @@ index 681a84e5b3e7594a43fac0d47f1df2eef310bf81..f01bd38d0b600a69224f610fd77a542e import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerChatTabCompleteEvent; import org.bukkit.event.server.BroadcastMessageEvent; -@@ -751,7 +753,13 @@ public final class CraftServer implements Server { +@@ -775,7 +777,13 @@ public final class CraftServer implements Server { // Spigot start if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) { diff --git a/Spigot-Server-Patches/0154-Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/0153-Basic-PlayerProfile-API.patch similarity index 90% rename from Spigot-Server-Patches/0154-Basic-PlayerProfile-API.patch rename to Spigot-Server-Patches/0153-Basic-PlayerProfile-API.patch index df8c488a2..a14be80b4 100644 --- a/Spigot-Server-Patches/0154-Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/0153-Basic-PlayerProfile-API.patch @@ -309,23 +309,24 @@ index 0000000000000000000000000000000000000000..d73de9eb89c4e3a748907f2da21a3072 +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java new file mode 100644 -index 0000000000000000000000000000000000000000..25836b975b51af701d4b9523ab398fbf157b82fd +index 0000000000000000000000000000000000000000..ef9f55afd6bffa8c02c6820295223e5465eed91e --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java -@@ -0,0 +1,30 @@ +@@ -0,0 +1,31 @@ +package com.destroystokyo.paper.profile; + -+import com.mojang.authlib.Agent; -+import com.mojang.authlib.GameProfileRepository; -+import com.mojang.authlib.UserAuthentication; ++import com.mojang.authlib.*; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; ++import com.mojang.authlib.yggdrasil.YggdrasilEnvironment; + +import java.net.Proxy; + +public class PaperAuthenticationService extends YggdrasilAuthenticationService { ++ private final Environment environment; + public PaperAuthenticationService(Proxy proxy, String clientToken) { + super(proxy, clientToken); ++ this.environment = (Environment)EnvironmentParser.getEnvironmentFromProperties().orElse(YggdrasilEnvironment.PROD);; + } + + @Override @@ -335,30 +336,31 @@ index 0000000000000000000000000000000000000000..25836b975b51af701d4b9523ab398fbf + + @Override + public MinecraftSessionService createMinecraftSessionService() { -+ return new PaperMinecraftSessionService(this); ++ return new PaperMinecraftSessionService(this, this.environment); + } + + @Override + public GameProfileRepository createProfileRepository() { -+ return new PaperGameProfileRepository(this); ++ return new PaperGameProfileRepository(this, this.environment); + } +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java new file mode 100644 -index 0000000000000000000000000000000000000000..3bcdb8f93f1930ee53395470ffb3833e2bd75222 +index 0000000000000000000000000000000000000000..582c169c85ac66f1f9430f79042e4655f776c157 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java -@@ -0,0 +1,17 @@ +@@ -0,0 +1,18 @@ +package com.destroystokyo.paper.profile; + +import com.mojang.authlib.Agent; ++import com.mojang.authlib.Environment; +import com.mojang.authlib.ProfileLookupCallback; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; + +public class PaperGameProfileRepository extends YggdrasilGameProfileRepository { -+ public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService) { -+ super(authenticationService); ++ public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService, Environment environment) { ++ super(authenticationService, environment); + } + + @Override @@ -368,12 +370,13 @@ index 0000000000000000000000000000000000000000..3bcdb8f93f1930ee53395470ffb3833e +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java new file mode 100644 -index 0000000000000000000000000000000000000000..4b2a67423f57b70d316115e4525e3841a415b1cc +index 0000000000000000000000000000000000000000..93d73c27340645c7502acafdc0b2cfbc1a759dd8 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java -@@ -0,0 +1,29 @@ +@@ -0,0 +1,30 @@ +package com.destroystokyo.paper.profile; + ++import com.mojang.authlib.Environment; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; @@ -382,8 +385,8 @@ index 0000000000000000000000000000000000000000..4b2a67423f57b70d316115e4525e3841 +import java.util.Map; + +public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionService { -+ protected PaperMinecraftSessionService(YggdrasilAuthenticationService authenticationService) { -+ super(authenticationService); ++ protected PaperMinecraftSessionService(YggdrasilAuthenticationService authenticationService, Environment environment) { ++ super(authenticationService, environment); + } + + @Override @@ -419,7 +422,7 @@ index 0000000000000000000000000000000000000000..3aceb0ea8a1a3ed94dd8a9e954c52ecd + } +} diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 16302c4ac6d3e40318a762cea0afcf3f94715216..148917547bb7a626d1b2bacce7385607043db7e2 100644 +index da7a325d070e194cd1664ed20dcb3a762c9a517a..797654c653ec6dc4d46b457cf8a6121b29eca7aa 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -1,8 +1,11 @@ @@ -445,21 +448,25 @@ index 16302c4ac6d3e40318a762cea0afcf3f94715216..148917547bb7a626d1b2bacce7385607 /** * 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 ed32242bd169e9f28607942aa31aa48a5799b215..54f80cb8e1b771f2a493543e04f8bc8346a391dc 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1304,7 +1304,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant() { @Override -@@ -178,7 +179,16 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa +@@ -181,7 +182,16 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa } else if (MinecraftServer.getServer() == null) { callback.apply(gameprofile); } else { @@ -496,7 +503,7 @@ index 177cceb77f8783fe93ba7e4342de9c589f155c1b..83faa9dc5f74df4609cab34a66e4feed if (profile != null && Iterables.getFirst(profile.getProperties().get("textures"), (Object) null) != null) { callback.apply(profile); -@@ -187,7 +197,10 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa +@@ -190,7 +200,10 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa Callable callable = new Callable() { @Override public GameProfile call() { @@ -509,7 +516,7 @@ index 177cceb77f8783fe93ba7e4342de9c589f155c1b..83faa9dc5f74df4609cab34a66e4feed @Override public void run() { diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c12ea75272 100644 +index 4f769211cf98c3da720a904da3dcdcd4c7611f0b..a038397028848edb4f43cd4f7262546666e32883 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -43,7 +43,7 @@ public class UserCache { @@ -521,7 +528,7 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1 private final Map e = new java.util.concurrent.ConcurrentHashMap<>(); // Paper private final Deque f = new java.util.concurrent.LinkedBlockingDeque(); // CraftBukkit private final GameProfileRepository g; -@@ -104,6 +104,7 @@ public class UserCache { +@@ -93,6 +93,7 @@ public class UserCache { return UserCache.c; } @@ -529,7 +536,7 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1 public void a(GameProfile gameprofile) { this.a(gameprofile, (Date) null); } -@@ -165,6 +166,13 @@ public class UserCache { +@@ -154,6 +155,13 @@ public class UserCache { return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); } @@ -543,7 +550,7 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1 @Nullable public GameProfile getProfile(UUID uuid) { UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.e.get(uuid); -@@ -273,7 +281,7 @@ public class UserCache { +@@ -262,7 +270,7 @@ public class UserCache { class UserCacheEntry { @@ -553,10 +560,10 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1 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 f01bd38d0b600a69224f610fd77a542ec6d1c322..95f4abddf57eb8c59cb5a5410b8d551d39f94fd7 100644 +index 1d7549e03bc43f1867662acf12ae3cb82a951478..07a4ce8c71d52f4a6f1f9c97b9cb143c72db8af9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -200,6 +200,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; +@@ -224,6 +224,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; import net.md_5.bungee.api.chat.BaseComponent; // Spigot @@ -566,7 +573,7 @@ index f01bd38d0b600a69224f610fd77a542ec6d1c322..95f4abddf57eb8c59cb5a5410b8d551d public final class CraftServer implements Server { private final String serverName = "Paper"; // Paper private final String serverVersion; -@@ -2154,5 +2157,24 @@ public final class CraftServer implements Server { +@@ -2205,5 +2208,24 @@ public final class CraftServer implements Server { public boolean suggestPlayerNamesWhenNullTabCompletions() { return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions; } diff --git a/Spigot-Server-Patches/0155-Shoulder-Entities-Release-API.patch b/Spigot-Server-Patches/0154-Shoulder-Entities-Release-API.patch similarity index 92% rename from Spigot-Server-Patches/0155-Shoulder-Entities-Release-API.patch rename to Spigot-Server-Patches/0154-Shoulder-Entities-Release-API.patch index b7180c114..c7748f085 100644 --- a/Spigot-Server-Patches/0155-Shoulder-Entities-Release-API.patch +++ b/Spigot-Server-Patches/0154-Shoulder-Entities-Release-API.patch @@ -5,10 +5,10 @@ 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 ad79e4521cee699de86a94885b27356339bcb866..8e5edd2c9b7cc9a441969efeb666061515188486 100644 +index 0dc2ffcfceeffed2cb949d31c4f976bce639f110..69c0a4c7bfb1c753d544dcd074ad832d3e5ef3a0 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1901,20 +1901,44 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1779,20 +1779,44 @@ public abstract class EntityHuman extends EntityLiving { } @@ -58,10 +58,10 @@ index ad79e4521cee699de86a94885b27356339bcb866..8e5edd2c9b7cc9a441969efeb6660615 @Override 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 2c20a7b924e055794f6d3a296db754129052c3fe..191bb7345e06cbad7bef416e4e849df3727bdac0 100644 +index 9e0bd99122832d3dc25a79569d9e134d0d072fa4..d67fd3bf1048afae0bb78a95724ddf53337d9a2f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -518,6 +518,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -485,6 +485,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { getHandle().getCooldownTracker().setCooldown(CraftMagicNumbers.getItem(material), ticks); } diff --git a/Spigot-Server-Patches/0156-Profile-Lookup-Events.patch b/Spigot-Server-Patches/0155-Profile-Lookup-Events.patch similarity index 90% rename from Spigot-Server-Patches/0156-Profile-Lookup-Events.patch rename to Spigot-Server-Patches/0155-Profile-Lookup-Events.patch index f2898230e..a9a4210f1 100644 --- a/Spigot-Server-Patches/0156-Profile-Lookup-Events.patch +++ b/Spigot-Server-Patches/0155-Profile-Lookup-Events.patch @@ -7,28 +7,27 @@ Adds a Pre Lookup Event and a Post Lookup Event so that plugins may prefill in p profiles that had to be looked up. diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java -index 3bcdb8f93f1930ee53395470ffb3833e2bd75222..bb9894318e1ff75f0c5611a65d3e4d9969eab1fb 100644 +index 582c169c85ac66f1f9430f79042e4655f776c157..08fdb681a68e8be6e4062af0630957ce3e524806 100644 --- a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java +++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java -@@ -1,17 +1,68 @@ +@@ -1,11 +1,16 @@ package com.destroystokyo.paper.profile; +import com.destroystokyo.paper.event.profile.LookupProfileEvent; +import com.destroystokyo.paper.event.profile.PreLookupProfileEvent; +import com.google.common.collect.Sets; import com.mojang.authlib.Agent; + import com.mojang.authlib.Environment; +import com.mojang.authlib.GameProfile; import com.mojang.authlib.ProfileLookupCallback; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; +import java.util.Set; -+ public class PaperGameProfileRepository extends YggdrasilGameProfileRepository { -+ - public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService) { - super(authenticationService); - } + public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService, Environment environment) { + super(authenticationService, environment); +@@ -13,6 +18,50 @@ public class PaperGameProfileRepository extends YggdrasilGameProfileRepository { @Override public void findProfilesByNames(String[] names, Agent agent, ProfileLookupCallback callback) { diff --git a/Spigot-Server-Patches/0157-Block-player-logins-during-server-shutdown.patch b/Spigot-Server-Patches/0156-Block-player-logins-during-server-shutdown.patch similarity index 85% rename from Spigot-Server-Patches/0157-Block-player-logins-during-server-shutdown.patch rename to Spigot-Server-Patches/0156-Block-player-logins-during-server-shutdown.patch index 6c06f3128..980f5758e 100644 --- a/Spigot-Server-Patches/0157-Block-player-logins-during-server-shutdown.patch +++ b/Spigot-Server-Patches/0156-Block-player-logins-during-server-shutdown.patch @@ -5,10 +5,10 @@ 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 19e72da6d9a8bf43d1d25c1be3aa23c75dd6e5d7..234451ebc89fe47cffebdcbbc96a5163620b6124 100644 +index 7c016afc904d6d6958abf73fd0d87a25c9fa41ad..975499bca45acb4ba3196c48e3739310275cfc8b 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -49,6 +49,12 @@ public class LoginListener implements PacketLoginInListener { +@@ -48,6 +48,12 @@ public class LoginListener implements PacketLoginInListener { } public void tick() { diff --git a/Spigot-Server-Patches/0158-Entity-fromMobSpawner.patch b/Spigot-Server-Patches/0157-Entity-fromMobSpawner.patch similarity index 85% rename from Spigot-Server-Patches/0158-Entity-fromMobSpawner.patch rename to Spigot-Server-Patches/0157-Entity-fromMobSpawner.patch index 91c632cc2..4d76c81b4 100644 --- a/Spigot-Server-Patches/0158-Entity-fromMobSpawner.patch +++ b/Spigot-Server-Patches/0157-Entity-fromMobSpawner.patch @@ -5,10 +5,10 @@ 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 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab61938cc8b 100644 +index 400e6d5784d1d92678bf26fa3dbffbe2e0424a65..3e5b6c2a0ce6df2620d5f6505fcd25e6ea622744 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -188,6 +188,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -189,6 +189,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; public long activatedTick = Integer.MIN_VALUE; @@ -16,7 +16,7 @@ index 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab6 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1622,6 +1623,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1583,6 +1584,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke if (this.origin != null) { nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); } @@ -27,7 +27,7 @@ index 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab6 // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -1742,6 +1747,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1705,6 +1710,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,7 +37,7 @@ index 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab6 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index b249af20c4712a89e5f340eb922291557099058a..ab5d83d34d9314a253353d6d01fdcd2bed964933 100644 +index 2b7f020e00fc1ea456d0155e7e383969aee318b7..5fda5be52ee7dbf29ac791d0f49326dd74ff2d08 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -140,6 +140,7 @@ public abstract class MobSpawnerAbstract { @@ -49,10 +49,10 @@ index b249af20c4712a89e5f340eb922291557099058a..ab5d83d34d9314a253353d6d01fdcd2b if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { Entity vehicle = entity.getVehicle(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 7a6df77f196db8ccdaf589b680de9aab09b0ef32..2d84f8410a7b8ff88d9dbab64741dcdf40fc1612 100644 +index 613081685e233074728366b9ff16642c04774c91..66edc6ae67084959503ffa0df2c04174fb29b8d8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1046,5 +1046,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1054,5 +1054,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/0159-Improve-the-Saddle-API-for-Horses.patch b/Spigot-Server-Patches/0158-Improve-the-Saddle-API-for-Horses.patch similarity index 94% rename from Spigot-Server-Patches/0159-Improve-the-Saddle-API-for-Horses.patch rename to Spigot-Server-Patches/0158-Improve-the-Saddle-API-for-Horses.patch index ddb33b7d9..ce9759840 100644 --- a/Spigot-Server-Patches/0159-Improve-the-Saddle-API-for-Horses.patch +++ b/Spigot-Server-Patches/0158-Improve-the-Saddle-API-for-Horses.patch @@ -7,10 +7,10 @@ Not all horses with Saddles have armor. This lets us break up the horses with sa and access their saddle state separately from an interface shared with Armor. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -index 09016e35473069ac61572c4edf97c06077b0cf3b..9952db3eb5ba94547f5e786c473fb59dfec616ab 100644 +index 339656c623a5af7fbf1a7e81952dec1dd3c18205..8c59b9ce12d4148b209c3824d44f6e9c736de16c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -@@ -6,6 +6,7 @@ import net.minecraft.server.EntityHorseAbstract; +@@ -6,6 +6,7 @@ import net.minecraft.server.GenericAttributes; import org.apache.commons.lang.Validate; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.inventory.CraftInventoryAbstractHorse; diff --git a/Spigot-Server-Patches/0160-Implement-ensureServerConversions-API.patch b/Spigot-Server-Patches/0159-Implement-ensureServerConversions-API.patch similarity index 86% rename from Spigot-Server-Patches/0160-Implement-ensureServerConversions-API.patch rename to Spigot-Server-Patches/0159-Implement-ensureServerConversions-API.patch index e1ebc0e4e..99f50fd14 100644 --- a/Spigot-Server-Patches/0160-Implement-ensureServerConversions-API.patch +++ b/Spigot-Server-Patches/0159-Implement-ensureServerConversions-API.patch @@ -7,10 +7,10 @@ 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 01ab19434a39a7062c813b1696e8d35cb2712b46..8b219b5fa2746d73d6d3acb0b61d13218a2c6ea8 100644 +index b2fadd5a3c2d35e1d6f3c02dd5cf450ff1f31d36..71e289b5a7777e307b937f243d4f2204d17d8845 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -335,4 +335,10 @@ public final class CraftItemFactory implements ItemFactory { +@@ -321,4 +321,10 @@ public final class CraftItemFactory implements ItemFactory { public Material updateMaterial(ItemMeta meta, Material material) throws IllegalArgumentException { return ((CraftMetaItem) meta).updateMaterial(material); } diff --git a/Spigot-Server-Patches/0161-Implement-getI18NDisplayName.patch b/Spigot-Server-Patches/0160-Implement-getI18NDisplayName.patch similarity index 64% rename from Spigot-Server-Patches/0161-Implement-getI18NDisplayName.patch rename to Spigot-Server-Patches/0160-Implement-getI18NDisplayName.patch index 60bfe7415..4e1aee285 100644 --- a/Spigot-Server-Patches/0161-Implement-getI18NDisplayName.patch +++ b/Spigot-Server-Patches/0160-Implement-getI18NDisplayName.patch @@ -8,27 +8,36 @@ 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/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java -index c0c13798f84029565e623fdd8cb85ffcd3504559..6012739331add8a77c6684b58a669f39bf183f5b 100644 +index ea7cb9943dc6da7a05e0841985eb1be4b6bc5169..c83ba9d9869f8ba51df17963d530536d2a08c263 100644 --- a/src/main/java/net/minecraft/server/LocaleLanguage.java +++ b/src/main/java/net/minecraft/server/LocaleLanguage.java -@@ -65,10 +65,12 @@ public class LocaleLanguage { +@@ -29,7 +29,7 @@ public abstract class LocaleLanguage { + + private static LocaleLanguage c() { + Builder builder = ImmutableMap.builder(); +- BiConsumer biconsumer = builder::put; ++ BiConsumer biconsumer = builder::put; // Paper - decompile fix + + try { + InputStream inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json"); +@@ -91,10 +91,12 @@ public abstract class LocaleLanguage { } + public static LocaleLanguage getInstance() { return a(); } // Paper - OBFHELPER public static LocaleLanguage a() { - return LocaleLanguage.c; + return LocaleLanguage.d; } -+ public synchronized String translateKey(String key) { return a(key); } // Paper - OBFHELPER - public synchronized String a(String s) { - return this.c(s); - } ++ public String translateKey(String key) { return a(key); } // Paper - OBFHELPER + public abstract String a(String s); + + public abstract boolean b(String s); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 8b219b5fa2746d73d6d3acb0b61d13218a2c6ea8..23d7756456fdd650914a3a49c653182a68924a5c 100644 +index 71e289b5a7777e307b937f243d4f2204d17d8845..8d694e3a659a405fc5f6729ce512be81316229a9 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -340,5 +340,18 @@ public final class CraftItemFactory implements ItemFactory { +@@ -326,5 +326,18 @@ public final class CraftItemFactory implements ItemFactory { public ItemStack ensureServerConversions(ItemStack item) { return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item)); } diff --git a/Spigot-Server-Patches/0162-ProfileWhitelistVerifyEvent.patch b/Spigot-Server-Patches/0161-ProfileWhitelistVerifyEvent.patch similarity index 82% rename from Spigot-Server-Patches/0162-ProfileWhitelistVerifyEvent.patch rename to Spigot-Server-Patches/0161-ProfileWhitelistVerifyEvent.patch index 22b195fad..a27e3a686 100644 --- a/Spigot-Server-Patches/0162-ProfileWhitelistVerifyEvent.patch +++ b/Spigot-Server-Patches/0161-ProfileWhitelistVerifyEvent.patch @@ -5,22 +5,19 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 6b669f0f632418d36617c980b01cfcd0ef7487c2..46ea6d8e487d0c051780b0bdb06622e515cd987f 100644 +index 21f583302e9d8da8c9a9651ce40c64dc8abfa512..70339603aa3e256470be241bf033f3471e2090ea 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -509,9 +509,9 @@ public abstract class PlayerList { - - // return chatmessage; +@@ -541,7 +541,7 @@ public abstract class PlayerList { 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 - chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted", new Object[0]); + } else if (!this.isWhitelisted(gameprofile)) { + chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); - 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); -@@ -880,9 +880,25 @@ public abstract class PlayerList { +@@ -922,9 +922,25 @@ public abstract class PlayerList { this.server.getCommandDispatcher().a(entityplayer); } @@ -46,4 +43,4 @@ index 6b669f0f632418d36617c980b01cfcd0ef7487c2..46ea6d8e487d0c051780b0bdb06622e5 + // Paper end public boolean isOp(GameProfile gameprofile) { - return this.operators.d(gameprofile) || this.server.a(gameprofile) && this.server.getWorldServer(DimensionManager.OVERWORLD).getWorldData().t() || this.u; + return this.operators.d(gameprofile) || this.server.a(gameprofile) && this.server.getSaveData().n() || this.v; diff --git a/Spigot-Server-Patches/0163-Fix-this-stupid-bullshit.patch b/Spigot-Server-Patches/0162-Fix-this-stupid-bullshit.patch similarity index 91% rename from Spigot-Server-Patches/0163-Fix-this-stupid-bullshit.patch rename to Spigot-Server-Patches/0162-Fix-this-stupid-bullshit.patch index 9f78361c9..12d66c24e 100644 --- a/Spigot-Server-Patches/0163-Fix-this-stupid-bullshit.patch +++ b/Spigot-Server-Patches/0162-Fix-this-stupid-bullshit.patch @@ -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 c3641ca48bfe4051f6450c891ccd4dd023257cb5..9b4f01120d473a4fea993a5df952e265b33cde0b 100644 +index b77b051137f66106bac396debe0c0542ac86e257..05b647fbb360910b2961c9276c2928fe71dad90c 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -218,10 +218,12 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -21); + 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/0164-Ocelot-despawns-should-honor-nametags-and-leash.patch b/Spigot-Server-Patches/0163-Ocelot-despawns-should-honor-nametags-and-leash.patch similarity index 85% rename from Spigot-Server-Patches/0164-Ocelot-despawns-should-honor-nametags-and-leash.patch rename to Spigot-Server-Patches/0163-Ocelot-despawns-should-honor-nametags-and-leash.patch index 459cbd7c0..6909dbae0 100644 --- a/Spigot-Server-Patches/0164-Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/Spigot-Server-Patches/0163-Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -5,7 +5,7 @@ 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 06241145537d311b1994a2d672ca975177d03a53..d9a7b8ac1eac58e02607f4df0c9413239fcec3a4 100644 +index a88f15546e5cad8da5b342162c05228bdbbf5aad..9c1f019f911a1b91bbfa431e1558dec790624050 100644 --- a/src/main/java/net/minecraft/server/EntityOcelot.java +++ b/src/main/java/net/minecraft/server/EntityOcelot.java @@ -81,7 +81,7 @@ public class EntityOcelot extends EntityAnimal { @@ -16,4 +16,4 @@ index 06241145537d311b1994a2d672ca975177d03a53..d9a7b8ac1eac58e02607f4df0c941323 + return !this.isTrusting() && !this.hasCustomName() && !this.isLeashed() /*&& this.ticksLived > 2400*/; // CraftBukkit // Paper - honor name and leash } - @Override + public static AttributeProvider.Builder eL() { diff --git a/Spigot-Server-Patches/0165-Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/Spigot-Server-Patches/0164-Reset-spawner-timer-when-spawner-event-is-cancelled.patch similarity index 93% rename from Spigot-Server-Patches/0165-Reset-spawner-timer-when-spawner-event-is-cancelled.patch rename to Spigot-Server-Patches/0164-Reset-spawner-timer-when-spawner-event-is-cancelled.patch index 931728e67..14e130675 100644 --- a/Spigot-Server-Patches/0165-Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ b/Spigot-Server-Patches/0164-Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -5,7 +5,7 @@ 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 ab5d83d34d9314a253353d6d01fdcd2bed964933..c38295a09d99221cb196f9785ce674fe11120825 100644 +index 5fda5be52ee7dbf29ac791d0f49326dd74ff2d08..efd4d2844c4ad638837a1fd971927758908e7db1 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -142,6 +142,7 @@ public abstract class MobSpawnerAbstract { diff --git a/Spigot-Server-Patches/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch b/Spigot-Server-Patches/0165-Fix-MC-117075-TE-Unload-Lag-Spike.patch similarity index 87% rename from Spigot-Server-Patches/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch rename to Spigot-Server-Patches/0165-Fix-MC-117075-TE-Unload-Lag-Spike.patch index 00698ecb3..6d4d4e2c6 100644 --- a/Spigot-Server-Patches/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/Spigot-Server-Patches/0165-Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -5,10 +5,10 @@ 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 203c4173ff2467a027da059b2d473ec1a90bb88b..d8509ccdb01be022d5aa216b05fd97faeebd53a9 100644 +index cfd03f29e6c46c66bf3ad9253c88e27b30f313c1..b1d4f955a59313d7274e39870c9a7300fe012d08 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -648,7 +648,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -703,7 +703,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.enter("blockEntities"); timings.tileEntityTick.startTiming(); // Spigot if (!this.tileEntityListUnload.isEmpty()) { diff --git a/Spigot-Server-Patches/0167-Allow-specifying-a-custom-authentication-servers-dow.patch b/Spigot-Server-Patches/0166-Allow-specifying-a-custom-authentication-servers-dow.patch similarity index 91% rename from Spigot-Server-Patches/0167-Allow-specifying-a-custom-authentication-servers-dow.patch rename to Spigot-Server-Patches/0166-Allow-specifying-a-custom-authentication-servers-dow.patch index 20b70895a..cb8773c58 100644 --- a/Spigot-Server-Patches/0167-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/Spigot-Server-Patches/0166-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -27,10 +27,10 @@ index 295b8390cbc31fc1fcb225f80ec2ff8f0df44321..5884b04f7e84048a9710736bd1423714 + } } diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 234451ebc89fe47cffebdcbbc96a5163620b6124..758fe774897245148befeb26ddd65cf4c1a8301b 100644 +index 975499bca45acb4ba3196c48e3739310275cfc8b..723c73a8056d34136c64cd038f274d3d94749314 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -247,6 +247,10 @@ public class LoginListener implements PacketLoginInListener { +@@ -246,6 +246,10 @@ public class LoginListener implements PacketLoginInListener { LoginListener.this.i = LoginListener.this.a(gameprofile); LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; } else { @@ -38,6 +38,6 @@ index 234451ebc89fe47cffebdcbbc96a5163620b6124..758fe774897245148befeb26ddd65cf4 + if (com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage != null) { + LoginListener.this.disconnect(new ChatComponentText(com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage)); + } else // Paper end - LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0])); + LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down")); LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable"); } diff --git a/Spigot-Server-Patches/0168-LivingEntity-setKiller.patch b/Spigot-Server-Patches/0167-LivingEntity-setKiller.patch similarity index 82% rename from Spigot-Server-Patches/0168-LivingEntity-setKiller.patch rename to Spigot-Server-Patches/0167-LivingEntity-setKiller.patch index 5c8b4eb3c..9152a9d30 100644 --- a/Spigot-Server-Patches/0168-LivingEntity-setKiller.patch +++ b/Spigot-Server-Patches/0167-LivingEntity-setKiller.patch @@ -5,23 +5,23 @@ Subject: [PATCH] LivingEntity#setKiller diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 28d873d8fe7bb79d2a84eb9bf234ac8ba0223813..ca2620548c7c80beab09554b96d8e55e499614f8 100644 +index 34f2821a64c7893ff0a8c33ae4b77ce883227f0c..7ec1a572efd99928e8aae9b75c0eed73430aa337 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -80,7 +80,7 @@ public abstract class EntityLiving extends Entity { +@@ -86,7 +86,7 @@ public abstract class EntityLiving extends Entity { public float aL; - public float aM; + @Nullable public EntityHuman killer; - protected int lastDamageByPlayerTime; + public int lastDamageByPlayerTime; // Paper - protected -> public protected boolean killed; protected int ticksFarFromPlayer; - protected float aR; + protected float aQ; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index da86ee41499b02959755328544307aed39752483..1760dfa7a312b63d7608d890c977452ad995d7ae 100644 +index 8c3fa2335cfa1df94eb64bda5b12f1f5858dec27..1f33b2d7db6ab1c0f07f3e87cb046eda40f6c698 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -318,6 +318,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -319,6 +319,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity(); } diff --git a/Spigot-Server-Patches/0169-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch b/Spigot-Server-Patches/0168-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch similarity index 88% rename from Spigot-Server-Patches/0169-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch rename to Spigot-Server-Patches/0168-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch index b74a6a937..ff1195fa4 100644 --- a/Spigot-Server-Patches/0169-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch +++ b/Spigot-Server-Patches/0168-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch @@ -12,7 +12,7 @@ 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 aeaceac771644ece5365d07be77f4481ced2fe13..25e327c38cc3aa1f9ad9275faba481bdb4240e25 100644 +index 2acc2a98bd8df6d81b5865b768265a210597b57b..55cdd9061b2c70abe8458de497dd61e1f734bc9f 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,11 @@ @@ -28,10 +28,10 @@ index aeaceac771644ece5365d07be77f4481ced2fe13..25e327c38cc3aa1f9ad9275faba481bd org.ow2.asm asm diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index d34f772fae3543cec6a130831b1f3eaa67934944..ec257ba31f012d3d3576bbff41326df13ede6776 100644 +index 49b5c226dcbd4ef7d2a3418ef2c7e98bb689ccfb..f6544e4fb0eacce7f3579998e8ec0743b7f46c65 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -155,8 +155,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -131,8 +131,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer */ // Paper end diff --git a/Spigot-Server-Patches/0170-Handle-plugin-prefixes-using-Log4J-configuration.patch b/Spigot-Server-Patches/0169-Handle-plugin-prefixes-using-Log4J-configuration.patch similarity index 97% rename from Spigot-Server-Patches/0170-Handle-plugin-prefixes-using-Log4J-configuration.patch rename to Spigot-Server-Patches/0169-Handle-plugin-prefixes-using-Log4J-configuration.patch index 373a195cb..3ea82627d 100644 --- a/Spigot-Server-Patches/0170-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/Spigot-Server-Patches/0169-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. diff --git a/pom.xml b/pom.xml -index 25e327c38cc3aa1f9ad9275faba481bdb4240e25..daeb60a93cf0bbd1f6b731b9502a80c93b2e090b 100644 +index 55cdd9061b2c70abe8458de497dd61e1f734bc9f..0cdfa5367766b3883433d39fec4d6dcb8aa14cdf 100644 --- a/pom.xml +++ b/pom.xml @@ -64,7 +64,7 @@ diff --git a/Spigot-Server-Patches/0171-Include-Log4J2-SLF4J-implementation.patch b/Spigot-Server-Patches/0170-Include-Log4J2-SLF4J-implementation.patch similarity index 88% rename from Spigot-Server-Patches/0171-Include-Log4J2-SLF4J-implementation.patch rename to Spigot-Server-Patches/0170-Include-Log4J2-SLF4J-implementation.patch index 60c71fa5d..c92069b98 100644 --- a/Spigot-Server-Patches/0171-Include-Log4J2-SLF4J-implementation.patch +++ b/Spigot-Server-Patches/0170-Include-Log4J2-SLF4J-implementation.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Include Log4J2 SLF4J implementation diff --git a/pom.xml b/pom.xml -index daeb60a93cf0bbd1f6b731b9502a80c93b2e090b..8ad07cf6e03cbc5354d2dd2b149b51bbb5067a9d 100644 +index 0cdfa5367766b3883433d39fec4d6dcb8aa14cdf..8150756361174fd46df8f73943ab48c55a523c0c 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,12 @@ diff --git a/Spigot-Server-Patches/0172-Improve-Log4J-Configuration-Plugin-Loggers.patch b/Spigot-Server-Patches/0171-Improve-Log4J-Configuration-Plugin-Loggers.patch similarity index 100% rename from Spigot-Server-Patches/0172-Improve-Log4J-Configuration-Plugin-Loggers.patch rename to Spigot-Server-Patches/0171-Improve-Log4J-Configuration-Plugin-Loggers.patch diff --git a/Spigot-Server-Patches/0173-Add-PlayerJumpEvent.patch b/Spigot-Server-Patches/0172-Add-PlayerJumpEvent.patch similarity index 90% rename from Spigot-Server-Patches/0173-Add-PlayerJumpEvent.patch rename to Spigot-Server-Patches/0172-Add-PlayerJumpEvent.patch index f46cc03fa..e7ff6a253 100644 --- a/Spigot-Server-Patches/0173-Add-PlayerJumpEvent.patch +++ b/Spigot-Server-Patches/0172-Add-PlayerJumpEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerJumpEvent diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 26f894c752d623ed082f97fdbffe5a6680a941b7..2fd9f9ceddd108f0d733ea481d5b5c7d4506329c 100644 +index ace3f3e30224c09bdb296e4ac2974fb0bd3e7dbc..a7ab77707b5cd9ca65c012c3b18bc0c6db7fa7ee 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -58,6 +58,8 @@ import org.bukkit.inventory.CraftingInventory; @@ -17,10 +17,10 @@ index 26f894c752d623ed082f97fdbffe5a6680a941b7..2fd9f9ceddd108f0d733ea481d5b5c7d import co.aikar.timings.MinecraftTimings; // Paper // CraftBukkit end -@@ -925,7 +927,34 @@ public class PlayerConnection implements PacketListenerPlayIn { - } +@@ -945,7 +947,34 @@ public class PlayerConnection implements PacketListenerPlayIn { + boolean flag = d8 > 0.0D; - if (this.player.onGround && !packetplayinflying.b() && d8 > 0.0D) { + if (this.player.isOnGround() && !packetplayinflying.b() && flag) { - this.player.jump(); + // Paper start - Add player jump event + Player player = this.getPlayer(); diff --git a/Spigot-Server-Patches/0174-handle-PacketPlayInKeepAlive-async.patch b/Spigot-Server-Patches/0173-handle-PacketPlayInKeepAlive-async.patch similarity index 85% rename from Spigot-Server-Patches/0174-handle-PacketPlayInKeepAlive-async.patch rename to Spigot-Server-Patches/0173-handle-PacketPlayInKeepAlive-async.patch index da0e511ec..ac33db3f1 100644 --- a/Spigot-Server-Patches/0174-handle-PacketPlayInKeepAlive-async.patch +++ b/Spigot-Server-Patches/0173-handle-PacketPlayInKeepAlive-async.patch @@ -15,10 +15,10 @@ 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 2fd9f9ceddd108f0d733ea481d5b5c7d4506329c..7512764532fc3403cf1daa31079fe739820facde 100644 +index a7ab77707b5cd9ca65c012c3b18bc0c6db7fa7ee..79888d559e7d62216d48516ebb7da138395c2f2a 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2487,14 +2487,18 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2529,14 +2529,18 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInKeepAlive packetplayinkeepalive) { @@ -30,10 +30,9 @@ index 2fd9f9ceddd108f0d733ea481d5b5c7d4506329c..7512764532fc3403cf1daa31079fe739 this.player.ping = (this.player.ping * 3 + i) / 4; this.awaitingKeepAlive = false; } else if (!this.isExemptPlayer()) { -- this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); + // Paper start - This needs to be handled on the main thread for plugins + minecraftServer.scheduleOnMain(() -> { -+ this.disconnect(new ChatMessage("disconnect.timeout")); + this.disconnect(new ChatMessage("disconnect.timeout")); + }); + // Paper end } diff --git a/Spigot-Server-Patches/0175-Expose-client-protocol-version-and-virtual-host.patch b/Spigot-Server-Patches/0174-Expose-client-protocol-version-and-virtual-host.patch similarity index 86% rename from Spigot-Server-Patches/0175-Expose-client-protocol-version-and-virtual-host.patch rename to Spigot-Server-Patches/0174-Expose-client-protocol-version-and-virtual-host.patch index 8ae0d610a..887cc01a2 100644 --- a/Spigot-Server-Patches/0175-Expose-client-protocol-version-and-virtual-host.patch +++ b/Spigot-Server-Patches/0174-Expose-client-protocol-version-and-virtual-host.patch @@ -61,18 +61,10 @@ index 0000000000000000000000000000000000000000..5caca6439d2135e34880d501397fe2ea + +} diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index d0b9c6e3dcae76d802e095731c78fb9693982f90..8928d93e49bec174e86a2b451ac40f3946193009 100644 +index a3b48376b92aee548ec28eec1cdc978925b96df0..8049f54f049122b065ea30e7e831c33486a83b7e 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 { - - private final MinecraftServer a; - private final NetworkManager b; -+ private NetworkManager getNetworkManager() { return b; } // Paper - OBFHELPER - - public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { - this.a = minecraftserver; -@@ -129,6 +130,10 @@ public class HandshakeListener implements PacketHandshakingInListener { +@@ -133,6 +133,10 @@ public class HandshakeListener implements PacketHandshakingInListener { throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.b()); } @@ -84,7 +76,7 @@ index d0b9c6e3dcae76d802e095731c78fb9693982f90..8928d93e49bec174e86a2b451ac40f39 @Override diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 3ccf1663669c79a63a6b3a9f6dc17a6e25e91915..e2d8ed88f05bf8cb214329ea27ac2b67f43e071a 100644 +index c2fdccfb9192aa7ec55fd67c169cba71a695075c..33900c22d4123e0f8333b9bdb9601d302e26c972 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -60,6 +60,10 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -111,10 +103,10 @@ index 4f008e4723d2cb0bcabb2d5621203d63c40c4923..8545146fb1f093f821e3b966d9337049 return this.a; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a4afce71be0707c43700b73ae0107074448e3d4a..3d4a1065fbe38239743e485d078b76b47981baf1 100644 +index 527c116c23a505eead00e73a39ce9f932eb4ad8d..09ac19363ecfdebe2b124fdf68a95265ae085cfe 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -182,6 +182,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -186,6 +186,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } diff --git a/Spigot-Server-Patches/0176-revert-serverside-behavior-of-keepalives.patch b/Spigot-Server-Patches/0175-revert-serverside-behavior-of-keepalives.patch similarity index 93% rename from Spigot-Server-Patches/0176-revert-serverside-behavior-of-keepalives.patch rename to Spigot-Server-Patches/0175-revert-serverside-behavior-of-keepalives.patch index a7aa14f47..d8e6c8a91 100644 --- a/Spigot-Server-Patches/0176-revert-serverside-behavior-of-keepalives.patch +++ b/Spigot-Server-Patches/0175-revert-serverside-behavior-of-keepalives.patch @@ -17,7 +17,7 @@ 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 7512764532fc3403cf1daa31079fe739820facde..7d0fa2efe876d5de8b4bafd2be1a1323ea630410 100644 +index 79888d559e7d62216d48516ebb7da138395c2f2a..b2eac041c3ff7d8a7c4524dac381ab95045f28af 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -70,7 +70,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -37,7 +37,7 @@ index 7512764532fc3403cf1daa31079fe739820facde..7d0fa2efe876d5de8b4bafd2be1a1323 public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { this.minecraftServer = minecraftserver; -@@ -182,18 +183,26 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -182,18 +183,25 @@ public class PlayerConnection implements PacketListenerPlayIn { } this.minecraftServer.getMethodProfiler().enter("keepAlive"); @@ -45,6 +45,12 @@ index 7512764532fc3403cf1daa31079fe739820facde..7d0fa2efe876d5de8b4bafd2be1a1323 - - if (i - this.lastKeepAlive >= 25000L) { // CraftBukkit - if (this.awaitingKeepAlive) { +- this.disconnect(new ChatMessage("disconnect.timeout")); +- } else { +- this.awaitingKeepAlive = true; +- this.lastKeepAlive = 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 = SystemUtils.getMonotonicMillis(); @@ -53,12 +59,7 @@ index 7512764532fc3403cf1daa31079fe739820facde..7d0fa2efe876d5de8b4bafd2be1a1323 + 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.awaitingKeepAlive = true; -- this.lastKeepAlive = i; -- this.h = i; -- this.sendPacket(new PacketPlayOutKeepAlive(this.h)); ++ this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); + } + } else { + if (elapsedTime >= 15000L) { // 15 seconds @@ -66,7 +67,6 @@ index 7512764532fc3403cf1daa31079fe739820facde..7d0fa2efe876d5de8b4bafd2be1a1323 + this.setLastPing(currentTime); + this.setKeepAliveID(currentTime); + this.sendPacket(new PacketPlayOutKeepAlive(this.getKeepAliveID())); -+ } } + // Paper end diff --git a/Spigot-Server-Patches/0177-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/Spigot-Server-Patches/0176-Send-attack-SoundEffects-only-to-players-who-can-see.patch similarity index 89% rename from Spigot-Server-Patches/0177-Send-attack-SoundEffects-only-to-players-who-can-see.patch rename to Spigot-Server-Patches/0176-Send-attack-SoundEffects-only-to-players-who-can-see.patch index 3b4cf3e48..1935a953a 100644 --- a/Spigot-Server-Patches/0177-Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/Spigot-Server-Patches/0176-Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -6,10 +6,10 @@ 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 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523286c5106 100644 +index 69c0a4c7bfb1c753d544dcd074ad832d3e5ef3a0..eaed020982bd19dab72872849170fa62d75699eb 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1023,6 +1023,15 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1002,6 +1002,15 @@ public abstract class EntityHuman extends EntityLiving { return vec3d; } @@ -23,9 +23,9 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523 + // Paper end + public void attack(Entity entity) { - if (entity.bA()) { + if (entity.bH()) { if (!entity.t(this)) { -@@ -1047,7 +1056,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1026,7 +1035,7 @@ public abstract class EntityHuman extends EntityLiving { int i = b0 + EnchantmentManager.b((EntityLiving) this); if (this.isSprinting() && flag) { @@ -34,16 +34,16 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523 ++i; flag1 = true; } -@@ -1122,7 +1131,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1101,7 +1110,7 @@ public abstract class EntityHuman extends EntityLiving { } } - this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F); + sendSoundEffect(this, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F); // Paper - send while respecting visibility - this.ea(); + this.ew(); } -@@ -1150,15 +1159,15 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1129,15 +1138,15 @@ public abstract class EntityHuman extends EntityLiving { } if (flag2) { @@ -62,7 +62,7 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523 } } -@@ -1210,7 +1219,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1189,7 +1198,7 @@ public abstract class EntityHuman extends EntityLiving { this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value } else { @@ -72,10 +72,10 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523 entity.extinguish(); } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d8509ccdb01be022d5aa216b05fd97faeebd53a9..4e41b4262971401d90a96cd7710890e5048d5b63 100644 +index b1d4f955a59313d7274e39870c9a7300fe012d08..ad1841f16ea3ecfbd9c6047483a4b7bd061c1981 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -585,6 +585,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -640,6 +640,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.playSound(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1); } diff --git a/Spigot-Server-Patches/0178-Option-for-maximum-exp-value-when-merging-orbs.patch b/Spigot-Server-Patches/0177-Option-for-maximum-exp-value-when-merging-orbs.patch similarity index 95% rename from Spigot-Server-Patches/0178-Option-for-maximum-exp-value-when-merging-orbs.patch rename to Spigot-Server-Patches/0177-Option-for-maximum-exp-value-when-merging-orbs.patch index 8e9e68000..83363b03e 100644 --- a/Spigot-Server-Patches/0178-Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/Spigot-Server-Patches/0177-Option-for-maximum-exp-value-when-merging-orbs.patch @@ -20,10 +20,10 @@ index 39ab5457569684bc66cd67f5f9d2505ef9f304ab..d2582d981f859b55ba5086540963c01e + } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index f1a4de57282f3553f34245122bf15130420f558b..d012376c134886cdf692bfe29e6154a618f932ea 100644 +index dc4fc5b300bb319be3d483aa7206bb0134343068..ee7f71c0fe2cf075ab2e821391cd94f920dc494b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -550,16 +550,32 @@ public class CraftEventFactory { +@@ -548,16 +548,32 @@ public class CraftEventFactory { EntityExperienceOrb xp = (EntityExperienceOrb) entity; double radius = world.spigotConfig.expMerge; if (radius > 0) { diff --git a/Spigot-Server-Patches/0178-Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/0178-Add-PlayerArmorChangeEvent.patch new file mode 100644 index 000000000..cc14fa55c --- /dev/null +++ b/Spigot-Server-Patches/0178-Add-PlayerArmorChangeEvent.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 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 7ec1a572efd99928e8aae9b75c0eed73430aa337..26832d31cc64d26a9ca61a3bad21424ed366c74c 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -1,5 +1,6 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; // Paper + import com.google.common.base.Objects; + import com.google.common.collect.ImmutableList; + import com.google.common.collect.ImmutableMap; +@@ -2523,6 +2524,13 @@ public abstract class EntityLiving extends Entity { + ItemStack itemstack1 = this.getEquipment(enumitemslot); + + if (!ItemStack.matches(itemstack1, itemstack)) { ++ // Paper start - PlayerArmorChangeEvent ++ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { ++ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); ++ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); ++ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); ++ } ++ // Paper end + if (map == null) { + map = Maps.newEnumMap(EnumItemSlot.class); + } +diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java +index 02a7ae6785b0539e4aa567fca377d727184fd019..60b235f16f5e762d635efa1578b715db445513a5 100644 +--- a/src/main/java/net/minecraft/server/EnumItemSlot.java ++++ b/src/main/java/net/minecraft/server/EnumItemSlot.java +@@ -16,6 +16,7 @@ public enum EnumItemSlot { + this.j = s; + } + ++ public EnumItemSlot.Function getType() { return this.a(); } // Paper - OBFHELPER + public EnumItemSlot.Function a() { + return this.g; + } diff --git a/Spigot-Server-Patches/0179-Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/0179-Add-PlayerArmorChangeEvent.patch deleted file mode 100644 index b867534ca..000000000 --- a/Spigot-Server-Patches/0179-Add-PlayerArmorChangeEvent.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 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 ca2620548c7c80beab09554b96d8e55e499614f8..f5da67fd8908f027835b837a8b847e27c3638790 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1,5 +1,6 @@ - package net.minecraft.server; - -+import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; - import com.google.common.base.Objects; - import com.google.common.collect.ImmutableList; - import com.google.common.collect.ImmutableSet; -@@ -2339,6 +2340,13 @@ public abstract class EntityLiving extends Entity { - ItemStack itemstack1 = this.getEquipment(enumitemslot); - - if (!ItemStack.matches(itemstack1, itemstack)) { -+ // Paper start - PlayerArmorChangeEvent -+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { -+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); -+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); -+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); -+ } -+ // Paper end - ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1)); - if (!itemstack.isEmpty()) { - this.getAttributeMap().a(itemstack.a(enumitemslot)); -diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java -index 02a7ae6785b0539e4aa567fca377d727184fd019..60b235f16f5e762d635efa1578b715db445513a5 100644 ---- a/src/main/java/net/minecraft/server/EnumItemSlot.java -+++ b/src/main/java/net/minecraft/server/EnumItemSlot.java -@@ -16,6 +16,7 @@ public enum EnumItemSlot { - this.j = s; - } - -+ public EnumItemSlot.Function getType() { return this.a(); } // Paper - OBFHELPER - public EnumItemSlot.Function a() { - return this.g; - } diff --git a/Spigot-Server-Patches/0180-Prevent-logins-from-being-processed-when-the-player-.patch b/Spigot-Server-Patches/0179-Prevent-logins-from-being-processed-when-the-player-.patch similarity index 83% rename from Spigot-Server-Patches/0180-Prevent-logins-from-being-processed-when-the-player-.patch rename to Spigot-Server-Patches/0179-Prevent-logins-from-being-processed-when-the-player-.patch index 9d33fdb2e..f3a5b4b02 100644 --- a/Spigot-Server-Patches/0180-Prevent-logins-from-being-processed-when-the-player-.patch +++ b/Spigot-Server-Patches/0179-Prevent-logins-from-being-processed-when-the-player-.patch @@ -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 758fe774897245148befeb26ddd65cf4c1a8301b..1fb609dcfc61adfc63f0d32dc87a5e144a5013cf 100644 +index 723c73a8056d34136c64cd038f274d3d94749314..3cc12e7b75b8ed21a0ea44f8453553cf856fb786 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -56,7 +56,11 @@ public class LoginListener implements PacketLoginInListener { +@@ -55,7 +55,11 @@ public class LoginListener implements PacketLoginInListener { } // Paper end if (this.g == LoginListener.EnumProtocolState.READY_TO_ACCEPT) { @@ -20,5 +20,5 @@ index 758fe774897245148befeb26ddd65cf4c1a8301b..1fb609dcfc61adfc63f0d32dc87a5e14 + } + // Paper end } else if (this.g == LoginListener.EnumProtocolState.DELAY_ACCEPT) { - EntityPlayer entityplayer = this.server.getPlayerList().a(this.i.getId()); + EntityPlayer entityplayer = this.server.getPlayerList().getPlayer(this.i.getId()); diff --git a/Spigot-Server-Patches/0181-use-CB-BlockState-implementations-for-captured-block.patch b/Spigot-Server-Patches/0180-use-CB-BlockState-implementations-for-captured-block.patch similarity index 87% rename from Spigot-Server-Patches/0181-use-CB-BlockState-implementations-for-captured-block.patch rename to Spigot-Server-Patches/0180-use-CB-BlockState-implementations-for-captured-block.patch index ca6804125..bae6f78ae 100644 --- a/Spigot-Server-Patches/0181-use-CB-BlockState-implementations-for-captured-block.patch +++ b/Spigot-Server-Patches/0180-use-CB-BlockState-implementations-for-captured-block.patch @@ -18,10 +18,10 @@ 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 4e41b4262971401d90a96cd7710890e5048d5b63..6603392f475f0bfe7af259a54ba9bb3469c18541 100644 +index ad1841f16ea3ecfbd9c6047483a4b7bd061c1981..6f91878fedd3bf8daedc16bcde7ac1fd042f704c 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -66,7 +66,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -71,7 +71,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean captureBlockStates = false; public boolean captureTreeGeneration = false; @@ -30,8 +30,8 @@ index 4e41b4262971401d90a96cd7710890e5048d5b63..6603392f475f0bfe7af259a54ba9bb34 public Map capturedTileEntities = new HashMap<>(); public List captureDrops; public long ticksPerAnimalSpawns; -@@ -258,7 +258,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { +@@ -323,7 +323,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { - CapturedBlockState blockstate = capturedBlockStates.get(blockposition); @@ -39,7 +39,7 @@ index 4e41b4262971401d90a96cd7710890e5048d5b63..6603392f475f0bfe7af259a54ba9bb34 if (blockstate == null) { blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i); this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate); -@@ -278,7 +278,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -343,7 +343,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit start - capture blockstates boolean captured = false; if (this.captureBlockStates && !this.capturedBlockStates.containsKey(blockposition)) { @@ -48,7 +48,7 @@ index 4e41b4262971401d90a96cd7710890e5048d5b63..6603392f475f0bfe7af259a54ba9bb34 this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate); captured = true; } -@@ -546,7 +546,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -601,7 +601,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public IBlockData getType(BlockPosition blockposition) { // CraftBukkit start - tree generation if (captureTreeGeneration) { diff --git a/Spigot-Server-Patches/0182-API-to-get-a-BlockState-without-a-snapshot.patch b/Spigot-Server-Patches/0181-API-to-get-a-BlockState-without-a-snapshot.patch similarity index 94% rename from Spigot-Server-Patches/0182-API-to-get-a-BlockState-without-a-snapshot.patch rename to Spigot-Server-Patches/0181-API-to-get-a-BlockState-without-a-snapshot.patch index 6f6ca899d..0df5427f9 100644 --- a/Spigot-Server-Patches/0182-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/Spigot-Server-Patches/0181-API-to-get-a-BlockState-without-a-snapshot.patch @@ -13,7 +13,7 @@ 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 630b279158f26902ebdcc6e5c810b189ce49c910..958279249fdadfe5c2808d2a046636f06c3bd500 100644 +index 967aec7ce9a7fbbb42b51d1ed281db005e107c2c..54285237ed5a096b2e46cabd78f7dcd5128133a8 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -231,7 +231,12 @@ public abstract class TileEntity implements KeyedObject { // Paper @@ -39,7 +39,7 @@ index 630b279158f26902ebdcc6e5c810b189ce49c910..958279249fdadfe5c2808d2a046636f0 return null; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 5a1629a19f082235f91913736d78509d44f8fd67..dd0bccd6995a79c52ec20cf45df27bb7ed06a5e6 100644 +index 562d9daa34540c0e3d99b799dd6f01bf87329006..5ce381ad88daf5f95b19871356ab5852097c5956 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -308,6 +308,20 @@ public class CraftBlock implements Block { @@ -64,7 +64,7 @@ index 5a1629a19f082235f91913736d78509d44f8fd67..dd0bccd6995a79c52ec20cf45df27bb7 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 17d80b5c6e512e0c582b05c92bb795b004ba27c2..f6401e2cde9d56547cee7f8d9e4b2a58764ee895 100644 +index 26cc40e57f5b73b9c32859bff37c4a3d94904c56..feeae1a9eb309ae4101783b191bb2bffe9aeb7d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -26,20 +26,40 @@ public class CraftBlockEntityState extends CraftBlockState diff --git a/Spigot-Server-Patches/0183-AsyncTabCompleteEvent.patch b/Spigot-Server-Patches/0182-AsyncTabCompleteEvent.patch similarity index 83% rename from Spigot-Server-Patches/0183-AsyncTabCompleteEvent.patch rename to Spigot-Server-Patches/0182-AsyncTabCompleteEvent.patch index cd18e4ad5..e110ca2f1 100644 --- a/Spigot-Server-Patches/0183-AsyncTabCompleteEvent.patch +++ b/Spigot-Server-Patches/0182-AsyncTabCompleteEvent.patch @@ -14,10 +14,10 @@ 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 7d0fa2efe876d5de8b4bafd2be1a1323ea630410..c256e798d12098881cb5bfb655eab5b63f1614e7 100644 +index b2eac041c3ff7d8a7c4524dac381ab95045f28af..fa5c640239451579fba35ad7b0979739e0b7b16f 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -524,10 +524,10 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -527,10 +527,10 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInTabComplete packetplayintabcomplete) { @@ -30,7 +30,7 @@ index 7d0fa2efe876d5de8b4bafd2be1a1323ea630410..c256e798d12098881cb5bfb655eab5b6 return; } // CraftBukkit end -@@ -537,12 +537,37 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -540,12 +540,35 @@ public class PlayerConnection implements PacketListenerPlayIn { stringreader.skip(); } @@ -46,19 +46,20 @@ index 7d0fa2efe876d5de8b4bafd2be1a1323ea630410..c256e798d12098881cb5bfb655eab5b6 + // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server + if (!event.isHandled()) { + if (!event.isCancelled()) { -+ // Paper end - async tab completion -+ this.minecraftServer.scheduleOnMain(() -> { // Paper - This needs to be on main -+ ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); - this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { - if (((Suggestions) suggestions).isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer -- this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestions)); // CraftBukkit - decompile error +- this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { +- if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer +- this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions)); - }); -+ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestions)); // CraftBukkit - decompile error -+ }); -+ }); // Paper - This needs to be on main ++ this.minecraftServer.scheduleOnMain(() -> { // Paper - This needs to be on main ++ ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); ++ ++ this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { ++ if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer ++ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions)); ++ }); ++ }); + } -+ // Paper start - async tab completion + } else if (!completions.isEmpty()) { + com.mojang.brigadier.suggestion.SuggestionsBuilder builder = new com.mojang.brigadier.suggestion.SuggestionsBuilder(packetplayintabcomplete.c(), stringreader.getTotalLength()); + @@ -67,15 +68,14 @@ index 7d0fa2efe876d5de8b4bafd2be1a1323ea630410..c256e798d12098881cb5bfb655eab5b6 + player.playerConnection.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), builder.buildFuture().join())); + } + // Paper end - async tab completion -+ } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 95f4abddf57eb8c59cb5a5410b8d551d39f94fd7..3697b3298feaec30c305e3da011790f2406e12d7 100644 +index 07a4ce8c71d52f4a6f1f9c97b9cb143c72db8af9..cf93d5451a68e812811b32add1a76ed1ee6f3c27 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1710,7 +1710,7 @@ public final class CraftServer implements Server { +@@ -1761,7 +1761,7 @@ public final class CraftServer implements Server { offers = tabCompleteChat(player, message); } diff --git a/Spigot-Server-Patches/0184-Avoid-NPE-in-PathfinderGoalTempt.patch b/Spigot-Server-Patches/0183-Avoid-NPE-in-PathfinderGoalTempt.patch similarity index 90% rename from Spigot-Server-Patches/0184-Avoid-NPE-in-PathfinderGoalTempt.patch rename to Spigot-Server-Patches/0183-Avoid-NPE-in-PathfinderGoalTempt.patch index 3fbc4202d..2e8bf4295 100644 --- a/Spigot-Server-Patches/0184-Avoid-NPE-in-PathfinderGoalTempt.patch +++ b/Spigot-Server-Patches/0183-Avoid-NPE-in-PathfinderGoalTempt.patch @@ -5,7 +5,7 @@ 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 eafdcb916af55978672c139b7ccdf5feba383264..d37a2fa0ab3cbf4b76be90079c083e208843fe6e 100644 +index 351152ae32e162fa912d60e929abeec783140106..b115f40b0b11e89184960a5cce5b8295030469e9 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java @@ -55,7 +55,7 @@ public class PathfinderGoalTempt extends PathfinderGoal { diff --git a/Spigot-Server-Patches/0185-PlayerPickupExperienceEvent.patch b/Spigot-Server-Patches/0184-PlayerPickupExperienceEvent.patch similarity index 70% rename from Spigot-Server-Patches/0185-PlayerPickupExperienceEvent.patch rename to Spigot-Server-Patches/0184-PlayerPickupExperienceEvent.patch index 00a43cac8..1120cd9b7 100644 --- a/Spigot-Server-Patches/0185-PlayerPickupExperienceEvent.patch +++ b/Spigot-Server-Patches/0184-PlayerPickupExperienceEvent.patch @@ -6,15 +6,15 @@ Subject: [PATCH] PlayerPickupExperienceEvent Allows plugins to cancel a player picking up an experience orb diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index d4275e733d9996d121efd95ae1ff4676a1ebfbb5..b3edb69a967058392f5027fbdc7fadff7e1dc6e2 100644 +index d9a0cd1e90445ff7a1d9e7cef2f71e27bd3686cb..e7fb982913f391bafd608c4626086cd9cab7fad7 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -222,7 +222,7 @@ public class EntityExperienceOrb extends Entity { +@@ -217,7 +217,7 @@ public class EntityExperienceOrb extends Entity { @Override public void pickup(EntityHuman entityhuman) { if (!this.world.isClientSide) { -- if (this.d == 0 && entityhuman.bC == 0) { -+ if (this.d == 0 && entityhuman.bC == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - entityhuman.bC = 2; +- if (this.d == 0 && entityhuman.bB == 0) { ++ if (this.d == 0 && entityhuman.bB == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper + entityhuman.bB = 2; entityhuman.receive(this, 1); - Entry entry = EnchantmentManager.b(Enchantments.MENDING, (EntityLiving) entityhuman); + Entry entry = EnchantmentManager.a(Enchantments.MENDING, (EntityLiving) entityhuman, ItemStack::f); diff --git a/Spigot-Server-Patches/0186-ExperienceOrbMergeEvent.patch b/Spigot-Server-Patches/0185-ExperienceOrbMergeEvent.patch similarity index 91% rename from Spigot-Server-Patches/0186-ExperienceOrbMergeEvent.patch rename to Spigot-Server-Patches/0185-ExperienceOrbMergeEvent.patch index 7a67c4095..769320160 100644 --- a/Spigot-Server-Patches/0186-ExperienceOrbMergeEvent.patch +++ b/Spigot-Server-Patches/0185-ExperienceOrbMergeEvent.patch @@ -8,10 +8,10 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor metadata such as spawn reason, or conditionally move data from source to target. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index d012376c134886cdf692bfe29e6154a618f932ea..6d7236d3dcdb70cc1f33f462d08e78720045ccd0 100644 +index ee7f71c0fe2cf075ab2e821391cd94f920dc494b..8551d3c9ba808bb9a77897a9866249bc0845c3b2 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -560,7 +560,7 @@ public class CraftEventFactory { +@@ -558,7 +558,7 @@ public class CraftEventFactory { if (e instanceof EntityExperienceOrb) { EntityExperienceOrb loopItem = (EntityExperienceOrb) e; // Paper start diff --git a/Spigot-Server-Patches/0187-Ability-to-apply-mending-to-XP-API.patch b/Spigot-Server-Patches/0186-Ability-to-apply-mending-to-XP-API.patch similarity index 87% rename from Spigot-Server-Patches/0187-Ability-to-apply-mending-to-XP-API.patch rename to Spigot-Server-Patches/0186-Ability-to-apply-mending-to-XP-API.patch index 8eff7f4dc..26b317150 100644 --- a/Spigot-Server-Patches/0187-Ability-to-apply-mending-to-XP-API.patch +++ b/Spigot-Server-Patches/0186-Ability-to-apply-mending-to-XP-API.patch @@ -10,10 +10,10 @@ of giving the player experience points. Both an API To standalone mend, and apply mending logic to .giveExp has been added. diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java -index 1822178e8dd67bb063f5eab60335de9852b9a71c..d96c03a1a164799f49fdb3309594e7592a8d2206 100644 +index cea65c1d80a7bd303cf28a6fe2bd73d542a19557..92ceb8bb7d7c47e395dfdcfe6d01f807c048ddc1 100644 --- a/src/main/java/net/minecraft/server/EnchantmentManager.java +++ b/src/main/java/net/minecraft/server/EnchantmentManager.java -@@ -246,6 +246,11 @@ public class EnchantmentManager { +@@ -251,6 +251,11 @@ public class EnchantmentManager { return getEnchantmentLevel(Enchantments.CHANNELING, itemstack) > 0; } @@ -24,12 +24,12 @@ index 1822178e8dd67bb063f5eab60335de9852b9a71c..d96c03a1a164799f49fdb3309594e759 + } @Nullable public static Entry b(Enchantment enchantment, EntityLiving entityliving) { - Map map = enchantment.a(entityliving); + return a(enchantment, entityliving, (itemstack) -> { diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index b3edb69a967058392f5027fbdc7fadff7e1dc6e2..87c6b77ce3b1446893a0d617b63f925a403e09cc 100644 +index e7fb982913f391bafd608c4626086cd9cab7fad7..7f2d8de12473c5413bbfc10ea0947d6a30802645 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -254,10 +254,12 @@ public class EntityExperienceOrb extends Entity { +@@ -249,10 +249,12 @@ public class EntityExperienceOrb extends Entity { } } @@ -43,10 +43,10 @@ index b3edb69a967058392f5027fbdc7fadff7e1dc6e2..87c6b77ce3b1446893a0d617b63f925a return i * 2; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 3d4a1065fbe38239743e485d078b76b47981baf1..5b088b21da2ca3945de9c5dcc4370114f930d739 100644 +index 09ac19363ecfdebe2b124fdf68a95265ae085cfe..734274db8f8c53d7e5310f2c16b1c64a42a6277c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1017,8 +1017,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1058,8 +1058,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return GameMode.getByValue(getHandle().playerInteractManager.getGameMode().getId()); } diff --git a/Spigot-Server-Patches/0188-Make-max-squid-spawn-height-configurable.patch b/Spigot-Server-Patches/0187-Make-max-squid-spawn-height-configurable.patch similarity index 92% rename from Spigot-Server-Patches/0188-Make-max-squid-spawn-height-configurable.patch rename to Spigot-Server-Patches/0187-Make-max-squid-spawn-height-configurable.patch index 5a0f752d2..a12846c61 100644 --- a/Spigot-Server-Patches/0188-Make-max-squid-spawn-height-configurable.patch +++ b/Spigot-Server-Patches/0187-Make-max-squid-spawn-height-configurable.patch @@ -21,10 +21,10 @@ index d2582d981f859b55ba5086540963c01ed49e4c15..92e6891502ef6dc276ed5b371124f24d + } } diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java -index 8c4f3b2c2e6e4e354562e32931b3fbf3d705a278..1c1ff2069d6daaf866a3e80a9b3ce78b19941384 100644 +index 915a2736447b651ac892254ed6429bad5a56954e..9c9ec8226ab43beaae0ef4abc97632b503e2120c 100644 --- a/src/main/java/net/minecraft/server/EntitySquid.java +++ b/src/main/java/net/minecraft/server/EntitySquid.java -@@ -171,7 +171,8 @@ public class EntitySquid extends EntityWaterAnimal { +@@ -169,7 +169,8 @@ public class EntitySquid extends EntityWaterAnimal { } public static boolean b(EntityTypes entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) { diff --git a/Spigot-Server-Patches/0188-PreCreatureSpawnEvent.patch b/Spigot-Server-Patches/0188-PreCreatureSpawnEvent.patch new file mode 100644 index 000000000..e07c6528c --- /dev/null +++ b/Spigot-Server-Patches/0188-PreCreatureSpawnEvent.patch @@ -0,0 +1,92 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 14 Jan 2018 17:01:31 -0500 +Subject: [PATCH] PreCreatureSpawnEvent + +Adds an event to fire before an Entity is created, so that plugins that need to cancel +CreatureSpawnEvent can do so from this event instead. + +Cancelling CreatureSpawnEvent rapidly causes a lot of garbage collection and CPU waste +as it's done after the Entity object has been fully created. + +Mob Limiting plugins and blanket "ban this type of monster" plugins should use this event +instead and save a lot of server resources. + +See: https://github.com/PaperMC/Paper/issues/917 + +diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +index efd4d2844c4ad638837a1fd971927758908e7db1..45cd44335427a818a580158d57025289f37079bf 100644 +--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +@@ -105,6 +105,27 @@ public abstract class MobSpawnerAbstract { + double d5 = j >= 3 ? nbttaglist.h(2) : (double) blockposition.getZ() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D; + + if (world.b(((EntityTypes) optional.get()).a(d3, d4, d5)) && EntityPositionTypes.a((EntityTypes) optional.get(), world.getMinecraftWorld(), EnumMobSpawn.SPAWNER, new BlockPosition(d3, d4, d5), world.getRandom())) { ++ // Paper start ++ EntityTypes entityType = optional.get(); ++ String key = EntityTypes.getName(entityType).getKey(); ++ ++ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); ++ if (type != null) { ++ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; ++ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( ++ MCUtil.toLocation(world, d3, d4, d5), ++ type, ++ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER ++ ); ++ if (!event.callEvent()) { ++ flag = true; ++ if (event.shouldAbortSpawn()) { ++ break; ++ } ++ continue; ++ } ++ } ++ // Paper end + Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> { + entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch); + return entity1; +diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java +index 50be743513145bd2c8b9c65af219f60099cbb09f..4b1a5e92cc05df06edd6d2d7eab5ca70b70ede79 100644 +--- a/src/main/java/net/minecraft/server/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +@@ -180,7 +180,12 @@ public final class SpawnerCreature { + j1 = biomebase_biomemeta.d + worldserver.random.nextInt(1 + biomebase_biomemeta.e - biomebase_biomemeta.d); + } + +- if (a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomebase_biomemeta, blockposition_mutableblockposition, d2) && spawnercreature_c.test(biomebase_biomemeta.c, blockposition_mutableblockposition, ichunkaccess)) { ++ // Paper start ++ Boolean doSpawning = a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomebase_biomemeta, blockposition_mutableblockposition, d2); ++ if (doSpawning == null) { ++ return; ++ } ++ if (doSpawning.booleanValue() && spawnercreature_c.test(biomebase_biomemeta.c, blockposition_mutableblockposition, ichunkaccess)) { // Paper end + EntityInsentient entityinsentient = a(worldserver, biomebase_biomemeta.c); + + if (entityinsentient == null) { +@@ -234,8 +239,24 @@ public final class SpawnerCreature { + } + } + +- private static boolean a(WorldServer worldserver, EnumCreatureType enumcreaturetype, StructureManager structuremanager, ChunkGenerator chunkgenerator, BiomeBase.BiomeMeta biomebase_biomemeta, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) { ++ private static Boolean a(WorldServer worldserver, EnumCreatureType enumcreaturetype, StructureManager structuremanager, ChunkGenerator chunkgenerator, BiomeBase.BiomeMeta biomebase_biomemeta, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) { // Paper + EntityTypes entitytypes = biomebase_biomemeta.c; ++ // Paper start ++ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; ++ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityTypes.getName(entitytypes).getKey()); ++ if (type != null) { ++ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( ++ MCUtil.toLocation(worldserver, blockposition_mutableblockposition), ++ type, SpawnReason.NATURAL ++ ); ++ if (!event.callEvent()) { ++ if (event.shouldAbortSpawn()) { ++ return null; ++ } ++ return false; // TODO is this handled correctly? ++ } ++ } ++ // Paper end + + if (entitytypes.e() == EnumCreatureType.MISC) { + return false; diff --git a/Spigot-Server-Patches/0190-PlayerNaturallySpawnCreaturesEvent.patch b/Spigot-Server-Patches/0189-PlayerNaturallySpawnCreaturesEvent.patch similarity index 82% rename from Spigot-Server-Patches/0190-PlayerNaturallySpawnCreaturesEvent.patch rename to Spigot-Server-Patches/0189-PlayerNaturallySpawnCreaturesEvent.patch index c21361276..cf0949b6b 100644 --- a/Spigot-Server-Patches/0190-PlayerNaturallySpawnCreaturesEvent.patch +++ b/Spigot-Server-Patches/0189-PlayerNaturallySpawnCreaturesEvent.patch @@ -9,27 +9,27 @@ from triggering monster spawns on a server. Also a highly more effecient way to blanket block spawns in a world diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 7464aeb4e2f2cbe177cfd2ac19c45aabac625632..261eff5bdb4f4dfae2f66eecad79b21fef69ea8f 100644 +index 7abd3683f9cc21b90dc74739954de2decddf6478..6921def2dc8dd7f2b8ba9d46ab697a9f9b62cf4e 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -599,6 +599,15 @@ public class ChunkProviderServer extends IChunkProvider { - - this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings +@@ -589,6 +589,15 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().exit(); + //List list = Lists.newArrayList(this.playerChunkMap.f()); // Paper + //Collections.shuffle(list); // Paper + //Paper start - call player naturally spawn event + int chunkRange = world.spigotConfig.mobSpawnRange; + chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange; + chunkRange = Math.min(chunkRange, 8); -+ for (EntityPlayer entityPlayer : this.world.players) { ++ for (EntityPlayer entityPlayer : this.world.getPlayers()) { + entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange); + entityPlayer.playerNaturallySpawnedEvent.callEvent(); + }; + // Paper end - this.playerChunkMap.f().forEach((playerchunk) -> { - Optional optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... + Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index bf32997c422d478699c32ce0539a65c35fbf0d12..88692d9eaea57a4d172d537a6cf2a3bffe058d54 100644 +index f4275e2ba2659d3087395105da9446225d3a904c..00b19cce68abf405117c5e2d55ba86fc10e7db34 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -1,5 +1,6 @@ @@ -39,7 +39,7 @@ index bf32997c422d478699c32ce0539a65c35fbf0d12..88692d9eaea57a4d172d537a6cf2a3bf import com.google.common.collect.Lists; import com.mojang.authlib.GameProfile; import com.mojang.datafixers.util.Either; -@@ -89,6 +90,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -93,6 +94,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean sentListPacket = false; public Integer clientViewDistance; // CraftBukkit end @@ -48,10 +48,10 @@ index bf32997c422d478699c32ce0539a65c35fbf0d12..88692d9eaea57a4d172d537a6cf2a3bf public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0edba596754c6d5379c3c1eb0469aee447b7113f..7804cc0f6a02d14f4adbe05b37e8470a382c0d26 100644 +index cec1baadf5e8e0459837522ca434327491005e8c..ebe18750e19030b7e7eceb8190fc8d78dc0c3a90 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -882,12 +882,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -912,12 +912,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange; chunkRange = (chunkRange > 8) ? 8 : chunkRange; diff --git a/Spigot-Server-Patches/0189-PreCreatureSpawnEvent.patch b/Spigot-Server-Patches/0189-PreCreatureSpawnEvent.patch deleted file mode 100644 index db46076d7..000000000 --- a/Spigot-Server-Patches/0189-PreCreatureSpawnEvent.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 14 Jan 2018 17:01:31 -0500 -Subject: [PATCH] PreCreatureSpawnEvent - -Adds an event to fire before an Entity is created, so that plugins that need to cancel -CreatureSpawnEvent can do so from this event instead. - -Cancelling CreatureSpawnEvent rapidly causes a lot of garbage collection and CPU waste -as it's done after the Entity object has been fully created. - -Mob Limiting plugins and blanket "ban this type of monster" plugins should use this event -instead and save a lot of server resources. - -See: https://github.com/PaperMC/Paper/issues/917 - -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index c38295a09d99221cb196f9785ce674fe11120825..43c491f71b7739c782b46ee77ff8debe44213f11 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -105,6 +105,27 @@ public abstract class MobSpawnerAbstract { - double d5 = j >= 3 ? nbttaglist.h(2) : (double) blockposition.getZ() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D; - - if (world.a(((EntityTypes) optional.get()).a(d3, d4, d5)) && EntityPositionTypes.a((EntityTypes) optional.get(), world.getMinecraftWorld(), EnumMobSpawn.SPAWNER, new BlockPosition(d3, d4, d5), world.getRandom())) { -+ // Paper start -+ EntityTypes entityType = optional.get(); -+ String key = EntityTypes.getName(entityType).getKey(); -+ -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); -+ if (type != null) { -+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; -+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( -+ MCUtil.toLocation(world, d3, d4, d5), -+ type, -+ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER -+ ); -+ if (!event.callEvent()) { -+ flag = true; -+ if (event.shouldAbortSpawn()) { -+ break; -+ } -+ continue; -+ } -+ } -+ // Paper end - Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> { - entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch); - return entity1; -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 02157d051f3ecfc05f23ae8631cf01b6133ad159..224443e03c9e55af2744eebd7e754e2a1b3fa296 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -38,7 +38,7 @@ public final class SpawnerCreature { - BiomeBase.BiomeMeta biomebase_biomemeta = null; - GroupDataEntity groupdataentity = null; - int l1 = MathHelper.f(Math.random() * 4.0D); -- int i2 = 0; -+ int i2 = 0; // Paper - force diff on name change - int j2 = 0; - - while (true) { -@@ -77,6 +77,25 @@ public final class SpawnerCreature { - if (a(entitypositiontypes_surface, (IWorldReader) worldserver, (BlockPosition) blockposition_mutableblockposition, entitytypes) && EntityPositionTypes.a(entitytypes, worldserver, EnumMobSpawn.NATURAL, blockposition_mutableblockposition, worldserver.random) && worldserver.a(entitytypes.a((double) f, (double) k, (double) f1))) { - EntityInsentient entityinsentient; - -+ // Paper start -+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; -+ EntityTypes cls = biomebase_biomemeta.b; -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityTypes.getName(cls).getKey()); -+ if (type != null) { -+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( -+ MCUtil.toLocation(worldserver, blockposition_mutableblockposition), -+ type, SpawnReason.NATURAL -+ ); -+ if (!event.callEvent()) { -+ if (event.shouldAbortSpawn()) { -+ return; -+ } -+ ++i2; -+ continue; -+ } -+ } -+ // Paper end -+ - try { - Entity entity = entitytypes.a((World) worldserver); - diff --git a/Spigot-Server-Patches/0191-Add-setPlayerProfile-API-for-Skulls.patch b/Spigot-Server-Patches/0190-Add-setPlayerProfile-API-for-Skulls.patch similarity index 100% rename from Spigot-Server-Patches/0191-Add-setPlayerProfile-API-for-Skulls.patch rename to Spigot-Server-Patches/0190-Add-setPlayerProfile-API-for-Skulls.patch diff --git a/Spigot-Server-Patches/0192-Fill-Profile-Property-Events.patch b/Spigot-Server-Patches/0191-Fill-Profile-Property-Events.patch similarity index 90% rename from Spigot-Server-Patches/0192-Fill-Profile-Property-Events.patch rename to Spigot-Server-Patches/0191-Fill-Profile-Property-Events.patch index b70eaeb17..30643d081 100644 --- a/Spigot-Server-Patches/0192-Fill-Profile-Property-Events.patch +++ b/Spigot-Server-Patches/0191-Fill-Profile-Property-Events.patch @@ -11,18 +11,19 @@ If Mojang API does need to be hit, event fire so you can get the results. This is useful for implementing a ProfileCache for Player Skulls diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java -index 4b2a67423f57b70d316115e4525e3841a415b1cc..61cfdf73c8a5b0dcf2f9903ebbb2f4132ba1f0dd 100644 +index 93d73c27340645c7502acafdc0b2cfbc1a759dd8..5c7d2ee19243d0911a3a00af3ae42078a2ccba94 100644 --- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java +++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java -@@ -1,5 +1,7 @@ +@@ -1,6 +1,8 @@ package com.destroystokyo.paper.profile; + import com.mojang.authlib.Environment; +import com.destroystokyo.paper.event.profile.FillProfileEvent; +import com.destroystokyo.paper.event.profile.PreFillProfileEvent; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -@@ -19,7 +21,15 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi +@@ -20,7 +22,15 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi @Override public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) { diff --git a/Spigot-Server-Patches/0193-PlayerAdvancementCriterionGrantEvent.patch b/Spigot-Server-Patches/0192-PlayerAdvancementCriterionGrantEvent.patch similarity index 83% rename from Spigot-Server-Patches/0193-PlayerAdvancementCriterionGrantEvent.patch rename to Spigot-Server-Patches/0192-PlayerAdvancementCriterionGrantEvent.patch index c1c57794e..28973e775 100644 --- a/Spigot-Server-Patches/0193-PlayerAdvancementCriterionGrantEvent.patch +++ b/Spigot-Server-Patches/0192-PlayerAdvancementCriterionGrantEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerAdvancementCriterionGrantEvent diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -index ca661f3933dad81150654551de4679fe2baeb138..c41e1384724ab150f43dc43fe2a453c9b1262e48 100644 +index 12fc641299342a317177cf0ab876186fb8a2b760..57b9d13447a4f7804827c1bd41121c3069c696bd 100644 --- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -@@ -276,6 +276,12 @@ public class AdvancementDataPlayer { +@@ -279,6 +279,12 @@ public class AdvancementDataPlayer { boolean flag1 = advancementprogress.isDone(); if (advancementprogress.a(s)) { @@ -19,5 +19,5 @@ index ca661f3933dad81150654551de4679fe2baeb138..c41e1384724ab150f43dc43fe2a453c9 + } + // Paper end this.d(advancement); - this.i.add(advancement); + this.j.add(advancement); flag = true; diff --git a/Spigot-Server-Patches/0194-Add-ArmorStand-Item-Meta.patch b/Spigot-Server-Patches/0193-Add-ArmorStand-Item-Meta.patch similarity index 98% rename from Spigot-Server-Patches/0194-Add-ArmorStand-Item-Meta.patch rename to Spigot-Server-Patches/0193-Add-ArmorStand-Item-Meta.patch index bd6648dd4..c9871a8cb 100644 --- a/Spigot-Server-Patches/0194-Add-ArmorStand-Item-Meta.patch +++ b/Spigot-Server-Patches/0193-Add-ArmorStand-Item-Meta.patch @@ -267,10 +267,10 @@ index f700522840ee0dfd90871b1b0c8973d7d62a9353..3723faccac00afe19e59d71008ba1604 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index b9435bbd51764f75b8d24171513f3dddc48906f8..b87d2581754fde163a7b5532b9d5e21b48d3e243 100644 +index c1a42d04429a4e9587a4907c29f6b917951e659c..e5a2779a0460500c7d58f97c605549a366b5f0ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -1428,7 +1428,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1427,7 +1427,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { CraftMetaTropicalFishBucket.VARIANT.NBT, CraftMetaCrossbow.CHARGED.NBT, CraftMetaCrossbow.CHARGED_PROJECTILES.NBT, diff --git a/Spigot-Server-Patches/0195-Extend-Player-Interact-cancellation.patch b/Spigot-Server-Patches/0194-Extend-Player-Interact-cancellation.patch similarity index 73% rename from Spigot-Server-Patches/0195-Extend-Player-Interact-cancellation.patch rename to Spigot-Server-Patches/0194-Extend-Player-Interact-cancellation.patch index 74811bc0f..7ddec9164 100644 --- a/Spigot-Server-Patches/0195-Extend-Player-Interact-cancellation.patch +++ b/Spigot-Server-Patches/0194-Extend-Player-Interact-cancellation.patch @@ -13,10 +13,10 @@ Update adjacent blocks of doors, double plants, pistons and beds when cancelling interaction. diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index dff3eb118856bb4b79e4378b5c39100d65a09767..e2e5c17c24c8f5e9807ca879b1025d13cb195226 100644 +index ee59d76d31b8b8cfd39d612b1e6040891f2256f4..36cf4c332054a350ae193637f895a45a8b04da9b 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -137,6 +137,11 @@ public class PlayerInteractManager { +@@ -148,6 +148,11 @@ public class PlayerInteractManager { PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND); if (event.isCancelled()) { // Let the client know the block still exists @@ -28,15 +28,22 @@ index dff3eb118856bb4b79e4378b5c39100d65a09767..e2e5c17c24c8f5e9807ca879b1025d13 this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); // Update any tile entity data for this block TileEntity tileentity = this.world.getTileEntity(blockposition); -@@ -449,7 +454,25 @@ public class PlayerInteractManager { - ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down())); +@@ -446,13 +451,32 @@ public class PlayerInteractManager { + interactResult = event.useItemInHand() == Event.Result.DENY; + + if (event.useInteractedBlock() == Event.Result.DENY) { ++ + // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. + if (iblockdata.getBlock() instanceof BlockDoor) { + boolean bottom = iblockdata.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER; + entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down())); } else if (iblockdata.getBlock() instanceof BlockCake) { - ((EntityPlayer) entityhuman).getBukkitEntity().sendHealthUpdate(); // SPIGOT-1341 - reset health for cake + entityplayer.getBukkitEntity().sendHealthUpdate(); // SPIGOT-1341 - reset health for cake + // Paper start - extend Player Interact cancellation // TODO: consider merging this into the extracted method + } else if (iblockdata.getBlock() instanceof BlockStructure) { -+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutCloseWindow()); ++ entityplayer.playerConnection.sendPacket(new PacketPlayOutCloseWindow()); + } else if (iblockdata.getBlock() instanceof BlockCommand) { -+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutCloseWindow()); ++ entityplayer.playerConnection.sendPacket(new PacketPlayOutCloseWindow()); + } else if (iblockdata.getBlock() instanceof BlockFlowerPot) { + // Send a block change to air and then send back the correct block, just to make the client happy + PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(this.world, blockposition); @@ -51,6 +58,6 @@ index dff3eb118856bb4b79e4378b5c39100d65a09767..e2e5c17c24c8f5e9807ca879b1025d13 + } } + // Paper end - extend Player Interact cancellation - ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-2867 + entityplayer.getBukkitEntity().updateInventory(); // SPIGOT-2867 enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS; } else if (this.gamemode == EnumGamemode.SPECTATOR) { diff --git a/Spigot-Server-Patches/0196-Tameable-getOwnerUniqueId-API.patch b/Spigot-Server-Patches/0195-Tameable-getOwnerUniqueId-API.patch similarity index 88% rename from Spigot-Server-Patches/0196-Tameable-getOwnerUniqueId-API.patch rename to Spigot-Server-Patches/0195-Tameable-getOwnerUniqueId-API.patch index d27adf73e..2951cd45d 100644 --- a/Spigot-Server-Patches/0196-Tameable-getOwnerUniqueId-API.patch +++ b/Spigot-Server-Patches/0195-Tameable-getOwnerUniqueId-API.patch @@ -7,7 +7,7 @@ This is faster if all you need is the UUID, as .getOwner() will cause an OfflinePlayer to be loaded from disk. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -index 9952db3eb5ba94547f5e786c473fb59dfec616ab..1aea5f3f05794b444ca592cf518e29f76ccbd397 100644 +index 8c59b9ce12d4148b209c3824d44f6e9c736de16c..218a2190d1203ca0fbc2a5ad87e145f436aac314 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java @@ -90,6 +90,9 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac @@ -21,7 +21,7 @@ index 9952db3eb5ba94547f5e786c473fb59dfec616ab..1aea5f3f05794b444ca592cf518e29f7 return getHandle().getOwnerUUID(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java -index bff9854f3088649e6718ba8096abb170915f9d84..286d1194f2d46a8715a095ecaed276f657e5214b 100644 +index 58d9cd8172dcb8d3df93355d8ff51053b7469c45..6a642155cf387f7d0e2cf9bdf1a78c62aef8205b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java @@ -17,6 +17,9 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat diff --git a/Spigot-Server-Patches/0197-Toggleable-player-crits-helps-mitigate-hacked-client.patch b/Spigot-Server-Patches/0196-Toggleable-player-crits-helps-mitigate-hacked-client.patch similarity index 91% rename from Spigot-Server-Patches/0197-Toggleable-player-crits-helps-mitigate-hacked-client.patch rename to Spigot-Server-Patches/0196-Toggleable-player-crits-helps-mitigate-hacked-client.patch index d9c9f0df7..2e13a0372 100644 --- a/Spigot-Server-Patches/0197-Toggleable-player-crits-helps-mitigate-hacked-client.patch +++ b/Spigot-Server-Patches/0196-Toggleable-player-crits-helps-mitigate-hacked-client.patch @@ -21,10 +21,10 @@ index 92e6891502ef6dc276ed5b371124f24d5237b26b..77cdbfadf9c3eddb6a02460c321fa816 private void allChunksAreSlimeChunks() { allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 542f935b4e7a027b3df82f037fcd6523286c5106..55d08d77480fda81e0155aa1e0287fddc827b67a 100644 +index eaed020982bd19dab72872849170fa62d75699eb..5326e7433dc0a4ff0e1d0ca30aad95b1ec718d6a 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1063,6 +1063,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1042,6 +1042,7 @@ public abstract class EntityHuman extends EntityLiving { boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isClimbing() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && entity instanceof EntityLiving; diff --git a/Spigot-Server-Patches/0198-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch b/Spigot-Server-Patches/0197-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch similarity index 92% rename from Spigot-Server-Patches/0198-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch rename to Spigot-Server-Patches/0197-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch index 87e6aa309..2745dde43 100644 --- a/Spigot-Server-Patches/0198-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch +++ b/Spigot-Server-Patches/0197-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix NPE when getting location from InventoryEnderChest opened diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java -index 5a9ac3960de199b166ba481794529f8801cdebb7..fd31b9a6dcf6aba4041f9f08e49a9b464b956843 100644 +index ce74a5ff2905042e54615439b8e5369d6a921a27..bf8c5436b6cc9f661e7b607fa4696e7ae55b3a13 100644 --- a/src/main/java/net/minecraft/server/InventoryEnderChest.java +++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java @@ -5,7 +5,7 @@ import org.bukkit.inventory.InventoryHolder; diff --git a/Spigot-Server-Patches/0198-Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/Spigot-Server-Patches/0198-Prevent-Frosted-Ice-from-loading-holding-chunks.patch new file mode 100644 index 000000000..5dc72b261 --- /dev/null +++ b/Spigot-Server-Patches/0198-Prevent-Frosted-Ice-from-loading-holding-chunks.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 10 Mar 2018 16:33:15 -0500 +Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks + + +diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java +index 061b157f66999a733c3c4e990371b6f8d7860de2..77f5f835c60c181a0a2d6fc782d756338bc2ccb0 100644 +--- a/src/main/java/net/minecraft/server/BlockIceFrost.java ++++ b/src/main/java/net/minecraft/server/BlockIceFrost.java +@@ -28,7 +28,8 @@ public class BlockIceFrost extends BlockIce { + EnumDirection enumdirection = aenumdirection[j]; + + blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, enumdirection); +- IBlockData iblockdata1 = worldserver.getType(blockposition_mutableblockposition); ++ IBlockData iblockdata1 = worldserver.getTypeIfLoaded(blockposition_mutableblockposition); // Paper ++ if (iblockdata1 == null) { continue; } // Paper + + if (iblockdata1.a((Block) this) && !this.e(iblockdata1, (World) worldserver, blockposition_mutableblockposition)) { + worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay +@@ -71,7 +72,9 @@ public class BlockIceFrost extends BlockIce { + EnumDirection enumdirection = aenumdirection[l]; + + blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, enumdirection); +- if (iblockaccess.getType(blockposition_mutableblockposition).a((Block) this)) { ++ // Paper start ++ IBlockData type = iblockaccess.getTypeIfLoaded(blockposition_mutableblockposition); ++ if (type != null && type.a((Block) this)) { // Paper end + ++j; + if (j >= i) { + return false; diff --git a/Spigot-Server-Patches/0200-Disable-Explicit-Network-Manager-Flushing.patch b/Spigot-Server-Patches/0199-Disable-Explicit-Network-Manager-Flushing.patch similarity index 90% rename from Spigot-Server-Patches/0200-Disable-Explicit-Network-Manager-Flushing.patch rename to Spigot-Server-Patches/0199-Disable-Explicit-Network-Manager-Flushing.patch index dfe29e706..d7aad3619 100644 --- a/Spigot-Server-Patches/0200-Disable-Explicit-Network-Manager-Flushing.patch +++ b/Spigot-Server-Patches/0199-Disable-Explicit-Network-Manager-Flushing.patch @@ -12,7 +12,7 @@ flushing on the netty event loop, so it won't do the flush on the main thread. Renable flushing by passing -Dpaper.explicit-flush=true diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index e2d8ed88f05bf8cb214329ea27ac2b67f43e071a..08e314af7cbd6523bbd0bd5a5ad0a0fff2f080be 100644 +index 33900c22d4123e0f8333b9bdb9601d302e26c972..8cb29ddc0d5a5951ea35e1a16c023efb9b0be42d 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -63,6 +63,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -23,7 +23,7 @@ index e2d8ed88f05bf8cb214329ea27ac2b67f43e071a..08e314af7cbd6523bbd0bd5a5ad0a0ff // Paper end public NetworkManager(EnumProtocolDirection enumprotocoldirection) { -@@ -231,7 +232,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -230,7 +231,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } if (this.channel != null) { diff --git a/Spigot-Server-Patches/0199-Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/Spigot-Server-Patches/0199-Prevent-Frosted-Ice-from-loading-holding-chunks.patch deleted file mode 100644 index bb2a2bba4..000000000 --- a/Spigot-Server-Patches/0199-Prevent-Frosted-Ice-from-loading-holding-chunks.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 10 Mar 2018 16:33:15 -0500 -Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks - - -diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java -index 5e414138e4e542c16508d679e571aac72c082e7b..638a0aa5ae80da2df9e640060272b83c6fc986ae 100644 ---- a/src/main/java/net/minecraft/server/BlockIceFrost.java -+++ b/src/main/java/net/minecraft/server/BlockIceFrost.java -@@ -26,8 +26,8 @@ public class BlockIceFrost extends BlockIce { - EnumDirection enumdirection = aenumdirection[j]; - - blockposition_pooledblockposition.g(blockposition).c(enumdirection); -- IBlockData iblockdata1 = worldserver.getType(blockposition_pooledblockposition); -- -+ IBlockData iblockdata1 = worldserver.getTypeIfLoaded(blockposition_pooledblockposition); // Paper - don't load chunks -+ if (iblockdata1 == null) continue; // Paper - if (iblockdata1.getBlock() == this && !this.e(iblockdata1, (World) worldserver, blockposition_pooledblockposition)) { - worldserver.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay - } -@@ -89,7 +89,7 @@ public class BlockIceFrost extends BlockIce { - EnumDirection enumdirection = aenumdirection[l]; - - blockposition_pooledblockposition.g(blockposition).c(enumdirection); -- if (iblockaccess.getType(blockposition_pooledblockposition).getBlock() == this) { -+ if (((World) iblockaccess).getBlockIfLoaded(blockposition_pooledblockposition) == this) { // Paper - don't load chunks - ++j; - if (j >= i) { - boolean flag = false; diff --git a/Spigot-Server-Patches/0201-Implement-extended-PaperServerListPingEvent.patch b/Spigot-Server-Patches/0200-Implement-extended-PaperServerListPingEvent.patch similarity index 95% rename from Spigot-Server-Patches/0201-Implement-extended-PaperServerListPingEvent.patch rename to Spigot-Server-Patches/0200-Implement-extended-PaperServerListPingEvent.patch index a59630a80..a2619661a 100644 --- a/Spigot-Server-Patches/0201-Implement-extended-PaperServerListPingEvent.patch +++ b/Spigot-Server-Patches/0200-Implement-extended-PaperServerListPingEvent.patch @@ -177,30 +177,30 @@ index 0000000000000000000000000000000000000000..a85466bc7e0a8aa54b9eff14077fe6c9 + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 54f80cb8e1b771f2a493543e04f8bc8346a391dc..e7ee0e9b9b68f1fe31e189fbfd7e5b175a288a50 100644 +index 82e0def9becf8ecb68b2629531852808ad5a40a3..445d691b5051b4aefe480bea33a7bd6855009ecf 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1,6 +1,9 @@ - package net.minecraft.server; +@@ -2,6 +2,9 @@ package net.minecraft.server; import com.google.common.base.Splitter; + import com.google.common.collect.ImmutableList; +import co.aikar.timings.Timings; +import com.destroystokyo.paper.event.server.PaperServerListPingEvent; +import com.google.common.base.Stopwatch; import com.google.common.collect.Lists; import com.google.common.collect.Maps; - import com.google.gson.JsonElement; -@@ -1095,7 +1098,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 5000000000L) { - this.Z = i; + import com.google.common.collect.Sets; +@@ -1118,7 +1121,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 5000000000L) { + this.T = i; this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount())); - GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), 12)]; + GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), org.spigotmc.SpigotConfig.playerSample)]; // Paper - int j = MathHelper.nextInt(this.q, 0, this.getPlayerCount() - agameprofile.length); + int j = MathHelper.nextInt(this.r, 0, this.getPlayerCount() - agameprofile.length); for (int k = 0; k < agameprofile.length; ++k) { diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index 658ea609cb4927b29a3d5303006f2adf2847e06b..4bb21c48bd50353370ec3c3546a00a5d20e4b9d8 100644 +index d9d9999e79f888d9d9ac0ef9ae5b3db67ac405ed..da804a9904c0bf7219729e9b9aca1bfc72dd10d6 100644 --- a/src/main/java/net/minecraft/server/PacketStatusListener.java +++ b/src/main/java/net/minecraft/server/PacketStatusListener.java @@ -37,6 +37,8 @@ public class PacketStatusListener implements PacketStatusInListener { diff --git a/Spigot-Server-Patches/0202-Improved-Async-Task-Scheduler.patch b/Spigot-Server-Patches/0201-Improved-Async-Task-Scheduler.patch similarity index 100% rename from Spigot-Server-Patches/0202-Improved-Async-Task-Scheduler.patch rename to Spigot-Server-Patches/0201-Improved-Async-Task-Scheduler.patch diff --git a/Spigot-Server-Patches/0203-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/Spigot-Server-Patches/0202-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch similarity index 89% rename from Spigot-Server-Patches/0203-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch rename to Spigot-Server-Patches/0202-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch index 9081b53c9..1e599aa25 100644 --- a/Spigot-Server-Patches/0203-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ b/Spigot-Server-Patches/0202-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent This will allow you to change the players name or skin on login. diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 1fb609dcfc61adfc63f0d32dc87a5e144a5013cf..1b43f921646e3c1bfdca22ef7d3719c72aaf4520 100644 +index 3cc12e7b75b8ed21a0ea44f8453553cf856fb786..80a21dbc05ed3007f2e827f7a320131244c3044b 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java @@ -1,5 +1,7 @@ @@ -16,8 +16,8 @@ index 1fb609dcfc61adfc63f0d32dc87a5e144a5013cf..1b43f921646e3c1bfdca22ef7d3719c7 +import com.destroystokyo.paper.profile.PlayerProfile; import com.mojang.authlib.GameProfile; import com.mojang.authlib.exceptions.AuthenticationUnavailableException; - import io.netty.channel.ChannelFuture; -@@ -19,6 +21,7 @@ import org.apache.logging.log4j.LogManager; + import java.math.BigInteger; +@@ -18,6 +20,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // CraftBukkit start @@ -25,7 +25,7 @@ index 1fb609dcfc61adfc63f0d32dc87a5e144a5013cf..1b43f921646e3c1bfdca22ef7d3719c7 import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerPreLoginEvent; -@@ -287,8 +290,16 @@ public class LoginListener implements PacketLoginInListener { +@@ -286,8 +289,16 @@ public class LoginListener implements PacketLoginInListener { java.util.UUID uniqueId = i.getId(); final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;