From 4aa79558187e23f95ac550e0ce59782634572904 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Thu, 25 Jun 2020 06:11:48 -0700 Subject: [PATCH] even even more work --- .../Ability-to-apply-mending-to-XP-API.patch | 2 +- ...e-PlayerProfile-in-AsyncPreLoginEven.patch | 2 +- .../Add-PlayerArmorChangeEvent.patch | 28 ++++---- .../Add-PlayerJumpEvent.patch | 4 +- .../Add-UnknownCommandEvent.patch | 4 +- ...-a-custom-authentication-servers-dow.patch | 2 +- .../AsyncTabCompleteEvent.patch | 22 +++--- .../Basic-PlayerProfile-API.patch | 45 +++++++----- .../Do-not-let-armorstands-drown.patch | 8 +-- ...nt-protocol-version-and-virtual-host.patch | 8 --- .../Extend-Player-Interact-cancellation.patch | 17 +++-- .../Fill-Profile-Property-Events.patch | 1 + .../Fix-this-stupid-bullshit.patch | 2 +- ...nt-extended-PaperServerListPingEvent.patch | 12 ++-- .../Implement-getI18NDisplayName.patch | 21 ++++-- .../Improve-the-Saddle-API-for-Horses.patch | 2 +- .../Item-canEntityPickup.patch | 4 +- .../LivingEntity-setKiller.patch | 4 +- ...awns-should-honor-nametags-and-leash.patch | 2 +- ...PlayerAdvancementCriterionGrantEvent.patch | 2 +- .../PlayerNaturallySpawnCreaturesEvent.patch | 10 +-- .../PlayerPickupExperienceEvent.patch | 8 +-- .../PreCreatureSpawnEvent.patch | 69 ++++++++++--------- ...sted-Ice-from-loading-holding-chunks.patch | 33 ++++----- ...rom-being-processed-when-the-player-.patch | 2 +- .../Profile-Lookup-Events.patch | 9 ++- .../ProfileWhitelistVerifyEvent.patch | 9 +-- ...le-async-calls-to-restart-the-server.patch | 6 +- ...dEffects-only-to-players-who-can-see.patch | 4 +- ...oleAppender-for-console-improvements.patch | 22 +++--- .../handle-PacketPlayInKeepAlive-async.patch | 3 +- ...rt-serverside-behavior-of-keepalives.patch | 14 ++-- ...e-implementations-for-captured-block.patch | 2 +- 33 files changed, 200 insertions(+), 183 deletions(-) diff --git a/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch b/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch index 61a683e77b..f59cc5e55a 100644 --- a/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch +++ b/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } @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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java diff --git a/Spigot-Server-Patches/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/Spigot-Server-Patches/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch index 2722950169..c3447efd77 100644 --- a/Spigot-Server-Patches/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ b/Spigot-Server-Patches/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.destroystokyo.paper.profile.PlayerProfile; import com.mojang.authlib.GameProfile; import com.mojang.authlib.exceptions.AuthenticationUnavailableException; - import io.netty.channel.ChannelFuture; + import java.math.BigInteger; @@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch index 251ed82155..f78f0cbd97 100644 --- a/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch @@ -11,24 +11,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ package net.minecraft.server; -+import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; ++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.ImmutableSet; + import com.google.common.collect.ImmutableMap; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - ItemStack itemstack1 = this.getEquipment(enumitemslot); + 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)); + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EnumItemSlot.java diff --git a/Spigot-Server-Patches/Add-PlayerJumpEvent.patch b/Spigot-Server-Patches/Add-PlayerJumpEvent.patch index 3cb5cd8994..9b7c2491ee 100644 --- a/Spigot-Server-Patches/Add-PlayerJumpEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerJumpEvent.patch @@ -18,9 +18,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end @@ -0,0 +0,0 @@ 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/Add-UnknownCommandEvent.patch b/Spigot-Server-Patches/Add-UnknownCommandEvent.patch index 39dc00d560..d459cb3296 100644 --- a/Spigot-Server-Patches/Add-UnknownCommandEvent.patch +++ b/Spigot-Server-Patches/Add-UnknownCommandEvent.patch @@ -8,9 +8,9 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -0,0 +0,0 @@ import net.minecraft.server.WorldServer; +@@ -0,0 +0,0 @@ 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; diff --git a/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch b/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch index 7c42041f2a..5d939965c5 100644 --- a/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch @@ -38,6 +38,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/AsyncTabCompleteEvent.patch b/Spigot-Server-Patches/AsyncTabCompleteEvent.patch index 6a34979c0d..5fa430455d 100644 --- a/Spigot-Server-Patches/AsyncTabCompleteEvent.patch +++ b/Spigot-Server-Patches/AsyncTabCompleteEvent.patch @@ -46,19 +46,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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,7 +68,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + player.playerConnection.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), builder.buildFuture().join())); + } + // Paper end - async tab completion -+ } @Override diff --git a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch index 15df7c9edb..0fa7b80c05 100644 --- a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch @@ -315,17 +315,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +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,12 +336,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @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 @@ -352,13 +353,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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 @@ -374,6 +376,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +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..00000000000000000000000000000000 +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 @@ -445,21 +448,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** * Calculates distance between 2 entities * @param e1 +diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/Main.java ++++ b/src/main/java/net/minecraft/server/Main.java +@@ -0,0 +0,0 @@ public class Main { + } + + File file = (File) optionset.valueOf("universe"); // CraftBukkit +- YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString()); ++ YggdrasilAuthenticationService yggdrasilauthenticationservice = new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString()); // Paper + MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); + GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); + UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName())); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 5000000000L) { - this.Z = i; + if (i - this.T >= 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 diff --git a/Spigot-Server-Patches/Implement-getI18NDisplayName.patch b/Spigot-Server-Patches/Implement-getI18NDisplayName.patch index e23ac6ac71..76837e9405 100644 --- a/Spigot-Server-Patches/Implement-getI18NDisplayName.patch +++ b/Spigot-Server-Patches/Implement-getI18NDisplayName.patch @@ -11,19 +11,28 @@ diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/LocaleLanguage.java +++ b/src/main/java/net/minecraft/server/LocaleLanguage.java -@@ -0,0 +0,0 @@ public class LocaleLanguage { +@@ -0,0 +0,0 @@ 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"); +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java diff --git a/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch b/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch index 6cc44be4fa..09e1fdb7e5 100644 --- a/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch +++ b/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch @@ -10,7 +10,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -@@ -0,0 +0,0 @@ import net.minecraft.server.EntityHorseAbstract; +@@ -0,0 +0,0 @@ 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/Item-canEntityPickup.patch b/Spigot-Server-Patches/Item-canEntityPickup.patch index 05e3cbe5ed..9df7a8230c 100644 --- a/Spigot-Server-Patches/Item-canEntityPickup.patch +++ b/Spigot-Server-Patches/Item-canEntityPickup.patch @@ -11,13 +11,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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 diff --git a/Spigot-Server-Patches/LivingEntity-setKiller.patch b/Spigot-Server-Patches/LivingEntity-setKiller.patch index c0dbee1b02..4edf41b263 100644 --- a/Spigot-Server-Patches/LivingEntity-setKiller.patch +++ b/Spigot-Server-Patches/LivingEntity-setKiller.patch @@ -10,13 +10,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch b/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch index b083060b69..a1ab905d58 100644 --- a/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -16,4 +16,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/PlayerAdvancementCriterionGrantEvent.patch b/Spigot-Server-Patches/PlayerAdvancementCriterionGrantEvent.patch index cdaae1d3c1..42595d86d6 100644 --- a/Spigot-Server-Patches/PlayerAdvancementCriterionGrantEvent.patch +++ b/Spigot-Server-Patches/PlayerAdvancementCriterionGrantEvent.patch @@ -19,5 +19,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end this.d(advancement); - this.i.add(advancement); + this.j.add(advancement); flag = true; diff --git a/Spigot-Server-Patches/PlayerNaturallySpawnCreaturesEvent.patch b/Spigot-Server-Patches/PlayerNaturallySpawnCreaturesEvent.patch index 7b3e8ec2db..c726713c3b 100644 --- a/Spigot-Server-Patches/PlayerNaturallySpawnCreaturesEvent.patch +++ b/Spigot-Server-Patches/PlayerNaturallySpawnCreaturesEvent.patch @@ -13,20 +13,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - - this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch b/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch index 608747378c..a98c235140 100644 --- a/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch +++ b/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch @@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @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/PreCreatureSpawnEvent.patch b/Spigot-Server-Patches/PreCreatureSpawnEvent.patch index dd5fe1dd41..54f268c6aa 100644 --- a/Spigot-Server-Patches/PreCreatureSpawnEvent.patch +++ b/Spigot-Server-Patches/PreCreatureSpawnEvent.patch @@ -21,9 +21,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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())) { + 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(); ++ EntityTypes entityType = optional.get(); + String key = EntityTypes.getName(entityType).getKey(); + + org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); @@ -51,37 +51,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -0,0 +0,0 @@ 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; + j1 = biomebase_biomemeta.d + worldserver.random.nextInt(1 + biomebase_biomemeta.e - biomebase_biomemeta.d); + } - while (true) { +- 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) { @@ -0,0 +0,0 @@ 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); +- 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/Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/Spigot-Server-Patches/Prevent-Frosted-Ice-from-loading-holding-chunks.patch index 28c75edfd3..b065e63281 100644 --- a/Spigot-Server-Patches/Prevent-Frosted-Ice-from-loading-holding-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Frosted-Ice-from-loading-holding-chunks.patch @@ -9,22 +9,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/BlockIceFrost.java +++ b/src/main/java/net/minecraft/server/BlockIceFrost.java @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { - EnumDirection enumdirection = aenumdirection[j]; + 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 - } + 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 @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { - EnumDirection enumdirection = aenumdirection[l]; + 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; + 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/Prevent-logins-from-being-processed-when-the-player-.patch b/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch index 66d4779626..f020fa950d 100644 --- a/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch +++ b/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch @@ -20,5 +20,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // 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/Profile-Lookup-Events.patch b/Spigot-Server-Patches/Profile-Lookup-Events.patch index b76c4776aa..d9b9aff6a5 100644 --- a/Spigot-Server-Patches/Profile-Lookup-Events.patch +++ b/Spigot-Server-Patches/Profile-Lookup-Events.patch @@ -17,18 +17,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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); +@@ -0,0 +0,0 @@ public class PaperGameProfileRepository extends YggdrasilGameProfileRepository { @Override public void findProfilesByNames(String[] names, Agent agent, ProfileLookupCallback callback) { diff --git a/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch b/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch index 508d586486..d9429a8cb8 100644 --- a/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch +++ b/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch @@ -9,12 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { - - // return chatmessage; if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot -- } else if (!this.isWhitelisted(gameprofile)) { -+ } else if (!this.isWhitelisted(gameprofile, event)) { // Paper - 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()) { @@ -46,4 +43,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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/Properly-handle-async-calls-to-restart-the-server.patch b/Spigot-Server-Patches/Properly-handle-async-calls-to-restart-the-server.patch index 76ba93d724..8e6af2a1c6 100644 --- a/Spigot-Server-Patches/Properly-handle-async-calls-to-restart-the-server.patch +++ b/Spigot-Server-Patches/Properly-handle-async-calls-to-restart-the-server.patch @@ -34,9 +34,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant worldServer = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods + public final Map, 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; @@ -77,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { - entityplayer.playerInteractManager.b(generatoraccess.getWorldData().getGameType()); + entityplayer.playerInteractManager.b(worldserver.getMinecraftServer().getSaveData().getGameType()); } + // Paper start - Extract method to allow for restarting flag diff --git a/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch b/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch index 6b013310df..7f0ea1018d 100644 --- a/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + public void attack(Entity entity) { - if (entity.bA()) { + if (entity.bH()) { if (!entity.t(this)) { @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { int i = b0 + EnchantmentManager.b((EntityLiving) this); @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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(); } @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { diff --git a/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch b/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch index a42f1c07b0..92c15e858e 100644 --- a/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch @@ -194,10 +194,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { -+ this.disconnect(new ChatMessage("disconnect.timeout")); + this.disconnect(new ChatMessage("disconnect.timeout")); + }); + // Paper end } diff --git a/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch b/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch index 7b6cc63ff7..ac4a543121 100644 --- a/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch +++ b/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch @@ -45,6 +45,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.setLastPing(currentTime); + this.setKeepAliveID(currentTime); + this.sendPacket(new PacketPlayOutKeepAlive(this.getKeepAliveID())); -+ } } + // Paper end diff --git a/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch b/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch index 75958afe19..8b4fb45e72 100644 --- a/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch +++ b/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public List captureDrops; public long ticksPerAnimalSpawns; @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { + public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { - CapturedBlockState blockstate = capturedBlockStates.get(blockposition);