More more more more more more patches

This commit is contained in:
Nassim Jahnke 2022-06-08 11:31:06 +02:00
parent b464e02ba4
commit 0e06c77264
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
51 changed files with 321 additions and 349 deletions

View File

@ -1,44 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Wed, 15 Jul 2020 19:34:11 -0700
Subject: [PATCH] Move range check for block placing up
TODO: vanilla has smth very similar already in place starting in 1.19 -MM
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6acc4ee50ba32a208930bda89d37f155e3f4835a..0f031b094a180bcce1fe3b388321db838ca4df63 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1686,6 +1686,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
// Spigot end
+ // Paper start
+ private static final int SURVIVAL_PLACE_DISTANCE_SQUARED = 6 * 6;
+ private static final int CREATIVE_PLACE_DISTANCE_SQUARED = 7 * 7;
+ private boolean isOutsideOfReach(double x, double y, double z) {
+ Location eyeLoc = this.getCraftPlayer().getEyeLocation();
+ double reachDistance = org.bukkit.util.NumberConversions.square(eyeLoc.getX() - x) + org.bukkit.util.NumberConversions.square(eyeLoc.getY() - y) + org.bukkit.util.NumberConversions.square(eyeLoc.getZ() - z);
+ return reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED);
+ }
+ // Paper end
+
@Override
public void handleUseItemOn(ServerboundUseItemOnPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -1699,6 +1709,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
Vec3 vec3d1 = vec3d.subtract(Vec3.atCenterOf(blockposition));
+ // Paper start - improve distance check
+ final Vec3 clickedLocation = movingobjectpositionblock.getLocation();
+ if (isOutsideOfReach(blockposition.getX() + 0.5D, blockposition.getY() + 0.5D, blockposition.getZ() + 0.5D)
+ || !Double.isFinite(clickedLocation.x) || !Double.isFinite(clickedLocation.y) || !Double.isFinite(clickedLocation.z)
+ || isOutsideOfReach(clickedLocation.x, clickedLocation.y, clickedLocation.z)) {
+ return;
+ }
+ // Paper end
+
if (this.player.level.getServer() != null && this.player.chunkPosition().getChessboardDistance(new ChunkPos(blockposition)) < this.player.level.spigotConfig.viewDistance) { // Spigot
double d0 = 1.0000001D;

View File

@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <jahnke.nassim@gmail.com>
Date: Wed, 8 Jun 2022 10:52:18 +0200
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 d216529f4cc40c99298ff823761dfe73e398f694..205f8f270da077aaefaad509acb5923b97788feb 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1762,6 +1762,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
ItemStack itemstack = this.player.getItemInHand(enumhand);
BlockHitResult movingobjectpositionblock = packet.getHitResult();
Vec3 vec3d = movingobjectpositionblock.getLocation();
+ // Paper start - improve distance check
+ if (!Double.isFinite(vec3d.x) || !Double.isFinite(vec3d.y) || !Double.isFinite(vec3d.z)) {
+ return;
+ }
+ // Paper end
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
Vec3 vec3d1 = Vec3.atCenterOf(blockposition);

View File

@ -244,18 +244,18 @@ index 0000000000000000000000000000000000000000..ca4e9acb4b7beb739546954d0aa02461
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 69dc1271be0a3f3f2fb4ce15981ed25d24dce785..1e0d261439255091a6f61485c0747231fbd5b1db 100644
index 9ebfa8c8a3fc1299e513efd467c562459f2684e7..8beb378536d87047fda50d365f49c3ff64d7497f 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -15,6 +15,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
@@ -16,6 +16,7 @@ import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.function.BooleanSupplier;
+import io.papermc.paper.world.ThreadedWorldUpgrader;
import joptsimple.NonOptionArgumentSpec;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
@@ -316,6 +317,15 @@ public class Main {
@@ -312,6 +313,15 @@ public class Main {
}
// Paper end
@ -272,10 +272,10 @@ index 69dc1271be0a3f3f2fb4ce15981ed25d24dce785..1e0d261439255091a6f61485c0747231
Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, generatorOptions, eraseCache);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2ec8216d19de795bbe0827f6c9b3f9cdc2ce6760..b8ffd95bbad81521b9f91e83f63188553c09d4bd 100644
index 3b950c0a6a660d5d9b957cfc08d85fc2bdb706e4..6693a1861a775b755aa06844a37753ba9ec3bbc5 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -555,11 +555,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -541,11 +541,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worlddata = new PrimaryLevelData(worldsettings, generatorsettings, Lifecycle.stable());
}
worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
@ -286,28 +286,27 @@ index 2ec8216d19de795bbe0827f6c9b3f9cdc2ce6760..b8ffd95bbad81521b9f91e83f6318855
- }
+ // Paper - move down
ServerLevelData iworlddataserver = worlddata;
PrimaryLevelData iworlddataserver = worlddata;
WorldGenSettings generatorsettings = worlddata.worldGenSettings();
@@ -591,6 +587,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
@@ -560,6 +556,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
}
+ // Paper start - fix and optimise world upgrading
+ if (options.has("forceUpgrade")) {
+ net.minecraft.server.Main.convertWorldButItWorks(
+ dimensionKey, worldSession, DataFixers.getDataFixer(), chunkgenerator.getTypeNameForDataFixer(), options.has("eraseCache")
+ dimensionKey, worldSession, DataFixers.getDataFixer(), worlddimension.generator().getTypeNameForDataFixer(), options.has("eraseCache")
+ );
+ }
+ // Paper end - fix and optimise world upgrading
+
ResourceKey<Level> worldKey = ResourceKey.create(Registry.DIMENSION_REGISTRY, dimensionKey.location());
if (dimensionKey == LevelStem.OVERWORLD) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 7d7d6ac3ae38eda0aed9f52059fccd3970718890..c3ae2b4b5b4eb14d24f2c15a7e8ace8ebee84c1a 100644
index 23ae163fa08311d2b41dfeafd9df32bebcc04152..474b1dc68e138fb3fcca8c846d50fa2c04f74fd5 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -172,6 +172,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -178,6 +178,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
@ -357,10 +356,10 @@ index 4bc33c31d497aa7d69226ab870fd78902bedfd5b..089e8414c7bdc102ba0d914af576df1a
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 90b0673411d33f46ac959c31f0608c489d41c3bb..20025b1e3c749ef3c164041e519a53b39a7a9b7d 100644
index eb2d4225eea2940bc9091daf7d7aa96fc8cab675..59e1303353e029ee754bde2e43f2bca622154381 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1199,12 +1199,7 @@ public final class CraftServer implements Server {
@@ -1194,12 +1194,7 @@ public final class CraftServer implements Server {
}
worlddata.checkName(name);
worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().shouldReportAsModified());
@ -374,18 +373,17 @@ index 90b0673411d33f46ac959c31f0608c489d41c3bb..20025b1e3c749ef3c164041e519a53b3
long j = BiomeManager.obfuscateSeed(creator.seed());
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
@@ -1233,6 +1228,14 @@ public final class CraftServer implements Server {
}
@@ -1211,6 +1206,13 @@ public final class CraftServer implements Server {
biomeProvider = generator.getDefaultBiomeProvider(worldInfo);
}
+ // Paper start - fix and optimise world upgrading
+ if (console.options.has("forceUpgrade")) {
+ net.minecraft.server.Main.convertWorldButItWorks(
+ actualDimension, worldSession, DataFixers.getDataFixer(), chunkgenerator.getTypeNameForDataFixer(), console.options.has("eraseCache")
+ actualDimension, worldSession, DataFixers.getDataFixer(), worlddimension.generator().getTypeNameForDataFixer(), console.options.has("eraseCache")
+ );
+ }
+ // Paper end - fix and optimise world upgrading
+
ResourceKey<net.minecraft.world.level.Level> worldKey;
String levelName = this.getServer().getProperties().levelName;
if (name.equals(levelName + "_nether")) {

View File

@ -11,10 +11,10 @@ Tested-by: Mariell Hoversholm <proximyst@proximyst.com>
Reviewed-by: Mariell Hoversholm <proximyst@proximyst.com>
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 932b494ea2a5e849b233c73bd2472d5c85f5ba52..8536dd544876e245a611379a7ed1446b0ed06eac 100644
index 4798ac3a9c7a7d34eaca5cb50b013b071793ed94..00ab93e02a884e51cd6cc647c7e58c2e53b8a7cc 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -626,6 +626,11 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -628,6 +628,11 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
// Spigot Start
public SocketAddress getRawAddress()
{
@ -27,10 +27,10 @@ index 932b494ea2a5e849b233c73bd2472d5c85f5ba52..8536dd544876e245a611379a7ed1446b
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index fa6adf12e8272c90c3376bc93350dc57eb1cd461..939745227346e6d23e50f942eb48ab97c4ab6190 100644
index 949e2050dae9048f53cd5b8452763be5fbd70958..5cc3a55b90135f0aa97c5faaf6c1b6f4d6fe9a0e 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -234,6 +234,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -226,6 +226,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist);
// this.worldData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
@ -51,7 +51,7 @@ index fa6adf12e8272c90c3376bc93350dc57eb1cd461..939745227346e6d23e50f942eb48ab97
InetAddress inetaddress = null;
if (!this.getLocalIp().isEmpty()) {
@@ -243,12 +257,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -235,12 +249,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
if (this.getPort() < 0) {
this.setPort(dedicatedserverproperties.serverPort);
}
@ -69,10 +69,10 @@ index fa6adf12e8272c90c3376bc93350dc57eb1cd461..939745227346e6d23e50f942eb48ab97
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 c36089ead51d2e7dc3369d5f9a1869f58ff5391c..bfa519b9335c960a5baec50b0da95d95cd5ee958 100644
index 076c1d5fb69a4a30b3e412e85b17db09fd9a1def..9e7154c9df96d5a0577886d43a98a73626a8f189 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 {
@@ -79,7 +79,12 @@ public class ServerConnectionListener {
this.running = true;
}
@ -85,7 +85,7 @@ index c36089ead51d2e7dc3369d5f9a1869f58ff5391c..bfa519b9335c960a5baec50b0da95d95
List list = this.channels;
synchronized (this.channels) {
@@ -86,7 +91,11 @@ public class ServerConnectionListener {
@@ -87,7 +92,11 @@ public class ServerConnectionListener {
LazyLoadedValue lazyinitvar;
if (Epoll.isAvailable() && this.server.isEpollEnabled()) {
@ -97,7 +97,7 @@ index c36089ead51d2e7dc3369d5f9a1869f58ff5391c..bfa519b9335c960a5baec50b0da95d95
lazyinitvar = ServerConnectionListener.SERVER_EPOLL_EVENT_GROUP;
ServerConnectionListener.LOGGER.info("Using epoll channel type");
} else {
@@ -114,7 +123,7 @@ public class ServerConnectionListener {
@@ -115,7 +124,7 @@ public class ServerConnectionListener {
((Connection) object).setListener(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object));
io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper
}
@ -107,10 +107,10 @@ index c36089ead51d2e7dc3369d5f9a1869f58ff5391c..bfa519b9335c960a5baec50b0da95d95
}
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index f74b6d2110e51c76eeb1aea7665153509b6e6371..e76b9670213de966ee275e624e7ee5f673d3f210 100644
index a54bb43a3acf31be0278fee3d23de9acfdfc64cf..95340e4067ff1cbc9539615adb260377a5187cb7 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -44,6 +44,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@@ -43,6 +43,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
this.connection.setProtocol(ConnectionProtocol.LOGIN);
// CraftBukkit start - Connection throttle
try {
@ -118,7 +118,7 @@ index f74b6d2110e51c76eeb1aea7665153509b6e6371..e76b9670213de966ee275e624e7ee5f6
long currentTime = System.currentTimeMillis();
long connectionThrottle = this.server.server.getConnectionThrottle();
InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress();
@@ -72,6 +73,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@@ -71,6 +72,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
}
}
}
@ -126,7 +126,7 @@ index f74b6d2110e51c76eeb1aea7665153509b6e6371..e76b9670213de966ee275e624e7ee5f6
} catch (Throwable t) {
org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
}
@@ -120,8 +122,11 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@@ -119,8 +121,11 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
// Paper end
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityInsideBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
index ed216f0b6cf031883c4ca4123d82c9fc542b915e..4d1f94c576b65e067efce95d5ef8c0078453b494 100644
index 922b5b22a4ccfeead9d6d2b9a2a2b3cc8a1e6c55..a76c452dc5c2069a3071aec31bfb3e977867161e 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
@@ -121,6 +121,7 @@ public abstract class BaseFireBlock extends Block {
@ -17,7 +17,7 @@ index ed216f0b6cf031883c4ca4123d82c9fc542b915e..4d1f94c576b65e067efce95d5ef8c007
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
if (entity.getRemainingFireTicks() == 0) {
diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
index 7cc20edb0cc3994a6c23ae99801bb254869e424f..2036006b934ba1f27da606320b4c456af019a361 100644
index af808ddea455b2df9e551ce32dcd5bb472623dd9..f9aaec28be3e7a191981d30b361e369d7fea2c9e 100644
--- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
@@ -67,6 +67,7 @@ public abstract class BasePressurePlateBlock extends Block {
@ -29,7 +29,7 @@ index 7cc20edb0cc3994a6c23ae99801bb254869e424f..2036006b934ba1f27da606320b4c456a
int i = this.getSignalForState(state);
diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
index e3079d858d9252f13a24f51a2da097bfb6524ea4..45a5343c1109c63ce7864327837979282b904367 100644
index ce32a0582c6d86e754710daa1413ff46da05dc56..63aa6b82ba21ec8e8f362b390063e4e275a979a5 100644
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
@@ -170,6 +170,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
@ -41,7 +41,7 @@ index e3079d858d9252f13a24f51a2da097bfb6524ea4..45a5343c1109c63ce786432783797928
if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) {
// CraftBukkit start - tilt dripleaf
diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
index d99399eca5e30423f007c0e0665e8c14374c503c..ee3045133965da67611f180835fa111998f918b4 100644
index 3da8d49f7e36d8f1c0873bec32123971e53d2a31..461288cb56793f11e8dac80720b36cb9b42da518 100644
--- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
@@ -38,6 +38,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
@ -53,7 +53,7 @@ index d99399eca5e30423f007c0e0665e8c14374c503c..ee3045133965da67611f180835fa1119
if (blockState.isAir()) {
entity.onAboveBubbleCol(state.getValue(DRAG_DOWN));
diff --git a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
index 70161d554163779ba53ad278c6af95b9da87edce..b7f37475192bf79252482314080c9ba08e9aefdb 100644
index c187e9df237ee71562343bbb4b577b2dcd9b4f1c..a0194e78913017693df7d92516dfbacb1153a1c2 100644
--- a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
@@ -186,6 +186,7 @@ public abstract class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock
@ -65,7 +65,7 @@ index 70161d554163779ba53ad278c6af95b9da87edce..b7f37475192bf79252482314080c9ba0
this.checkPressed(state, world, pos);
}
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
index f1bbfc85582d29a50a82f9207509985dcb76b693..4323e5cc2054804243e8e2f24fd5447280f218de 100644
index 0d255201ebce3bb495a4e086da5e4d9195cbc091..1a735974c784c545d7f25548964b25b38ecdc762 100644
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
@@ -116,6 +116,7 @@ public class CactusBlock extends Block {
@ -77,7 +77,7 @@ index f1bbfc85582d29a50a82f9207509985dcb76b693..4323e5cc2054804243e8e2f24fd54472
entity.hurt(DamageSource.CACTUS, 1.0F);
CraftEventFactory.blockDamage = null; // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
index 6d28b4724f7befc56534ba52b6d45068f6b06868..b29d1fd37f3f265e01128ff6fb1d56da2280f6e0 100644
index 930421c72326fabfa3f2e3ab37c4dd6f416d6d44..a4c44cb59dee29cf227dbb51bfc1576d89dfb2e3 100644
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
@@ -93,6 +93,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
@ -85,11 +85,11 @@ index 6d28b4724f7befc56534ba52b6d45068f6b06868..b29d1fd37f3f265e01128ff6fb1d56da
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
if (!entity.fireImmune() && (Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) {
if ((Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) {
org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = CraftBlock.at(world, pos); // CraftBukkit
entity.hurt(DamageSource.IN_FIRE, (float) this.fireDamage);
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
index 75dc5d9a750a49b6ad9fd2aba99b9f84c2663e10..b4fd9af8805f451c87a91f319c15fa132b91faf7 100644
index 76fc886013b6c53f7888292f8fda50abe72e43bf..275e5334b1206a2dcafc3772c7e2ad0ebe3693f9 100644
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
@@ -163,6 +163,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
@ -101,7 +101,7 @@ index 75dc5d9a750a49b6ad9fd2aba99b9f84c2663e10..b4fd9af8805f451c87a91f319c15fa13
world.destroyBlock(pos, true, entity);
}
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
index b68e3ced407a9e6b386cbd379e58c86f195eb17a..4dc92fafc3ea593afd19cfc7c5e6b1591408d095 100644
index 932a2c279f46c951182d2604b525b473b6945895..05dfb1790a292f9f85b641377c2ca3675726c127 100644
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
@@ -44,6 +44,7 @@ public class DetectorRailBlock extends BaseRailBlock {
@ -113,7 +113,7 @@ index b68e3ced407a9e6b386cbd379e58c86f195eb17a..4dc92fafc3ea593afd19cfc7c5e6b159
if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) {
this.checkPressed(world, pos, state);
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
index 40fe9e093f32c65947973daa21afec58ca7976f8..b8305112c759ecb62ef9ad972e57ff85ceff20dc 100644
index 3b54eb4962a0cd39e6ff7a934f814de864a16a3d..150c16da7caa655cfc2c371d3336a8d7345438c6 100644
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -44,6 +44,7 @@ public class EndPortalBlock extends BaseEntityBlock {
@ -137,7 +137,7 @@ index 0549256cbd7028c82bf82ccc4ff64219df7e0906..683f24251baf8ef3bef8f32ba83dc7f0
this.maybeDoSlideAchievement(entity, pos);
this.doSlideMovement(entity);
diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
index ec2fde5d5e62925e6668699675935c8e2ba04389..3278c40979af3b0fb6097ad34936c6aa43d36060 100644
index c89bce01302348115791732fb31ce48aec7239d4..45224b264c7500a9d4342864cf67e7d1550c8103 100644
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
@@ -200,6 +200,7 @@ public class HopperBlock extends BaseEntityBlock {
@ -161,10 +161,10 @@ index f0a3ef0529951e7732602d358ddea1782001db7e..6588b207d93d96934e72176874ba60c8
entity.lavaHurt();
}
diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
index f0a4c52b9cba6ebf7712950852aba4b2e0083f3d..e6ea389350cf391a87c4c388ed9a6325bdceb90d 100644
index 2d0191eeb746d496a481d66cdfa77078313a13ec..24d2da792bc498adf4251555a538df4cafe2e827 100644
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -59,6 +59,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
@@ -60,6 +60,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -173,7 +173,7 @@ index f0a4c52b9cba6ebf7712950852aba4b2e0083f3d..e6ea389350cf391a87c4c388ed9a6325
// CraftBukkit start
if (entity.mayInteract(world, pos)) {
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
index d2b82872f6f8c3febb6c4b6468fd39f3549b1ed8..82c132bc90381aab6a29d50319ff40e7383eb7f2 100644
index fe073237dbec6e9890395575206bbc893bef6d9b..51f0dc173ddb29c6928badbc3c3a68ff3677a0e1 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -85,6 +85,7 @@ public class NetherPortalBlock extends Block {
@ -185,7 +185,7 @@ index d2b82872f6f8c3febb6c4b6468fd39f3549b1ed8..82c132bc90381aab6a29d50319ff40e7
// CraftBukkit start - Entity in portal
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
index dcdcbb1a2acffab2c5b389e6ecb853364f689021..5e22a1cd1a0902d63f091bbfb8ae518b12c66f09 100644
index 47f54002654d198a56a85884de34e305e545eb4b..518d3832c36c9ecf1ed9267ffc1f926dc84b7989 100644
--- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
@@ -55,6 +55,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
@ -197,10 +197,10 @@ index dcdcbb1a2acffab2c5b389e6ecb853364f689021..5e22a1cd1a0902d63f091bbfb8ae518b
entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D));
if (world.isClientSide) {
diff --git a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
index 1a5590ff8e5122b5c7587347fcc38d73671c2747..71abf800e623336124bd9a955e07db4950286516 100644
index 272ec85b1bde4b7a9439ab8fbb2711f3adb65b55..1d28810f697565e34d59ffc8dbf55173c2a671ea 100644
--- a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
@@ -73,6 +73,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock
@@ -77,6 +77,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -209,7 +209,7 @@ index 1a5590ff8e5122b5c7587347fcc38d73671c2747..71abf800e623336124bd9a955e07db49
entity.makeStuckInBlock(state, new Vec3(0.800000011920929D, 0.75D, 0.800000011920929D));
if (!world.isClientSide && (Integer) state.getValue(SweetBerryBushBlock.AGE) > 0 && (entity.xOld != entity.getX() || entity.zOld != entity.getZ())) {
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
index 0c24c025e537b501f583aa3de920e18abc6ca259..6b40bf94fbaa18605b59b92ad1582e8dc3a6a9cd 100644
index 5e1133bf2cba55a6ec5559d8db41e1a3db582d06..4e2fb4ee8e46b3c363992ff23e26f5a648c5f003 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
@@ -121,6 +121,7 @@ public class TripWireBlock extends Block {
@ -245,7 +245,7 @@ index 6964308822ebf8a7027ce426062ba43a70c20c15..763fa221c562e96c2abd09c7055e91a8
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
index 02779f3695c6609f07db326334b3c270cd7bf8e6..bb322ffd3dddb14d97884c0cc78d098577daad05 100644
index 7acac8e59d6d46d03f6a15f0657b6028a63f752a..7d5f7983bbbcb004a1334f22dbe47b477ea5b750 100644
--- a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
@@ -46,6 +46,7 @@ public class WitherRoseBlock extends FlowerBlock {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Attributes API for item defaults
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 9a98097f2d6beb6e7125ac5a7a2d60747d143a36..5e6e0b137604ac64e11a2dd883978ff1c8c59012 100644
index 54184e94a3516c2be27c39951efee28b45160284..3ae0f73b00496ff05b845aff057fd4f91dad0ccd 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -545,6 +545,19 @@ public final class CraftMagicNumbers implements UnsafeValues {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add cause to Weather/ThunderChangeEvents
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a1df04f14fb149315e73307a81514b805ef3cb0d..958949d972fd7b8ae61041bfe15c21d4d19d9573 100644
index 5ad461eb42724ade2574c0ce9c68df655a4524b4..e0a5e978d584bcc0e692806b3d80d01710526eb3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -474,8 +474,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -490,8 +490,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.serverLevelData.setClearWeatherTime(clearDuration);
this.serverLevelData.setRainTime(rainDuration);
this.serverLevelData.setThunderTime(rainDuration);
@ -19,7 +19,7 @@ index a1df04f14fb149315e73307a81514b805ef3cb0d..958949d972fd7b8ae61041bfe15c21d4
}
@Override
@@ -865,8 +865,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -883,8 +883,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.serverLevelData.setThunderTime(j);
this.serverLevelData.setRainTime(k);
this.serverLevelData.setClearWeatherTime(i);
@ -30,7 +30,7 @@ index a1df04f14fb149315e73307a81514b805ef3cb0d..958949d972fd7b8ae61041bfe15c21d4
}
this.oThunderLevel = this.thunderLevel;
@@ -932,14 +932,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -950,14 +950,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
private void resetWeatherCycle() {
// CraftBukkit start
@ -48,10 +48,10 @@ index a1df04f14fb149315e73307a81514b805ef3cb0d..958949d972fd7b8ae61041bfe15c21d4
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time....
diff --git a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
index 1bd338c7860adf3b846cd6caa33312b3269ac3ef..95635cc7367b757d149bb2c81326a041f84782f0 100644
index 401787a5b55384b9ab7755e822b3b881dc45ac45..e537a8df45c31efa80cb898cbef9c3a09fac3bf9 100644
--- a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
+++ b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
@@ -346,6 +346,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -351,6 +351,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@Override
public void setThundering(boolean thundering) {
@ -63,7 +63,7 @@ index 1bd338c7860adf3b846cd6caa33312b3269ac3ef..95635cc7367b757d149bb2c81326a041
// CraftBukkit start
if (this.thundering == thundering) {
return;
@@ -353,7 +358,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -358,7 +363,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
if (world != null) {
@ -72,7 +72,7 @@ index 1bd338c7860adf3b846cd6caa33312b3269ac3ef..95635cc7367b757d149bb2c81326a041
Bukkit.getServer().getPluginManager().callEvent(thunder);
if (thunder.isCancelled()) {
return;
@@ -380,6 +385,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -385,6 +390,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@Override
public void setRaining(boolean raining) {
@ -85,7 +85,7 @@ index 1bd338c7860adf3b846cd6caa33312b3269ac3ef..95635cc7367b757d149bb2c81326a041
// CraftBukkit start
if (this.raining == raining) {
return;
@@ -387,7 +398,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -392,7 +403,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
if (world != null) {
@ -95,7 +95,7 @@ index 1bd338c7860adf3b846cd6caa33312b3269ac3ef..95635cc7367b757d149bb2c81326a041
if (weather.isCancelled()) {
return;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 07c90f6a98819c835b2341bd5c144609655b33e7..a557bc8b5fab1fb3516476793c965aa3c068edf9 100644
index a56071592420f9b649c84437fff336b03d6c93ba..792d660b10c841876a87625f8da1910a86542ec3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1189,7 +1189,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerKickEvent causes
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b8ffd95bbad81521b9f91e83f63188553c09d4bd..8aaf73d24ddff65c45eeb18d573e20fb8a1439a5 100644
index 6693a1861a775b755aa06844a37753ba9ec3bbc5..939170ade7c24bcf1c358f00931f867599cf9d54 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2117,7 +2117,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2083,7 +2083,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)
@ -18,49 +18,49 @@ index b8ffd95bbad81521b9f91e83f63188553c09d4bd..8aaf73d24ddff65c45eeb18d573e20fb
}
diff --git a/src/main/java/net/minecraft/server/commands/BanIpCommands.java b/src/main/java/net/minecraft/server/commands/BanIpCommands.java
index 144ca9280ce2fb19b4859e2c8299349ffd19f115..9f63d38853657cb01a4be0f1f7b613b2377a33ad 100644
index 37c6be64f618857abcbdbfe2a1fd58ed4f997a29..19023c0796f0b6d7b4acd4ff8984355ec5b3faa7 100644
--- a/src/main/java/net/minecraft/server/commands/BanIpCommands.java
+++ b/src/main/java/net/minecraft/server/commands/BanIpCommands.java
@@ -62,7 +62,7 @@ public class BanIpCommands {
@@ -61,7 +61,7 @@ public class BanIpCommands {
}
for(ServerPlayer serverPlayer : list) {
- serverPlayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.ip_banned"));
+ serverPlayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.ip_banned"), org.bukkit.event.player.PlayerKickEvent.Cause.IP_BANNED); // Paper - kick event cause
- serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.ip_banned"));
+ serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.ip_banned"), org.bukkit.event.player.PlayerKickEvent.Cause.IP_BANNED); // Paper - kick event cause
}
return list.size();
diff --git a/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java b/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
index c8361cd6c75df09481612eee729e23435229c6bf..b6eb53d5647600963c038cf2ef1301aba66f524d 100644
index 991d9a2bfd8d577c9c25e559833af9ddf690f1dc..458b9a730a1f629bd605c26a4ec4440e8ee84b1d 100644
--- a/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
+++ b/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
@@ -43,7 +43,7 @@ public class BanPlayerCommands {
source.sendSuccess(new TranslatableComponent("commands.ban.success", ComponentUtils.getDisplayName(gameProfile), userBanListEntry.getReason()), true);
@@ -42,7 +42,7 @@ public class BanPlayerCommands {
source.sendSuccess(Component.translatable("commands.ban.success", ComponentUtils.getDisplayName(gameProfile), userBanListEntry.getReason()), true);
ServerPlayer serverPlayer = source.getServer().getPlayerList().getPlayer(gameProfile.getId());
if (serverPlayer != null) {
- serverPlayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.banned"));
+ serverPlayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.banned"), org.bukkit.event.player.PlayerKickEvent.Cause.BANNED); // Paper - kick event cause
- serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.banned"));
+ serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.banned"), org.bukkit.event.player.PlayerKickEvent.Cause.BANNED); // Paper - kick event cause
}
}
}
diff --git a/src/main/java/net/minecraft/server/commands/KickCommand.java b/src/main/java/net/minecraft/server/commands/KickCommand.java
index 708ac03d5a849bf09c49547306e4a8c5a5ef8d91..5a8df368a4a25839cd4ac9be6972da2ee4875d85 100644
index 65637a33ba171a4b598f70cd943d24b0ee44a69f..57a9146bf2dee7a60aab16716e25348fad7ba127 100644
--- a/src/main/java/net/minecraft/server/commands/KickCommand.java
+++ b/src/main/java/net/minecraft/server/commands/KickCommand.java
@@ -23,7 +23,7 @@ public class KickCommand {
@@ -22,7 +22,7 @@ public class KickCommand {
private static int kickPlayers(CommandSourceStack source, Collection<ServerPlayer> targets, Component reason) {
for(ServerPlayer serverPlayer : targets) {
- serverPlayer.connection.disconnect(reason);
+ serverPlayer.connection.disconnect(reason, org.bukkit.event.player.PlayerKickEvent.Cause.KICK_COMMAND); // Paper - kick event cause
source.sendSuccess(new TranslatableComponent("commands.kick.success", serverPlayer.getDisplayName(), reason), true);
source.sendSuccess(Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason), true);
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025ba0ebabe 100644
index 205f8f270da077aaefaad509acb5923b97788feb..338a026b283de5e83428073b8debb5cfca07f653 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -318,7 +318,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -343,7 +343,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger()) {
if (++this.aboveGroundTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
@ -69,7 +69,7 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
return;
}
} else {
@@ -337,7 +337,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -362,7 +362,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
@ -78,25 +78,25 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
return;
}
} else {
@@ -359,7 +359,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -384,7 +384,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
- this.disconnect(new TranslatableComponent("disconnect.timeout", new Object[0]));
+ this.disconnect(new TranslatableComponent("disconnect.timeout", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
- this.disconnect(Component.translatable("disconnect.timeout", new Object[0]));
+ this.disconnect(Component.translatable("disconnect.timeout", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
}
} else {
if (elapsedTime >= 15000L) { // 15 seconds
@@ -389,7 +389,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -414,7 +414,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60)) {
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.idling"));
+ this.disconnect(new TranslatableComponent("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
- this.disconnect(Component.translatable("multiplayer.disconnect.idling"));
+ this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
}
}
@@ -414,14 +414,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.chatPreviewThrottler.tick();
@@ -440,14 +440,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void disconnect(String s) {
// Paper start
@ -111,18 +111,18 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
public void disconnect(final Component reason) {
- this.disconnect(PaperAdventure.asAdventure(reason));
+ this.disconnect(PaperAdventure.asAdventure(reason), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
+ }
+
+ public void disconnect(final Component reason, PlayerKickEvent.Cause cause) {
+ this.disconnect(PaperAdventure.asAdventure(reason), cause);
}
- public void disconnect(net.kyori.adventure.text.Component reason) {
+ public void disconnect(final Component reason, PlayerKickEvent.Cause cause) {
+ this.disconnect(PaperAdventure.asAdventure(reason), cause);
+ }
+
+ public void disconnect(net.kyori.adventure.text.Component reason, org.bukkit.event.player.PlayerKickEvent.Cause cause) {
// Paper end
// CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) {
@@ -429,7 +437,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -455,7 +463,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
@ -131,32 +131,32 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event);
@@ -506,7 +514,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -532,7 +540,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) {
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_vehicle_movement"));
+ this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_vehicle_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_VEHICLE_MOVEMENT); // Paper - kick event cause
- this.disconnect(Component.translatable("multiplayer.disconnect.invalid_vehicle_movement"));
+ this.disconnect(Component.translatable("multiplayer.disconnect.invalid_vehicle_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_VEHICLE_MOVEMENT); // Paper - kick event cause
} else {
Entity entity = this.player.getRootVehicle();
@@ -752,13 +760,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -783,13 +791,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
// CraftBukkit start
if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
- server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper
+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
// Paper start
String str = packet.getCommand(); int index = -1;
if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) {
- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
- server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper
+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
// Paper end
@@ -911,7 +919,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -942,7 +950,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper start - validate pick item position
if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -165,7 +165,7 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
return;
}
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
@@ -1076,7 +1084,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1107,7 +1115,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
if (byteLength > 256 * 4) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
@ -174,7 +174,7 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
return;
}
byteTotal += byteLength;
@@ -1099,14 +1107,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1130,14 +1138,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (byteTotal > byteAllowed) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
@ -191,16 +191,16 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
return;
}
this.lastBookTick = MinecraftServer.currentTick;
@@ -1230,7 +1238,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1259,7 +1267,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_player_movement"));
+ this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
- this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"));
+ this.disconnect(Component.translatable(("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT)); // Paper - kick event cause
} else {
ServerLevel worldserver = this.player.getLevel();
@@ -1657,7 +1665,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1686,7 +1694,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.dropCount++;
if (this.dropCount >= 20) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
@ -209,16 +209,16 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
return;
}
}
@@ -1876,7 +1884,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1894,7 +1902,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
- this.disconnect(new TranslatableComponent("multiplayer.requiredTexturePrompt.disconnect"));
+ this.disconnect(new TranslatableComponent("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - add cause
- this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"));
+ this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - add cause
}
// Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
@@ -1981,7 +1989,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2007,7 +2015,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.resetLastActionTime();
} else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -227,34 +227,34 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
}
}
@@ -1997,7 +2005,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"));
+ this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause
return;
@@ -2020,7 +2028,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
}
@@ -2070,7 +2078,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// CraftBukkit end
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.getMessage())) {
- this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
+ this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause
} else {
if (this.tryHandleChat(packet.getMessage(), packet.getTimeStamp())) {
// CraftBukkit start
@@ -2303,7 +2311,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
- ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("disconnect.spam"));
+ ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
- ServerGamePacketListenerImpl.this.disconnect(Component.translatable("disconnect.spam"));
+ ServerGamePacketListenerImpl.this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
return null;
}
};
@@ -2085,7 +2093,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2318,7 +2326,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
throw new RuntimeException(e);
}
} else {
- this.disconnect(new TranslatableComponent("disconnect.spam"));
+ this.disconnect(new TranslatableComponent("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
- this.disconnect(Component.translatable("disconnect.spam"));
+ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
}
// CraftBukkit end
}
@@ -2358,7 +2366,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2536,7 +2544,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Spigot Start
if ( entity == this.player && !this.player.isSpectator() )
{
@ -263,34 +263,34 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
return;
}
// Spigot End
@@ -2453,7 +2461,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2629,7 +2637,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
// CraftBukkit end
} else {
- ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_entity_attacked"));
+ ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_entity_attacked"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_ENTITY_ATTACKED); // Paper - add cause
- ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked"));
+ ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_ENTITY_ATTACKED); // Paper - add cause
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
}
@@ -2859,7 +2867,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3035,7 +3043,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
- server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper
+ server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
}
@@ -3047,7 +3055,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3226,7 +3234,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> {
- this.disconnect(new TranslatableComponent("disconnect.timeout"));
+ this.disconnect(new TranslatableComponent("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
- this.disconnect(Component.translatable("disconnect.timeout"));
+ this.disconnect(Component.translatable("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
});
// Paper end
}
@@ -3093,7 +3101,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3272,7 +3280,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -299,7 +299,7 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
}
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try {
@@ -3103,7 +3111,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3282,7 +3290,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -308,7 +308,7 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
}
} else {
try {
@@ -3121,7 +3129,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3300,7 +3308,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@ -318,15 +318,15 @@ index 4f7cd9209cf6c352817591dd497c2e7ec6265ac6..0a018328dfe2b73f962a1939786b9025
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 6dfca5731966084efce3997898a6ebe9c0c6ea0d..3198291eaf12f8da4c138a1963db09f60381b4b6 100644
index 11b5335a7f30113da58c39aa15ca5e6f0b2588d5..3562532e446e3a6b2ecfc4aa37693b3a4ec6af47 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -719,7 +719,7 @@ public abstract class PlayerList {
while (iterator.hasNext()) {
entityplayer = (ServerPlayer) iterator.next();
this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved
- entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]));
+ entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause
- entityplayer.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login"));
+ entityplayer.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause
}
// Instead of kicking then returning, we need to store the kick reason
@ -342,10 +342,10 @@ index 6dfca5731966084efce3997898a6ebe9c0c6ea0d..3198291eaf12f8da4c138a1963db09f6
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e80268801518b1cbdec69a09ea571af0f2cf5492..a18af13204792e37f81d57cda8123aaa394e1050 100644
index 3a61bc70b52372016ce7f50f50faa68ad6ed94ba..720ccaa64293b075c893f1e4f64a35e0fc43b869 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -519,7 +519,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -516,7 +516,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot
if (this.getHandle().connection == null) return;
@ -354,7 +354,7 @@ index e80268801518b1cbdec69a09ea571af0f2cf5492..a18af13204792e37f81d57cda8123aaa
}
// Paper start
@@ -531,10 +531,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -528,10 +528,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void kick(final net.kyori.adventure.text.Component message) {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix PlayerBucketEmptyEvent result itemstack
Fixes SPIGOT-2560: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-2560
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
index 5406acd65d4e1146f3bd7340ff9a1954a5c39ddb..a3f04f66c66f40068792da3ef0e75e7df102b0e0 100644
index 7c6c928da4e0f3ac54fa9b9ddce7b0e0bf3cce4b..73f1211470d9626c82c8345037da19aed9db3f23 100644
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
@@ -39,6 +39,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
@@ -40,6 +40,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
public class BucketItem extends Item implements DispensibleContainerItem {
@ -18,7 +18,7 @@ index 5406acd65d4e1146f3bd7340ff9a1954a5c39ddb..a3f04f66c66f40068792da3ef0e75e7d
public final Fluid content;
public BucketItem(Fluid fluid, Item.Properties settings) {
@@ -120,6 +122,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
@@ -121,6 +123,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
}
public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
@ -32,7 +32,7 @@ index 5406acd65d4e1146f3bd7340ff9a1954a5c39ddb..a3f04f66c66f40068792da3ef0e75e7d
return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack;
}
@@ -152,6 +161,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
@@ -153,6 +162,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
return false;
}

View File

@ -14,10 +14,10 @@ contention situations.
And this is extremely a low contention situation.
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index ea7b92b9ecb99bc995ab9a6ee5a974a0810778db..d886320211c7fa80960042c9b9ef4951eb34aaf1 100644
index 0a174b07e58f638e75a013552c964a9fb833d4cb..6800452604e0db660e8d5dca9778abd6e2f66478 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -32,14 +32,14 @@ public class PalettedContainer<T> implements PaletteResize<T> {
@@ -32,14 +32,14 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
private final T @org.jetbrains.annotations.Nullable [] presetValues; // Paper - Anti-Xray - Add preset values
private volatile PalettedContainer.Data<T> data;
private final PalettedContainer.Strategy strategy;
@ -34,8 +34,8 @@ index ea7b92b9ecb99bc995ab9a6ee5a974a0810778db..d886320211c7fa80960042c9b9ef4951
+ // this.threadingDetector.checkAndUnlock(); // Paper - disable this
}
// Paper start - Anti-Xray - Add preset values
@@ -113,7 +113,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
// Paper start
@@ -130,7 +130,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
@Override
@ -44,7 +44,7 @@ index ea7b92b9ecb99bc995ab9a6ee5a974a0810778db..d886320211c7fa80960042c9b9ef4951
PalettedContainer.Data<T> data = this.data;
// Paper start - Anti-Xray - Add preset values
@@ -160,7 +160,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
@@ -177,7 +177,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
return this.getAndSet(this.strategy.getIndex(x, y, z), value);
}
@ -53,7 +53,7 @@ index ea7b92b9ecb99bc995ab9a6ee5a974a0810778db..d886320211c7fa80960042c9b9ef4951
int i = this.data.palette.idFor(value);
int j = this.data.storage.getAndSet(index, i);
return this.data.palette.valueFor(j);
@@ -177,7 +177,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
@@ -194,7 +194,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
@ -62,7 +62,7 @@ index ea7b92b9ecb99bc995ab9a6ee5a974a0810778db..d886320211c7fa80960042c9b9ef4951
int i = this.data.palette.idFor(value);
this.data.storage.set(index, i);
}
@@ -200,7 +200,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
@@ -219,7 +219,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
});
}
@ -71,21 +71,21 @@ index ea7b92b9ecb99bc995ab9a6ee5a974a0810778db..d886320211c7fa80960042c9b9ef4951
this.acquire();
try {
@@ -218,7 +218,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
@@ -237,7 +237,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
// Paper start - Anti-Xray - Add chunk packet info
@Deprecated public void write(FriendlyByteBuf buf) { this.write(buf, null, 0); } // Notice for updates: Please make sure this method isn't used anywhere
@Override @Deprecated public void write(FriendlyByteBuf buf) { this.write(buf, null, 0); } // Notice for updates: Please make sure this method isn't used anywhere
- public void write(FriendlyByteBuf buf, @Nullable com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int bottomBlockY) {
+ public synchronized void write(FriendlyByteBuf buf, @Nullable com.destroystokyo.paper.antixray.ChunkPacketInfo<T> chunkPacketInfo, int bottomBlockY) { // Paper - synchronize
this.acquire();
try {
@@ -275,7 +275,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
return DataResult.success(new PalettedContainer<>(idList, provider, configuration, bitStorage, list, defaultValue, presetValues)); // Paper - Anti-Xray - Add preset values
@@ -295,7 +295,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
- private PalettedContainer.DiscData<T> write(IdMap<T> idList, PalettedContainer.Strategy provider) {
+ private synchronized PalettedContainer.DiscData<T> write(IdMap<T> idList, PalettedContainer.Strategy provider) { // Paper - synchronize
@Override
- public PalettedContainerRO.PackedData<T> pack(IdMap<T> idMap, PalettedContainer.Strategy strategy) {
+ public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> idMap, PalettedContainer.Strategy strategy) { // Paper - synchronize
this.acquire();
PalettedContainer.DiscData var12;
PalettedContainerRO.PackedData var12;

View File

@ -19,10 +19,10 @@ index b03c38b62b15b31477e22ba0ed45236ea8ee8970..36f22f7a02341d16d69ce1c7e14cbe50
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index b56d1229333bb86433d6691f1116f2d195c4b16b..336d753bbd836e2a08207c5e3d41acbe2b72543f 100644
index 3364316079dba81778869380b70e621cb9ac6269..3b70e37140531884397696760dd9ef597c4655bc 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -241,6 +241,14 @@ public class ItemEntity extends Entity {
@@ -251,6 +251,14 @@ public class ItemEntity extends Entity {
ItemEntity entityitem = (ItemEntity) iterator.next();
if (entityitem.isMergable()) {

View File

@ -66,7 +66,7 @@ index 78b0456a3f9e3f66d467386c3e5f68d07adf1977..d8c4f36ae0e65c6d0398fac80c93b786
}
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
index 4d24566f6297813e040333fdfd1e3e2aae6a4004..c7e9bed9cfb22b4ada906540434f9c0eff1d53ab 100644
index 8e51c2bc6dc6483b2c670348daf793ca4d59e5b9..94209f8c02656c113b537093cbbfaba1b9871045 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
@@ -99,6 +99,7 @@ public class SpikeFeature extends Feature<SpikeConfiguration> {

View File

@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Fri, 19 Mar 2021 23:39:09 -0400
Subject: [PATCH] Add ElderGuardianAppearanceEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
index 0b6c6740e1411a558d224589b3786f3ba8e0a1bc..0da2eecda83ba4e4acd4dd0603c77066d4fd060f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
@@ -70,7 +70,9 @@ public class ElderGuardian extends Guardian {
List<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround((ServerLevel) this.level, this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
list.forEach((entityplayer) -> {
+ if (new io.papermc.paper.event.entity.ElderGuardianAppearanceEvent(getBukkitEntity(), entityplayer.getBukkitEntity()).callEvent()) { // Paper - Add Guardian Appearance Event
entityplayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
+ } // Paper
});
}

View File

@ -11,10 +11,10 @@ Move the tick logic into the post tick, where portaling was
designed to happen in the first place.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c14cbbf7d88d99bf5f24aad5c45fcb1504187a16..468fffe6dbecbf276fbcac92a3345625b5218f34 100644
index 7d699878267293a6bb3183c218662144706f4abe..27846c6b42602a6e23031f79b05ae832c6a76061 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -397,6 +397,36 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -418,6 +418,36 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this));
}
// Paper end - optimise entity tracking
@ -51,7 +51,7 @@ index c14cbbf7d88d99bf5f24aad5c45fcb1504187a16..468fffe6dbecbf276fbcac92a3345625
public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -2535,6 +2565,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2583,6 +2613,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
this.processPortalCooldown();
@ -60,7 +60,7 @@ index c14cbbf7d88d99bf5f24aad5c45fcb1504187a16..468fffe6dbecbf276fbcac92a3345625
}
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
index b8305112c759ecb62ef9ad972e57ff85ceff20dc..19892cb3cb290add4f094dc87bb22106e4f07a24 100644
index 150c16da7caa655cfc2c371d3336a8d7345438c6..15c5cccfe02c924c02f605eb47dd0b420b189891 100644
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -53,16 +53,10 @@ public class EndPortalBlock extends BaseEntityBlock {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Make item validations configurable
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index affede1bcd604ce2bb1f95b037e7d7acfe21cf91..5c1062f1f9578f2c728b0674eb3a1785b9c345b5 100644
index 39dada86032dce8573d1be40d13daca0e93e47be..1978f4bc9cf3ac5f24e6a558c50fd772b4ca2685 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -506,4 +506,19 @@ public class PaperConfig {
@@ -502,4 +502,19 @@ public class PaperConfig {
config.set("settings.unsupported-settings.allow-headless-pistons-readme", "This setting controls if players should be able to create headless pistons.");
allowHeadlessPistons = getBoolean("settings.unsupported-settings.allow-headless-pistons", false);
}
@ -56,7 +56,7 @@ index fefa4d83c5699be0b55794cd28d13d27b66ef108..182cd92b4322127a81d5f14e5d4fd156
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 24588933984cea75e983752ebd0c5643ff1e7846..1fe46049cc33c24db04fbfcde36ab275c03177bf 100644
index c475ddea1c995df1dfcaf4f491f341761a5f8802..bf3d6c613d905554d3faa73765a16774f43c6546 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -357,18 +357,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Line Of Sight Changes
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index b079f9cd9dd3c818b859010df74172a84eee544d..2e304d845878ff58a574c11dfa4424ba68991f64 100644
index aff3c2020a604942b5ba407156ebf5953ffa0377..1bd4f72a5c0aba38609cb34dcb94ff03809f853c 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3449,7 +3449,8 @@ public abstract class LivingEntity extends Entity {
@@ -3481,7 +3481,8 @@ public abstract class LivingEntity extends Entity {
Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
@ -19,10 +19,10 @@ index b079f9cd9dd3c818b859010df74172a84eee544d..2e304d845878ff58a574c11dfa4424ba
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 57b8c02dc8466dfc572719d72c9ff1fdefbbca4c..e996ffb6fd952208b1dabba8b470fd42f004919d 100644
index 84d84ceda1855bd1d11b2917c16fdb845a7600fe..d1fca0e3227b5f37c11367548be362f5a49b6a71 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -919,5 +919,16 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
@@ -944,5 +944,16 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
public org.bukkit.NamespacedKey getKey() {
return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(this.getHandle().getLevel().dimension().location());
}

View File

@ -44,7 +44,7 @@ index b68c2f46c7b595fe860f609b5681524ba310003e..1ae2e1599cb5b8612ca5b45c37367377
private void lightQueueSize() {
lightQueueSize = getInt("light-queue-size", lightQueueSize);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a557bc8b5fab1fb3516476793c965aa3c068edf9..047be408426750fcc4a84372e7250b749e747369 100644
index 792d660b10c841876a87625f8da1910a86542ec3..1274bc5324f8cbf1ae8d37190eafeb8cb9b6e233 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -205,6 +205,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix PlayerDropItemEvent using wrong item
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 045729440899e59bd023b3e84ef11f4d6682d10b..b88728889c2ebfc44bfa5032b1629817b4e7b45d 100644
index d78de27793ffca39a256accecd5033860ac23d1d..641bfb20197e6885c019aa825ff06980fb2f7ca8 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2180,7 +2180,7 @@ public class ServerPlayer extends Player {
@@ -2206,7 +2206,7 @@ public class ServerPlayer extends Player {
if (retainOwnership) {
if (!itemstack1.isEmpty()) {
@ -18,10 +18,10 @@ index 045729440899e59bd023b3e84ef11f4d6682d10b..b88728889c2ebfc44bfa5032b1629817
this.awardStat(Stats.DROP);
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index de0b885ebafecb37ef8be127362f76d487ff92ae..909f5c26ca149687c03688c33c241e549f19a3e9 100644
index b8077f26c8705b78ff7bd91a15bf6deac922b85b..8d8ecdbb8447a2d19cf380ae1f35291c3adf3300 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -713,6 +713,11 @@ public abstract class Player extends LivingEntity {
@@ -724,6 +724,11 @@ public abstract class Player extends LivingEntity {
}
double d0 = this.getEyeY() - 0.30000001192092896D;

View File

@ -7,10 +7,10 @@ Co-authored-by: Nassim Jahnke <jahnke.nassim@gmail.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index c49e7ea3e2efc4459f5ed1d4ebd83c9d23420611..79a9fa2a2257925685e45329365d2828ccd4c48c 100644
index d13f3460644f635ded96bf92ddf9ecf8984c8e47..bd048cc30046f19f9eee89c6ba45d0816a160e67 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -539,11 +539,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -540,11 +540,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
this.setFlag(4, hasStung);
}
@ -25,10 +25,10 @@ index c49e7ea3e2efc4459f5ed1d4ebd83c9d23420611..79a9fa2a2257925685e45329365d2828
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index cd278a859c87fc89c421378ffab1bd36a45bd65d..a726006888bbbdb290bcda3ac4fd45d68ba51b79 100644
index 04a119e6641898454253e2478bc1b4dff181b5ee..a8da601b8342aa6e4902b452eb588c76c98a7adf 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -660,6 +660,14 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@@ -663,6 +663,14 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
}
@ -43,7 +43,7 @@ index cd278a859c87fc89c421378ffab1bd36a45bd65d..a726006888bbbdb290bcda3ac4fd45d6
private void openMouth() {
if (!this.level.isClientSide) {
this.mouthCounter = 1;
@@ -672,6 +680,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@@ -675,6 +683,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
this.setFlag(16, eatingGrass);
}
@ -81,10 +81,10 @@ index 32b302aad0319ce3ee412912425c1c8db9979f8a..92734f767fde60351a179a88350a97b8
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 4920f5465298b4da33b53f80b8af6220cb0e8ccc..411eb4d495907aa1d646673bf07d56ff01e52eee 100644
index e0e32528ed9f2f494b5ee2079c3167021f2e84c4..f22e615dba31619c97bf58930da060476a52facf 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -429,6 +429,16 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -433,6 +433,16 @@ public class EnderMan extends Monster implements NeutralMob {
this.entityData.set(EnderMan.DATA_STARED_AT, true);
}
@ -102,7 +102,7 @@ index 4920f5465298b4da33b53f80b8af6220cb0e8ccc..411eb4d495907aa1d646673bf07d56ff
public boolean requiresCustomPersistence() {
return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ghast.java b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
index f834e96c48cce6af65a65dafcdeb2cf0ea12763a..77a5f8339df5a46967713b51570735de828f0b49 100644
index 1f3506d38894fea224f3b2f125b45c3b68d705c7..bb2cb17e4e5ce142eeec18951c8948e3d6b3209c 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ghast.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
@@ -66,6 +66,12 @@ public class Ghast extends FlyingMob implements Enemy {
@ -212,10 +212,10 @@ index 8ada3dfbe89c8b55d85c31c71e365af0cbf66d19..b5d3a00a48d3b7618f974bb0f6909aa7
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
index a4f909123de26d911aea7cd767d2315ed1f697c9..0eee53c068bca070a86645d0ba54fb1ad49a6a5b 100644
index 37352ca3ff267d02a26ed182ce3df3ef775fa9bc..6a504f61c55d3983871f8d1c5c002c7a7b9c50ff 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
@@ -49,4 +49,25 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
@@ -51,4 +51,25 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
public void setCollarColor(DyeColor color) {
this.getHandle().setCollarColor(net.minecraft.world.item.DyeColor.byId(color.getWoolData()));
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0a018328dfe2b73f962a1939786b9025ba0ebabe..f2be24d87cbd7aaaa518d0d1aab8652ed2493694 100644
index 338a026b283de5e83428073b8debb5cfca07f653..7c4d962b71d8119f0310435a519ab61412b8d969 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1114,7 +1114,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1145,7 +1145,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper end
// CraftBukkit start
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {

View File

@ -8,10 +8,10 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case).
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 958949d972fd7b8ae61041bfe15c21d4d19d9573..384222f321f1678803d62187b76bf3dee1970c0c 100644
index e0a5e978d584bcc0e692806b3d80d01710526eb3..62bb1fd46e4dff43e9c83c05260c7deaffe445a9 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -215,7 +215,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -220,7 +220,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
@ -20,11 +20,20 @@ index 958949d972fd7b8ae61041bfe15c21d4d19d9573..384222f321f1678803d62187b76bf3de
}
@Override
@@ -1433,7 +1433,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
for (int l1 = j; l1 <= i1; ++l1) {
for (int i2 = l; i2 <= k1; ++i2) {
- LevelChunk chunk = this.getChunkSource().getChunkNow(l1, i2);
+ LevelChunk chunk = (LevelChunk) this.getChunkIfLoadedImmediately(l1, i2); // Paper
if (chunk != null) {
for (int j2 = k; j2 <= j1; ++j2) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index c3ae2b4b5b4eb14d24f2c15a7e8ace8ebee84c1a..c293531a6913b365c3bf804d6d0bfae24378dc43 100644
index 474b1dc68e138fb3fcca8c846d50fa2c04f74fd5..7a378def3702bc3e2fd20d422ec38e20d4083574 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -189,6 +189,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -195,6 +195,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return (CraftServer) Bukkit.getServer();
}
@ -37,13 +46,4 @@ index c3ae2b4b5b4eb14d24f2c15a7e8ace8ebee84c1a..c293531a6913b365c3bf804d6d0bfae2
+
public abstract ResourceKey<LevelStem> getTypeKey();
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
@@ -1366,7 +1373,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
for (int l1 = j; l1 <= l; ++l1) {
for (int i2 = k; i2 <= i1; ++i2) {
- LevelChunk chunk = this.getChunkSource().getChunkNow(l1, i2);
+ LevelChunk chunk = (LevelChunk) this.getChunkIfLoadedImmediately(l1, i2); // Paper
if (chunk != null) {
for (int j2 = j1; j2 <= k1; ++j2) {
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor

View File

@ -72,7 +72,7 @@ index 0000000000000000000000000000000000000000..1f6747d7a4c33f0ee7b0dc2120081bb8
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index 615c4f9d9841f7ddc3e5c854e90f41c3905c2e8f..6371176fba41218a209ea59b4cafe5b2d4a685fd 100644
index 831db5ee21938d71e99bf9d17b92a6ca15531740..d7ecd6c7d28f88d67430bee6b586307fda98a92e 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -40,6 +40,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@ -83,11 +83,10 @@ index 615c4f9d9841f7ddc3e5c854e90f41c3905c2e8f..6371176fba41218a209ea59b4cafe5b2
public SignBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityType.SIGN, pos, state);
@@ -224,7 +225,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
ClickEvent chatclickable = chatmodifier.getClickEvent();
@@ -225,6 +226,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
if (chatclickable != null && chatclickable.getAction() == ClickEvent.Action.RUN_COMMAND) {
- player.getServer().getCommands().performCommand(this.createCommandSourceStack(player), chatclickable.getValue());
player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(player), chatclickable.getValue());
+ // Paper start
+ String command = chatclickable.getValue().startsWith("/") ? chatclickable.getValue() : "/" + chatclickable.getValue();
+ if (org.spigotmc.SpigotConfig.logCommands) {
@ -102,9 +101,9 @@ index 615c4f9d9841f7ddc3e5c854e90f41c3905c2e8f..6371176fba41218a209ea59b4cafe5b2
}
}
@@ -260,8 +271,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@@ -260,8 +272,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
String s = player == null ? "Sign" : player.getName().getString();
Object object = player == null ? new TextComponent("Sign") : player.getDisplayName();
Object object = player == null ? Component.literal("Sign") : player.getDisplayName();
+ // Paper start - send messages back to the player
+ CommandSource commandSource = this.level.paperConfig.showSignClickCommandFailureMessagesToPlayer ? new io.papermc.paper.commands.DelegatingCommandSource(this) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Adds PlayerArmSwingEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index f2be24d87cbd7aaaa518d0d1aab8652ed2493694..62c429b2df9b0d5dc8dbd867f60f9b6cdfb9532c 100644
index 7c4d962b71d8119f0310435a519ab61412b8d969..ab4d0a34b32a3bdf61cebe29518838b4f2a3a9e0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2262,7 +2262,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2436,7 +2436,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
// Arm swing animation

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fixes kick event leave message not being sent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b88728889c2ebfc44bfa5032b1629817b4e7b45d..b49dd352f6d8d27ab97fd0d69cf4001039ae577e 100644
index 641bfb20197e6885c019aa825ff06980fb2f7ca8..5bd66fab9231a2be14d3586cfdad86f22abeb0db 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -251,7 +251,6 @@ public class ServerPlayer extends Player {
@@ -258,7 +258,6 @@ public class ServerPlayer extends Player {
public boolean supressTrackerForLogin = false; // Paper
public boolean didPlayerJoinEvent = false; // Paper
public Integer clientViewDistance;
@ -17,10 +17,10 @@ index b88728889c2ebfc44bfa5032b1629817b4e7b45d..b49dd352f6d8d27ab97fd0d69cf40010
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 62c429b2df9b0d5dc8dbd867f60f9b6cdfb9532c..d23ebb6ee187eaa657fd6fa255f66b4095090b6d 100644
index ab4d0a34b32a3bdf61cebe29518838b4f2a3a9e0..bd784585238f80d6d28a56c98173bc4b9f638112 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -447,7 +447,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -473,7 +473,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Do not kick the player
return;
}
@ -28,7 +28,7 @@ index 62c429b2df9b0d5dc8dbd867f60f9b6cdfb9532c..d23ebb6ee187eaa657fd6fa255f66b40
// Send the possibly modified leave message
final Component ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end
@@ -456,7 +455,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -482,7 +481,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), (future) -> {
this.connection.disconnect(ichatbasecomponent);
});
@ -37,7 +37,7 @@ index 62c429b2df9b0d5dc8dbd867f60f9b6cdfb9532c..d23ebb6ee187eaa657fd6fa255f66b40
this.connection.setReadOnly();
MinecraftServer minecraftserver = this.server;
Connection networkmanager = this.connection;
@@ -1909,6 +1908,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1927,6 +1926,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override
public void onDisconnect(Component reason) {
@ -49,17 +49,17 @@ index 62c429b2df9b0d5dc8dbd867f60f9b6cdfb9532c..d23ebb6ee187eaa657fd6fa255f66b40
// CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) {
return;
@@ -1925,7 +1929,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1943,7 +1947,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.disconnect();
// Paper start - Adventure
- net.kyori.adventure.text.Component quitMessage = this.server.getPlayerList().remove(this.player);
+ quitMessage = quitMessage == null ? this.server.getPlayerList().remove(this.player) : this.server.getPlayerList().remove(this.player, quitMessage); // Paper - pass in quitMessage to fix kick message not being used
if ((quitMessage != null) && !quitMessage.equals(net.kyori.adventure.text.Component.empty())) {
this.server.getPlayerList().broadcastMessage(PaperAdventure.asVanilla(quitMessage), ChatType.SYSTEM, Util.NIL_UUID);
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), ChatType.SYSTEM);
// Paper end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3198291eaf12f8da4c138a1963db09f60381b4b6..c6f2ef6b12c699651aaefff0d0dbc20877ea5584 100644
index 3562532e446e3a6b2ecfc4aa37693b3a4ec6af47..30c3a7c566b6cdc83695a36f03f1ff155a8eae20 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -591,6 +591,11 @@ public abstract class PlayerList {

View File

@ -31,10 +31,10 @@ index 0731dcc367b621b18c2435db053645e9f9af2a80..b7d30804bfd4f9a2f379f5b77dcb6ae7
private void nerfNetherPortalPigmen() {
nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 2e304d845878ff58a574c11dfa4424ba68991f64..b2a561ec99af75188eb0141abb36bb42f37f7185 100644
index 1bd4f72a5c0aba38609cb34dcb94ff03809f853c..a6a8b6e50d23b046c8696f141af528f569a84ce9 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1130,7 +1130,7 @@ public abstract class LivingEntity extends Entity {
@@ -1153,7 +1153,7 @@ public abstract class LivingEntity extends Entity {
if (this.getMobType() == MobType.UNDEAD) {
MobEffect mobeffectlist = effect.getEffect();
@ -57,7 +57,7 @@ index 92734f767fde60351a179a88350a97b861be0e88..d347ab0a638a972ea53a982f29af4042
private class WitherDoNothingGoal extends Goal {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
index a3cb44914ef7d8636e743baa361a1a09ceeb2207..05b6c07c0705c7d8741c77baa87982e8e278dc97 100644
index 46779380f44a037d3915f287f40515a9bd31a439..694643c8ee7447da01ae02ca242338dbdbb3412a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
@@ -133,7 +133,7 @@ public class Spider extends Monster {
@ -70,10 +70,10 @@ index a3cb44914ef7d8636e743baa361a1a09ceeb2207..05b6c07c0705c7d8741c77baa87982e8
public boolean isClimbing() {
diff --git a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
index c727bbf7de71213fba410625c4a7ad90315b608a..6acc46c3a6fe7648d2cc4d0aaef063633c74c20d 100644
index ea6233cb3ca30864e54d553a5d1071ea9147a868..c65319caa4bf95bd1d3bc41811b9cd401cc5c705 100644
--- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
@@ -122,6 +122,6 @@ public class WitherSkeleton extends AbstractSkeleton {
@@ -123,6 +123,6 @@ public class WitherSkeleton extends AbstractSkeleton {
@Override
public boolean canBeAffected(MobEffectInstance effect) {

View File

@ -5,15 +5,15 @@ Subject: [PATCH] Fix incorrect message for outdated client
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index e76b9670213de966ee275e624e7ee5f673d3f210..e8a79277f3e57bc82d67ada6543c7f8665311bd3 100644
index 95340e4067ff1cbc9539615adb260377a5187cb7..bf5a36ccb0a7dc10328c67f97e634661ce4c1b0e 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -81,7 +81,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@@ -80,7 +80,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
if (packet.getProtocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
Component chatmessage; // Paper - Fix hex colors not working in some kick messages
Component ichatmutablecomponent; // Paper - Fix hex colors not working in some kick messages
- if (packet.getProtocolVersion() < 754) {
+ if (packet.getProtocolVersion() < SharedConstants.getCurrentVersion().getProtocolVersion()) { // Paper - Fix incorrect message for outdated clients
chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) , true )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages
ichatmutablecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) , true )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages
} else {
chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) , true )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages
ichatmutablecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) , true )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages

View File

@ -25,10 +25,10 @@ index b7d30804bfd4f9a2f379f5b77dcb6ae7446a76e9..b05b400dbee7963c48478368bd4950f2
+ }
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b49dd352f6d8d27ab97fd0d69cf4001039ae577e..9e774df7b0846a8d4b22914eb5e4b09d621a9a2c 100644
index 5bd66fab9231a2be14d3586cfdad86f22abeb0db..69dc85f2f0082331b43b7acb23e4cf447d318c40 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1438,7 +1438,7 @@ public class ServerPlayer extends Player {
@@ -1447,7 +1447,7 @@ public class ServerPlayer extends Player {
@Override
public boolean isInvulnerableTo(DamageSource damageSource) {

View File

@ -101,7 +101,7 @@ index b05b400dbee7963c48478368bd4950f2910b69bc..d1a00ef7ef9ffe4f474ce3d5513df912
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
index bc4aab719d42e6d17585e6492b873f801e5d75cf..dcd76598ca41fbed8fb4e62118552659f8cb605c 100644
index ea5dea8fc6af73afb3b9f79bcb254e1644a3b302..36e9db7c2f70a9d35f5bc31d4dd611726dcee38f 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
@@ -13,6 +13,10 @@ public abstract class Behavior<E extends LivingEntity> {
@ -166,7 +166,7 @@ index bc4aab719d42e6d17585e6492b873f801e5d75cf..dcd76598ca41fbed8fb4e62118552659
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
index c940a910a435b20297eca493c7b27fd69be54e86..f3b8e253a5bfc3f68121dbe656ae7e2ac0f0eb1c 100644
index 7970eebbd6935402223e6bba962bb8ba7d861dfd..f661864c332a76f8c5b54bbf69e10516c7ece6ea 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
@@ -19,8 +19,21 @@ public abstract class Sensor<E extends LivingEntity> {

View File

@ -19,7 +19,7 @@ index e47f3092b6bd6b86b577de705db1a575d0952348..490212cfe4e5cea7219eaf4304e14bfa
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
index 306aa8c36be92d66ebcc6b7e0dbb9dee6ec41a9b..8db4fc59b99694d2b15af188fc1c39ccf0090a8d 100644
index 9c07e3f5554b3b9cf2a2c4d9239a72342567d7f1..39c26f486d6392eb0a9b623cdb2161846357174b 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -522,7 +522,9 @@ public class Panda extends Animal {
@ -33,10 +33,10 @@ index 306aa8c36be92d66ebcc6b7e0dbb9dee6ec41a9b..8db4fc59b99694d2b15af188fc1c39cc
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
index 0caf8e2cf42b83f1c62fa8c08f8cf86951be2827..63cfda124b5bad20af3050a0b62d73883b6abf7d 100644
index d733bcf1049a21009c2548679a51563c15f79523..793576928dad6752dddd86e62d4c0800d8515fc4 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -305,7 +305,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@@ -306,7 +306,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void finishConversion(ServerLevel world) {
PiglinAi.cancelAdmiring(this);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix incosistency issue with empty map items in CB
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index 6f86f00d33cd50a2b67409c2f0f5400c869b802a..b714417cb3712a8f1d9bbdd47cff66436a49ba07 100644
index d407cf849a31a7a77fda07aa687ebb254f43d6ab..45a7e01288f780cf8a812d8e0ae12c4fb79d79e1 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -70,7 +70,7 @@ public class MapItem extends ComplexItem {
@@ -71,7 +71,7 @@ public class MapItem extends ComplexItem {
public static Integer getMapId(ItemStack stack) {
CompoundTag nbttagcompound = stack.getTag();

View File

@ -105,10 +105,10 @@ index 0000000000000000000000000000000000000000..76d0d00cd6742991e3f3ec827a75ee87
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 20025b1e3c749ef3c164041e519a53b39a7a9b7d..538e5663e7e23a1bcc2c832930d4c1489a48c07a 100644
index 59e1303353e029ee754bde2e43f2bca622154381..9486c53285fabb2d72b2bc3881673cd6640bd50e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -283,6 +283,7 @@ public final class CraftServer implements Server {
@@ -278,6 +278,7 @@ public final class CraftServer implements Server {
public int reloadCount;
private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper
public static Exception excessiveVelEx; // Paper - Velocity warnings

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Improve boat collision performance
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 47fcfb1e5b65ce2ae3fcdfc5eecf3a1cf4a8d67f..c506b837d0f8b49fa65efe7ff80dd64c2d653e35 100644
index 70b8b86ed827217e536e35a690160adf9e974bb5..5f9e3d37c3ba79d26806374d73f87328cebb562d 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -84,6 +84,7 @@ public class Util {
@@ -94,6 +94,7 @@ public class Util {
}).findFirst().orElseThrow(() -> {
return new IllegalStateException("No jar file system provider found");
});
@ -17,10 +17,10 @@ index 47fcfb1e5b65ce2ae3fcdfc5eecf3a1cf4a8d67f..c506b837d0f8b49fa65efe7ff80dd64c
};
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index b2a561ec99af75188eb0141abb36bb42f37f7185..d49d9d60a839d5ac5d67a677fcbae2897e54dada 100644
index a6a8b6e50d23b046c8696f141af528f569a84ce9..a32aa337c890eabeb400903df153aff323bc8645 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1318,7 +1318,7 @@ public abstract class LivingEntity extends Entity {
@@ -1341,7 +1341,7 @@ public abstract class LivingEntity extends Entity {
if (!source.isProjectile()) {
Entity entity = source.getDirectEntity();
@ -29,7 +29,7 @@ index b2a561ec99af75188eb0141abb36bb42f37f7185..d49d9d60a839d5ac5d67a677fcbae289
this.blockUsingShield((LivingEntity) entity);
}
}
@@ -1426,11 +1426,12 @@ public abstract class LivingEntity extends Entity {
@@ -1449,11 +1449,12 @@ public abstract class LivingEntity extends Entity {
}
if (entity1 != null) {
@ -44,7 +44,7 @@ index b2a561ec99af75188eb0141abb36bb42f37f7185..d49d9d60a839d5ac5d67a677fcbae289
d0 = (Math.random() - Math.random()) * 0.01D;
}
@@ -2109,7 +2110,7 @@ public abstract class LivingEntity extends Entity {
@@ -2141,7 +2142,7 @@ public abstract class LivingEntity extends Entity {
this.hurtCurrentlyUsedShield((float) -event.getDamage(DamageModifier.BLOCKING));
Entity entity = damagesource.getDirectEntity();
@ -54,10 +54,10 @@ index b2a561ec99af75188eb0141abb36bb42f37f7185..d49d9d60a839d5ac5d67a677fcbae289
}
}
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
index a8f37fab9c8020e884bf029145d03e3be57b7f2b..0dbc85c450797d7384e641f80e1b1f8c56fd14fc 100644
index ae069489eeb52489e69c10207739f07f867c58e4..4642012c72cb77302f69c808d73d8d42e8bbc39e 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -686,8 +686,8 @@ public class Boat extends Entity {
@@ -691,8 +691,8 @@ public class Boat extends Entity {
this.invFriction = 0.05F;
if (this.oldStatus == Boat.Status.IN_AIR && this.status != Boat.Status.IN_AIR && this.status != Boat.Status.ON_LAND) {
this.waterLevel = this.getY(1.0D);

View File

@ -5,15 +5,15 @@ Subject: [PATCH] Prevent AFK kick while watching end credits.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d23ebb6ee187eaa657fd6fa255f66b4095090b6d..eeb21a890480f5cae2a25a4af215bd56778b83e5 100644
index bd784585238f80d6d28a56c98173bc4b9f638112..8ceae524899d6aa739f358b8c88968fb4df56481 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -387,7 +387,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -412,7 +412,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
--this.dropSpamTickCount;
}
- if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60)) {
+ if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60) && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits.
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(new TranslatableComponent("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerSetSpawnEvent
diff --git a/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java b/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
index e95f2222814e104bf9194a96385737dffe2cb2b5..dd6b78d94dcd16c0a708dbc1764e24e9dbe4d3b1 100644
index ce1c7512cc368e196ae94ee22c6a228c975b4980..1e41de9523c5fa3b9cfced798a5c35a24ec9d349 100644
--- a/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
+++ b/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
@@ -32,9 +32,21 @@ public class SetSpawnCommand {
@ -32,10 +32,10 @@ index e95f2222814e104bf9194a96385737dffe2cb2b5..dd6b78d94dcd16c0a708dbc1764e24e9
String string = resourceKey.location().toString();
if (targets.size() == 1) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 9e774df7b0846a8d4b22914eb5e4b09d621a9a2c..c8be2fa8c0b39e7b02d5214551e13b49af0c4730 100644
index 69dc85f2f0082331b43b7acb23e4cf447d318c40..a39a387a744ec1f63c06fc05b431983a6e8bf70a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1279,7 +1279,7 @@ public class ServerPlayer extends Player {
@@ -1288,7 +1288,7 @@ public class ServerPlayer extends Player {
} else if (this.bedBlocked(blockposition, enumdirection)) {
return Either.left(Player.BedSleepingProblem.OBSTRUCTED);
} else {
@ -44,7 +44,7 @@ index 9e774df7b0846a8d4b22914eb5e4b09d621a9a2c..c8be2fa8c0b39e7b02d5214551e13b49
if (this.level.isDay()) {
return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW);
} else {
@@ -2107,12 +2107,33 @@ public class ServerPlayer extends Player {
@@ -2133,12 +2133,33 @@ public class ServerPlayer extends Player {
return this.respawnForced;
}
@ -74,13 +74,13 @@ index 9e774df7b0846a8d4b22914eb5e4b09d621a9a2c..c8be2fa8c0b39e7b02d5214551e13b49
+ // Paper end
- if (sendMessage && !flag2) {
- this.sendMessage(new TranslatableComponent("block.minecraft.set_spawn"), Util.NIL_UUID);
- this.sendSystemMessage(Component.translatable("block.minecraft.set_spawn"));
+ if (event.willNotifyPlayer() && event.getNotification() != null) { // Paper
+ this.sendMessage(PaperAdventure.asVanilla(event.getNotification()), Util.NIL_UUID); // Paper
+ this.sendSystemMessage(PaperAdventure.asVanilla(event.getNotification())); // Paper
}
this.respawnPosition = pos;
@@ -2126,6 +2147,7 @@ public class ServerPlayer extends Player {
@@ -2152,6 +2173,7 @@ public class ServerPlayer extends Player {
this.respawnForced = false;
}
@ -89,7 +89,7 @@ index 9e774df7b0846a8d4b22914eb5e4b09d621a9a2c..c8be2fa8c0b39e7b02d5214551e13b49
public void trackChunk(ChunkPos chunkPos, Packet<?> chunkDataPacket) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c6f2ef6b12c699651aaefff0d0dbc20877ea5584..6b3ab58a4446e9ce6f91f870ef8b2511522e0da0 100644
index 30c3a7c566b6cdc83695a36f03f1ff155a8eae20..ed0e162c39f1f1ed9b02cdb2fc353a3fcbe79182 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -895,13 +895,13 @@ public abstract class PlayerList {
@ -109,7 +109,7 @@ index c6f2ef6b12c699651aaefff0d0dbc20877ea5584..6b3ab58a4446e9ce6f91f870ef8b2511
}
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
index bc7859ea6e9eb9b4f82d51a228034d60d4662f62..491ad2098e982f3c947fcae6f258f0b1aa44a562 100644
index c3e49a781f838e6a46cb89744f3f1846de182275..c2f3d3a09327e7cb7d3167609eb3ce68eadf6443 100644
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
@@ -72,9 +72,14 @@ public class RespawnAnchorBlock extends Block {
@ -129,10 +129,10 @@ index bc7859ea6e9eb9b4f82d51a228034d60d4662f62..491ad2098e982f3c947fcae6f258f0b1
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a18af13204792e37f81d57cda8123aaa394e1050..818e9f36f5e19bd160cf7ee0805f6337a418bce5 100644
index 720ccaa64293b075c893f1e4f64a35e0fc43b869..4b3dd5ac0a238966dce53dc7523ec2a2f753a6e7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1200,9 +1200,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1197,9 +1197,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setBedSpawnLocation(Location location, boolean override) {
if (location == null) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Make hoppers respect inventory max stack size
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
index ae680111d01470881e5dc4914cc7e8e82a463aaa..d241b25acc223982109495542fd17e0fbdf53437 100644
index 80ca90806bc1e52b6995ba287bc4195617aa9e67..b030bc64abc73607d3df651fec727654df09a4f9 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
@@ -587,17 +587,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
@@ -586,17 +586,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
if (itemstack1.isEmpty()) {
// Spigot start - SPIGOT-6693, InventorySubcontainer#setItem

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Optimize entity tracker passenger checks
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 1a4350b40d15edba998e3dee5f16cde4e9f50759..5128efe19f57278ebc8540f3a614cebc27dbd3b0 100644
index 2c43304fd7a189f399f0e7757dbd593f3f462c37..98142edeb105e213545b47ba1addf2e6f799861c 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -73,7 +73,7 @@ public class ServerEntity {
@@ -71,7 +71,7 @@ public class ServerEntity {
this.trackedPlayers = trackedPlayers;
// CraftBukkit end
this.ap = Vec3.ZERO;

View File

@ -21,7 +21,7 @@ index d1a00ef7ef9ffe4f474ce3d5513df912faacf871..ebc8ffcf19a1eb8e1e318df3aca6cc80
VANILLA, EIGENCRAFT
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
index 65480f1ee70a55abbb35a88388d9161e366765a5..57f593e5f797d646ceb70fa61ec2e966cf4dabc1 100644
index 8aecd15cfb915f44bc6208b656e7db309270c132..0ca5ff8a85a17009ab53afc4d0487683c4af9d47 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
@@ -463,6 +463,7 @@ public class PiglinAi {

View File

@ -1,23 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Fri, 19 Mar 2021 23:39:09 -0400
Subject: [PATCH] Add ElderGuardianAppearanceEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
index 854ef7895f044087ab4d74bc6952d2987cfe2460..ee9194ffb3cc6d660d4f99a3914ede7e4a3643fe 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
@@ -77,10 +77,12 @@ public class ElderGuardian extends Guardian {
while (iterator.hasNext()) {
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
+ if (new io.papermc.paper.event.entity.ElderGuardianAppearanceEvent(getBukkitEntity(), entityplayer.getBukkitEntity()).callEvent()) { // Paper - Add Guardian Appearance Event
if (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) {
entityplayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
entityplayer.addEffect(new MobEffectInstance(mobeffectlist, 6000, 2), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
}
+ } // Paper - Add Guardian Appearance Event
}
}