diff --git a/patches/server/0001-Fix-Decompilation-errors.patch b/patches/server/0001-Fix-Decompilation-errors.patch index 6334e55b..fe1f1e89 100644 --- a/patches/server/0001-Fix-Decompilation-errors.patch +++ b/patches/server/0001-Fix-Decompilation-errors.patch @@ -1,11 +1,26 @@ -From 97eb4c50bb22267d87f9e136ce1e6e85f1c27032 Mon Sep 17 00:00:00 2001 +From 01800bd76642402904fc77ba7522ddc87166f206 Mon Sep 17 00:00:00 2001 From: cswhite2000 <18whitechristop@gmail.com> Date: Mon, 6 Aug 2018 16:39:57 -0700 Subject: [PATCH] Fix Decompilation errors +diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java +index 81c45a95..c27709e1 100644 +--- a/src/main/java/net/minecraft/server/IEntitySelector.java ++++ b/src/main/java/net/minecraft/server/IEntitySelector.java +@@ -61,8 +61,8 @@ public final class IEntitySelector { + } + } + +- public boolean apply(Object object) { +- return this.a((Entity) object); ++ public boolean apply(Entity entity) { ++ return this.a(entity); + } + } + } diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -index f55bedaff..a8fc3361a 100644 +index f55bedaf..a8fc3361 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java @@ -46,10 +46,6 @@ public class PacketPlayInUseEntity implements Packet { @@ -20,7 +35,7 @@ index f55bedaff..a8fc3361a 100644 INTERACT, ATTACK, INTERACT_AT; diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -index c5be70f8b..62492650a 100644 +index c5be70f8..62492650 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java @@ -33,8 +33,4 @@ public class PacketPlayOutEntityMetadata implements Packet { @@ -48,7 +63,7 @@ index ab4520ba2..fc5ad2911 100644 static final int[] a = new int[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.values().length]; diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -index 90606f50b..4b8eb3eed 100644 +index 90606f50..4b8eb3ee 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java @@ -109,8 +109,4 @@ public class PacketPlayOutScoreboardTeam implements Packet Date: Mon, 26 Oct 2020 21:02:04 -0500 Subject: [PATCH] Fire block place sounds inside event logic chain +Co-authored-by: David Rodriguez <15853933+limbo56@users.noreply.github.com> diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java index 0cd41754..c6b313a7 100644 @@ -19,22 +20,23 @@ index 0cd41754..c6b313a7 100644 } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 55be2b71..c54050bf 100644 +index 55be2b71..92657b61 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -219,6 +219,12 @@ public final class ItemStack { +@@ -219,6 +219,13 @@ public final class ItemStack { } } + // SPIGOT-1288 - play sound stripped from ItemBlock + if (this.getItem() instanceof ItemBlock) { + Block base = ((ItemBlock) this.getItem()).a; -+ world.makeSound((double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), base.stepSound.getPlaceSound(), (base.stepSound.getVolume1() + 1.0F) / 2.0F, base.stepSound.getVolume2() * 0.8F); ++ BlockPosition bp = blockposition.shift(enumdirection); ++ world.makeSound((double) ((float) bp.getX() + 0.5F), (double) ((float) bp.getY() + 0.5F), (double) ((float) bp.getZ() + 0.5F), base.stepSound.getPlaceSound(), (base.stepSound.getVolume1() + 1.0F) / 2.0F, base.stepSound.getVolume2() * 0.8F); + } + entityhuman.b(StatisticList.USE_ITEM_COUNT[Item.getId(this.item)]); } } -- -2.23.0 +2.50.0 diff --git a/patches/server/0212-Update-to-Netty-4.1.x.patch b/patches/server/0212-Update-to-Netty-4.1.118.patch similarity index 92% rename from patches/server/0212-Update-to-Netty-4.1.x.patch rename to patches/server/0212-Update-to-Netty-4.1.118.patch index 4a9ade95..61b0632b 100644 --- a/patches/server/0212-Update-to-Netty-4.1.x.patch +++ b/patches/server/0212-Update-to-Netty-4.1.118.patch @@ -1,11 +1,11 @@ -From fba402aaeddb102e5c129501882793e896546082 Mon Sep 17 00:00:00 2001 +From 3f47e449dda883c211475e9924be1492d20ac99b Mon Sep 17 00:00:00 2001 From: hpfxd Date: Wed, 27 Oct 2021 06:29:44 -0400 -Subject: [PATCH] Update to Netty 4.1.x +Subject: [PATCH] Update to Netty 4.1.118 diff --git a/pom.xml b/pom.xml -index d8e35ef2..a52663c2 100644 +index d8e35ef2..2a02fbcb 100644 --- a/pom.xml +++ b/pom.xml @@ -27,6 +27,11 @@ @@ -15,11 +15,19 @@ index d8e35ef2..a52663c2 100644 + + io.netty + netty-all -+ 4.1.105.Final ++ 4.1.118.Final + it.unimi.dsi fastutil +@@ -228,6 +233,7 @@ + + org.spigotmc:minecraft-server:** + ++ io/netty/** + org/apache/logging/log4j/** + + diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java index e2eb3054..9a075fef 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java diff --git a/patches/server/0215-Resolve-build-issues-with-Java-17.patch b/patches/server/0215-Resolve-build-issues-with-Java-17.patch index 31dd7cf8..0621534a 100644 --- a/patches/server/0215-Resolve-build-issues-with-Java-17.patch +++ b/patches/server/0215-Resolve-build-issues-with-Java-17.patch @@ -1,4 +1,4 @@ -From 8385e00a18e6f82355cc012a6d90f9635761eed5 Mon Sep 17 00:00:00 2001 +From 91bff9166c187ff003d0d6037026a421df907c50 Mon Sep 17 00:00:00 2001 From: "BT (calcastor/mame)" <43831917+calcastor@users.noreply.github.com> Date: Mon, 6 Feb 2023 23:30:48 -0800 Subject: [PATCH] Resolve build issues with Java 17 @@ -6,7 +6,7 @@ Subject: [PATCH] Resolve build issues with Java 17 https://github.com/CobbleSword/NachoSpigot/commit/944e02c131b4f4f12a3140778fc9d681f773ae2c diff --git a/pom.xml b/pom.xml -index a52663c2..4aff3f3d 100644 +index 2a02fbcb..f38265d6 100644 --- a/pom.xml +++ b/pom.xml @@ -105,12 +105,7 @@ @@ -22,7 +22,7 @@ index a52663c2..4aff3f3d 100644 papermc -@@ -292,22 +287,7 @@ +@@ -293,22 +288,7 @@ org.apache.maven.plugins maven-compiler-plugin diff --git a/patches/server/0219-Add-Unix-domain-socket-support.patch b/patches/server/0219-Add-Unix-domain-socket-support.patch deleted file mode 100644 index feef9a80..00000000 --- a/patches/server/0219-Add-Unix-domain-socket-support.patch +++ /dev/null @@ -1,220 +0,0 @@ -From eed0a552fb9b2d79fbeb48328ae69c89b556a8fd Mon Sep 17 00:00:00 2001 -From: Andrew Steinborn -Date: Tue, 11 May 2021 17:39:22 -0400 -Subject: [PATCH] Add Unix domain socket support - -Backported from Paper upstream -https://github.com/PaperMC/Paper/pull/5611 - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 79a53cc4..a8fa7bbf 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -164,19 +164,39 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - - this.r = WorldSettings.a(i); - DedicatedServer.LOGGER.info("Default game type: " + this.r); -- InetAddress inetaddress = null; - -- if (this.getServerIp().length() > 0) { -- inetaddress = InetAddress.getByName(this.getServerIp()); -- } -- -- if (this.R() < 0) { -- this.setPort(this.propertyManager.getInt("server-port", 25565)); -- } -+ // SportPaper start - load config earlier to check IP forwarding setting - // Spigot start - this.a((PlayerList) (new DedicatedPlayerList(this))); - // Spigot end - SharedConfig.registerCommands(); -+ // SportPaper end -+ // Paper start - Unix domain socket support -+ java.net.SocketAddress bindAddress; -+ if (this.getServerIp().startsWith("unix:")) { -+ if (!io.netty.channel.epoll.Epoll.isAvailable()) { -+ DedicatedServer.LOGGER.error("**** INVALID CONFIGURATION!"); -+ DedicatedServer.LOGGER.error("You are trying to use a Unix domain socket but you're not on a supported OS."); -+ return false; -+ } else if (!org.spigotmc.SpigotConfig.bungee) { -+ DedicatedServer.LOGGER.error("**** INVALID CONFIGURATION!"); -+ DedicatedServer.LOGGER.error("Unix domain sockets require IPs to be forwarded from a proxy."); -+ return false; -+ } -+ bindAddress = new io.netty.channel.unix.DomainSocketAddress(this.getServerIp().substring("unix:".length())); -+ } else { -+ InetAddress inetaddress = null; -+ -+ if (this.getServerIp().length() > 0) { -+ inetaddress = InetAddress.getByName(this.getServerIp()); -+ } -+ -+ if (this.R() < 0) { -+ this.setPort(this.propertyManager.getInt("server-port", 25565)); -+ } -+ bindAddress = new java.net.InetSocketAddress(inetaddress, this.R()); -+ } -+ // Paper end - - DedicatedServer.LOGGER.info("Generating keypair"); - this.a(MinecraftEncryption.b()); -@@ -184,7 +204,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - - if (!org.spigotmc.SpigotConfig.lateBind) { - try { -- this.aq().a(inetaddress, this.R()); -+ this.aq().bind(bindAddress); // Paper - Unix domain socket support - } catch (IOException ioexception) { - DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); - DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()}); -@@ -280,7 +300,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - - if (org.spigotmc.SpigotConfig.lateBind) { - try { -- this.aq().a(inetaddress, this.R()); -+ this.aq().bind(bindAddress); // Paper - Unix domain socket support - } catch (IOException ioexception) { - DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); - DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()}); -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 5454f2b5..f4a3c2f5 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -29,34 +29,36 @@ public class HandshakeListener implements PacketHandshakingInListener { - - // CraftBukkit start - Connection throttle - try { -- long currentTime = System.currentTimeMillis(); -- long connectionThrottle = MinecraftServer.getServer().server.getConnectionThrottle(); -- InetAddress address = ((java.net.InetSocketAddress) this.b.getSocketAddress()).getAddress(); -+ if (!(this.b.channel.localAddress() instanceof io.netty.channel.unix.DomainSocketAddress)) { // Paper - the connection throttle is useless when you have a Unix domain socket -+ long currentTime = System.currentTimeMillis(); -+ long connectionThrottle = MinecraftServer.getServer().server.getConnectionThrottle(); -+ InetAddress address = ((java.net.InetSocketAddress) this.b.getSocketAddress()).getAddress(); -+ -+ synchronized (throttleTracker) { -+ if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) { -+ throttleTracker.put(address, currentTime); -+ chatcomponenttext = new ChatComponentText("Connection throttled! Please wait before reconnecting."); -+ this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); -+ this.b.close(chatcomponenttext); -+ return; -+ } - -- synchronized (throttleTracker) { -- if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) { - throttleTracker.put(address, currentTime); -- chatcomponenttext = new ChatComponentText("Connection throttled! Please wait before reconnecting."); -- this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); -- this.b.close(chatcomponenttext); -- return; -- } -- -- throttleTracker.put(address, currentTime); -- throttleCounter++; -- if (throttleCounter > 200) { -- throttleCounter = 0; -- -- // Cleanup stale entries -- java.util.Iterator iter = throttleTracker.entrySet().iterator(); -- while (iter.hasNext()) { -- java.util.Map.Entry entry = (java.util.Map.Entry) iter.next(); -- if (entry.getValue() > connectionThrottle) { -- iter.remove(); -+ throttleCounter++; -+ if (throttleCounter > 200) { -+ throttleCounter = 0; -+ -+ // Cleanup stale entries -+ java.util.Iterator iter = throttleTracker.entrySet().iterator(); -+ while (iter.hasNext()) { -+ java.util.Map.Entry entry = (java.util.Map.Entry) iter.next(); -+ if (entry.getValue() > connectionThrottle) { -+ iter.remove(); -+ } - } - } - } -- } -+ } // Paper - add closing bracket for if check above - } catch (Throwable t) { - org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t); - } -@@ -77,8 +79,11 @@ public class HandshakeListener implements PacketHandshakingInListener { - if (org.spigotmc.SpigotConfig.bungee) { - String[] split = packethandshakinginsetprotocol.hostname.split("\00"); - if ( split.length == 3 || split.length == 4 ) { -+ // Paper start - Unix domain socket support -+ java.net.SocketAddress socketAddress = b.getSocketAddress(); - packethandshakinginsetprotocol.hostname = split[0]; -- b.l = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort()); -+ b.l = new java.net.InetSocketAddress(split[1], socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0); -+ // Paper end - b.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] ); - } else - { -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 9e35715a..854d1196 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -340,6 +340,11 @@ public class NetworkManager extends SimpleChannelInboundHandler { - // Spigot Start - public SocketAddress getRawAddress() - { -+ // Paper start - this can be nullable in the case of a Unix domain socket, so if it is, fake something -+ if (this.channel.remoteAddress() == null) { -+ return new java.net.InetSocketAddress(java.net.InetAddress.getLoopbackAddress(), 0); -+ } -+ // Paper end - return this.channel.remoteAddress(); - } - // Spigot End -diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -index 052139d4..abdfedf6 100644 ---- a/src/main/java/net/minecraft/server/ServerConnection.java -+++ b/src/main/java/net/minecraft/server/ServerConnection.java -@@ -77,7 +77,13 @@ public class ServerConnection { - this.d = true; - } - -+ // Paper start - Unix domain socket support - public void a(InetAddress inetaddress, int i) throws IOException { -+ bind(new java.net.InetSocketAddress(inetaddress, i)); -+ } -+ -+ public void bind(java.net.SocketAddress address) throws IOException { -+ // Paper end - List list = this.g; - - synchronized (this.g) { -@@ -85,9 +91,15 @@ public class ServerConnection { - LazyInitVar lazyinitvar; - - if (Epoll.isAvailable() && this.f.ai()) { -- oclass = EpollServerSocketChannel.class; -- lazyinitvar = ServerConnection.b; -- ServerConnection.e.info("Using epoll channel type"); -+ // Paper start - Unix domain socket support -+ if (address instanceof io.netty.channel.unix.DomainSocketAddress) { -+ oclass = io.netty.channel.epoll.EpollServerDomainSocketChannel.class; -+ } else { -+ oclass = EpollServerSocketChannel.class; -+ } -+ // Paper end -+ lazyinitvar = ServerConnection.b; -+ ServerConnection.e.info("Using epoll channel type"); - } else { - oclass = NioServerSocketChannel.class; - lazyinitvar = ServerConnection.a; -@@ -110,7 +122,7 @@ public class ServerConnection { - channel.pipeline().addLast("packet_handler", networkmanager); - networkmanager.a((PacketListener) (new HandshakeListener(ServerConnection.this.f, networkmanager))); - } -- }).group((EventLoopGroup) lazyinitvar.c()).localAddress(inetaddress, i)).bind().syncUninterruptibly()); -+ }).group((EventLoopGroup) lazyinitvar.c()).localAddress(address)).bind().syncUninterruptibly()); // Paper - Unix domain socket support - } - } - --- -2.50.0 - diff --git a/patches/server/0220-Fix-east-west-cannoning.patch b/patches/server/0219-Fix-east-west-cannoning.patch similarity index 84% rename from patches/server/0220-Fix-east-west-cannoning.patch rename to patches/server/0219-Fix-east-west-cannoning.patch index 62628299..627faf7d 100644 --- a/patches/server/0220-Fix-east-west-cannoning.patch +++ b/patches/server/0219-Fix-east-west-cannoning.patch @@ -1,4 +1,4 @@ -From fa4c43d1f83aae486ed04bb33734bfba83541a64 Mon Sep 17 00:00:00 2001 +From 9a88115fc24f0b63898f0b617e00c541cee10152 Mon Sep 17 00:00:00 2001 From: AmbrosL Date: Sat, 10 Mar 2018 02:33:28 +0100 Subject: [PATCH] Fix east/west cannoning @@ -7,18 +7,10 @@ Ported to SportPaper from TacoSpigot and Titanium https://github.com/TacoSpigot/TacoSpigot/pull/89 diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0d95a296..2790207d 100644 +index 0d95a296..f9d7e660 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -38,6 +38,7 @@ import org.bukkit.plugin.PluginManager; - // CraftBukkit end - - // PaperSpigot start -+import org.github.paperspigot.PaperSpigotWorldConfig; - import org.spigotmc.event.entity.EntityDismountEvent; - // PaperSpigot end - -@@ -555,17 +556,34 @@ public abstract class Entity implements ICommandListener { +@@ -555,17 +555,34 @@ public abstract class Entity implements ICommandListener { AxisAlignedBB axisalignedbb2; Iterator iterator1; @@ -26,7 +18,7 @@ index 0d95a296..2790207d 100644 - axisalignedbb2 = (AxisAlignedBB) iterator1.next(); - } + // SportPaper start - fix east/west cannoning by calculating the z movement before x if the x velocity is greater -+ if (PaperSpigotWorldConfig.fixCannons && Math.abs(d0) > Math.abs(d2)) { ++ if (Math.abs(d0) > Math.abs(d2)) { + for (iterator1 = list.iterator(); iterator1.hasNext(); d2 = axisalignedbb2.c(this.getBoundingBox(), d2)) { + axisalignedbb2 = (AxisAlignedBB) iterator1.next(); + } diff --git a/patches/server/0221-Remove-hacky-stackable-buckets-code.patch b/patches/server/0220-Remove-hacky-stackable-buckets-code.patch similarity index 97% rename from patches/server/0221-Remove-hacky-stackable-buckets-code.patch rename to patches/server/0220-Remove-hacky-stackable-buckets-code.patch index b63b3105..2aee1931 100644 --- a/patches/server/0221-Remove-hacky-stackable-buckets-code.patch +++ b/patches/server/0220-Remove-hacky-stackable-buckets-code.patch @@ -1,4 +1,4 @@ -From b10c6741b5d697c3136b8f9f06ff2d0a39cbc33c Mon Sep 17 00:00:00 2001 +From d365bf1ede9458d12365ef857c6f1280c9f475dd Mon Sep 17 00:00:00 2001 From: hpfxd Date: Wed, 27 Oct 2021 20:46:41 -0400 Subject: [PATCH] Remove hacky stackable buckets code diff --git a/patches/server/0222-Make-dimension-field-non-final.patch b/patches/server/0221-Make-dimension-field-non-final.patch similarity index 93% rename from patches/server/0222-Make-dimension-field-non-final.patch rename to patches/server/0221-Make-dimension-field-non-final.patch index af30c51b..49efa726 100644 --- a/patches/server/0222-Make-dimension-field-non-final.patch +++ b/patches/server/0221-Make-dimension-field-non-final.patch @@ -1,4 +1,4 @@ -From 6c66a4688988518aa4cb3970dbbf9366fa4fd949 Mon Sep 17 00:00:00 2001 +From 1e090794b1688f04ec20c47f4cd1a3f3d2092585 Mon Sep 17 00:00:00 2001 From: "BT (calcastor/mame)" <43831917+calcastor@users.noreply.github.com> Date: Sun, 31 Dec 2023 22:03:05 -0800 Subject: [PATCH] Make dimension field non-final diff --git a/patches/server/0223-Update-several-build-plugins.patch b/patches/server/0222-Update-several-build-plugins.patch similarity index 94% rename from patches/server/0223-Update-several-build-plugins.patch rename to patches/server/0222-Update-several-build-plugins.patch index 540492a6..95d45351 100644 --- a/patches/server/0223-Update-several-build-plugins.patch +++ b/patches/server/0222-Update-several-build-plugins.patch @@ -1,11 +1,11 @@ -From f19aadcf0744ceeb7df3f7743e27c109123f04f2 Mon Sep 17 00:00:00 2001 +From ea31acbbae4a5e75d6db743078d16ded234d14d1 Mon Sep 17 00:00:00 2001 From: "BT (calcastor/mame)" <43831917+calcastor@users.noreply.github.com> Date: Tue, 22 Aug 2023 10:11:12 -0700 Subject: [PATCH] Update several build plugins diff --git a/pom.xml b/pom.xml -index 4aff3f3d..4f756286 100644 +index f38265d6..c31fc87a 100644 --- a/pom.xml +++ b/pom.xml @@ -120,7 +120,7 @@ @@ -35,7 +35,7 @@ index 4aff3f3d..4f756286 100644 package -@@ -287,12 +287,12 @@ +@@ -288,12 +288,12 @@ org.apache.maven.plugins maven-compiler-plugin diff --git a/patches/server/0224-Readd-NPE-prevention-for-BlockDispenseEntityEvent.patch b/patches/server/0223-Readd-NPE-prevention-for-BlockDispenseEntityEvent.patch similarity index 95% rename from patches/server/0224-Readd-NPE-prevention-for-BlockDispenseEntityEvent.patch rename to patches/server/0223-Readd-NPE-prevention-for-BlockDispenseEntityEvent.patch index 5d3609e1..60f630c0 100644 --- a/patches/server/0224-Readd-NPE-prevention-for-BlockDispenseEntityEvent.patch +++ b/patches/server/0223-Readd-NPE-prevention-for-BlockDispenseEntityEvent.patch @@ -1,4 +1,4 @@ -From 504fc94bf00275e51b03aa0c5ede95fb5edc8291 Mon Sep 17 00:00:00 2001 +From e7fb21b1d7f2eb9e6903b08207fb5f8fc0b84273 Mon Sep 17 00:00:00 2001 From: Christopher White <18whitechristop@gmail.com> Date: Sat, 20 Jul 2024 11:28:20 -0700 Subject: [PATCH] Readd NPE prevention for BlockDispenseEntityEvent diff --git a/patches/server/0224-Fix-issues-with-non-interacting-players.patch b/patches/server/0224-Fix-issues-with-non-interacting-players.patch new file mode 100644 index 00000000..8e214609 --- /dev/null +++ b/patches/server/0224-Fix-issues-with-non-interacting-players.patch @@ -0,0 +1,34 @@ +From 4220397023003a1781420e88ff18422c6d40935f Mon Sep 17 00:00:00 2001 +From: Pugzy +Date: Fri, 29 Sep 2023 17:35:55 +0100 +Subject: [PATCH] Fix issues with non-interacting players + + +diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java +index c27709e1..fb5bb04b 100644 +--- a/src/main/java/net/minecraft/server/IEntitySelector.java ++++ b/src/main/java/net/minecraft/server/IEntitySelector.java +@@ -50,7 +50,7 @@ public final class IEntitySelector { + } + + public boolean a(Entity entity) { +- if (!entity.isAlive()) { ++ if (!entity.ad()) { // SportPaper - exempt non-interacting players + return false; + } else if (!(entity instanceof EntityLiving)) { + return false; +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 3e5332f9..394b35b1 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -1289,6 +1289,7 @@ public abstract class World implements IBlockAccess { + + for (int j2 = 0; j2 < list.size(); ++j2) { + if (entity.passenger != list && entity.vehicle != list) { ++ if (!((Entity) list.get(j2)).ad()) continue; // SportPaper - Fix boat placing collision + AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).S(); + + if (axisalignedbb1 != null && axisalignedbb1.b(axisalignedbb)) { +-- +2.50.0 + diff --git a/patches/server/0225-Fix-NPE-in-unloadAllChunks.patch b/patches/server/0225-Fix-NPE-in-unloadAllChunks.patch new file mode 100644 index 00000000..03747a69 --- /dev/null +++ b/patches/server/0225-Fix-NPE-in-unloadAllChunks.patch @@ -0,0 +1,24 @@ +From dad1b8a89a409c0c2791ef0d5c48ff90ff2c7562 Mon Sep 17 00:00:00 2001 +From: Christopher White <18whitechristop@gmail.com> +Date: Sun, 1 Oct 2023 13:24:05 -0700 +Subject: [PATCH] Fix NPE in unloadAllChunks + + +diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +index 812686d5..8cdc6568 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -393,9 +393,7 @@ public class ChunkProviderServer implements IChunkProvider { + + // SportPaper start + public void unloadAllChunks() { +- for(Chunk chunk : chunks.values()) { +- unloadChunk(chunk); +- } ++ chunks.forEach((ignore, chunk) -> unloadChunk(chunk)); + } + + public void unloadChunk(Chunk chunk) { +-- +2.50.0 + diff --git a/patches/server/0226-Optimize-CraftPlayer.playEffect.patch b/patches/server/0226-Optimize-CraftPlayer.playEffect.patch new file mode 100644 index 00000000..97e3b06b --- /dev/null +++ b/patches/server/0226-Optimize-CraftPlayer.playEffect.patch @@ -0,0 +1,80 @@ +From 12e12863e96968b8b2ebccc6df43072232a89a19 Mon Sep 17 00:00:00 2001 +From: Christopher White <18whitechristop@gmail.com> +Date: Fri, 8 Dec 2023 17:37:15 -0800 +Subject: [PATCH] Optimize CraftPlayer.playEffect + +Signed-off-by: Christopher White <18whitechristop@gmail.com> + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index ff4236cc..91007509 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -14,6 +14,8 @@ import java.net.SocketAddress; + import java.util.ArrayList; + import java.util.Arrays; + import java.util.Collection; ++import java.util.EnumMap; ++import java.util.HashMap; + import java.util.HashSet; + import java.util.LinkedHashMap; + import java.util.List; +@@ -1838,6 +1840,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + return getHandle().protocolVersion; + } + ++ private static final Map effectParticleMap = buildEffectMap(); ++ ++ static Map buildEffectMap() { ++ Map effectEnumParticleMap = new EnumMap<>(Effect.class); ++ for (Effect effect : Effect.values()) { ++ if (Effect.Type.PARTICLE.equals(effect.getType())) { ++ for (net.minecraft.server.EnumParticle particle : net.minecraft.server.EnumParticle.values()) { ++ if (effect.getName().startsWith(particle.b().replace("_", ""))) { ++ effectEnumParticleMap.put(effect, particle); ++ break; ++ } ++ } ++ } ++ } ++ return effectEnumParticleMap; ++ } ++ + // Spigot start + private final Player.Spigot spigot = new Player.Spigot() + { +@@ -1883,24 +1902,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + packet = new PacketPlayOutWorldEvent( packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ() ), id, false ); + } else + { +- net.minecraft.server.EnumParticle particle = null; + int[] extra = null; +- for ( net.minecraft.server.EnumParticle p : net.minecraft.server.EnumParticle.values() ) ++ ++ net.minecraft.server.EnumParticle particle = effectParticleMap.get(effect); ++ if ( effect.getData() != null ) + { +- if ( effect.getName().startsWith( p.b().replace("_", "") ) ) ++ if ( effect.getData().equals( org.bukkit.Material.class ) ) + { +- particle = p; +- if ( effect.getData() != null ) +- { +- if ( effect.getData().equals( org.bukkit.Material.class ) ) +- { +- extra = new int[]{ id }; +- } else +- { +- extra = new int[]{ (data << 12) | (id & 0xFFF) }; +- } +- } +- break; ++ extra = new int[]{ id }; ++ } else ++ { ++ extra = new int[]{ (data << 12) | (id & 0xFFF) }; + } + } + if ( extra == null ) +-- +2.50.0 + diff --git a/patches/server/0227-Increase-chat-message-length-to-256.patch b/patches/server/0227-Increase-chat-message-length-to-256.patch new file mode 100644 index 00000000..410a5d3c --- /dev/null +++ b/patches/server/0227-Increase-chat-message-length-to-256.patch @@ -0,0 +1,36 @@ +From 0e7e8502f432eb838aa4cb3994fba19e97498dd4 Mon Sep 17 00:00:00 2001 +From: "BT (calcastor/mame)" <43831917+calcastor@users.noreply.github.com> +Date: Fri, 5 Jul 2024 21:12:10 -0700 +Subject: [PATCH] Increase chat message length to 256 + +This lets modded 1.8 clients send longer messages. ViaChatFixer will +still be needed for modern Minecraft versions since ViaVersion trims +messages on its end. + +diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java +index 18358b43..d82dc0a8 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInChat.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java +@@ -9,15 +9,15 @@ public class PacketPlayInChat implements Packet { + public PacketPlayInChat() {} + + public PacketPlayInChat(String s) { +- if (s.length() > 100) { +- s = s.substring(0, 100); +- } ++ if (s.length() > 256) { ++ s = s.substring(0, 256); ++ } // SportPaper - change from 100 to 256 + + this.a = s; + } + + public void a(PacketDataSerializer packetdataserializer) throws IOException { +- this.a = packetdataserializer.c(100); ++ this.a = packetdataserializer.c(256); // SportPaper - change from 100 to 256 + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { +-- +2.50.0 + diff --git a/patches/server/0228-Add-Tuinity-flush-patches.patch b/patches/server/0228-Add-Tuinity-flush-patches.patch new file mode 100644 index 00000000..1e2c33a3 --- /dev/null +++ b/patches/server/0228-Add-Tuinity-flush-patches.patch @@ -0,0 +1,180 @@ +From be0d6abfef5906949e07f2bedaf3ceacac8a6fca Mon Sep 17 00:00:00 2001 +From: Christopher White <18whitechristop@gmail.com> +Date: Fri, 22 Sep 2023 15:58:16 -0700 +Subject: [PATCH] Add Tuinity flush patches + +These changes largely come from Spottedleaf's "Allow controlled flushing +for network manager" and "Consolidate flush calls for entity tracker +packets" patches + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 87bb6542..53bcd950 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -964,7 +964,26 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + this.methodProfiler.b(); + this.methodProfiler.a("tracker"); + worldserver.timings.tracker.startTiming(); // Spigot +- worldserver.getTracker().updatePlayers(); ++ if(this.getPlayerList().getPlayerCount() != 0) // Tuinity ++ { ++ // Tuinity start - controlled flush for entity tracker packets ++ List disabledFlushes = new java.util.ArrayList<>(this.getPlayerList().getPlayerCount()); ++ for (EntityPlayer player : this.getPlayerList().players) { ++ PlayerConnection connection = player.playerConnection; ++ if (connection != null) { ++ connection.networkManager.disableAutomaticFlush(); ++ disabledFlushes.add(connection.networkManager); ++ } ++ } ++ try { ++ worldserver.getTracker().updatePlayers(); ++ } finally { ++ for (NetworkManager networkManager : disabledFlushes) { ++ networkManager.enableAutomaticFlush(); ++ } ++ } ++ // Tuinity end - controlled flush for entity tracker packets ++ } + worldserver.timings.tracker.stopTiming(); // Spigot + this.methodProfiler.b(); + this.methodProfiler.b(); +diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +index 9e35715a..1f14d087 100644 +--- a/src/main/java/net/minecraft/server/NetworkManager.java ++++ b/src/main/java/net/minecraft/server/NetworkManager.java +@@ -17,6 +17,7 @@ import io.netty.util.AttributeKey; + import io.netty.util.concurrent.Future; + import io.netty.util.concurrent.GenericFutureListener; + import java.net.SocketAddress; ++import java.util.Iterator; + import java.util.Queue; + import java.util.concurrent.locks.ReentrantReadWriteLock; + import javax.crypto.SecretKey; +@@ -76,6 +77,41 @@ public class NetworkManager extends SimpleChannelInboundHandler { + private boolean p; + public int protocolVersion; // Paper + ++ // Tuinity start - allow controlled flushing ++ volatile boolean canFlush = true; ++ private final java.util.concurrent.atomic.AtomicInteger packetWrites = new java.util.concurrent.atomic.AtomicInteger(); ++ private int flushPacketsStart; ++ private final Object flushLock = new Object(); ++ ++ void disableAutomaticFlush() { ++ synchronized (this.flushLock) { ++ this.flushPacketsStart = this.packetWrites.get(); // must be volatile and before canFlush = false ++ this.canFlush = false; ++ } ++ } ++ ++ void enableAutomaticFlush() { ++ synchronized (this.flushLock) ++ { ++ this.canFlush = true; ++ if (this.packetWrites.get() != this.flushPacketsStart) { // must be after canFlush = true ++ this.flush(); // only make the flush call if we need to ++ } ++ } ++ } ++ ++ private final void flush() ++ { ++ if (this.channel.eventLoop().inEventLoop()) { ++ this.channel.flush(); ++ } else { ++ this.channel.eventLoop().execute(() -> { ++ this.channel.flush(); ++ }); ++ } ++ } ++ // Tuinity end - allow controlled flushing ++ + public NetworkManager(EnumProtocolDirection enumprotocoldirection) { + this.h = enumprotocoldirection; + } +@@ -139,7 +175,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { + public void handle(Packet packet) { + if (this.g()) { + this.m(); +- this.a(packet, (GenericFutureListener[]) null); ++ this.a(packet, (GenericFutureListener[]) null, Boolean.TRUE); + } else { + this.j.writeLock().lock(); + +@@ -155,7 +191,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { + public void a(Packet packet, GenericFutureListener> genericfuturelistener, GenericFutureListener>... agenericfuturelistener) { + if (this.g()) { + this.m(); +- this.a(packet, (GenericFutureListener[]) ArrayUtils.add(agenericfuturelistener, 0, genericfuturelistener)); ++ this.a(packet, (GenericFutureListener[]) ArrayUtils.add(agenericfuturelistener, 0, genericfuturelistener), Boolean.TRUE); + } else { + this.j.writeLock().lock(); + +@@ -168,10 +204,14 @@ public class NetworkManager extends SimpleChannelInboundHandler { + + } + +- private void a(final Packet packet, final GenericFutureListener>[] agenericfuturelistener) { ++ // dispatchPacket ++ private void a(final Packet packet, final GenericFutureListener>[] agenericfuturelistener, Boolean flushConditional) { + final EnumProtocol enumprotocol = EnumProtocol.a(packet); + final EnumProtocol enumprotocol1 = (EnumProtocol) this.channel.attr(NetworkManager.c).get(); + ++ boolean effectiveFlush = (flushConditional == null) ? this.canFlush : flushConditional.booleanValue(); ++ boolean flush = (effectiveFlush || packet instanceof PacketPlayOutKeepAlive || packet instanceof PacketPlayOutKickDisconnect); ++ + if (enumprotocol1 != enumprotocol) { + NetworkManager.g.debug("Disabled auto read"); + this.channel.config().setAutoRead(false); +@@ -182,7 +222,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { + this.a(enumprotocol); + } + +- ChannelFuture channelfuture = this.channel.writeAndFlush(packet); ++ ChannelFuture channelfuture = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet); + + if (agenericfuturelistener != null) { + channelfuture.addListeners(agenericfuturelistener); +@@ -196,7 +236,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { + NetworkManager.this.a(enumprotocol); + } + +- ChannelFuture channelfuture = NetworkManager.this.channel.writeAndFlush(packet); ++ ChannelFuture channelfuture = flush ? NetworkManager.this.channel.writeAndFlush(packet) : NetworkManager.this.channel.write(packet); + + if (agenericfuturelistener != null) { + channelfuture.addListeners(agenericfuturelistener); +@@ -209,15 +249,25 @@ public class NetworkManager extends SimpleChannelInboundHandler { + + } + ++ // sendPacketQueue() + private void m() { ++ if(this.i.isEmpty()) return; + if (this.channel != null && this.channel.isOpen()) { + this.j.readLock().lock(); ++ boolean needsFlush = this.canFlush; ++ boolean hasWrotePacket = false; + + try { +- while (!this.i.isEmpty()) { +- NetworkManager.QueuedPacket networkmanager_queuedpacket = (NetworkManager.QueuedPacket) this.i.poll(); +- +- this.a(networkmanager_queuedpacket.a, networkmanager_queuedpacket.b); ++ Iterator iterator = this.i.iterator(); ++ while (iterator.hasNext()) { ++ QueuedPacket queued = iterator.next(); ++ Packet packet = queued.a; ++ if (hasWrotePacket && (needsFlush || this.canFlush)) { ++ flush(); ++ } ++ iterator.remove(); ++ this.a(packet, queued.b, (!iterator.hasNext() && (needsFlush || this.canFlush)) ? Boolean.TRUE : Boolean.FALSE); ++ hasWrotePacket = true; + } + } finally { + this.j.readLock().unlock(); +-- +2.50.0 + diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 84721390..5a58a076 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -62,6 +62,7 @@ import MerchantRecipeList import DamageSource import ServerNBTManager import IChunkLoader +import IEntitySelector cd "$basedir/base/Paper/PaperSpigot-Server/" rm -rf nms-patches applyPatches.sh makePatches.sh >/dev/null 2>&1