diff options
author | Bjarne Koll <[email protected]> | 2024-10-22 22:00:33 +0200 |
---|---|---|
committer | Bjarne Koll <[email protected]> | 2024-10-22 22:00:33 +0200 |
commit | 152e82ceec622ab38be10cc4281cf4b36766023c (patch) | |
tree | 279eba3f018d6d52c6e7ddc3c05f2763a8001d37 /patches/unapplied | |
parent | 6b27267fb7cab462298b0523846f633974775f53 (diff) | |
download | Paper-152e82ceec622ab38be10cc4281cf4b36766023c.tar.gz Paper-152e82ceec622ab38be10cc4281cf4b36766023c.zip |
Some work
Diffstat (limited to 'patches/unapplied')
21 files changed, 0 insertions, 976 deletions
diff --git a/patches/unapplied/server/0101-Fix-global-sound-handling.patch b/patches/unapplied/server/0101-Fix-global-sound-handling.patch deleted file mode 100644 index 8f4acbadad..0000000000 --- a/patches/unapplied/server/0101-Fix-global-sound-handling.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Tue, 31 May 2016 22:53:50 -0400 -Subject: [PATCH] Fix global sound handling - -* Only send global sounds to same world if limiting radius -* respect global sound events gamerule - -Co-authored-by: Evan McCarthy <[email protected]> -Co-authored-by: lexikiq <[email protected]> -Co-authored-by: Aikar <[email protected]> - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 223f8d9be5d73e296f5815db7123b95c3b345162..d728afbe1d6882f1ace4ead9d87f4b7d2af43ba2 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1322,7 +1322,7 @@ public class ServerLevel extends Level implements WorldGenLevel { - - @Override - public void levelEvent(@Nullable Player player, int eventId, BlockPos pos, int data) { -- this.server.getPlayerList().broadcast(player, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), 64.0D, this.dimension(), new ClientboundLevelEventPacket(eventId, pos, data, false)); -+ this.server.getPlayerList().broadcast(player, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), 64.0D, this.dimension(), new ClientboundLevelEventPacket(eventId, pos, data, false)); // Paper - diff on change (the 64.0 distance is used as defaults for sound ranges in spigot config for ender dragon, end portal and wither) - } - - public int getLogicalHeight() { -diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index 0be5ae83d2fa86142e3404393729039c51ae0639..25a429a2d1725d562a28b9d07dba630cfe49d32a 100644 ---- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -695,11 +695,12 @@ public class EnderDragon extends Mob implements Enemy { - // CraftBukkit start - Use relative location for far away sounds - // this.level().globalLevelEvent(1028, this.blockPosition(), 0); - int viewDistance = ((ServerLevel) this.level()).getCraftServer().getViewDistance() * 16; -- for (net.minecraft.server.level.ServerPlayer player : this.level().getServer().getPlayerList().players) { -+ for (net.minecraft.server.level.ServerPlayer player : this.level().getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule - double deltaX = this.getX() - player.getX(); - double deltaZ = this.getZ() - player.getZ(); - double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -- if ( this.level().spigotConfig.dragonDeathSoundRadius > 0 && distanceSquared > this.level().spigotConfig.dragonDeathSoundRadius * this.level().spigotConfig.dragonDeathSoundRadius ) continue; // Spigot -+ final double soundRadiusSquared = this.level().getGlobalSoundRangeSquared(config -> config.dragonDeathSoundRadius); // Paper - respect global sound events gamerule -+ if ( !this.level().getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared ) continue; // Spigot // Paper - respect global sound events gamerule - if (distanceSquared > viewDistance * viewDistance) { - double deltaLength = Math.sqrt(distanceSquared); - double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; -diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index d288bc209a0b0fdf2d73197a8e7d179e8e8c31e7..3ee24382ef3614ff0c5d5cdc614a41286ba4af5e 100644 ---- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -278,11 +278,12 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob - // CraftBukkit start - Use relative location for far away sounds - // this.level().globalLevelEvent(1023, new BlockPosition(this), 0); - int viewDistance = ((ServerLevel) this.level()).getCraftServer().getViewDistance() * 16; -- for (ServerPlayer player : (List<ServerPlayer>) MinecraftServer.getServer().getPlayerList().players) { -+ for (ServerPlayer player : this.level().getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule - double deltaX = this.getX() - player.getX(); - double deltaZ = this.getZ() - player.getZ(); - double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -- if ( this.level().spigotConfig.witherSpawnSoundRadius > 0 && distanceSquared > this.level().spigotConfig.witherSpawnSoundRadius * this.level().spigotConfig.witherSpawnSoundRadius ) continue; // Spigot -+ final double soundRadiusSquared = this.level().getGlobalSoundRangeSquared(config -> config.witherSpawnSoundRadius); // Paper - respect global sound events gamerule -+ if ( !this.level().getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared ) continue; // Spigot // Paper - respect global sound events gamerule - if (distanceSquared > viewDistance * viewDistance) { - double deltaLength = Math.sqrt(distanceSquared); - double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; -diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java -index 0224a0e901f9430ef06c30432a7988149a67037d..391579b515c5a07066f82b33c4f9ef8ee1d05530 100644 ---- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java -+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java -@@ -67,11 +67,12 @@ public class EnderEyeItem extends Item { - // world.b(1038, blockposition1.c(1, 0, 1), 0); - int viewDistance = world.getCraftServer().getViewDistance() * 16; - BlockPos soundPos = blockposition1.offset(1, 0, 1); -- for (ServerPlayer player : world.getServer().getPlayerList().players) { -+ for (ServerPlayer player : world.getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule - double deltaX = soundPos.getX() - player.getX(); - double deltaZ = soundPos.getZ() - player.getZ(); - double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -- if (world.spigotConfig.endPortalSoundRadius > 0 && distanceSquared > world.spigotConfig.endPortalSoundRadius * world.spigotConfig.endPortalSoundRadius) continue; // Spigot -+ final double soundRadiusSquared = world.getGlobalSoundRangeSquared(config -> config.endPortalSoundRadius); // Paper - respect global sound events gamerule -+ if (!world.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared) continue; // Spigot // Paper - respect global sound events gamerule - if (distanceSquared > viewDistance * viewDistance) { - double deltaLength = Math.sqrt(distanceSquared); - double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 240db0aae0b0e306c90bcc4a537c9afcb290acb3..59992bea10218e48397fa781f895d36e0e1df46e 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -1277,4 +1277,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - return this.id; - } - } -+ // Paper start - respect global sound events gamerule -+ public List<net.minecraft.server.level.ServerPlayer> getPlayersForGlobalSoundGamerule() { -+ return this.getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS) ? ((ServerLevel) this).getServer().getPlayerList().players : ((ServerLevel) this).players(); -+ } -+ -+ public double getGlobalSoundRangeSquared(java.util.function.Function<org.spigotmc.SpigotWorldConfig, Integer> rangeFunction) { -+ final double range = rangeFunction.apply(this.spigotConfig); -+ return range <= 0 ? 64.0 * 64.0 : range * range; // 64 is taken from default in ServerLevel#levelEvent -+ } -+ // Paper end - respect global sound events gamerule - } diff --git a/patches/unapplied/server/0102-Avoid-blocking-on-Network-Manager-creation.patch b/patches/unapplied/server/0102-Avoid-blocking-on-Network-Manager-creation.patch deleted file mode 100644 index 1c6ee84de8..0000000000 --- a/patches/unapplied/server/0102-Avoid-blocking-on-Network-Manager-creation.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Mon, 16 May 2016 23:19:16 -0400 -Subject: [PATCH] Avoid blocking on Network Manager creation - -Per Paper issue 294 - -diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index 2cf3e79ec5e8706b71d27ebad4668773f0b91195..64119f2188f8958b8a5913fec82ac5bba1b74b2a 100644 ---- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -@@ -61,6 +61,15 @@ public class ServerConnectionListener { - public volatile boolean running; - private final List<ChannelFuture> channels = Collections.synchronizedList(Lists.newArrayList()); - final List<Connection> connections = Collections.synchronizedList(Lists.newArrayList()); -+ // Paper start - prevent blocking on adding a new connection while the server is ticking -+ private final java.util.Queue<Connection> pending = new java.util.concurrent.ConcurrentLinkedQueue<>(); -+ private final void addPending() { -+ Connection connection; -+ while ((connection = pending.poll()) != null) { -+ connections.add(connection); -+ } -+ } -+ // Paper end - prevent blocking on adding a new connection while the server is ticking - - public ServerConnectionListener(MinecraftServer server) { - this.server = server; -@@ -102,7 +111,8 @@ public class ServerConnectionListener { - int j = ServerConnectionListener.this.server.getRateLimitPacketsPerSecond(); - Connection object = j > 0 ? new RateKickingConnection(j) : new Connection(PacketFlow.SERVERBOUND); // CraftBukkit - decompile error - -- ServerConnectionListener.this.connections.add(object); -+ //ServerConnectionListener.this.connections.add(object); // Paper -+ pending.add(object); // Paper - prevent blocking on adding a new connection while the server is ticking - ((Connection) object).configurePacketHandler(channelpipeline); - ((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); - } -@@ -164,6 +174,7 @@ public class ServerConnectionListener { - - synchronized (this.connections) { - // Spigot Start -+ this.addPending(); // Paper - prevent blocking on adding a new connection while the server is ticking - // This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order - if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 ) - { diff --git a/patches/unapplied/server/0103-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch b/patches/unapplied/server/0103-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch deleted file mode 100644 index 82dc93463f..0000000000 --- a/patches/unapplied/server/0103-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <[email protected]> -Date: Sat, 16 Jul 2016 19:11:17 -0500 -Subject: [PATCH] Don't lookup game profiles that have no UUID and no name - - -diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 5b219b5eee0c5958b80093c9223feeed0dec830b..bc7143ad915f001726e8558c8ca4160f3f9ace68 100644 ---- a/src/main/java/net/minecraft/server/players/GameProfileCache.java -+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java -@@ -89,6 +89,7 @@ public class GameProfileCache { - } - }; - -+ if (!org.apache.commons.lang3.StringUtils.isBlank(name)) // Paper - Don't lookup a profile with a blank name - repository.findProfilesByNames(new String[]{name}, profilelookupcallback); - GameProfile gameprofile = (GameProfile) atomicreference.get(); - diff --git a/patches/unapplied/server/0104-Add-setting-for-proxy-online-mode-status.patch b/patches/unapplied/server/0104-Add-setting-for-proxy-online-mode-status.patch deleted file mode 100644 index e08249957a..0000000000 --- a/patches/unapplied/server/0104-Add-setting-for-proxy-online-mode-status.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Gabriele C <[email protected]> -Date: Fri, 5 Aug 2016 01:03:08 +0200 -Subject: [PATCH] Add setting for proxy online mode status - -TODO: Add isProxyOnlineMode check to Metrics - -diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index c1f41dcf49c75c3d69485c0e1ec821205438ed1e..c466ec011d059b9960606ef2ee51ea3a3a65f8d0 100644 ---- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -593,7 +593,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - public boolean enforceSecureProfile() { - DedicatedServerProperties dedicatedserverproperties = this.getProperties(); - -- return dedicatedserverproperties.enforceSecureProfile && dedicatedserverproperties.onlineMode && this.services.canValidateProfileKeys(); -+ // Paper start - Add setting for proxy online mode status -+ return dedicatedserverproperties.enforceSecureProfile -+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() -+ && this.services.canValidateProfileKeys(); -+ // Paper end - Add setting for proxy online mode status - } - - @Override -diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index bc7143ad915f001726e8558c8ca4160f3f9ace68..aeb0c7ce9b6f93dadd407dbdefba053568f2e2fe 100644 ---- a/src/main/java/net/minecraft/server/players/GameProfileCache.java -+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java -@@ -89,7 +89,8 @@ public class GameProfileCache { - } - }; - -- if (!org.apache.commons.lang3.StringUtils.isBlank(name)) // Paper - Don't lookup a profile with a blank name -+ if (!org.apache.commons.lang3.StringUtils.isBlank(name) // Paper - Don't lookup a profile with a blank name -+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) // Paper - Add setting for proxy online mode status - repository.findProfilesByNames(new String[]{name}, profilelookupcallback); - GameProfile gameprofile = (GameProfile) atomicreference.get(); - -@@ -106,7 +107,7 @@ public class GameProfileCache { - } - - private static boolean usesAuthentication() { -- return GameProfileCache.usesAuthentication; -+ return io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode(); // Paper - Add setting for proxy online mode status - } - - public void add(GameProfile profile) { -diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java -index a0b0614ac7d2009db5c6c10ab4a5f09dd447c635..653856d0b8dcf2baf4cc77a276f17c8cc1fa717e 100644 ---- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java -+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java -@@ -65,7 +65,8 @@ public class OldUsersConverter { - return new String[i]; - }); - -- if (server.usesAuthentication() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now. -+ if (server.usesAuthentication() || -+ (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode())) { // Spigot: bungee = online mode, for now. // Paper - Add setting for proxy online mode status - server.getProfileRepository().findProfilesByNames(astring, callback); - } else { - String[] astring1 = astring; -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b7539a5f7bc20f20f3cd7fb30d87ab7ffc1133c3..b125872e57e15081d6f5a7b3e108f7633046b228 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1888,7 +1888,7 @@ public final class CraftServer implements Server { - if (result == null) { - GameProfile profile = null; - // Only fetch an online UUID in online mode -- if (this.getOnlineMode() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now. -+ if (this.getOnlineMode() || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) { // Paper - Add setting for proxy online mode status - // This is potentially blocking :( - profile = this.console.getProfileCache().get(name).orElse(null); - } diff --git a/patches/unapplied/server/0105-Optimise-BlockState-s-hashCode-equals.patch b/patches/unapplied/server/0105-Optimise-BlockState-s-hashCode-equals.patch deleted file mode 100644 index 348097f8ce..0000000000 --- a/patches/unapplied/server/0105-Optimise-BlockState-s-hashCode-equals.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alfie Cleveland <[email protected]> -Date: Fri, 19 Aug 2016 01:52:56 +0100 -Subject: [PATCH] Optimise BlockState's hashCode/equals - -These are singleton "single instance" objects. We can rely on -object identity checks safely. - -Use a simpler optimized hashcode - -diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java -index ee2f1bff22fed14cda434173dc6286e4d4520822..b63116b333b6e06494091a82588acfb639bddb71 100644 ---- a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java -+++ b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java -@@ -30,8 +30,7 @@ public class BooleanProperty extends Property<Boolean> { - return value.toString(); - } - -- @Override -- public boolean equals(Object object) { -+ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals - if (this == object) { - return true; - } else { -diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -index f4d9856420a6e7e857fc9b9cb6182a54fe341568..3097298fe356df98967cf4bdeaaede69dfe8a441 100644 ---- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -+++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -@@ -44,8 +44,7 @@ public class EnumProperty<T extends Enum<T> & StringRepresentable> extends Prope - return value.getSerializedName(); - } - -- @Override -- public boolean equals(Object object) { -+ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals - if (this == object) { - return true; - } else { -diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java -index 3c590d400032d8266de63aae301fedbd83d37a1d..3a850321a4bcc68058483b5fd53e829c425a68af 100644 ---- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java -+++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java -@@ -35,8 +35,7 @@ public class IntegerProperty extends Property<Integer> { - return this.values; - } - -- @Override -- public boolean equals(Object object) { -+ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals - if (this == object) { - return true; - } else { -diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java -index 7cbc5e6e75f389f47ef07045f9876cec192f14e4..9055f15af0cae55effa6942913a9d7edf3857e07 100644 ---- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java -+++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java -@@ -70,7 +70,7 @@ public abstract class Property<T extends Comparable<T>> { - - @Override - public boolean equals(Object object) { -- return this == object || object instanceof Property<?> property && this.clazz.equals(property.clazz) && this.name.equals(property.name); -+ return this == object; // Paper - Perf: Optimize hashCode/equals - } - - @Override diff --git a/patches/unapplied/server/0106-Configurable-packet-in-spam-threshold.patch b/patches/unapplied/server/0106-Configurable-packet-in-spam-threshold.patch deleted file mode 100644 index 65d911de77..0000000000 --- a/patches/unapplied/server/0106-Configurable-packet-in-spam-threshold.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <[email protected]> -Date: Sun, 11 Sep 2016 14:30:57 -0500 -Subject: [PATCH] Configurable packet in spam threshold - - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 14a821bfc6b20475889d3138b8da9e6bfaf1787c..905a7941597306b0cd23ec9a883ef3ee9a684788 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1534,13 +1534,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - // Spigot start - limit place/interactions - private int limitedPackets; - private long lastLimitedPacket = -1; -+ private static int getSpamThreshold() { return io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.incomingPacketThreshold; } // Paper - Configurable threshold - - private boolean checkLimit(long timestamp) { -- if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < 30 && this.limitedPackets++ >= 4) { -+ if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < getSpamThreshold() && this.limitedPackets++ >= 8) { // Paper - Configurable threshold; raise packet limit to 8 - return false; - } - -- if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= 30) { -+ if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= getSpamThreshold()) { // Paper - Configurable threshold - this.lastLimitedPacket = timestamp; - this.limitedPackets = 0; - return true; diff --git a/patches/unapplied/server/0107-Configurable-flying-kick-messages.patch b/patches/unapplied/server/0107-Configurable-flying-kick-messages.patch deleted file mode 100644 index 7a80c997cc..0000000000 --- a/patches/unapplied/server/0107-Configurable-flying-kick-messages.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kashike <[email protected]> -Date: Tue, 20 Sep 2016 00:58:01 +0000 -Subject: [PATCH] Configurable flying kick messages - - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 905a7941597306b0cd23ec9a883ef3ee9a684788..34aeb823950fac8eaef3f38b302c1585a45f7498 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -346,7 +346,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) { - if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) { - ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); -- this.disconnect((Component) Component.translatable("multiplayer.disconnect.flying")); -+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer); // Paper - use configurable kick message - return; - } - } else { -@@ -365,7 +365,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - 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) Component.translatable("multiplayer.disconnect.flying")); -+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle); // Paper - use configurable kick message - return; - } - } else { diff --git a/patches/unapplied/server/0108-Add-EntityZapEvent.patch b/patches/unapplied/server/0108-Add-EntityZapEvent.patch deleted file mode 100644 index cb6ab1da64..0000000000 --- a/patches/unapplied/server/0108-Add-EntityZapEvent.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaBlend <[email protected]> -Date: Sun, 16 Oct 2016 23:19:30 -0700 -Subject: [PATCH] Add EntityZapEvent - - -diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 63c10be6eacd7108b8b4795d76bf624e0614440a..243eb1e54293c763a06febff551c051398d43535 100644 ---- a/src/main/java/net/minecraft/world/entity/npc/Villager.java -+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -846,10 +846,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler - @Override - public void thunderHit(ServerLevel world, LightningBolt lightning) { - if (world.getDifficulty() != Difficulty.PEACEFUL) { -- Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); -+ // Paper - Add EntityZapEvent; move log down, event can cancel - Witch entitywitch = (Witch) EntityType.WITCH.create(world); - - if (entitywitch != null) { -+ // Paper start - Add EntityZapEvent -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, lightning, entitywitch).isCancelled()) { -+ return; -+ } -+ if (org.spigotmc.SpigotConfig.logVillagerDeaths) Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); // Move down -+ // 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); - 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 96e0fc5c8a018fd579f24529175decdac634cfa1..50f33c6029c190f947b6bf6215004416b034c0cc 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1217,6 +1217,14 @@ public class CraftEventFactory { - return !event.isCancelled(); - } - -+ // Paper start -+ public static com.destroystokyo.paper.event.entity.EntityZapEvent callEntityZapEvent(Entity entity, Entity lightning, Entity changedEntity) { -+ com.destroystokyo.paper.event.entity.EntityZapEvent event = new com.destroystokyo.paper.event.entity.EntityZapEvent(entity.getBukkitEntity(), (LightningStrike) lightning.getBukkitEntity(), changedEntity.getBukkitEntity()); -+ entity.getBukkitEntity().getServer().getPluginManager().callEvent(event); -+ return event; -+ } -+ // Paper end -+ - public static boolean callEntityChangeBlockEvent(Entity entity, BlockPos position, net.minecraft.world.level.block.state.BlockState newBlock) { - return CraftEventFactory.callEntityChangeBlockEvent(entity, position, newBlock, false); - } diff --git a/patches/unapplied/server/0109-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch b/patches/unapplied/server/0109-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch deleted file mode 100644 index 00673bc0e7..0000000000 --- a/patches/unapplied/server/0109-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <[email protected]> -Date: Sat, 12 Nov 2016 23:25:22 -0600 -Subject: [PATCH] Filter bad block entity nbt data from falling blocks - - -diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index c3a16691e8a843c02e0aea6469822cd8869ad593..01ac7bb0ef8ab13e7c4b5b56b768b7c0a642b300 100644 ---- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -340,7 +340,7 @@ public class FallingBlockEntity extends Entity { - this.dropItem = nbt.getBoolean("DropItem"); - } - -- if (nbt.contains("TileEntityData", 10)) { -+ if (nbt.contains("TileEntityData", 10) && !(this.level().paperConfig().entities.spawning.filterBadTileEntityNbtFromFallingBlocks && this.blockState.getBlock() instanceof net.minecraft.world.level.block.GameMasterBlock)) { // Paper - Filter bad block entity nbt data from falling blocks - this.blockData = nbt.getCompound("TileEntityData").copy(); - } - diff --git a/patches/unapplied/server/0110-Cache-user-authenticator-threads.patch b/patches/unapplied/server/0110-Cache-user-authenticator-threads.patch deleted file mode 100644 index f16083a26e..0000000000 --- a/patches/unapplied/server/0110-Cache-user-authenticator-threads.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alfie Cleveland <[email protected]> -Date: Fri, 25 Nov 2016 13:22:40 +0000 -Subject: [PATCH] Cache user authenticator threads - - -diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index b2f7c76207f2dc0c62f608f21aba4b531f8f523f..e65c582635317b9f8a1af4e6f6a5fb916f73cc35 100644 ---- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -76,6 +76,7 @@ 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 final byte[] challenge; - final MinecraftServer server; -@@ -174,7 +175,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - 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()) { -+ // Paper start - Cache authenticator threads -+ authenticatorPool.execute(new Runnable() { - - @Override - public void run() { -@@ -189,10 +191,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - ServerLoginPacketListenerImpl.this.server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.requestedUsername, ex); - } - } -- }; -- -- thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(ServerLoginPacketListenerImpl.LOGGER)); -- thread.start(); -+ }); -+ // Paper end - Cache authenticator threads - // CraftBukkit end - } - -@@ -271,7 +271,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - throw new IllegalStateException("Protocol error", cryptographyexception); - } - -- Thread thread = new Thread("User Authenticator #" + ServerLoginPacketListenerImpl.UNIQUE_THREAD_ID.incrementAndGet()) { -+ // Paper start - Cache authenticator threads -+ authenticatorPool.execute(new Runnable() { - public void run() { - String s1 = (String) Objects.requireNonNull(ServerLoginPacketListenerImpl.this.requestedUsername, "Player name not initialized"); - -@@ -319,10 +320,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - - return ServerLoginPacketListenerImpl.this.server.getPreventProxyConnections() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null; - } -- }; -- -- thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(ServerLoginPacketListenerImpl.LOGGER)); -- thread.start(); -+ }); -+ // Paper end - Cache authenticator threads - } - - // CraftBukkit start diff --git a/patches/unapplied/server/0111-Allow-Reloading-of-Command-Aliases.patch b/patches/unapplied/server/0111-Allow-Reloading-of-Command-Aliases.patch deleted file mode 100644 index 9bf9ad3da9..0000000000 --- a/patches/unapplied/server/0111-Allow-Reloading-of-Command-Aliases.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: willies952002 <[email protected]> -Date: Mon, 28 Nov 2016 10:21:52 -0500 -Subject: [PATCH] Allow Reloading of Command Aliases - -Reload the aliases stored in commands.yml - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b125872e57e15081d6f5a7b3e108f7633046b228..8e951ed126453cf1ffa81e5c8aa6e6ea5db03089 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2818,5 +2818,24 @@ public final class CraftServer implements Server { - DefaultPermissions.registerCorePermissions(); - CraftDefaultPermissions.registerCorePermissions(); - } -+ -+ @Override -+ public boolean reloadCommandAliases() { -+ Set<String> removals = getCommandAliases().keySet().stream() -+ .map(key -> key.toLowerCase(java.util.Locale.ENGLISH)) -+ .collect(java.util.stream.Collectors.toSet()); -+ getCommandMap().getKnownCommands().keySet().removeIf(removals::contains); -+ File file = getCommandsConfigFile(); -+ try { -+ commandsConfiguration.load(file); -+ } catch (FileNotFoundException ex) { -+ return false; -+ } catch (IOException | org.bukkit.configuration.InvalidConfigurationException ex) { -+ Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex); -+ return false; -+ } -+ commandMap.registerServerAliases(); -+ return true; -+ } - // Paper end - } diff --git a/patches/unapplied/server/0112-Add-source-to-PlayerExpChangeEvent.patch b/patches/unapplied/server/0112-Add-source-to-PlayerExpChangeEvent.patch deleted file mode 100644 index 539523b8dd..0000000000 --- a/patches/unapplied/server/0112-Add-source-to-PlayerExpChangeEvent.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaBlend <[email protected]> -Date: Thu, 8 Sep 2016 08:48:33 -0700 -Subject: [PATCH] Add source to PlayerExpChangeEvent - - -diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 56402312e44d12c859e2c4b39902d31b7cfd1573..25a45e680f9fdea90f43d59de87a3a500f4ee8c0 100644 ---- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -264,7 +264,7 @@ public class ExperienceOrb extends Entity { - int i = this.repairPlayerItems(entityplayer, this.value); - - if (i > 0) { -- player.giveExperiencePoints(CraftEventFactory.callPlayerExpChangeEvent(player, i).getAmount()); // CraftBukkit - this.value -> event.getAmount() -+ player.giveExperiencePoints(CraftEventFactory.callPlayerExpChangeEvent(player, this).getAmount()); // CraftBukkit - this.value -> event.getAmount() // Paper - supply experience orb object - } - - --this.count; -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 50f33c6029c190f947b6bf6215004416b034c0cc..d36e039aa5f1cf84179def5df5addaf448f54bd2 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1170,6 +1170,17 @@ public class CraftEventFactory { - return event; - } - -+ // Paper start - Add orb -+ public static PlayerExpChangeEvent callPlayerExpChangeEvent(net.minecraft.world.entity.player.Player entity, net.minecraft.world.entity.ExperienceOrb entityOrb) { -+ Player player = (Player) entity.getBukkitEntity(); -+ ExperienceOrb source = (ExperienceOrb) entityOrb.getBukkitEntity(); -+ int expAmount = source.getExperience(); -+ PlayerExpChangeEvent event = new PlayerExpChangeEvent(player, source, expAmount); -+ Bukkit.getPluginManager().callEvent(event); -+ return event; -+ } -+ // Paper end -+ - public static boolean handleBlockGrowEvent(Level world, BlockPos pos, net.minecraft.world.level.block.state.BlockState block) { - return CraftEventFactory.handleBlockGrowEvent(world, pos, block, 3); - } diff --git a/patches/unapplied/server/0113-Add-ProjectileCollideEvent.patch b/patches/unapplied/server/0113-Add-ProjectileCollideEvent.patch deleted file mode 100644 index f2c7317621..0000000000 --- a/patches/unapplied/server/0113-Add-ProjectileCollideEvent.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Techcable <[email protected]> -Date: Fri, 16 Dec 2016 21:25:39 -0600 -Subject: [PATCH] Add ProjectileCollideEvent - -Deprecated now and replaced with ProjectileHitEvent - -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index d36e039aa5f1cf84179def5df5addaf448f54bd2..91180d7ad705ca97c0df43debc14b204127165d0 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1323,6 +1323,16 @@ public class CraftEventFactory { - Bukkit.getPluginManager().callEvent(crafterCraftEvent); - return crafterCraftEvent; - } -+ // Paper start -+ @Deprecated -+ public static com.destroystokyo.paper.event.entity.ProjectileCollideEvent callProjectileCollideEvent(Entity entity, EntityHitResult position) { -+ Projectile projectile = (Projectile) entity.getBukkitEntity(); -+ org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity(); -+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided); -+ Bukkit.getPluginManager().callEvent(event); -+ return event; -+ } -+ // Paper end - - public static ProjectileLaunchEvent callProjectileLaunchEvent(Entity entity) { - Projectile bukkitEntity = (Projectile) entity.getBukkitEntity(); -@@ -1348,8 +1358,15 @@ public class CraftEventFactory { - if (position.getType() == HitResult.Type.ENTITY) { - hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity(); - } -+ // Paper start - legacy event -+ boolean cancelled = false; -+ if (hitEntity != null && position instanceof EntityHitResult entityHitResult) { -+ cancelled = callProjectileCollideEvent(entity, entityHitResult).isCancelled(); -+ } -+ // Paper end - - ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), hitEntity, hitBlock, hitFace); -+ event.setCancelled(cancelled); // Paper - propagate legacy event cancellation to modern event - entity.level().getCraftServer().getPluginManager().callEvent(event); - return event; - } diff --git a/patches/unapplied/server/0114-Prevent-Pathfinding-out-of-World-Border.patch b/patches/unapplied/server/0114-Prevent-Pathfinding-out-of-World-Border.patch deleted file mode 100644 index ce3053228d..0000000000 --- a/patches/unapplied/server/0114-Prevent-Pathfinding-out-of-World-Border.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Mon, 19 Dec 2016 23:07:42 -0500 -Subject: [PATCH] Prevent Pathfinding out of World Border - -This prevents Entities from trying to run outside of the World Border - -TODO: This doesn't prevent the pathfinder from using blocks outside the world border as nodes. We can fix this -by adding code to all overrides in: - NodeEvaluator: - public abstract BlockPathTypes getBlockPathType(BlockGetter world, int x, int y, int z); - -to return BLOCKED if it is outside the world border. - -diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 21bbc98b26b270b3ad6a3b34d6e50dfb796c3d5a..188904c9f0f81db1d63eec953d6746f2dc23dc81 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -158,7 +158,7 @@ public abstract class PathNavigation { - // Paper start - EntityPathfindEvent - boolean copiedSet = false; - for (BlockPos possibleTarget : positions) { -- if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(), -+ if (!this.mob.getCommandSenderWorld().getWorldBorder().isWithinBounds(possibleTarget) || !new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(), // Paper - don't path out of world border - io.papermc.paper.util.MCUtil.toLocation(this.mob.level(), possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) { - if (!copiedSet) { - copiedSet = true; diff --git a/patches/unapplied/server/0115-Optimize-Level.hasChunkAt-BlockPosition-Z.patch b/patches/unapplied/server/0115-Optimize-Level.hasChunkAt-BlockPosition-Z.patch deleted file mode 100644 index ee46f05dc0..0000000000 --- a/patches/unapplied/server/0115-Optimize-Level.hasChunkAt-BlockPosition-Z.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Fri, 2 Dec 2016 00:11:43 -0500 -Subject: [PATCH] Optimize Level.hasChunkAt(BlockPosition)Z - -Reduce method invocations for World.isLoaded(BlockPosition)Z - -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 008be3aad044d20be14da3a9e96933d265104587..03b0720c6ebf1a876d56d18a941e0a06ed26dbf0 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -342,6 +342,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - return chunk == null ? null : chunk.getFluidState(blockposition); - } - -+ @Override -+ public final boolean hasChunkAt(BlockPos pos) { -+ return getChunkIfLoaded(pos.getX() >> 4, pos.getZ() >> 4) != null; // Paper - Perf: Optimize Level.hasChunkAt(BlockPosition)Z -+ } -+ - public final boolean isLoadedAndInBounds(BlockPos blockposition) { // Paper - final for inline - return getWorldBorder().isWithinBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; - } diff --git a/patches/unapplied/server/0116-Bound-Treasure-Maps-to-World-Border.patch b/patches/unapplied/server/0116-Bound-Treasure-Maps-to-World-Border.patch deleted file mode 100644 index b4596cd20b..0000000000 --- a/patches/unapplied/server/0116-Bound-Treasure-Maps-to-World-Border.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Tue, 20 Dec 2016 15:15:11 -0500 -Subject: [PATCH] Bound Treasure Maps to World Border - -Make it so a Treasure Map does not target a structure outside of the -World Border, where players are not even able to reach. - -This also would help the case where a players close to the border, and one -that is outside happens to be closer, but unreachable, yet another reachable -one is in border that would of been missed. - -diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -index a3ba3a09378e3bd0517464130ad2c702b0b0165d..3442e33a1146318228c4727a2a5afde685f69bf7 100644 ---- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java -+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -@@ -46,6 +46,18 @@ public class WorldBorder { - return this.isWithinBounds((double) chunkPos.getMinBlockX(), (double) chunkPos.getMinBlockZ()) && this.isWithinBounds((double) chunkPos.getMaxBlockX(), (double) chunkPos.getMaxBlockZ()); - } - -+ // Paper start - Bound treasure maps to world border -+ private final BlockPos.MutableBlockPos mutPos = new BlockPos.MutableBlockPos(); -+ public boolean isBlockInBounds(int chunkX, int chunkZ) { -+ this.mutPos.set(chunkX, 64, chunkZ); -+ return this.isWithinBounds(this.mutPos); -+ } -+ public boolean isChunkInBounds(int chunkX, int chunkZ) { -+ this.mutPos.set(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15); -+ return this.isWithinBounds(this.mutPos); -+ } -+ // Paper end - Bound treasure maps to world border -+ - public boolean isWithinBounds(AABB box) { - return this.isWithinBounds(box.minX, box.minZ, box.maxX - 9.999999747378752E-6D, box.maxZ - 9.999999747378752E-6D); - } -diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index a53fa9bebdd46939a710e46466ca9a350ecefb27..0a779632c9d11496fcfc147870fba2699d9cc274 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -222,6 +222,7 @@ public abstract class ChunkGenerator { - - while (iterator.hasNext()) { - ChunkPos chunkcoordintpair = (ChunkPos) iterator.next(); -+ if (!world.paperConfig().environment.locateStructuresOutsideWorldBorder && !world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper - Bound treasure maps to world border - - blockposition_mutableblockposition.set(SectionPos.sectionToBlockCoord(chunkcoordintpair.x, 8), 32, SectionPos.sectionToBlockCoord(chunkcoordintpair.z, 8)); - double d1 = blockposition_mutableblockposition.distSqr(center); diff --git a/patches/unapplied/server/0117-Configurable-Cartographer-Treasure-Maps.patch b/patches/unapplied/server/0117-Configurable-Cartographer-Treasure-Maps.patch deleted file mode 100644 index a93dd268ae..0000000000 --- a/patches/unapplied/server/0117-Configurable-Cartographer-Treasure-Maps.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Tue, 20 Dec 2016 15:26:27 -0500 -Subject: [PATCH] Configurable Cartographer Treasure Maps - -Allow configuring for cartographers to return the same map location - -Also allow turning off treasure maps all together as they can eat up Map ID's -which are limited in quantity. - -diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -index 9358498491cd25ef760527ebd83188b76f8458f1..73a222d91dab1d5d1390b018f9537624aaff0798 100644 ---- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -+++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -@@ -1828,7 +1828,8 @@ public class VillagerTrades { - return null; - } else { - ServerLevel serverLevel = (ServerLevel)entity.level(); -- BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, true); -+ if (!serverLevel.paperConfig().environment.treasureMaps.enabled) return null; // Paper - Configurable cartographer treasure maps -+ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredVillager); // Paper - Configurable cartographer treasure maps - if (blockPos != null) { - ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true); - MapItem.renderBiomePreviewMap(serverLevel, itemStack); -diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -index e7f2cc799e7c50a9525845347a3f235f7bfefe41..709bc6838d20c420c5a4b3a994a041e594bd6210 100644 ---- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -+++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -@@ -84,8 +84,17 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { - Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN); - if (vec3 != null) { - ServerLevel serverLevel = context.getLevel(); -+ // Paper start - Configurable cartographer treasure maps -+ if (!serverLevel.paperConfig().environment.treasureMaps.enabled) { -+ /* -+ * NOTE: I fear users will just get a plain map as their "treasure" -+ * This is preferable to disrespecting the config. -+ */ -+ return stack; -+ } -+ // Paper end - Configurable cartographer treasure maps - BlockPos blockPos = serverLevel.findNearestMapStructure( -- this.destination, BlockPos.containing(vec3), this.searchRadius, this.skipKnownStructures -+ this.destination, BlockPos.containing(vec3), this.searchRadius, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures) // Paper - Configurable cartographer treasure maps - ); - if (blockPos != null) { - ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), this.zoom, true, true); diff --git a/patches/unapplied/server/0118-Add-API-methods-to-control-if-armor-stands-can-move.patch b/patches/unapplied/server/0118-Add-API-methods-to-control-if-armor-stands-can-move.patch deleted file mode 100644 index ace73cb969..0000000000 --- a/patches/unapplied/server/0118-Add-API-methods-to-control-if-armor-stands-can-move.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kashike <[email protected]> -Date: Wed, 21 Dec 2016 11:47:25 -0600 -Subject: [PATCH] Add API methods to control if armor stands can move - - -diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index af954b2c0c7106a231fb15172da3fa8e1d281d56..dae6835696e90bc5a541cacd37ea7aa88c60f4f4 100644 ---- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -95,6 +95,7 @@ public class ArmorStand extends LivingEntity { - public Rotations rightArmPose; - public Rotations leftLegPose; - public Rotations rightLegPose; -+ public boolean canMove = true; // Paper - - public ArmorStand(EntityType<? extends ArmorStand> type, Level world) { - super(type, world); -@@ -949,4 +950,13 @@ public class ArmorStand extends LivingEntity { - public boolean canBeSeenByAnyone() { - return !this.isInvisible() && !this.isMarker(); - } -+ -+ // Paper start -+ @Override -+ public void move(net.minecraft.world.entity.MoverType type, Vec3 movement) { -+ if (this.canMove) { -+ super.move(type, movement); -+ } -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -index 04a7735d278c9e610a33294e65a17796e120fe7e..52ffc401bbb9fa768534a4b871f9cc7dbebb8b20 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -@@ -222,4 +222,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { - public boolean hasEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) { - return (this.getHandle().disabledSlots & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getFilterFlag() + lockType.ordinal() * 8)) != 0; - } -+ // Paper start -+ @Override -+ public boolean canMove() { -+ return getHandle().canMove; -+ } -+ -+ @Override -+ public void setCanMove(boolean move) { -+ getHandle().canMove = move; -+ } -+ // Paper end - } diff --git a/patches/unapplied/server/0119-String-based-Action-Bar-API.patch b/patches/unapplied/server/0119-String-based-Action-Bar-API.patch deleted file mode 100644 index 31024a0f8e..0000000000 --- a/patches/unapplied/server/0119-String-based-Action-Bar-API.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Tue, 27 Dec 2016 15:02:42 -0500 -Subject: [PATCH] String based Action Bar API - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index cdcb2fb6229277872db36b6a4c439080f083f64c..258808bcb6f853c5679476305074823a7bb8b379 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -390,6 +390,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } - - // Paper start -+ @Override -+ @Deprecated -+ public void sendActionBar(BaseComponent[] message) { -+ if (getHandle().connection == null) return; -+ net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket packet = new net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket(org.bukkit.craftbukkit.util.CraftChatMessage.fromJSON(net.md_5.bungee.chat.ComponentSerializer.toString(message))); -+ getHandle().connection.send(packet); -+ } -+ -+ @Override -+ @Deprecated -+ public void sendActionBar(String message) { -+ if (getHandle().connection == null || message == null || message.isEmpty()) return; -+ getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket(CraftChatMessage.fromStringOrNull(message))); -+ } -+ -+ @Override -+ @Deprecated -+ public void sendActionBar(char alternateChar, String message) { -+ if (message == null || message.isEmpty()) return; -+ sendActionBar(org.bukkit.ChatColor.translateAlternateColorCodes(alternateChar, message)); -+ } -+ - @Override - public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) { - if (header != null) { diff --git a/patches/unapplied/server/0120-Properly-fix-item-duplication-bug.patch b/patches/unapplied/server/0120-Properly-fix-item-duplication-bug.patch deleted file mode 100644 index 9fb45d2886..0000000000 --- a/patches/unapplied/server/0120-Properly-fix-item-duplication-bug.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alfie Cleveland <[email protected]> -Date: Tue, 27 Dec 2016 01:57:57 +0000 -Subject: [PATCH] Properly fix item duplication bug - -Credit to prplz for figuring out the real issue - -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 984dc7f7f7315b8a8cdb9744ef8454a330888ba7..f067b10e13f01e751fc4ebf088740c7d40afcb99 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -2627,7 +2627,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { - - @Override - public boolean isImmobile() { -- return super.isImmobile() || !this.getBukkitEntity().isOnline(); -+ return super.isImmobile() || (this.connection != null && this.connection.isDisconnected()); // Paper - Fix duplication bugs - } - - @Override -diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 9bfdcdf427f7c0689d346d17942b5902a9138a4e..5f3b3f03936cfe23ed792c57d342a9932ea2e962 100644 ---- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -184,7 +184,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - } - - public final boolean isDisconnected() { -- return !this.player.joining && !this.connection.isConnected(); -+ return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper - Fix duplication bugs - } - // CraftBukkit end - diff --git a/patches/unapplied/server/0121-Firework-API-s.patch b/patches/unapplied/server/0121-Firework-API-s.patch deleted file mode 100644 index c86538a2cf..0000000000 --- a/patches/unapplied/server/0121-Firework-API-s.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Wed, 28 Dec 2016 07:18:33 +0100 -Subject: [PATCH] Firework API's - -== AT == -public net.minecraft.world.entity.projectile.FireworkRocketEntity attachedToEntity - -diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index cc99d67bc52c89b50171b6c808c6e3bf293999f5..09d465947a5720e05c350d455c86002682104079 100644 ---- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -@@ -44,6 +44,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { - public int lifetime; - @Nullable - public LivingEntity attachedToEntity; -+ @Nullable public java.util.UUID spawningEntity; // Paper - - public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> type, Level world) { - super(type, world); -@@ -301,6 +302,11 @@ 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) { -+ nbt.putUUID("SpawningEntity", this.spawningEntity); -+ } -+ // Paper end - } - - @Override -@@ -317,7 +323,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { - if (nbt.contains("ShotAtAngle")) { - this.entityData.set(FireworkRocketEntity.DATA_SHOT_AT_ANGLE, nbt.getBoolean("ShotAtAngle")); - } -- -+ // Paper start -+ if (nbt.hasUUID("SpawningEntity")) { -+ this.spawningEntity = nbt.getUUID("SpawningEntity"); -+ } -+ // Paper end - } - - private List<FireworkExplosion> getExplosions() { -diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java -index 99a39f05e7aeefa2ea4372159b4837d80963eabf..f64cdfac1fc1333845ea4ea5efb7922f0ae39619 100644 ---- a/src/main/java/net/minecraft/world/item/CrossbowItem.java -+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java -@@ -160,7 +160,11 @@ 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 da89ccaf91e2baa7caa15681c113bc283f40cd21..38b33eb92d21d0099285a304c6e064bbf56db4eb 100644 ---- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -42,6 +42,7 @@ public class FireworkRocketItem extends Item implements ProjectileItem { - vec3.z + (double)direction.getStepZ() * 0.15, - itemStack - ); -+ fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper - level.addFreshEntity(fireworkRocketEntity); - itemStack.shrink(1); - } -@@ -55,6 +56,7 @@ 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); - 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 5ae87c370e47c545cef27a36e40da137e1ec656b..c9e15a9d82dee935293b2e7e233f5b9b2d822448 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java -@@ -129,4 +129,11 @@ public class CraftFirework extends CraftProjectile implements Firework { - public void setShotAtAngle(boolean shotAtAngle) { - this.getHandle().getEntityData().set(FireworkRocketEntity.DATA_SHOT_AT_ANGLE, shotAtAngle); - } -+ -+ // Paper start -+ @Override -+ public java.util.UUID getSpawningEntity() { -+ return getHandle().spawningEntity; -+ } -+ // Paper end - } |