Skip to content

Commit

Permalink
[ci skip] Add more identifying patch comments, merge related patches
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytv committed Jan 19, 2024
1 parent cc693ce commit eeb6afc
Show file tree
Hide file tree
Showing 441 changed files with 401 additions and 449 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Fri, 29 Jan 2021 15:13:11 +0100
Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent
Subject: [PATCH] Expand EntityUnleashEvent


diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index d330b6d291cd2967358e892ccbc480bb3bd8022d..764a5dd85e3fb581b1e713ce9b148be1874d55be 100644
index d330b6d291cd2967358e892ccbc480bb3bd8022d..f9743f8705a7f5f3ede4c869070d5735e24348a0 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1305,12 +1305,15 @@ public abstract class Mob extends LivingEntity implements Targeting {
Expand Down Expand Up @@ -48,7 +48,7 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..764a5dd85e3fb581b1e713ce9b148be1
- this.dropLeash(true, true);
+ // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ if (!event.callEvent()) { return flag1; }
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
}
Expand All @@ -62,7 +62,7 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..764a5dd85e3fb581b1e713ce9b148be1
- this.dropLeash(true, false);
+ // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, false);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ if (!event.callEvent()) { return; }
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
this.getAllSlots().forEach((itemstack) -> {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0586-More-Enchantment-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ public net.minecraft.world.item.enchantment.Enchantment slots
Co-authored-by: Luis <luisc99@icloud.com>

diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
index 92922e8eef7fa4638a01f3cefc4c46a1451e40e7..4daf2c54c7127e8e091ffc49362f288594956143 100644
index 92922e8eef7fa4638a01f3cefc4c46a1451e40e7..92465b2a9f1483be76004c9f80a1fe15913b3b8b 100644
--- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
+++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
@@ -90,7 +90,7 @@ public class CraftEnchantment extends Enchantment {

@Override
public boolean isCursed() {
- return this.handle instanceof BindingCurseEnchantment || this.handle instanceof VanishingCurseEnchantment;
+ return this.handle.isCurse(); // Paper
+ return this.handle.isCurse(); // Paper - More Enchantment API
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Move range check for block placing up


diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4ea889c12a6750914b82d796ed641cdd810ea957..4d3452fb5cf9330e87d914f775c1a8e0c955a571 100644
index 4ea889c12a6750914b82d796ed641cdd810ea957..8d6254c7f63bae10d3e09771d484ee9e44c2c3de 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1743,6 +1743,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
Expand All @@ -16,7 +16,7 @@ index 4ea889c12a6750914b82d796ed641cdd810ea957..4d3452fb5cf9330e87d914f775c1a8e0
+ if (!Double.isFinite(vec3d.x) || !Double.isFinite(vec3d.y) || !Double.isFinite(vec3d.z)) {
+ return;
+ }
+ // Paper end
+ // Paper end - improve distance check
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
Vec3 vec3d1 = Vec3.atCenterOf(blockposition);

Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ index 415d55285bb02442d8d1ec907d37b07fad4f3fcc..9b0bbaf23b90a04b6e6f6c97d9174fe3
Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, dimensionOptionsRegistry, eraseCache);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fbfe5d18a004225396f2d33084fb5073af2d9731..2acd875f34c367f9b9db85dee5052140c05d0add 100644
index fbfe5d18a004225396f2d33084fb5073af2d9731..7bfd8307555a9447d4c546a8945341806041cc32 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -586,11 +586,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Expand All @@ -279,7 +279,7 @@ index fbfe5d18a004225396f2d33084fb5073af2d9731..2acd875f34c367f9b9db85dee5052140
- return true;
- }, dimensions);
- }
+ // Paper - move down
+ // Paper - fix and optimise world upgrading; move down

PrimaryLevelData iworlddataserver = worlddata;
boolean flag = worlddata.isDebugWorld();
Expand Down Expand Up @@ -352,7 +352,7 @@ index deed4d50e0e4d810647a0745ef328c20dfe51093..9fa07295bf73317a4c2bbbbaf1918393
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()));
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 565beb65968b3f7e187f3e5b59aa08e9ac34f2a0..9c82a367ceacb1d2ae1a0503f5920d5919289502 100644
index 565beb65968b3f7e187f3e5b59aa08e9ac34f2a0..b28212bbf7678d73282d160bfeb0d246e93a8492 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1251,9 +1251,7 @@ public final class CraftServer implements Server {
Expand All @@ -362,7 +362,7 @@ index 565beb65968b3f7e187f3e5b59aa08e9ac34f2a0..9c82a367ceacb1d2ae1a0503f5920d59
- if (this.console.options.has("forceUpgrade")) {
- net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.console.options.has("eraseCache"), () -> true, iregistry);
- }
+ // Paper - move down
+ // Paper - fix and optimise world upgrading; move down

long j = BiomeManager.obfuscateSeed(creator.seed());
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
Expand Down
36 changes: 15 additions & 21 deletions patches/server/0590-Add-Unix-domain-socket-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@ From: Andrew Steinborn <git@steinborn.me>
Date: Tue, 11 May 2021 17:39:22 -0400
Subject: [PATCH] Add Unix domain socket support

For Windows and ARM support, JEP-380 is required:
https://inside.java/2021/02/03/jep380-unix-domain-sockets-channels/
This will be possible as of the Minecraft 1.17 Java version bump.

