diff --git a/patches/unapplied/server/API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch similarity index 96% rename from patches/unapplied/server/API-to-get-a-BlockState-without-a-snapshot.patch rename to patches/server/API-to-get-a-BlockState-without-a-snapshot.patch index 280275ba5..ea056a02c 100644 --- a/patches/unapplied/server/API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class BlockEntity { // CraftBukkit start - read container - public void load(CompoundTag nbt) { + protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) { - this.persistentDataContainer = new CraftPersistentDataContainer(BlockEntity.DATA_TYPE_REGISTRY); + this.persistentDataContainer.clear(); // Paper - clear instead of init @@ -100,10 +100,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } - protected CraftBlockEntityState(CraftBlockEntityState state) { + protected CraftBlockEntityState(CraftBlockEntityState state, Location location) { @@ -0,0 +0,0 @@ public class CraftBlockEntityState extends CraftBlockStat - public CraftBlockEntityState copy() { - return new CraftBlockEntityState<>(this); + public CraftBlockEntityState copy(Location location) { + return new CraftBlockEntityState<>(this, location); } + + // Paper start @@ -147,7 +147,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } - public static BlockState getBlockState(Material material, @Nullable CompoundTag blockEntityTag) { + @Deprecated diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java diff --git a/patches/unapplied/server/Ability-to-apply-mending-to-XP-API.patch b/patches/server/Ability-to-apply-mending-to-XP-API.patch similarity index 100% rename from patches/unapplied/server/Ability-to-apply-mending-to-XP-API.patch rename to patches/server/Ability-to-apply-mending-to-XP-API.patch diff --git a/patches/unapplied/server/Add-API-methods-to-control-if-armor-stands-can-move.patch b/patches/server/Add-API-methods-to-control-if-armor-stands-can-move.patch similarity index 100% rename from patches/unapplied/server/Add-API-methods-to-control-if-armor-stands-can-move.patch rename to patches/server/Add-API-methods-to-control-if-armor-stands-can-move.patch diff --git a/patches/unapplied/server/Add-EntityZapEvent.patch b/patches/server/Add-EntityZapEvent.patch similarity index 98% rename from patches/unapplied/server/Add-EntityZapEvent.patch rename to patches/server/Add-EntityZapEvent.patch index 6fb303b93..a0cbb2a00 100644 --- a/patches/unapplied/server/Add-EntityZapEvent.patch +++ b/patches/server/Add-EntityZapEvent.patch @@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - Add EntityZapEvent + entitywitch.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); - entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null, (CompoundTag) null); + entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null); entitywitch.setNoAi(this.isNoAi()); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/unapplied/server/Add-PlayerArmorChangeEvent.patch b/patches/server/Add-PlayerArmorChangeEvent.patch similarity index 96% rename from patches/unapplied/server/Add-PlayerArmorChangeEvent.patch rename to patches/server/Add-PlayerArmorChangeEvent.patch index 782bb9fc1..1f2f29624 100644 --- a/patches/unapplied/server/Add-PlayerArmorChangeEvent.patch +++ b/patches/server/Add-PlayerArmorChangeEvent.patch @@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { - ItemStack itemstack1 = this.getItemBySlot(enumitemslot); + ItemStack itemstack2 = this.getItemBySlot(enumitemslot); - if (this.equipmentHasChanged(itemstack, itemstack1)) { + if (this.equipmentHasChanged(itemstack1, itemstack2)) { + // Paper start - PlayerArmorChangeEvent + if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.ARMOR) { -+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); -+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); ++ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack1); ++ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack2); + new com.destroystokyo.paper.event.player.PlayerArmorChangeEvent((Player) this.getBukkitEntity(), com.destroystokyo.paper.event.player.PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); + } + // Paper end - PlayerArmorChangeEvent diff --git a/patches/unapplied/server/Add-PlayerInitialSpawnEvent.patch b/patches/server/Add-PlayerInitialSpawnEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerInitialSpawnEvent.patch rename to patches/server/Add-PlayerInitialSpawnEvent.patch diff --git a/patches/unapplied/server/Add-PlayerJumpEvent.patch b/patches/server/Add-PlayerJumpEvent.patch similarity index 95% rename from patches/unapplied/server/Add-PlayerJumpEvent.patch rename to patches/server/Add-PlayerJumpEvent.patch index d83dd9ac6..a49da4b35 100644 --- a/patches/unapplied/server/Add-PlayerJumpEvent.patch +++ b/patches/server/Add-PlayerJumpEvent.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - boolean flag = d7 > 0.0D; + boolean flag1 = d7 > 0.0D; - if (this.player.onGround() && !packet.isOnGround() && flag) { + if (this.player.onGround() && !packet.isOnGround() && flag1) { - this.player.jumpFromGround(); + // Paper start - Add PlayerJumpEvent + Player player = this.getCraftPlayer(); @@ -43,4 +43,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - Add PlayerJumpEvent } - boolean flag1 = this.player.verticalCollisionBelow; + boolean flag2 = this.player.verticalCollisionBelow; diff --git a/patches/unapplied/server/Add-PlayerUseUnknownEntityEvent.patch b/patches/server/Add-PlayerUseUnknownEntityEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerUseUnknownEntityEvent.patch rename to patches/server/Add-PlayerUseUnknownEntityEvent.patch diff --git a/patches/unapplied/server/Add-ProjectileCollideEvent.patch b/patches/server/Add-ProjectileCollideEvent.patch similarity index 100% rename from patches/unapplied/server/Add-ProjectileCollideEvent.patch rename to patches/server/Add-ProjectileCollideEvent.patch diff --git a/patches/unapplied/server/Add-UnknownCommandEvent.patch b/patches/server/Add-UnknownCommandEvent.patch similarity index 98% rename from patches/unapplied/server/Add-UnknownCommandEvent.patch rename to patches/server/Add-UnknownCommandEvent.patch index 3b3d6c163..c96475e02 100644 --- a/patches/unapplied/server/Add-UnknownCommandEvent.patch +++ b/patches/server/Add-UnknownCommandEvent.patch @@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 commandlistenerwrapper.getServer().getProfiler().push(() -> { return "/" + s; }); -- ContextChain contextchain = Commands.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit +- ContextChain contextchain = Commands.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit + ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent try { diff --git a/patches/unapplied/server/Add-World-Util-Methods.patch b/patches/server/Add-World-Util-Methods.patch similarity index 100% rename from patches/unapplied/server/Add-World-Util-Methods.patch rename to patches/server/Add-World-Util-Methods.patch diff --git a/patches/unapplied/server/Add-ability-to-configure-frosted_ice-properties.patch b/patches/server/Add-ability-to-configure-frosted_ice-properties.patch similarity index 95% rename from patches/unapplied/server/Add-ability-to-configure-frosted_ice-properties.patch rename to patches/server/Add-ability-to-configure-frosted_ice-properties.patch index c9ab7cfdc..a197cc272 100644 --- a/patches/unapplied/server/Add-ability-to-configure-frosted_ice-properties.patch +++ b/patches/server/Add-ability-to-configure-frosted_ice-properties.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class FrostedIceBlock extends IceBlock { @Override - public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (!world.paperConfig().environment.frostedIce.enabled) return; // Paper - Frosted ice options if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) diff --git a/patches/unapplied/server/Add-configurable-portal-search-radius.patch b/patches/server/Add-configurable-portal-search-radius.patch similarity index 96% rename from patches/unapplied/server/Add-configurable-portal-search-radius.patch rename to patches/server/Add-configurable-portal-search-radius.patch index 557b40431..eb68337a7 100644 --- a/patches/unapplied/server/Add-configurable-portal-search-radius.patch +++ b/patches/server/Add-configurable-portal-search-radius.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess double d0 = DimensionType.getTeleportationScale(this.level().dimensionType(), destination.dimensionType()); BlockPos blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0); // CraftBukkit start diff --git a/patches/unapplied/server/Add-configuration-option-to-prevent-player-names-fro.patch b/patches/server/Add-configuration-option-to-prevent-player-names-fro.patch similarity index 100% rename from patches/unapplied/server/Add-configuration-option-to-prevent-player-names-fro.patch rename to patches/server/Add-configuration-option-to-prevent-player-names-fro.patch diff --git a/patches/unapplied/server/Add-exception-reporting-event.patch b/patches/server/Add-exception-reporting-event.patch similarity index 92% rename from patches/unapplied/server/Add-exception-reporting-event.patch rename to patches/server/Add-exception-reporting-event.patch index 1416c7143..4b3fca44a 100644 --- a/patches/unapplied/server/Add-exception-reporting-event.patch +++ b/patches/server/Add-exception-reporting-event.patch @@ -53,18 +53,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java +++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java @@ -0,0 +0,0 @@ public class OldUsersConverter { + try { root = NbtIo.readCompressed(new java.io.FileInputStream(file5), NbtAccounter.unlimitedHeap()); } catch (Exception exception) { - exception.printStackTrace(); -+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent +- io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper ++ // Paper start ++ io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception); ++ exception.printStackTrace(); ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); ++ // Paper end } if (root != null) { @@ -0,0 +0,0 @@ public class OldUsersConverter { + try { NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2)); } catch (Exception exception) { - exception.printStackTrace(); -+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent +- io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper ++ // Paper start ++ io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception); ++ exception.printStackTrace(); ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); ++ // Paper end } } // CraftBukkit end @@ -73,7 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java @@ -0,0 +0,0 @@ public class VillageSiege implements CustomSpawner { - entityzombie.finalizeSpawn(world, world.getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.EVENT, (SpawnGroupData) null, (CompoundTag) null); + entityzombie.finalizeSpawn(world, world.getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.EVENT, (SpawnGroupData) null); } catch (Exception exception) { VillageSiege.LOGGER.warn("Failed to create zombie for village siege at {}", vec3d, exception); + com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent diff --git a/patches/server/Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/patches/server/Add-handshake-event-to-allow-plugins-to-handle-clien.patch new file mode 100644 index 000000000..32faf813e --- /dev/null +++ b/patches/server/Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Riley Park +Date: Wed, 13 Apr 2016 20:21:38 -0700 +Subject: [PATCH] Add handshake event to allow plugins to handle client + handshaking logic themselves + + +diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL + this.connection.disconnect(ichatmutablecomponent); + } else { + this.connection.setupInboundProtocol(LoginProtocols.SERVERBOUND, new ServerLoginPacketListenerImpl(this.server, this.connection, transfer)); ++ // Paper start - PlayerHandshakeEvent ++ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee; ++ boolean handledByEvent = false; ++ // Try and handle the handshake through the event ++ if (com.destroystokyo.paper.event.player.PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) { // Hello? Can you hear me? ++ java.net.SocketAddress socketAddress = this.connection.address; ++ String hostnameOfRemote = socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getHostString() : InetAddress.getLoopbackAddress().getHostAddress(); ++ com.destroystokyo.paper.event.player.PlayerHandshakeEvent event = new com.destroystokyo.paper.event.player.PlayerHandshakeEvent(packet.hostName(), hostnameOfRemote, !proxyLogicEnabled); ++ if (event.callEvent()) { ++ // If we've failed somehow, let the client know so and go no further. ++ if (event.isFailed()) { ++ Component component = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage()); ++ this.connection.send(new ClientboundLoginDisconnectPacket(component)); ++ this.connection.disconnect(component); ++ return; ++ } ++ ++ if (event.getServerHostname() != null) { ++ // change hostname ++ packet = new ClientIntentionPacket( ++ packet.protocolVersion(), ++ event.getServerHostname(), ++ packet.port(), ++ packet.intention() ++ ); ++ } ++ if (event.getSocketAddressHostname() != null) this.connection.address = new java.net.InetSocketAddress(event.getSocketAddressHostname(), socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0); ++ this.connection.spoofedUUID = event.getUniqueId(); ++ this.connection.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class); ++ handledByEvent = true; // Hooray, we did it! ++ } ++ } ++ // Paper end + // Spigot Start + String[] split = packet.hostName().split("\00"); +- if (org.spigotmc.SpigotConfig.bungee) { ++ if (!handledByEvent && proxyLogicEnabled) { // Paper ++ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! + if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { + this.connection.hostname = split[0]; + this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); diff --git a/patches/unapplied/server/Add-methods-for-working-with-arrows-stuck-in-living-.patch b/patches/server/Add-methods-for-working-with-arrows-stuck-in-living-.patch similarity index 100% rename from patches/unapplied/server/Add-methods-for-working-with-arrows-stuck-in-living-.patch rename to patches/server/Add-methods-for-working-with-arrows-stuck-in-living-.patch diff --git a/patches/unapplied/server/Add-option-to-make-parrots-stay-on-shoulders-despite.patch b/patches/server/Add-option-to-make-parrots-stay-on-shoulders-despite.patch similarity index 100% rename from patches/unapplied/server/Add-option-to-make-parrots-stay-on-shoulders-despite.patch rename to patches/server/Add-option-to-make-parrots-stay-on-shoulders-despite.patch diff --git a/patches/unapplied/server/Add-server-name-parameter.patch b/patches/server/Add-server-name-parameter.patch similarity index 100% rename from patches/unapplied/server/Add-server-name-parameter.patch rename to patches/server/Add-server-name-parameter.patch diff --git a/patches/unapplied/server/Add-setPlayerProfile-API-for-Skulls.patch b/patches/server/Add-setPlayerProfile-API-for-Skulls.patch similarity index 100% rename from patches/unapplied/server/Add-setPlayerProfile-API-for-Skulls.patch rename to patches/server/Add-setPlayerProfile-API-for-Skulls.patch diff --git a/patches/unapplied/server/Add-setting-for-proxy-online-mode-status.patch b/patches/server/Add-setting-for-proxy-online-mode-status.patch similarity index 100% rename from patches/unapplied/server/Add-setting-for-proxy-online-mode-status.patch rename to patches/server/Add-setting-for-proxy-online-mode-status.patch diff --git a/patches/unapplied/server/Add-source-to-PlayerExpChangeEvent.patch b/patches/server/Add-source-to-PlayerExpChangeEvent.patch similarity index 100% rename from patches/unapplied/server/Add-source-to-PlayerExpChangeEvent.patch rename to patches/server/Add-source-to-PlayerExpChangeEvent.patch diff --git a/patches/unapplied/server/Add-velocity-warnings.patch b/patches/server/Add-velocity-warnings.patch similarity index 100% rename from patches/unapplied/server/Add-velocity-warnings.patch rename to patches/server/Add-velocity-warnings.patch diff --git a/patches/unapplied/server/All-chunks-are-slime-spawn-chunks-toggle.patch b/patches/server/All-chunks-are-slime-spawn-chunks-toggle.patch similarity index 100% rename from patches/unapplied/server/All-chunks-are-slime-spawn-chunks-toggle.patch rename to patches/server/All-chunks-are-slime-spawn-chunks-toggle.patch diff --git a/patches/unapplied/server/Allow-Reloading-of-Command-Aliases.patch b/patches/server/Allow-Reloading-of-Command-Aliases.patch similarity index 100% rename from patches/unapplied/server/Allow-Reloading-of-Command-Aliases.patch rename to patches/server/Allow-Reloading-of-Command-Aliases.patch diff --git a/patches/unapplied/server/Allow-Reloading-of-Custom-Permissions.patch b/patches/server/Allow-Reloading-of-Custom-Permissions.patch similarity index 100% rename from patches/unapplied/server/Allow-Reloading-of-Custom-Permissions.patch rename to patches/server/Allow-Reloading-of-Custom-Permissions.patch diff --git a/patches/unapplied/server/Allow-specifying-a-custom-authentication-servers-dow.patch b/patches/server/Allow-specifying-a-custom-authentication-servers-dow.patch similarity index 100% rename from patches/unapplied/server/Allow-specifying-a-custom-authentication-servers-dow.patch rename to patches/server/Allow-specifying-a-custom-authentication-servers-dow.patch diff --git a/patches/unapplied/server/Async-GameProfileCache-saving.patch b/patches/server/Async-GameProfileCache-saving.patch similarity index 99% rename from patches/unapplied/server/Async-GameProfileCache-saving.patch rename to patches/server/Async-GameProfileCache-saving.patch index dd381f425..5aac1a088 100644 --- a/patches/unapplied/server/Async-GameProfileCache-saving.patch +++ b/patches/server/Async-GameProfileCache-saving.patch @@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return optional; @@ -0,0 +0,0 @@ public class GameProfileCache { - return arraylist; + return list; } - public void save() { diff --git a/patches/unapplied/server/AsyncTabCompleteEvent.patch b/patches/server/AsyncTabCompleteEvent.patch similarity index 100% rename from patches/unapplied/server/AsyncTabCompleteEvent.patch rename to patches/server/AsyncTabCompleteEvent.patch diff --git a/patches/unapplied/server/Avoid-blocking-on-Network-Manager-creation.patch b/patches/server/Avoid-blocking-on-Network-Manager-creation.patch similarity index 100% rename from patches/unapplied/server/Avoid-blocking-on-Network-Manager-creation.patch rename to patches/server/Avoid-blocking-on-Network-Manager-creation.patch diff --git a/patches/unapplied/server/Basic-PlayerProfile-API.patch b/patches/server/Basic-PlayerProfile-API.patch similarity index 99% rename from patches/unapplied/server/Basic-PlayerProfile-API.patch rename to patches/server/Basic-PlayerProfile-API.patch index 5438072b1..755f546a0 100644 --- a/patches/unapplied/server/Basic-PlayerProfile-API.patch +++ b/patches/server/Basic-PlayerProfile-API.patch @@ -634,8 +634,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ConfigurationSerialization.registerClass(CraftPlayerProfile.class); + ConfigurationSerialization.registerClass(com.destroystokyo.paper.profile.CraftPlayerProfile.class); // Paper CraftItemFactory.instance(); + CraftEntityFactory.instance(); } - @@ -0,0 +0,0 @@ public final class CraftServer implements Server { public boolean suggestPlayerNamesWhenNullTabCompletions() { return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions; diff --git a/patches/unapplied/server/Be-a-bit-more-informative-in-maxHealth-exception.patch b/patches/server/Be-a-bit-more-informative-in-maxHealth-exception.patch similarity index 100% rename from patches/unapplied/server/Be-a-bit-more-informative-in-maxHealth-exception.patch rename to patches/server/Be-a-bit-more-informative-in-maxHealth-exception.patch diff --git a/patches/unapplied/server/Block-player-logins-during-server-shutdown.patch b/patches/server/Block-player-logins-during-server-shutdown.patch similarity index 100% rename from patches/unapplied/server/Block-player-logins-during-server-shutdown.patch rename to patches/server/Block-player-logins-during-server-shutdown.patch diff --git a/patches/unapplied/server/Bound-Treasure-Maps-to-World-Border.patch b/patches/server/Bound-Treasure-Maps-to-World-Border.patch similarity index 100% rename from patches/unapplied/server/Bound-Treasure-Maps-to-World-Border.patch rename to patches/server/Bound-Treasure-Maps-to-World-Border.patch diff --git a/patches/unapplied/server/Cache-user-authenticator-threads.patch b/patches/server/Cache-user-authenticator-threads.patch similarity index 96% rename from patches/unapplied/server/Cache-user-authenticator-threads.patch rename to patches/server/Cache-user-authenticator-threads.patch index ddd6a25ae..46e1ff9b3 100644 --- a/patches/unapplied/server/Cache-user-authenticator-threads.patch +++ b/patches/server/Cache-user-authenticator-threads.patch @@ -9,15 +9,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - + // CraftBukkit end private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0); static final Logger LOGGER = LogUtils.getLogger(); + private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("User Authenticator #%d").setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build()); // Paper - Cache authenticator threads private static final int MAX_TICKS_BEFORE_LOGIN = 600; - private static final Component DISCONNECT_UNEXPECTED_QUERY = Component.translatable("multiplayer.disconnect.unexpected_query_response"); private final byte[] challenge; + final MinecraftServer server; @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge)); + this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true)); } else { // CraftBukkit start - Thread thread = new Thread("User Authenticator #" + ServerLoginPacketListenerImpl.UNIQUE_THREAD_ID.incrementAndGet()) { diff --git a/patches/unapplied/server/Cap-Entity-Collisions.patch b/patches/server/Cap-Entity-Collisions.patch similarity index 96% rename from patches/unapplied/server/Cap-Entity-Collisions.patch rename to patches/server/Cap-Entity-Collisions.patch index e8a7f7dbc..1c177af76 100644 --- a/patches/unapplied/server/Cap-Entity-Collisions.patch +++ b/patches/server/Cap-Entity-Collisions.patch @@ -15,7 +15,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public long activatedTick = Integer.MIN_VALUE; public void inactiveTick() { } // Spigot end diff --git a/patches/unapplied/server/Chunk-Save-Reattempt.patch b/patches/server/Chunk-Save-Reattempt.patch similarity index 100% rename from patches/unapplied/server/Chunk-Save-Reattempt.patch rename to patches/server/Chunk-Save-Reattempt.patch diff --git a/patches/unapplied/server/Complete-resource-pack-API.patch b/patches/server/Complete-resource-pack-API.patch similarity index 100% rename from patches/unapplied/server/Complete-resource-pack-API.patch rename to patches/server/Complete-resource-pack-API.patch diff --git a/patches/unapplied/server/Configurable-Cartographer-Treasure-Maps.patch b/patches/server/Configurable-Cartographer-Treasure-Maps.patch similarity index 100% rename from patches/unapplied/server/Configurable-Cartographer-Treasure-Maps.patch rename to patches/server/Configurable-Cartographer-Treasure-Maps.patch diff --git a/patches/unapplied/server/Configurable-Chunk-Inhabited-Time.patch b/patches/server/Configurable-Chunk-Inhabited-Time.patch similarity index 100% rename from patches/unapplied/server/Configurable-Chunk-Inhabited-Time.patch rename to patches/server/Configurable-Chunk-Inhabited-Time.patch diff --git a/patches/unapplied/server/Configurable-Disabling-Cat-Chest-Detection.patch b/patches/server/Configurable-Disabling-Cat-Chest-Detection.patch similarity index 100% rename from patches/unapplied/server/Configurable-Disabling-Cat-Chest-Detection.patch rename to patches/server/Configurable-Disabling-Cat-Chest-Detection.patch diff --git a/patches/unapplied/server/Configurable-Non-Player-Arrow-Despawn-Rate.patch b/patches/server/Configurable-Non-Player-Arrow-Despawn-Rate.patch similarity index 100% rename from patches/unapplied/server/Configurable-Non-Player-Arrow-Despawn-Rate.patch rename to patches/server/Configurable-Non-Player-Arrow-Despawn-Rate.patch diff --git a/patches/unapplied/server/Configurable-Player-Collision.patch b/patches/server/Configurable-Player-Collision.patch similarity index 93% rename from patches/unapplied/server/Configurable-Player-Collision.patch rename to patches/server/Configurable-Player-Collision.patch index 3c277eb5a..dd6233a52 100644 --- a/patches/unapplied/server/Configurable-Player-Collision.patch +++ b/patches/server/Configurable-Player-Collision.patch @@ -9,14 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java @@ -0,0 +0,0 @@ public class ClientboundSetPlayerTeamPacket implements Packet 80) { + if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); - this.disconnect(Component.translatable("multiplayer.disconnect.flying")); + this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer); // Paper - use configurable kick message @@ -18,8 +18,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } else { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) { - if (++this.aboveGroundVehicleTickCount > 80) { + if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) { + if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString()); - this.disconnect(Component.translatable("multiplayer.disconnect.flying")); + this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle); // Paper - use configurable kick message diff --git a/patches/unapplied/server/Configurable-inter-world-teleportation-safety.patch b/patches/server/Configurable-inter-world-teleportation-safety.patch similarity index 100% rename from patches/unapplied/server/Configurable-inter-world-teleportation-safety.patch rename to patches/server/Configurable-inter-world-teleportation-safety.patch diff --git a/patches/unapplied/server/Configurable-packet-in-spam-threshold.patch b/patches/server/Configurable-packet-in-spam-threshold.patch similarity index 100% rename from patches/unapplied/server/Configurable-packet-in-spam-threshold.patch rename to patches/server/Configurable-packet-in-spam-threshold.patch diff --git a/patches/unapplied/server/Configurable-random-tick-rates-for-blocks.patch b/patches/server/Configurable-random-tick-rates-for-blocks.patch similarity index 77% rename from patches/unapplied/server/Configurable-random-tick-rates-for-blocks.patch rename to patches/server/Configurable-random-tick-rates-for-blocks.patch index 64880e5b1..dfb1027e0 100644 --- a/patches/unapplied/server/Configurable-random-tick-rates-for-blocks.patch +++ b/patches/server/Configurable-random-tick-rates-for-blocks.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java @@ -0,0 +0,0 @@ public class FarmBlock extends Block { @Override - public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { int i = (Integer) state.getValue(FarmBlock.MOISTURE); + if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks + if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks @@ -25,19 +25,11 @@ diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlo index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java -@@ -0,0 +0,0 @@ package net.minecraft.world.level.block; - import com.mojang.serialization.MapCodec; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; -+import net.minecraft.server.MinecraftServer; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.tags.FluidTags; - import net.minecraft.util.RandomSource; @@ -0,0 +0,0 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock { @Override - public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { -+ if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper - Configurable random tick rates for blocks + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { ++ if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper - Configurable random tick rates for blocks if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) { // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) { diff --git a/patches/unapplied/server/Configurable-spawn-chances-for-skeleton-horses.patch b/patches/server/Configurable-spawn-chances-for-skeleton-horses.patch similarity index 100% rename from patches/unapplied/server/Configurable-spawn-chances-for-skeleton-horses.patch rename to patches/server/Configurable-spawn-chances-for-skeleton-horses.patch diff --git a/patches/unapplied/server/Custom-replacement-for-eaten-items.patch b/patches/server/Custom-replacement-for-eaten-items.patch similarity index 100% rename from patches/unapplied/server/Custom-replacement-for-eaten-items.patch rename to patches/server/Custom-replacement-for-eaten-items.patch diff --git a/patches/unapplied/server/Default-loading-permissions.yml-before-plugins.patch b/patches/server/Default-loading-permissions.yml-before-plugins.patch similarity index 100% rename from patches/unapplied/server/Default-loading-permissions.yml-before-plugins.patch rename to patches/server/Default-loading-permissions.yml-before-plugins.patch diff --git a/patches/unapplied/server/Disable-Scoreboards-for-non-players-by-default.patch b/patches/server/Disable-Scoreboards-for-non-players-by-default.patch similarity index 84% rename from patches/unapplied/server/Disable-Scoreboards-for-non-players-by-default.patch rename to patches/server/Disable-Scoreboards-for-non-players-by-default.patch index d6b3f871d..92b479938 100644 --- a/patches/unapplied/server/Disable-Scoreboards-for-non-players-by-default.patch +++ b/patches/server/Disable-Scoreboards-for-non-players-by-default.patch @@ -14,7 +14,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Nullable public PlayerTeam getTeam() { @@ -27,10 +27,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { - if (nbt.contains("Team", 8)) { String s = nbt.getString("Team"); - PlayerTeam scoreboardteam = this.level().getScoreboard().getPlayerTeam(s); + Scoreboard scoreboard = this.level().getScoreboard(); + PlayerTeam scoreboardteam = scoreboard.getPlayerTeam(s); + if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof net.minecraft.world.entity.player.Player)) { scoreboardteam = null; } // Paper - Perf: Disable Scoreboards for non players by default - boolean flag = scoreboardteam != null && this.level().getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam); + boolean flag = scoreboardteam != null && scoreboard.addPlayerToTeam(this.getStringUUID(), scoreboardteam); if (!flag) { diff --git a/patches/unapplied/server/Disable-spigot-tick-limiters.patch b/patches/server/Disable-spigot-tick-limiters.patch similarity index 100% rename from patches/unapplied/server/Disable-spigot-tick-limiters.patch rename to patches/server/Disable-spigot-tick-limiters.patch diff --git a/patches/server/Do-not-load-chunks-for-Pathfinding.patch b/patches/server/Do-not-load-chunks-for-Pathfinding.patch new file mode 100644 index 000000000..7377aa2c0 --- /dev/null +++ b/patches/server/Do-not-load-chunks-for-Pathfinding.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 31 Mar 2016 19:17:58 -0400 +Subject: [PATCH] Do not load chunks for Pathfinding + + +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +@@ -0,0 +0,0 @@ public class WalkNodeEvaluator extends NodeEvaluator { + } + + protected static PathType getPathTypeFromState(BlockGetter world, BlockPos pos) { +- BlockState blockState = world.getBlockState(pos); ++ // Paper start - Do not load chunks during pathfinding ++ BlockState blockState = world.getBlockStateIfLoaded(pos); ++ if (blockState == null) { ++ return BlockPathTypes.BLOCKED; ++ } ++ // Paper end + Block block = blockState.getBlock(); + if (blockState.isAir()) { + return PathType.OPEN; diff --git a/patches/unapplied/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch similarity index 94% rename from patches/unapplied/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch rename to patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch index 4325b7bca..3485a085f 100644 --- a/patches/unapplied/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch +++ b/patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }); + // Paper end - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread private static final DateTimeFormatter FILENAME_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss", Locale.ROOT); - private static final int LINEAR_LOOKUP_THRESHOLD = 8; + public static final int LINEAR_LOOKUP_THRESHOLD = 8; public static final long NANOS_PER_MILLI = 1000000L; diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -54,14 +54,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java @@ -0,0 +0,0 @@ public class SkullBlockEntity extends BlockEntity { - } else { - return Optional.empty(); + ProfileResult profileResult = apiServices.sessionService().fetchProfile(uuid, true); + return Optional.ofNullable(profileResult).map(ProfileResult::profile); } - }, Util.backgroundExecutor()); + }, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread } - @Override + public static void clear() { diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java diff --git a/patches/unapplied/server/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch b/patches/server/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch similarity index 100% rename from patches/unapplied/server/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch rename to patches/server/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch diff --git a/patches/unapplied/server/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/patches/server/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch similarity index 95% rename from patches/unapplied/server/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch rename to patches/server/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index 95cad6809..9c4f2632f 100644 --- a/patches/unapplied/server/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/patches/server/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -15,4 +15,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (!io.papermc.paper.configuration.GlobalConfiguration.get().scoreboards.saveEmptyScoreboardTeams && playerTeam.getPlayers().isEmpty()) continue; // Paper - Don't save empty scoreboard teams to scoreboard.dat CompoundTag compoundTag = new CompoundTag(); compoundTag.putString("Name", playerTeam.getName()); - compoundTag.putString("DisplayName", Component.Serializer.toJson(playerTeam.getDisplayName())); + compoundTag.putString("DisplayName", Component.Serializer.toJson(playerTeam.getDisplayName(), registries)); diff --git a/patches/unapplied/server/Enforce-Sync-Player-Saves.patch b/patches/server/Enforce-Sync-Player-Saves.patch similarity index 100% rename from patches/unapplied/server/Enforce-Sync-Player-Saves.patch rename to patches/server/Enforce-Sync-Player-Saves.patch diff --git a/patches/unapplied/server/Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/Entity-AddTo-RemoveFrom-World-Events.patch similarity index 100% rename from patches/unapplied/server/Entity-AddTo-RemoveFrom-World-Events.patch rename to patches/server/Entity-AddTo-RemoveFrom-World-Events.patch diff --git a/patches/unapplied/server/Entity-fromMobSpawner.patch b/patches/server/Entity-fromMobSpawner.patch similarity index 91% rename from patches/unapplied/server/Entity-fromMobSpawner.patch rename to patches/server/Entity-fromMobSpawner.patch index ae6e01661..6783b9576 100644 --- a/patches/unapplied/server/Entity-fromMobSpawner.patch +++ b/patches/server/Entity-fromMobSpawner.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public void inactiveTick() { } // Spigot end protected int numCollisions = 0; // Paper - Cap entity collisions @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start - Entity origin API @javax.annotation.Nullable private org.bukkit.util.Vector origin; -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.originWorld = originWorld; origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2)); } diff --git a/patches/unapplied/server/EntityPathfindEvent.patch b/patches/server/EntityPathfindEvent.patch similarity index 100% rename from patches/unapplied/server/EntityPathfindEvent.patch rename to patches/server/EntityPathfindEvent.patch diff --git a/patches/unapplied/server/EntityRegainHealthEvent-isFastRegen-API.patch b/patches/server/EntityRegainHealthEvent-isFastRegen-API.patch similarity index 100% rename from patches/unapplied/server/EntityRegainHealthEvent-isFastRegen-API.patch rename to patches/server/EntityRegainHealthEvent-isFastRegen-API.patch diff --git a/patches/unapplied/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch similarity index 100% rename from patches/unapplied/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch rename to patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch diff --git a/patches/unapplied/server/Expose-client-protocol-version-and-virtual-host.patch b/patches/server/Expose-client-protocol-version-and-virtual-host.patch similarity index 97% rename from patches/unapplied/server/Expose-client-protocol-version-and-virtual-host.patch rename to patches/server/Expose-client-protocol-version-and-virtual-host.patch index f8147c09c..05936ea47 100644 --- a/patches/unapplied/server/Expose-client-protocol-version-and-virtual-host.patch +++ b/patches/server/Expose-client-protocol-version-and-virtual-host.patch @@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - throw new UnsupportedOperationException("Invalid intention " + packet.intention()); + // Spigot End } + // Paper start - NetworkClient implementation @@ -94,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } + this.getHandle().transferCookieConnection.send(new ClientboundTransferPacket(host, port)); } + // Paper start - Implement NetworkClient diff --git a/patches/unapplied/server/Expose-server-CommandMap.patch b/patches/server/Expose-server-CommandMap.patch similarity index 100% rename from patches/unapplied/server/Expose-server-CommandMap.patch rename to patches/server/Expose-server-CommandMap.patch diff --git a/patches/unapplied/server/Faster-redstone-torch-rapid-clock-removal.patch b/patches/server/Faster-redstone-torch-rapid-clock-removal.patch similarity index 95% rename from patches/unapplied/server/Faster-redstone-torch-rapid-clock-removal.patch rename to patches/server/Faster-redstone-torch-rapid-clock-removal.patch index 50295c134..dfe62f120 100644 --- a/patches/unapplied/server/Faster-redstone-torch-rapid-clock-removal.patch +++ b/patches/server/Faster-redstone-torch-rapid-clock-removal.patch @@ -32,9 +32,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static final int RESTART_DELAY = 160; @@ -0,0 +0,0 @@ public class RedstoneTorchBlock extends BaseTorchBlock { @Override - public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { boolean flag = this.hasNeighborSignal(world, pos, state); -- List list = (List) RedstoneTorchBlock.RECENT_TOGGLES.get(world); +- List list = (List) RedstoneTorchBlock.RECENT_TOGGLES.get(world); - - while (list != null && !list.isEmpty() && world.getGameTime() - ((RedstoneTorchBlock.Toggle) list.get(0)).when > 60L) { - list.remove(0); diff --git a/patches/unapplied/server/Filter-bad-block-entity-nbt-data-from-falling-blocks.patch b/patches/server/Filter-bad-block-entity-nbt-data-from-falling-blocks.patch similarity index 100% rename from patches/unapplied/server/Filter-bad-block-entity-nbt-data-from-falling-blocks.patch rename to patches/server/Filter-bad-block-entity-nbt-data-from-falling-blocks.patch diff --git a/patches/unapplied/server/Firework-API-s.patch b/patches/server/Firework-API-s.patch similarity index 75% rename from patches/unapplied/server/Firework-API-s.patch rename to patches/server/Firework-API-s.patch index ae05150da..49c6ae34e 100644 --- a/patches/unapplied/server/Firework-API-s.patch +++ b/patches/server/Firework-API-s.patch @@ -19,8 +19,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public FireworkRocketEntity(EntityType type, Level world) { super(type, world); @@ -0,0 +0,0 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { - } - + nbt.putInt("LifeTime", this.lifetime); + nbt.put("FireworksItem", this.getItem().save(this.registryAccess())); nbt.putBoolean("ShotAtAngle", (Boolean) this.entityData.get(FireworkRocketEntity.DATA_SHOT_AT_ANGLE)); + // Paper start + if (this.spawningEntity != null) { @@ -42,24 +42,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } - @Override + private List getExplosions() { diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/CrossbowItem.java +++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java -@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable { - - if (flag1) { - object = new FireworkRocketEntity(world, projectile, shooter, shooter.getX(), shooter.getEyeY() - 0.15000000596046448D, shooter.getZ(), true); -+ ((FireworkRocketEntity) object).spawningEntity = shooter.getUUID(); // Paper - } else { - object = CrossbowItem.getArrow(world, shooter, crossbow, projectile); - if (creative || simulated != 0.0F) { +@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem { + @Override + protected Projectile createProjectile(Level world, LivingEntity shooter, ItemStack weaponStack, ItemStack projectileStack, boolean critical) { + if (projectileStack.is(Items.FIREWORK_ROCKET)) { +- return new FireworkRocketEntity(world, projectileStack, shooter, shooter.getX(), shooter.getEyeY() - 0.15F, shooter.getZ(), true); ++ // Paper start ++ FireworkRocketEntity entity = new FireworkRocketEntity(world, projectileStack, shooter, shooter.getX(), shooter.getEyeY() - 0.15F, shooter.getZ(), true); ++ entity.spawningEntity = shooter.getUUID(); // Paper ++ return entity; ++ // Paper end + } else { + Projectile projectile = super.createProjectile(world, shooter, weaponStack, projectileStack, critical); + if (projectile instanceof AbstractArrow abstractArrow) { diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item { +@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item implements ProjectileItem { vec3.z + (double)direction.getStepZ() * 0.15, itemStack ); @@ -67,14 +72,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 level.addFreshEntity(fireworkRocketEntity); itemStack.shrink(1); } -@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item { +@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item implements ProjectileItem { ItemStack itemStack = user.getItemInHand(hand); if (!world.isClientSide) { FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user); + fireworkRocketEntity.spawningEntity = user.getUUID(); // Paper world.addFreshEntity(fireworkRocketEntity); - if (!user.getAbilities().instabuild) { - itemStack.shrink(1); + itemStack.consume(1, user); + user.awardStat(Stats.ITEM_USED.get(this)); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java diff --git a/patches/unapplied/server/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/patches/server/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch similarity index 100% rename from patches/unapplied/server/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch rename to patches/server/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch diff --git a/patches/unapplied/server/Fix-MC-117075-Block-entity-unload-lag-spike.patch b/patches/server/Fix-MC-117075-Block-entity-unload-lag-spike.patch similarity index 100% rename from patches/unapplied/server/Fix-MC-117075-Block-entity-unload-lag-spike.patch rename to patches/server/Fix-MC-117075-Block-entity-unload-lag-spike.patch diff --git a/patches/unapplied/server/Fix-global-sound-handling.patch b/patches/server/Fix-global-sound-handling.patch similarity index 100% rename from patches/unapplied/server/Fix-global-sound-handling.patch rename to patches/server/Fix-global-sound-handling.patch diff --git a/patches/unapplied/server/Fix-this-stupid-bullshit.patch b/patches/server/Fix-this-stupid-bullshit.patch similarity index 97% rename from patches/unapplied/server/Fix-this-stupid-bullshit.patch rename to patches/server/Fix-this-stupid-bullshit.patch index 628652851..2748352d3 100644 --- a/patches/unapplied/server/Fix-this-stupid-bullshit.patch +++ b/patches/server/Fix-this-stupid-bullshit.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -28); + 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/patches/unapplied/server/Handle-Item-Meta-Inconsistencies.patch b/patches/server/Handle-Item-Meta-Inconsistencies.patch similarity index 60% rename from patches/unapplied/server/Handle-Item-Meta-Inconsistencies.patch rename to patches/server/Handle-Item-Meta-Inconsistencies.patch index 29f954103..b1068b97f 100644 --- a/patches/unapplied/server/Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/Handle-Item-Meta-Inconsistencies.patch @@ -17,58 +17,64 @@ was added, resulting in 2 different ways to modify an items enchantments. For consistency, the old API methods now forward to use the ItemMeta API equivalents, and should deprecate the old API's. -diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +diff --git a/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java b/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/item/ItemStack.java -+++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -0,0 +0,0 @@ public final class ItemStack { - return this.getItem().getTooltipImage(this); - } +--- a/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java ++++ b/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java +@@ -0,0 +0,0 @@ import net.minecraft.tags.TagKey; + import net.minecraft.world.item.Item; + import net.minecraft.world.item.TooltipFlag; + import net.minecraft.world.item.component.TooltipProvider; ++// Paper start ++import it.unimi.dsi.fastutil.objects.Object2IntAVLTreeMap; ++// Paper end + public class ItemEnchantments implements TooltipProvider { +- public static final ItemEnchantments EMPTY = new ItemEnchantments(new Object2IntOpenHashMap<>(), true); + // Paper start -+ private static final java.util.Comparator enchantSorter = java.util.Comparator.comparing(o -> o.getString("id")); -+ private void processEnchantOrder(@Nullable CompoundTag tag) { -+ if (tag == null || !tag.contains("Enchantments", net.minecraft.nbt.Tag.TAG_LIST)) { -+ return; -+ } -+ ListTag list = tag.getList("Enchantments", net.minecraft.nbt.Tag.TAG_COMPOUND); -+ if (list.size() < 2) { -+ return; -+ } -+ try { -+ //noinspection unchecked -+ list.sort((java.util.Comparator) enchantSorter); // Paper -+ } catch (Exception ignored) {} -+ } ++ private static final java.util.Comparator> ENCHANTMENT_ORDER = java.util.Comparator.comparing(Holder::getRegisteredName); ++ public static final ItemEnchantments EMPTY = new ItemEnchantments(new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER), true); + // Paper end -+ - public ItemStack(ItemLike item) { - this(item, 1); - } -@@ -0,0 +0,0 @@ public final class ItemStack { - this.count = nbttagcompound.getByte("Count"); - if (nbttagcompound.contains("tag", 10)) { - this.tag = nbttagcompound.getCompound("tag").copy(); -+ this.processEnchantOrder(this.tag); // Paper - this.getItem().verifyTagAfterLoad(this.tag); - } + public static final int MAX_LEVEL = 255; + private static final Codec LEVEL_CODEC = Codec.intRange(0, 255); +- private static final Codec>> LEVELS_CODEC = Codec.unboundedMap( ++ private static final Codec>> LEVELS_CODEC = Codec.unboundedMap( // Paper + BuiltInRegistries.ENCHANTMENT.holderByNameCodec(), LEVEL_CODEC + ) +- .xmap(Object2IntOpenHashMap::new, Function.identity()); ++ .xmap(Object2IntAVLTreeMap::new, Function.identity()); // Paper + private static final Codec FULL_CODEC = RecordCodecBuilder.create( + instance -> instance.group( + LEVELS_CODEC.fieldOf("levels").forGetter(component -> component.enchantments), +@@ -0,0 +0,0 @@ public class ItemEnchantments implements TooltipProvider { + ); + public static final Codec CODEC = Codec.withAlternative(FULL_CODEC, LEVELS_CODEC, map -> new ItemEnchantments(map, true)); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( +- ByteBufCodecs.map(Object2IntOpenHashMap::new, ByteBufCodecs.holderRegistry(Registries.ENCHANTMENT), ByteBufCodecs.VAR_INT), ++ ByteBufCodecs.map((v) -> new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER), ByteBufCodecs.holderRegistry(Registries.ENCHANTMENT), ByteBufCodecs.VAR_INT), // Paper + component -> component.enchantments, + ByteBufCodecs.BOOL, + component -> component.showInTooltip, + ItemEnchantments::new + ); +- final Object2IntOpenHashMap> enchantments; ++ final Object2IntAVLTreeMap> enchantments; // Paper + public final boolean showInTooltip; -@@ -0,0 +0,0 @@ public final class ItemStack { +- ItemEnchantments(Object2IntOpenHashMap> enchantments, boolean showInTooltip) { ++ ItemEnchantments(Object2IntAVLTreeMap> enchantments, boolean showInTooltip) { // Paper + this.enchantments = enchantments; + this.showInTooltip = showInTooltip; - public void setTag(@Nullable CompoundTag nbt) { - this.tag = nbt; -+ this.processEnchantOrder(this.tag); // Paper - if (this.getItem().canBeDepleted()) { - this.setDamageValue(this.getDamageValue()); - } -@@ -0,0 +0,0 @@ public final class ItemStack { - ListTag nbttaglist = this.tag.getList("Enchantments", 10); - - nbttaglist.add(EnchantmentHelper.storeEnchantment(EnchantmentHelper.getEnchantmentId(enchantment), (byte) level)); -+ processEnchantOrder(this.tag); // Paper +@@ -0,0 +0,0 @@ public class ItemEnchantments implements TooltipProvider { } - public boolean isEnchanted() { + public static class Mutable { +- private final Object2IntOpenHashMap> enchantments = new Object2IntOpenHashMap<>(); ++ private final Object2IntAVLTreeMap> enchantments = new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER); // Paper + public boolean showInTooltip; + + public Mutable(ItemEnchantments enchantmentsComponent) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -80,25 +86,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (!CraftItemStack.makeTag(this.handle)) { - return; - } -- ListTag list = CraftItemStack.getEnchantmentList(this.handle); +- ItemEnchantments list = CraftItemStack.getEnchantmentList(this.handle); - if (list == null) { -- list = new ListTag(); -- this.handle.getTag().put(ENCHANTMENTS.NBT, list); +- list = ItemEnchantments.EMPTY; - } -- int size = list.size(); -- -- for (int i = 0; i < size; i++) { -- CompoundTag tag = (CompoundTag) list.get(i); -- String id = tag.getString(ENCHANTMENTS_ID.NBT); -- if (ench.getKey().equals(NamespacedKey.fromString(id))) { -- tag.putShort(ENCHANTMENTS_LVL.NBT, (short) level); -- return; -- } -- } -- CompoundTag tag = new CompoundTag(); -- tag.putString(ENCHANTMENTS_ID.NBT, ench.getKey().toString()); -- tag.putShort(ENCHANTMENTS_LVL.NBT, (short) level); -- list.add(tag); +- ItemEnchantments.Mutable listCopy = new ItemEnchantments.Mutable(list); +- listCopy.set(CraftEnchantment.bukkitToMinecraft(ench), level); +- this.handle.set(DataComponents.ENCHANTMENTS, listCopy.toImmutable()); + // Paper start - Replace whole method + final ItemMeta itemMeta = this.getItemMeta(); + itemMeta.addEnchant(ench, level, true); @@ -111,41 +105,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int removeEnchantment(Enchantment ench) { Preconditions.checkArgument(ench != null, "Enchantment cannot be null"); -- ListTag list = CraftItemStack.getEnchantmentList(this.handle), listCopy; +- ItemEnchantments list = CraftItemStack.getEnchantmentList(this.handle); - if (list == null) { - return 0; - } -- int index = Integer.MIN_VALUE; -- int level = Integer.MIN_VALUE; -- int size = list.size(); -- -- for (int i = 0; i < size; i++) { -- CompoundTag enchantment = (CompoundTag) list.get(i); -- String id = enchantment.getString(ENCHANTMENTS_ID.NBT); -- if (ench.getKey().equals(NamespacedKey.fromString(id))) { -- index = i; -- level = 0xffff & enchantment.getShort(ENCHANTMENTS_LVL.NBT); -- break; -- } -- } -- -- if (index == Integer.MIN_VALUE) { +- int level = this.getEnchantmentLevel(ench); +- if (level <= 0) { - return 0; - } -- if (size == 1) { -- this.handle.getTag().remove(ENCHANTMENTS.NBT); -- if (this.handle.getTag().isEmpty()) { -- this.handle.setTag(null); -- } -- return level; -- } +- int size = list.size(); - -- // This is workaround for not having an index removal -- listCopy = new ListTag(); -- for (int i = 0; i < size; i++) { -- if (i != index) { -- listCopy.add(list.get(i)); -- } +- if (size == 1) { +- this.handle.remove(DataComponents.ENCHANTMENTS); +- return level; + // Paper start - replace entire method + int level = getEnchantmentLevel(ench); + if (level > 0) { @@ -154,7 +126,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + itemMeta.removeEnchant(ench); + this.setItemMeta(itemMeta); } -- this.handle.getTag().put(ENCHANTMENTS.NBT, listCopy); +- +- ItemEnchantments.Mutable listCopy = new ItemEnchantments.Mutable(list); +- listCopy.set(CraftEnchantment.bukkitToMinecraft(ench), -1); // Negative to remove +- this.handle.set(DataComponents.ENCHANTMENTS, listCopy.toImmutable()); + // Paper end return level; @@ -180,40 +155,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import com.google.common.collect.SetMultimap; -@@ -0,0 +0,0 @@ import java.util.ArrayList; - import java.util.Arrays; +@@ -0,0 +0,0 @@ import java.util.Arrays; import java.util.Base64; import java.util.Collection; + import java.util.Collections; +import java.util.Comparator; // Paper import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; @@ -0,0 +0,0 @@ import java.util.Map; - import java.util.NoSuchElementException; import java.util.Objects; + import java.util.Optional; import java.util.Set; +import java.util.TreeMap; // Paper import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nonnull; @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - private List lore; // null and empty are two different states internally + private List lore; // null and empty are two different states internally private Integer customModelData; - private CompoundTag blockData; + private Map blockData; - private Map enchantments; + private EnchantmentMap enchantments; // Paper private Multimap attributeModifiers; private int repairCost; private int hideFlag; -@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); - - private CompoundTag internalTag; -- final Map unhandledTags = new HashMap(); // Visible for testing only -+ final Map unhandledTags = new TreeMap(); // Visible for testing only // Paper - private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftMetaItem.DATA_TYPE_REGISTRY); - - private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { this.blockData = meta.blockData; @@ -227,20 +193,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -- static Map buildEnchantments(CompoundTag tag, ItemMetaKey key) { -+ static EnchantmentMap buildEnchantments(CompoundTag tag, ItemMetaKey key) { // Paper - if (!tag.contains(key.NBT)) { - return null; - } - - ListTag ench = tag.getList(key.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND); -- Map enchantments = new LinkedHashMap(ench.size()); +- static Map buildEnchantments(ItemEnchantments tag) { +- Map enchantments = new LinkedHashMap(tag.size()); ++ static EnchantmentMap buildEnchantments(ItemEnchantments tag) { // Paper + EnchantmentMap enchantments = new EnchantmentMap(); // Paper - for (int i = 0; i < ench.size(); i++) { - String id = ((CompoundTag) ench.get(i)).getString(CraftMetaItem.ENCHANTMENTS_ID.NBT); + tag.entrySet().forEach((entry) -> { + Holder id = entry.getKey(); @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - } + return modifiers; } - static Map buildEnchantments(Map map, ItemMetaKey key) { @@ -282,8 +243,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.hasAttributeModifiers()) { clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers); @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - return CraftMetaItem.HANDLED_TAGS; - } + + return (result != null) ? result : Optional.empty(); } + + // Paper start diff --git a/patches/unapplied/server/Implement-getI18NDisplayName.patch b/patches/server/Implement-getI18NDisplayName.patch similarity index 100% rename from patches/unapplied/server/Implement-getI18NDisplayName.patch rename to patches/server/Implement-getI18NDisplayName.patch diff --git a/patches/unapplied/server/Improve-Player-chat-API-handling.patch b/patches/server/Improve-Player-chat-API-handling.patch similarity index 100% rename from patches/unapplied/server/Improve-Player-chat-API-handling.patch rename to patches/server/Improve-Player-chat-API-handling.patch diff --git a/patches/unapplied/server/Improve-the-Saddle-API-for-Horses.patch b/patches/server/Improve-the-Saddle-API-for-Horses.patch similarity index 100% rename from patches/unapplied/server/Improve-the-Saddle-API-for-Horses.patch rename to patches/server/Improve-the-Saddle-API-for-Horses.patch diff --git a/patches/unapplied/server/Item-canEntityPickup.patch b/patches/server/Item-canEntityPickup.patch similarity index 98% rename from patches/unapplied/server/Item-canEntityPickup.patch rename to patches/server/Item-canEntityPickup.patch index ff4930f79..e88302ccd 100644 --- a/patches/unapplied/server/Item-canEntityPickup.patch +++ b/patches/server/Item-canEntityPickup.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti ItemEntity entityitem = (ItemEntity) iterator.next(); if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) { diff --git a/patches/unapplied/server/LivingEntity-setKiller.patch b/patches/server/LivingEntity-setKiller.patch similarity index 100% rename from patches/unapplied/server/LivingEntity-setKiller.patch rename to patches/server/LivingEntity-setKiller.patch diff --git a/patches/unapplied/server/LootTable-API-and-replenishable-lootables.patch b/patches/server/LootTable-API-and-replenishable-lootables.patch similarity index 95% rename from patches/unapplied/server/LootTable-API-and-replenishable-lootables.patch rename to patches/server/LootTable-API-and-replenishable-lootables.patch index 15bd22ede..68de2a8ae 100644 --- a/patches/unapplied/server/LootTable-API-and-replenishable-lootables.patch +++ b/patches/server/LootTable-API-and-replenishable-lootables.patch @@ -507,7 +507,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper end - Share random for entities to make them more random @@ -520,7 +520,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java @@ -0,0 +0,0 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme - public ResourceLocation lootTable; + public ResourceKey lootTable; public long lootTableSeed; + // Paper start @@ -545,14 +545,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); + this.lootableData.saveNbt(nbt); // Paper - this.addChestVehicleSaveData(nbt); + this.addChestVehicleSaveData(nbt, this.registryAccess()); } @Override protected void readAdditionalSaveData(CompoundTag nbt) { super.readAdditionalSaveData(nbt); + this.lootableData.loadNbt(nbt); // Paper - this.readChestVehicleSaveData(nbt); + this.readChestVehicleSaveData(nbt, this.registryAccess()); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java @@ -564,18 +564,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); + this.lootableData.saveNbt(nbt); // Paper - this.addChestVehicleSaveData(nbt); + this.addChestVehicleSaveData(nbt, this.registryAccess()); } @Override protected void readAdditionalSaveData(CompoundTag nbt) { super.readAdditionalSaveData(nbt); + this.lootableData.loadNbt(nbt); // Paper - this.readChestVehicleSaveData(nbt); + this.readChestVehicleSaveData(nbt, this.registryAccess()); } @@ -0,0 +0,0 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain - this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of((Entity) player)); + this.level().gameEvent((Holder) GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of((Entity) player)); } + // Paper start @@ -604,20 +604,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 nbt.putLong("LootTableSeed", this.getLootTableSeed()); } - } else { -- ContainerHelper.saveAllItems(nbt, this.getItemStacks()); +- ContainerHelper.saveAllItems(nbt, this.getItemStacks(), registriesLookup); } -+ ContainerHelper.saveAllItems(nbt, this.getItemStacks()); // Paper - always save the items, table may still remain ++ ContainerHelper.saveAllItems(nbt, this.getItemStacks(), registriesLookup); // Paper - always save the items, table may still remain } - default void readChestVehicleSaveData(CompoundTag nbt) { + default void readChestVehicleSaveData(CompoundTag nbt, HolderLookup.Provider registriesLookup) { @@ -0,0 +0,0 @@ public interface ContainerEntity extends Container, MenuProvider { if (nbt.contains("LootTable", 8)) { - this.setLootTable(new ResourceLocation(nbt.getString("LootTable"))); + this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable")))); this.setLootTableSeed(nbt.getLong("LootTableSeed")); - } else { -- ContainerHelper.loadAllItems(nbt, this.getItemStacks()); +- ContainerHelper.loadAllItems(nbt, this.getItemStacks(), registriesLookup); } -+ ContainerHelper.loadAllItems(nbt, this.getItemStacks()); // Paper - always load the items, table may still remain ++ ContainerHelper.loadAllItems(nbt, this.getItemStacks(), registriesLookup); // Paper - always save the items, table may still remain } default void chestVehicleDestroyed(DamageSource source, Level world, Entity vehicle) { @@ -627,7 +627,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 MinecraftServer minecraftServer = this.level().getServer(); - if (this.getLootTable() != null && minecraftServer != null) { + if (this.getLootableData().shouldReplenish(player) && minecraftServer != null) { // Paper - LootTable lootTable = minecraftServer.getLootData().getLootTable(this.getLootTable()); + LootTable lootTable = minecraftServer.reloadableRegistries().getLootTable(this.getLootTable()); if (player != null) { CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.getLootTable()); } @@ -639,7 +639,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player); @@ -0,0 +0,0 @@ public interface ContainerEntity extends Container, MenuProvider { default boolean isChestVehicleStillValid(Player player) { - return !this.isRemoved() && this.position().closerThan(player.position(), 8.0); + return !this.isRemoved() && player.canInteractWithEntity(this.getBoundingBox(), 4.0); } + // Paper start + default Entity getEntity() { @@ -657,8 +657,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java @@ -0,0 +0,0 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc @Nullable - public ResourceLocation lootTable; - public long lootTableSeed; + public ResourceKey lootTable; + public long lootTableSeed = 0L; + public final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperTileEntityLootableInventory(this)); // Paper protected RandomizableContainerBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { @@ -726,9 +726,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - private void setLootTable(LootTable table, long seed) { + public void setLootTable(LootTable table, long seed) { // Paper - make public since it overrides a public method - ResourceLocation key = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey()); - this.getSnapshot().setLootTable(key, seed); + this.getSnapshot().setLootTable(CraftLootTable.bukkitToMinecraft(table), seed); } + diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -748,7 +748,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java -@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftLootTable; import org.bukkit.loot.LootTable; import org.bukkit.loot.Lootable; @@ -761,7 +761,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java b/s index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java -@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftInventory; import org.bukkit.inventory.Inventory; import org.bukkit.loot.LootTable; @@ -777,9 +777,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - private void setLootTable(LootTable table, long seed) { + public void setLootTable(LootTable table, long seed) { // Paper - change visibility since it overrides a public method - ResourceLocation newKey = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey()); - this.getHandle().setLootTable(newKey); + this.getHandle().setLootTable(CraftLootTable.bukkitToMinecraft(table)); this.getHandle().setLootTableSeed(seed); + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java diff --git a/patches/unapplied/server/Ocelot-despawns-should-honor-nametags-and-leash.patch b/patches/server/Ocelot-despawns-should-honor-nametags-and-leash.patch similarity index 100% rename from patches/unapplied/server/Ocelot-despawns-should-honor-nametags-and-leash.patch rename to patches/server/Ocelot-despawns-should-honor-nametags-and-leash.patch diff --git a/patches/unapplied/server/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/patches/server/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch similarity index 95% rename from patches/unapplied/server/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch rename to patches/server/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index 0ef5b849c..62c43ba8b 100644 --- a/patches/unapplied/server/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/patches/server/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent this.profiler.push(() -> { - return worldserver + " " + worldserver.dimension().location(); + String s = String.valueOf(worldserver); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/BushBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BushBlock.java @@ -0,0 +0,0 @@ public abstract class BushBlock extends Block { - public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { // CraftBukkit start if (!state.canSurvive(world, pos)) { - if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, pos).isCancelled()) { diff --git a/patches/unapplied/server/Optimise-BlockState-s-hashCode-equals.patch b/patches/server/Optimise-BlockState-s-hashCode-equals.patch similarity index 100% rename from patches/unapplied/server/Optimise-BlockState-s-hashCode-equals.patch rename to patches/server/Optimise-BlockState-s-hashCode-equals.patch diff --git a/patches/unapplied/server/Optimize-DataBits.patch b/patches/server/Optimize-DataBits.patch similarity index 100% rename from patches/unapplied/server/Optimize-DataBits.patch rename to patches/server/Optimize-DataBits.patch diff --git a/patches/unapplied/server/Optimize-Level.hasChunkAt-BlockPosition-Z.patch b/patches/server/Optimize-Level.hasChunkAt-BlockPosition-Z.patch similarity index 100% rename from patches/unapplied/server/Optimize-Level.hasChunkAt-BlockPosition-Z.patch rename to patches/server/Optimize-Level.hasChunkAt-BlockPosition-Z.patch diff --git a/patches/unapplied/server/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/patches/server/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch similarity index 100% rename from patches/unapplied/server/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch rename to patches/server/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch diff --git a/patches/unapplied/server/Optional-TNT-doesn-t-move-in-water.patch b/patches/server/Optional-TNT-doesn-t-move-in-water.patch similarity index 100% rename from patches/unapplied/server/Optional-TNT-doesn-t-move-in-water.patch rename to patches/server/Optional-TNT-doesn-t-move-in-water.patch diff --git a/patches/server/Player-Tab-List-and-Title-APIs.patch b/patches/server/Player-Tab-List-and-Title-APIs.patch new file mode 100644 index 000000000..bb19cc9a3 --- /dev/null +++ b/patches/server/Player-Tab-List-and-Title-APIs.patch @@ -0,0 +1,109 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Techcable +Date: Thu, 3 Mar 2016 02:32:10 -0600 +Subject: [PATCH] Player Tab List and Title APIs + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + } + ++ // Paper start ++ @Override ++ public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) { ++ if (header != null) { ++ String headerJson = net.md_5.bungee.chat.ComponentSerializer.toString(header); ++ playerListHeader = net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().deserialize(headerJson); ++ } else { ++ playerListHeader = null; ++ } ++ ++ if (footer != null) { ++ String footerJson = net.md_5.bungee.chat.ComponentSerializer.toString(footer); ++ playerListFooter = net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().deserialize(footerJson); ++ } else { ++ playerListFooter = null; ++ } ++ ++ updatePlayerListHeaderFooter(); ++ } ++ ++ @Override ++ public void setPlayerListHeaderFooter(BaseComponent header, BaseComponent footer) { ++ this.setPlayerListHeaderFooter(header == null ? null : new BaseComponent[]{header}, ++ footer == null ? null : new BaseComponent[]{footer}); ++ } ++ ++ ++ @Override ++ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks) { ++ getHandle().connection.send(new ClientboundSetTitlesAnimationPacket(fadeInTicks, stayTicks, fadeOutTicks)); ++ } ++ ++ @Override ++ public void setSubtitle(BaseComponent[] subtitle) { ++ final ClientboundSetSubtitleTextPacket packet = new ClientboundSetSubtitleTextPacket(org.bukkit.craftbukkit.util.CraftChatMessage.fromJSON(net.md_5.bungee.chat.ComponentSerializer.toString(subtitle))); ++ getHandle().connection.send(packet); ++ } ++ ++ @Override ++ public void setSubtitle(BaseComponent subtitle) { ++ setSubtitle(new BaseComponent[]{subtitle}); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent[] title) { ++ final ClientboundSetTitleTextPacket packet = new ClientboundSetTitleTextPacket(org.bukkit.craftbukkit.util.CraftChatMessage.fromJSON(net.md_5.bungee.chat.ComponentSerializer.toString(title))); ++ getHandle().connection.send(packet); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent title) { ++ showTitle(new BaseComponent[]{title}); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent[] title, BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) { ++ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks); ++ setSubtitle(subtitle); ++ showTitle(title); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent title, BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) { ++ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks); ++ setSubtitle(subtitle); ++ showTitle(title); ++ } ++ ++ @Override ++ public void sendTitle(com.destroystokyo.paper.Title title) { ++ Preconditions.checkNotNull(title, "Title is null"); ++ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut()); ++ setSubtitle(title.getSubtitle() == null ? new BaseComponent[0] : title.getSubtitle()); ++ showTitle(title.getTitle()); ++ } ++ ++ @Override ++ public void updateTitle(com.destroystokyo.paper.Title title) { ++ Preconditions.checkNotNull(title, "Title is null"); ++ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut()); ++ if (title.getSubtitle() != null) { ++ setSubtitle(title.getSubtitle()); ++ } ++ showTitle(title.getTitle()); ++ } ++ ++ @Override ++ public void hideTitle() { ++ getHandle().connection.send(new ClientboundClearTitlesPacket(false)); ++ } ++ // Paper end ++ + @Override + public String getDisplayName() { + if(true) return io.papermc.paper.adventure.DisplayNames.getLegacy(this); // Paper diff --git a/patches/unapplied/server/PlayerAttemptPickupItemEvent.patch b/patches/server/PlayerAttemptPickupItemEvent.patch similarity index 100% rename from patches/unapplied/server/PlayerAttemptPickupItemEvent.patch rename to patches/server/PlayerAttemptPickupItemEvent.patch diff --git a/patches/unapplied/server/PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/PlayerNaturallySpawnCreaturesEvent.patch similarity index 100% rename from patches/unapplied/server/PlayerNaturallySpawnCreaturesEvent.patch rename to patches/server/PlayerNaturallySpawnCreaturesEvent.patch diff --git a/patches/unapplied/server/PlayerPickupExperienceEvent.patch b/patches/server/PlayerPickupExperienceEvent.patch similarity index 100% rename from patches/unapplied/server/PlayerPickupExperienceEvent.patch rename to patches/server/PlayerPickupExperienceEvent.patch diff --git a/patches/unapplied/server/PlayerPickupItemEvent-setFlyAtPlayer.patch b/patches/server/PlayerPickupItemEvent-setFlyAtPlayer.patch similarity index 100% rename from patches/unapplied/server/PlayerPickupItemEvent-setFlyAtPlayer.patch rename to patches/server/PlayerPickupItemEvent-setFlyAtPlayer.patch diff --git a/patches/unapplied/server/PlayerTeleportEndGatewayEvent.patch b/patches/server/PlayerTeleportEndGatewayEvent.patch similarity index 100% rename from patches/unapplied/server/PlayerTeleportEndGatewayEvent.patch rename to patches/server/PlayerTeleportEndGatewayEvent.patch diff --git a/patches/unapplied/server/Prevent-Pathfinding-out-of-World-Border.patch b/patches/server/Prevent-Pathfinding-out-of-World-Border.patch similarity index 100% rename from patches/unapplied/server/Prevent-Pathfinding-out-of-World-Border.patch rename to patches/server/Prevent-Pathfinding-out-of-World-Border.patch diff --git a/patches/unapplied/server/Prevent-logins-from-being-processed-when-the-player-.patch b/patches/server/Prevent-logins-from-being-processed-when-the-player-.patch similarity index 87% rename from patches/unapplied/server/Prevent-logins-from-being-processed-when-the-player-.patch rename to patches/server/Prevent-logins-from-being-processed-when-the-player-.patch index ffdd1bd86..3118521f0 100644 --- a/patches/unapplied/server/Prevent-logins-from-being-processed-when-the-player-.patch +++ b/patches/server/Prevent-logins-from-being-processed-when-the-player-.patch @@ -18,4 +18,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } // Paper - prevent logins to be processed even though disconnect was called } - if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) { + // CraftBukkit start diff --git a/patches/unapplied/server/Profile-Lookup-Events.patch b/patches/server/Profile-Lookup-Events.patch similarity index 100% rename from patches/unapplied/server/Profile-Lookup-Events.patch rename to patches/server/Profile-Lookup-Events.patch diff --git a/patches/unapplied/server/ProfileWhitelistVerifyEvent.patch b/patches/server/ProfileWhitelistVerifyEvent.patch similarity index 100% rename from patches/unapplied/server/ProfileWhitelistVerifyEvent.patch rename to patches/server/ProfileWhitelistVerifyEvent.patch diff --git a/patches/unapplied/server/Properly-fix-item-duplication-bug.patch b/patches/server/Properly-fix-item-duplication-bug.patch similarity index 100% rename from patches/unapplied/server/Properly-fix-item-duplication-bug.patch rename to patches/server/Properly-fix-item-duplication-bug.patch diff --git a/patches/unapplied/server/Properly-handle-async-calls-to-restart-the-server.patch b/patches/server/Properly-handle-async-calls-to-restart-the-server.patch similarity index 100% rename from patches/unapplied/server/Properly-handle-async-calls-to-restart-the-server.patch rename to patches/server/Properly-handle-async-calls-to-restart-the-server.patch diff --git a/patches/unapplied/server/Provide-E-TE-Chunk-count-stat-methods.patch b/patches/server/Provide-E-TE-Chunk-count-stat-methods.patch similarity index 100% rename from patches/unapplied/server/Provide-E-TE-Chunk-count-stat-methods.patch rename to patches/server/Provide-E-TE-Chunk-count-stat-methods.patch diff --git a/patches/unapplied/server/Remove-CraftScheduler-Async-Task-Debugger.patch b/patches/server/Remove-CraftScheduler-Async-Task-Debugger.patch similarity index 100% rename from patches/unapplied/server/Remove-CraftScheduler-Async-Task-Debugger.patch rename to patches/server/Remove-CraftScheduler-Async-Task-Debugger.patch diff --git a/patches/unapplied/server/Remove-Metadata-on-reload.patch b/patches/server/Remove-Metadata-on-reload.patch similarity index 100% rename from patches/unapplied/server/Remove-Metadata-on-reload.patch rename to patches/server/Remove-Metadata-on-reload.patch diff --git a/patches/unapplied/server/Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/patches/server/Reset-spawner-timer-when-spawner-event-is-cancelled.patch similarity index 100% rename from patches/unapplied/server/Reset-spawner-timer-when-spawner-event-is-cancelled.patch rename to patches/server/Reset-spawner-timer-when-spawner-event-is-cancelled.patch diff --git a/patches/unapplied/server/Sanitise-RegionFileCache-and-make-configurable.patch b/patches/server/Sanitise-RegionFileCache-and-make-configurable.patch similarity index 100% rename from patches/unapplied/server/Sanitise-RegionFileCache-and-make-configurable.patch rename to patches/server/Sanitise-RegionFileCache-and-make-configurable.patch diff --git a/patches/unapplied/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch similarity index 54% rename from patches/unapplied/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch rename to patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch index 88bfa7822..26d3ba2c7 100644 --- a/patches/unapplied/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -10,51 +10,51 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { - int i = b0 + EnchantmentHelper.getKnockbackBonus(this); - if (this.isSprinting() && flag) { -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility - ++i; - flag1 = true; - } + i += EnchantmentHelper.getKnockbackBonus(this); + if (this.isSprinting() && flag) { +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + ++i; + flag1 = true; + } @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { + } + } + +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + this.sweepAttack(); + } + +@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { + } + + if (flag2) { +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + this.crit(target); + } + + if (!flag2 && !flag3) { + if (flag) { +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + } else { +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility } } -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility - this.sweepAttack(); - } - @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { - } - if (flag2) { -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility - this.crit(target); - } - - if (!flag2 && !flag3) { - if (flag) { -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility - } else { -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + this.causeFoodExhaustion(this.level().spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value + } else { +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + if (flag4) { + target.clearFire(); } - } - -@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { - - this.causeFoodExhaustion(this.level().spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value - } else { -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility - if (flag4) { - target.clearFire(); - } @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { public int getXpNeededForNextLevel() { return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); diff --git a/patches/unapplied/server/Shoulder-Entities-Release-API.patch b/patches/server/Shoulder-Entities-Release-API.patch similarity index 100% rename from patches/unapplied/server/Shoulder-Entities-Release-API.patch rename to patches/server/Shoulder-Entities-Release-API.patch diff --git a/patches/unapplied/server/String-based-Action-Bar-API.patch b/patches/server/String-based-Action-Bar-API.patch similarity index 54% rename from patches/unapplied/server/String-based-Action-Bar-API.patch rename to patches/server/String-based-Action-Bar-API.patch index 654e3dae4..770fa4950 100644 --- a/patches/unapplied/server/String-based-Action-Bar-API.patch +++ b/patches/server/String-based-Action-Bar-API.patch @@ -4,27 +4,6 @@ Date: Tue, 27 Dec 2016 15:02:42 -0500 Subject: [PATCH] String based Action Bar API -diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java -@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet; - public class ClientboundSetActionBarTextPacket implements Packet { - private final Component text; - public net.kyori.adventure.text.Component adventure$text; // Paper -+ public net.md_5.bungee.api.chat.BaseComponent[] components; // Paper - - public ClientboundSetActionBarTextPacket(Component message) { - this.text = message; -@@ -0,0 +0,0 @@ public class ClientboundSetActionBarTextPacket implements Packet= level; } @@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private CraftEntity bukkitEntity; public CraftEntity getBukkitEntity() { -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.bb = Entity.INITIAL_AABB; this.stuckSpeedMultiplier = Vec3.ZERO; this.nextStep = 1.0F; diff --git a/patches/unapplied/server/ensureServerConversions-API.patch b/patches/server/ensureServerConversions-API.patch similarity index 52% rename from patches/unapplied/server/ensureServerConversions-API.patch rename to patches/server/ensureServerConversions-API.patch index d7ebe3485..18f318ab0 100644 --- a/patches/unapplied/server/ensureServerConversions-API.patch +++ b/patches/server/ensureServerConversions-API.patch @@ -6,19 +6,6 @@ Subject: [PATCH] ensureServerConversions API This will take a Bukkit ItemStack and run it through any conversions a server process would perform on it, to ensure it meets latest minecraft expectations. -diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/item/ItemStack.java -+++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -0,0 +0,0 @@ public final class ItemStack { - - // Called to run this stack through the data converter to handle older storage methods and serialized items - public void convertStack(int version) { -- if (0 < version && version < CraftMagicNumbers.INSTANCE.getDataVersion()) { -+ if (0 < version && version < CraftMagicNumbers.INSTANCE.getDataVersion() && MinecraftServer.getServer() != null) { // Paper - skip conversion if the server doesn't exist (for tests) - CompoundTag savedStack = new CompoundTag(); - this.save(savedStack); - savedStack = (CompoundTag) MinecraftServer.getServer().fixerUpper.update(References.ITEM_STACK, new Dynamic(NbtOps.INSTANCE, savedStack), version, CraftMagicNumbers.INSTANCE.getDataVersion()).getValue(); 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 @@ -29,6 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end - Adventure + + // Paper start - ensure server conversions API ++ // TODO: DO WE NEED THIS? + @Override + public ItemStack ensureServerConversions(ItemStack item) { + return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item)); diff --git a/patches/unapplied/server/handle-NaN-health-absorb-values-and-repair-bad-data.patch b/patches/server/handle-NaN-health-absorb-values-and-repair-bad-data.patch similarity index 100% rename from patches/unapplied/server/handle-NaN-health-absorb-values-and-repair-bad-data.patch rename to patches/server/handle-NaN-health-absorb-values-and-repair-bad-data.patch diff --git a/patches/unapplied/server/handle-ServerboundKeepAlivePacket-async.patch b/patches/server/handle-ServerboundKeepAlivePacket-async.patch similarity index 100% rename from patches/unapplied/server/handle-ServerboundKeepAlivePacket-async.patch rename to patches/server/handle-ServerboundKeepAlivePacket-async.patch diff --git a/patches/unapplied/server/provide-a-configurable-option-to-disable-creeper-lin.patch b/patches/server/provide-a-configurable-option-to-disable-creeper-lin.patch similarity index 100% rename from patches/unapplied/server/provide-a-configurable-option-to-disable-creeper-lin.patch rename to patches/server/provide-a-configurable-option-to-disable-creeper-lin.patch diff --git a/patches/unapplied/server/remove-null-possibility-for-getServer-singleton.patch b/patches/server/remove-null-possibility-for-getServer-singleton.patch similarity index 98% rename from patches/unapplied/server/remove-null-possibility-for-getServer-singleton.patch rename to patches/server/remove-null-possibility-for-getServer-singleton.patch index f04d69175..fa5c1c85d 100644 --- a/patches/unapplied/server/remove-null-possibility-for-getServer-singleton.patch +++ b/patches/server/remove-null-possibility-for-getServer-singleton.patch @@ -34,5 +34,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null; + return SERVER; // Paper } - // CraftBukkit end + @Deprecated diff --git a/patches/unapplied/server/revert-serverside-behavior-of-keepalives.patch b/patches/server/revert-serverside-behavior-of-keepalives.patch similarity index 85% rename from patches/unapplied/server/revert-serverside-behavior-of-keepalives.patch rename to patches/server/revert-serverside-behavior-of-keepalives.patch index eaf9f16f4..7ef3c2d0a 100644 --- a/patches/unapplied/server/revert-serverside-behavior-of-keepalives.patch +++ b/patches/server/revert-serverside-behavior-of-keepalives.patch @@ -21,13 +21,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - private static final Component TIMEOUT_DISCONNECTION_MESSAGE = Component.translatable("disconnect.timeout"); protected final MinecraftServer server; public final Connection connection; // Paper + private final boolean transferred; - private long keepAliveTime; + private long keepAliveTime = Util.getMillis(); // Paper private boolean keepAlivePending; private long keepAliveChallenge; + private long closedListenerTime; +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack private int latency; private volatile boolean suspendFlushingOnServerThread = false; public final java.util.Map packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks @@ -40,22 +42,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected void keepConnectionAlive() { this.server.getProfiler().push("keepAlive"); - long i = Util.getMillis(); -- -- if (i - this.keepAliveTime >= 25000L) { // CraftBukkit -- if (this.keepAlivePending) { + // 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 = Util.getMillis(); + long elapsedTime = currentTime - this.keepAliveTime; -+ -+ if (this.keepAlivePending) { -+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected -+ ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info + +- if (!this.isSingleplayerOwner() && i - this.keepAliveTime >= 25000L) { // CraftBukkit +- if (this.keepAlivePending) { ++ if (!this.isSingleplayerOwner() && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected ++ if (this.keepAlivePending && !this.processedDisconnect) { // Paper this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); -- } else { -+ } -+ } else { -+ if (elapsedTime >= 15000L) { // 15 seconds +- } else if (this.checkIfClosed(i)) { ++ } else if (this.checkIfClosed(currentTime)) { // Paper this.keepAlivePending = true; - this.keepAliveTime = i; - this.keepAliveChallenge = i; diff --git a/patches/unapplied/server/use-CB-BlockState-implementations-for-captured-block.patch b/patches/server/use-CB-BlockState-implementations-for-captured-block.patch similarity index 100% rename from patches/unapplied/server/use-CB-BlockState-implementations-for-captured-block.patch rename to patches/server/use-CB-BlockState-implementations-for-captured-block.patch diff --git a/patches/unapplied/server/Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/patches/unapplied/server/Add-handshake-event-to-allow-plugins-to-handle-clien.patch deleted file mode 100644 index 9d9f0762f..000000000 --- a/patches/unapplied/server/Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Riley Park -Date: Wed, 13 Apr 2016 20:21:38 -0700 -Subject: [PATCH] Add handshake event to allow plugins to handle client - handshaking logic themselves - - -diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - this.connection.disconnect(ichatmutablecomponent); - } else { - this.connection.setListener(new ServerLoginPacketListenerImpl(this.server, this.connection)); -+ // Paper start - PlayerHandshakeEvent -+ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee; -+ boolean handledByEvent = false; -+ // Try and handle the handshake through the event -+ if (com.destroystokyo.paper.event.player.PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) { // Hello? Can you hear me? -+ java.net.SocketAddress socketAddress = this.connection.address; -+ String hostnameOfRemote = socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getHostString() : InetAddress.getLoopbackAddress().getHostAddress(); -+ com.destroystokyo.paper.event.player.PlayerHandshakeEvent event = new com.destroystokyo.paper.event.player.PlayerHandshakeEvent(packet.hostName(), hostnameOfRemote, !proxyLogicEnabled); -+ if (event.callEvent()) { -+ // If we've failed somehow, let the client know so and go no further. -+ if (event.isFailed()) { -+ Component component = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage()); -+ this.connection.send(new ClientboundLoginDisconnectPacket(component)); -+ this.connection.disconnect(component); -+ return; -+ } -+ -+ if (event.getServerHostname() != null) { -+ // change hostname -+ packet = new ClientIntentionPacket( -+ packet.protocolVersion(), -+ event.getServerHostname(), -+ packet.port(), -+ packet.intention() -+ ); -+ } -+ if (event.getSocketAddressHostname() != null) this.connection.address = new java.net.InetSocketAddress(event.getSocketAddressHostname(), socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0); -+ this.connection.spoofedUUID = event.getUniqueId(); -+ this.connection.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class); -+ handledByEvent = true; // Hooray, we did it! -+ } -+ } - // Spigot Start - String[] split = packet.hostName().split("\00"); -- if (org.spigotmc.SpigotConfig.bungee) { -+ // Don't try and handle default logic if it's been handled by the event. -+ if (!handledByEvent && proxyLogicEnabled) { -+ // Paper end - PlayerHandshakeEvent -+ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! - if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { - this.connection.hostname = split[0]; - this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); diff --git a/patches/unapplied/server/Do-not-load-chunks-for-Pathfinding.patch b/patches/unapplied/server/Do-not-load-chunks-for-Pathfinding.patch deleted file mode 100644 index a99f80ea7..000000000 --- a/patches/unapplied/server/Do-not-load-chunks-for-Pathfinding.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 31 Mar 2016 19:17:58 -0400 -Subject: [PATCH] Do not load chunks for Pathfinding - - -diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -0,0 +0,0 @@ public class WalkNodeEvaluator extends NodeEvaluator { - for (int n = -1; n <= 1; n++) { - if (l != 0 || n != 0) { - pos.set(i + l, j + m, k + n); -- BlockState blockState = world.getBlockState(pos); -+ // Paper start - Do not load chunks during pathfinding -+ BlockState blockState = world.getBlockStateIfLoaded(pos); -+ if (blockState == null) { -+ return BlockPathTypes.BLOCKED; -+ } else { -+ // Paper end - Do not load chunks during pathfinding - if (blockState.is(Blocks.CACTUS) || blockState.is(Blocks.SWEET_BERRY_BUSH)) { - return BlockPathTypes.DANGER_OTHER; - } -@@ -0,0 +0,0 @@ public class WalkNodeEvaluator extends NodeEvaluator { - if (blockState.is(Blocks.WITHER_ROSE) || blockState.is(Blocks.POINTED_DRIPSTONE)) { - return BlockPathTypes.DAMAGE_CAUTIOUS; - } -+ } // Paper - } - } - } -@@ -0,0 +0,0 @@ public class WalkNodeEvaluator extends NodeEvaluator { - } - - protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) { -- BlockState blockState = world.getBlockState(pos); -+ BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper - Do not load chunks during pathfinding -+ if (blockState == null) return BlockPathTypes.BLOCKED; // Paper - Do not load chunks during pathfinding - Block block = blockState.getBlock(); - if (blockState.isAir()) { - return BlockPathTypes.OPEN; diff --git a/patches/unapplied/server/Player-Tab-List-and-Title-APIs.patch b/patches/unapplied/server/Player-Tab-List-and-Title-APIs.patch deleted file mode 100644 index 3c9ce45e8..000000000 --- a/patches/unapplied/server/Player-Tab-List-and-Title-APIs.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Techcable -Date: Thu, 3 Mar 2016 02:32:10 -0600 -Subject: [PATCH] Player Tab List and Title APIs - - -diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java -+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -@@ -0,0 +0,0 @@ public class FriendlyByteBuf extends ByteBuf { - return this.writeWithCodec(NbtOps.INSTANCE, ComponentSerialization.localizedCodec(this.adventure$locale), text); - // Paper end - adventure; support writing adventure components directly and server-side translations - } -+ // Paper start - deprecated Tab List & Title APIs -+ @Deprecated -+ public FriendlyByteBuf writeComponent(final net.md_5.bungee.api.chat.BaseComponent[] component) { -+ return this.writeComponent(java.util.Objects.requireNonNull(Component.Serializer.fromJson(net.md_5.bungee.chat.ComponentSerializer.toString(component)))); -+ } -+ // Paper end - deprecated Tab List & Title APIs - - public > T readEnum(Class enumClass) { - return ((T[]) enumClass.getEnumConstants())[this.readVarInt()]; // CraftBukkit - fix decompile error -diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java -@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet; - public class ClientboundSetSubtitleTextPacket implements Packet { - private final Component text; - public net.kyori.adventure.text.Component adventure$text; // Paper -+ public net.md_5.bungee.api.chat.BaseComponent[] components; // Paper - - public ClientboundSetSubtitleTextPacket(Component subtitle) { - this.text = subtitle; -@@ -0,0 +0,0 @@ public class ClientboundSetSubtitleTextPacket implements Packet { - private final Component text; - public net.kyori.adventure.text.Component adventure$text; // Paper -+ public net.md_5.bungee.api.chat.BaseComponent[] components; // Paper - - public ClientboundSetTitleTextPacket(Component title) { - this.text = title; -@@ -0,0 +0,0 @@ public class ClientboundSetTitleTextPacket implements Packet