Tested-by: Mariell Hoversholm <proximyst@proximyst.com>
Reviewed-by: Mariell Hoversholm <proximyst@proximyst.com>

diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 019dd5a66b883e6ac8d0f07abc2636768a373664..f0d6e6f85dc2a9ae8d70dd691b144fac0298bf33 100644
index 019dd5a66b883e6ac8d0f07abc2636768a373664..bc157cd71bb6dbc109990533f622f78bcc103918 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -219,6 +219,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
Expand Down Expand Up @@ -41,7 +35,7 @@ index 019dd5a66b883e6ac8d0f07abc2636768a373664..f0d6e6f85dc2a9ae8d70dd691b144fac
}
+ bindAddress = new java.net.InetSocketAddress(inetaddress, this.getPort());
+ }
+ // Paper end
+ // Paper end - Unix domain socket support

this.initializeKeyPair();
DedicatedServer.LOGGER.info("Starting Minecraft server on {}:{}", this.getLocalIp().isEmpty() ? "*" : this.getLocalIp(), this.getPort());
Expand All @@ -53,33 +47,33 @@ index 019dd5a66b883e6ac8d0f07abc2636768a373664..f0d6e6f85dc2a9ae8d70dd691b144fac
DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
DedicatedServer.LOGGER.warn("The exception was: {}", ioexception.toString());
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 6641fd04821240b1bbeff1bd8d996a8f2fff8385..5f625acf04ddb56e3596d086252f9bfccfdb95f2 100644
index 6641fd04821240b1bbeff1bd8d996a8f2fff8385..4bbb370c5d26749c566216bac079a0cb6d0b4507 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -78,7 +78,12 @@ public class ServerConnectionListener {
this.running = true;
}

+ // Paper start
+ // Paper start - Unix domain socket support
public void startTcpServerListener(@Nullable InetAddress address, int port) throws IOException {
+ bind(new java.net.InetSocketAddress(address, port));
+ }
+ public void bind(java.net.SocketAddress address) throws IOException {
+ // Paper end
+ // Paper end - Unix domain socket support
List list = this.channels;

synchronized (this.channels) {
@@ -86,7 +91,13 @@ public class ServerConnectionListener {
EventLoopGroup eventloopgroup;

if (Epoll.isAvailable() && this.server.isEpollEnabled()) {
+ // Paper start
+ // 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
+ // Paper end - Unix domain socket support
eventloopgroup = (EventLoopGroup) ServerConnectionListener.SERVER_EPOLL_EVENT_GROUP.get();
ServerConnectionListener.LOGGER.info("Using epoll channel type");
} else {
Expand All @@ -88,43 +82,43 @@ index 6641fd04821240b1bbeff1bd8d996a8f2fff8385..5f625acf04ddb56e3596d086252f9bfc
io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper
}
- }).group(eventloopgroup).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
+ }).group(eventloopgroup).localAddress(address)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit // Paper
+ }).group(eventloopgroup).localAddress(address)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit // Paper - Unix domain socket support
}
}

diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4d3452fb5cf9330e87d914f775c1a8e0c955a571..4d23d019173d0921145338544e190bc34f9f45c2 100644
index 8d6254c7f63bae10d3e09771d484ee9e44c2c3de..73b825b16f02e254a1e2313ff1c93c642c5dceeb 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2476,6 +2476,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// 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
+ // Paper start - Unix domain socket support; this can be nullable in the case of a Unix domain socket, so if it is, fake something
+ if (connection.channel.remoteAddress() == null) {
+ return new java.net.InetSocketAddress(java.net.InetAddress.getLoopbackAddress(), 0);
+ }
+ // Paper end
+ // Paper end - Unix domain socket support
return this.connection.channel.remoteAddress();
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 3068e25f2df958689627fb31783a2d356547f1be..d2edc000f34d7f07a840bb8012c6f884f37e387b 100644
index 3068e25f2df958689627fb31783a2d356547f1be..f1a002ddfa55ba3bf4313639d0e82f0c8b036c65 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -45,6 +45,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
this.connection.setClientboundProtocolAfterHandshake(ClientIntent.LOGIN);
// CraftBukkit start - Connection throttle
try {
+ if (!(this.connection.channel.localAddress() instanceof io.netty.channel.unix.DomainSocketAddress)) { // Paper - the connection throttle is useless when you have a Unix domain socket
+ if (!(this.connection.channel.localAddress() instanceof io.netty.channel.unix.DomainSocketAddress)) { // Paper - Unix domain socket support; the connection throttle is useless when you have a Unix domain socket
long currentTime = System.currentTimeMillis();
long connectionThrottle = this.server.server.getConnectionThrottle();
InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress();
@@ -73,6 +74,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
}
}
}
+ } // Paper - add closing bracket for if check above
+ } // Paper - Unix domain socket support
} catch (Throwable t) {
org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
}
Expand All @@ -137,7 +131,7 @@ index 3068e25f2df958689627fb31783a2d356547f1be..d2edc000f34d7f07a840bb8012c6f884
this.connection.hostname = split[0];
- this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
+ this.connection.address = new java.net.InetSocketAddress(split[1], socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0);
+ // Paper end
+ // Paper end - Unix domain socket support
this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
} else
{
Loading

0 comments on commit eeb6afc

Please sign in to comment.