3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

finished some more patches

Dieser Commit ist enthalten in:
Jake Potrebic 2023-06-07 18:13:54 -07:00
Ursprung 236eabd751
Commit 1eba407610
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5
45 geänderte Dateien mit 219 neuen und 214 gelöschten Zeilen

Datei anzeigen

@ -9,14 +9,14 @@ till their item is switched.
This patch clears the active item when the event is cancelled
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 7ce102e7a28b70d1ffeb3a433b927f49fc4d5904..3613422aeb87b83d04fde7341a01d4994a0a3b07 100644
index 7952ba7e7e9f36fe6dea851dbc239d39ff61a74a..4ad927541de2f5af9121d17b4f8b359049ee2000 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3774,6 +3774,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
level.getCraftServer().getPluginManager().callEvent(event);
@@ -3808,6 +3808,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.level().getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
+ this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use
+ this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use
// Update client
((ServerPlayer) this).getBukkitEntity().updateInventory();
((ServerPlayer) this).getBukkitEntity().updateScaledHealth();

Datei anzeigen

@ -8,11 +8,11 @@ Paper.bypassHostCheck
Seriously, fix your firewalls. -.-
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index ebb964aa4d6c3e98cb6da54f68370a155658b169..7675adce108df5790a34f90145a8fabcf9704c0f 100644
index 4fb1fde4983d81cc35e2c8717984d929460959b8..50c79be12cf8778a2ce451a8c9bb2cdc277d6830 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -30,6 +30,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
private static final Component IGNORE_STATUS_REASON = Component.literal("Ignoring status request");
private static final Component IGNORE_STATUS_REASON = Component.translatable("disconnect.ignoring_status_request");
private final MinecraftServer server;
private final Connection connection;
+ private static final boolean BYPASS_HOSTCHECK = Boolean.getBoolean("Paper.bypassHostCheck"); // Paper

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Set area affect cloud rotation
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 287dd68f1aa78bf5f1406f585e4a657563d6116c..f01c6f684da1438808f018fe9a814ecaceb49b2f 100644
index cb7ceaaaf4e8deec78962660298fa5316f8c5a63..5bd5a059c5beeade313f74ba3c1fc63825bd286b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -956,6 +956,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] add isDeeplySleeping to HumanEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index ffd07d9751deb87902213a3349bcb398ee281640..86b5532b3be5484c68152a777b976bc44008b0df 100644
index 15da552a8c085286fe412fffa654b338237ee3f4..48efd9277d9010df1206ccfac9623d66d8046825 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -133,6 +133,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] add consumeFuel to FurnaceBurnEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 7558ae098b242ea7e647055acfe253b95b00d498..5e70b5f643faabfc05989de9592d8c5c787102e3 100644
index d1eff8a4c83227d74502b5924df43f87c457a537..436290eaa0dab05a642b67b265117dbe5eceb8b7 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -358,7 +358,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] fix PigZombieAngerEvent cancellation
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
index 9620449fb938ad0029b1d126431f15a2994fe332..b75945807b425609394c343da56c316a769f0a29 100644
index f1d4a66aa55c4328fe6f834830d70686c95bea51..aff140cfb2bbdce8b512080cf394c84c5c4ff807 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
@@ -56,6 +56,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
@ -26,7 +26,7 @@ index 9620449fb938ad0029b1d126431f15a2994fe332..b75945807b425609394c343da56c316a
this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true));
}
@@ -184,6 +185,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
this.level.getCraftServer().getPluginManager().callEvent(event);
this.level().getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
this.setPersistentAngerTarget(null);
+ pathfinderGoalHurtByTarget.stop(); // Paper - clear goalTargets to fix cancellation

Datei anzeigen

@ -5,11 +5,11 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index f851b24fb6ea9de4d6533f526f40a2dad338e0cc..ba923fe09602440846520153ae1be9bdea70bb8f 100644
index 058a2a2d948b66afb8c70d75d2ce78e3bafcb504..1b43fd120f02f9bc09720d5d7b0411e1f381c3f5 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2041,6 +2041,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -2033,6 +2033,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.isImmobile()) return; // CraftBukkit
if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) {
+ if (packet.getSlot() == this.player.getInventory().selected) { return; } // Paper - don't fire itemheldevent when there wasn't a slot change

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Added PlayerDeepSleepEvent
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 a7dc305297d1a17291ffff40fe6c3bd7b8cc6bdb..532e2444e15e532d6be5f703bfa5de26c5bc3957 100644
index b36492efc3d6338e0099988c1ff31e7211b7d010..b3634a1d92182c746948862fc64b2e47d11320ba 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -251,6 +251,11 @@ public abstract class Player extends LivingEntity {
@@ -252,6 +252,11 @@ public abstract class Player extends LivingEntity {
if (this.isSleeping()) {
++this.sleepCounter;

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] More World API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 5c8270adf72114263d4e7b212201a7ea24bc95ae..d997691ab27b94f3eccaa7669922e53396966087 100644
index 1df230d4c583604486359ea141051a7b75ebb73b..0fcc04f4a4838bd6bee948e10707b527903984de 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2081,6 +2081,69 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -2086,6 +2086,69 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value(), this.getHandle().registryAccess()), CraftLocation.toBukkit(found.getFirst(), this));
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Added PlayerBedFailEnterEvent
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
index daf8b7f491453d08718fe25b270ffc9c7de6e282..002575ac14697572602e3f622b7ed1c93eca04c3 100644
index efac034d07f4aadf5dc4ca8322e0dc7d861e6034..a605c9739ebc8e60bd668ff67c760cca9bd210dc 100644
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
@@ -110,14 +110,23 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
@@ -109,14 +109,23 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
BlockPos finalblockposition = pos;
// CraftBukkit end
player.startSleepInBed(pos).ifLeft((entityhuman_enumbedresult) -> {

Datei anzeigen

@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..dd6012b6a097575b2d1471be5069ecce
+ }
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index cf3db466459490fd09d9c82238f413a0cc24ab80..8eb18e794845a2e7df5e7e6bc11134e4d132e06e 100644
index 4de78e2ebd8cdc587e74f7eefd35faa29a54079e..6bd0e3acb2d1cac9f65fba4b7f986b6dc1e55504 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -209,6 +209,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Fix anchor respawn acting as a bed respawn from the end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 481f2f5dc2e62ae0bbdb8bbac5e8c3c5e090def7..71b2a7d1d09a4a9da8d9a2822ef1daa417d468d0 100644
index 3f6f946c5c4870826ae0749fcd1d816906f0f4c3..6a5d1bd5a02933902b9ed5e83bb06021ab490913 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -803,6 +803,7 @@ public abstract class PlayerList {
@@ -810,6 +810,7 @@ public abstract class PlayerList {
// Paper start
boolean isBedSpawn = false;
@ -17,7 +17,7 @@ index 481f2f5dc2e62ae0bbdb8bbac5e8c3c5e090def7..71b2a7d1d09a4a9da8d9a2822ef1daa4
boolean isRespawn = false;
boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
// Paper end
@@ -823,6 +824,7 @@ public abstract class PlayerList {
@@ -830,6 +831,7 @@ public abstract class PlayerList {
if (optional.isPresent()) {
BlockState iblockdata = worldserver1.getBlockState(blockposition);
boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
@ -25,7 +25,7 @@ index 481f2f5dc2e62ae0bbdb8bbac5e8c3c5e090def7..71b2a7d1d09a4a9da8d9a2822ef1daa4
Vec3 vec3d = (Vec3) optional.get();
float f1;
@@ -851,7 +853,7 @@ public abstract class PlayerList {
@@ -858,7 +860,7 @@ public abstract class PlayerList {
}
Player respawnPlayer = entityplayer1.getBukkitEntity();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Introduce beacon activation/deactivation events
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index b572643536c47f34362b086e46f581417fa1719e..79a7178ff474c516eada83f2be3e1bb0eacb368c 100644
index c9b0b0c3fd615bda5f6e633ec33a20751a25d8d9..da9e6b799923642e5ccb250affde386c6b3bd7f2 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -212,6 +212,15 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7167fefcc623b03d9936fd4e4c329f0a51a01537..e6cbeae6800d22017b1762eaf9465419fbbe925f 100644
index 1b43fd120f02f9bc09720d5d7b0411e1f381c3f5..8d8fa01795a99481d29d5d0d5382656dce676a6a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2781,7 +2781,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2773,7 +2773,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;
@ -18,10 +18,10 @@ index 7167fefcc623b03d9936fd4e4c329f0a51a01537..e6cbeae6800d22017b1762eaf9465419
} else {
if (this.player.getHealth() > 0.0F) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 71b2a7d1d09a4a9da8d9a2822ef1daa417d468d0..8883a3a0b28377bf3290adfc0353d2e65c70b828 100644
index 6a5d1bd5a02933902b9ed5e83bb06021ab490913..d7397f81d7f379d57f9271eaf5b91027676c273f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -762,6 +762,12 @@ public abstract class PlayerList {
@@ -769,6 +769,12 @@ public abstract class PlayerList {
}
public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
@ -34,7 +34,7 @@ index 71b2a7d1d09a4a9da8d9a2822ef1daa417d468d0..8883a3a0b28377bf3290adfc0353d2e6
entityplayer.stopRiding(); // CraftBukkit
this.players.remove(entityplayer);
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
@@ -853,7 +859,7 @@ public abstract class PlayerList {
@@ -860,7 +866,7 @@ public abstract class PlayerList {
}
Player respawnPlayer = entityplayer1.getBukkitEntity();

Datei anzeigen

@ -122,10 +122,10 @@ index 0000000000000000000000000000000000000000..0d7e7db9e37ef0183c32b217bd944fb4
+ COMPRESSION_DISABLED
+}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 90dd5a5c3ac94782483f99165bb3ddc85c179aae..1404389f16cb6ed8bb1b2dad35e364b1428810a4 100644
index 04f16e56829cc6f2345071a9ca8502a436cb7b44..aa82e261b9c1d2003f90ded311ef31d7da9dc7bb 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -625,6 +625,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -469,6 +469,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} else {
this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressionThreshold));
}
@ -133,7 +133,7 @@ index 90dd5a5c3ac94782483f99165bb3ddc85c179aae..1404389f16cb6ed8bb1b2dad35e364b1
} else {
if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) {
this.channel.pipeline().remove("decompress");
@@ -633,6 +634,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -477,6 +478,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
if (this.channel.pipeline().get("compress") instanceof CompressionEncoder) {
this.channel.pipeline().remove("compress");
}
@ -142,10 +142,10 @@ index 90dd5a5c3ac94782483f99165bb3ddc85c179aae..1404389f16cb6ed8bb1b2dad35e364b1
}
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index bb9e65eee7e0ca0f715cd5791c47579a57b1b577..29a0a720f22f56ca3d844efef1ecde3980fb1c12 100644
index 4017c15a62ce1048a61f55f46f915fd516496181..deda8fca63fc1ed71d3c309d403167fa17a509a9 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -113,6 +113,7 @@ public class ServerConnectionListener {
@@ -110,6 +110,7 @@ public class ServerConnectionListener {
pending.add(object); // Paper
channelpipeline.addLast("packet_handler", (ChannelHandler) object);
((Connection) object).setListener(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object));

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Send empty commands if tab completion is disabled
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 8001a084a8086ce55de856579d69b45138eb5c59..677b4a54d2a5ff9eb77d15e05582439ef3c5d3f2 100644
index c034a772b95485a91ab800962b7d9dbf3d074a82..14c78028ff51fff6f24174ae16b7c42d34d6041a 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -394,7 +394,12 @@ public class Commands {
@@ -396,7 +396,12 @@ public class Commands {
}
public void sendCommands(ServerPlayer player) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add more WanderingTrader API
diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
index 69ab58f2d8d9287a64f330a02e7cd3be3fe02402..c9fb50c33ac15fe72bc77167e4647f30942fdc5d 100644
index 65592c41b1519eff77ccd7ddd3c885058f3ed138..2e7de2378e01aed514e237029d6d64e78871c9b4 100644
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
+++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
@@ -59,6 +59,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
@@ -56,6 +56,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
@Nullable
private BlockPos wanderTarget;
private int despawnDelay;
@ -19,16 +19,16 @@ index 69ab58f2d8d9287a64f330a02e7cd3be3fe02402..c9fb50c33ac15fe72bc77167e4647f30
public WanderingTrader(EntityType<? extends WanderingTrader> type, Level world) {
super(type, world);
@@ -69,10 +73,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
@@ -66,10 +70,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(0, new UseItemGoal<>(this, PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEvents.WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> {
- return this.level.isNight() && !entityvillagertrader.isInvisible();
+ return this.canDrinkPotion && this.level.isNight() && !entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API
- return this.level().isNight() && !entityvillagertrader.isInvisible();
+ return this.canDrinkPotion && this.level().isNight() && !entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API
}));
this.goalSelector.addGoal(0, new UseItemGoal<>(this, new ItemStack(Items.MILK_BUCKET), SoundEvents.WANDERING_TRADER_REAPPEARED, (entityvillagertrader) -> {
- return this.level.isDay() && entityvillagertrader.isInvisible();
+ return canDrinkMilk && this.level.isDay() && entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API
- return this.level().isDay() && entityvillagertrader.isInvisible();
+ return this.canDrinkMilk && this.level().isDay() && entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API
}));
this.goalSelector.addGoal(1, new TradeWithPlayerGoal(this));
this.goalSelector.addGoal(1, new AvoidEntityGoal<>(this, Zombie.class, 8.0F, 0.5D, 0.5D));

Datei anzeigen

@ -5,26 +5,26 @@ Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 3df2a3fdfe2aa70457581210adf1bfabc73291d0..8a29187a144cf59b58f0cdc8599407f14902db2b 100644
index 9034faaf7b169788abad01d3da9c65ad5ddc4b8b..acc49f66bf34e2507d0ee6fec0a56b11bfc68f46 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -239,10 +239,18 @@ public class PlayerAdvancements {
this.progressChanged.add(advancement);
flag = true;
if (!flag1 && advancementprogress.isDone()) {
- this.player.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
- this.player.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
+ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent
+ boolean announceToChat = advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat();
+ net.kyori.adventure.text.Component message = announceToChat ? io.papermc.paper.adventure.PaperAdventure.asAdventure(Component.translatable("chat.type.advancement." + advancement.getDisplay().getFrame().getName(), this.player.getDisplayName(), advancement.getChatComponent())) : null;
+ org.bukkit.event.player.PlayerAdvancementDoneEvent event = new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit, message);
+ this.player.level.getCraftServer().getPluginManager().callEvent(event);
+ this.player.level().getCraftServer().getPluginManager().callEvent(event);
+ message = event.message();
+ // Paper end
advancement.getRewards().grant(this.player);
- if (advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat() && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
- if (advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
- this.playerList.broadcastSystemMessage(Component.translatable("chat.type.advancement." + advancement.getDisplay().getFrame().getName(), this.player.getDisplayName(), advancement.getChatComponent()), false);
+ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent
+ if (message != null && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
+ if (message != null && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
+ this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), false);
+ // Paper end
}

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Add a "should burn in sunlight" API for Phantoms and
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index 98a3f6388712fab9012210241b84def3aca712e2..f2094c52196b45adfd51d8aebcc4c46b779b0925 100644
index ef525e5f523966c9af7380e8d09ff5092e56e7c5..9ca1e9d95e62929c0015d5ca2c2f9c70e421842e 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -98,9 +98,15 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@ -48,7 +48,7 @@ index 98a3f6388712fab9012210241b84def3aca712e2..f2094c52196b45adfd51d8aebcc4c46b
@Override
public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index 0ada1ba6774e3d0514afb946fd0f104004cc020d..97fb1d2110a51498f6419841081b500b3f190370 100644
index 9660f517963459396f3ff112fbcab9bb1f9c1949..38230578c7e280a4aaa699e2a81990094e2aa264 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -144,7 +144,7 @@ public class Phantom extends FlyingMob implements Enemy {

Datei anzeigen

@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..cf4374493c11057451a62a655514415c
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5014f7958074591d1eec22c6775d291828ba0560..2de98ed395e645111671e6a66b31da9b301f0194 100644
index 0f5df60d62f0203724e073e6149b6bbbece0e533..0e98716d722a325158746cc088e838ede70aa59f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -298,6 +298,7 @@ public final class CraftServer implements Server {
@ -111,7 +111,7 @@ index 5014f7958074591d1eec22c6775d291828ba0560..2de98ed395e645111671e6a66b31da9b
}
public boolean getCommandBlockOverride(String command) {
@@ -2835,5 +2837,11 @@ public final class CraftServer implements Server {
@@ -2833,5 +2835,11 @@ public final class CraftServer implements Server {
public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
return mobGoals;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add environment variable to disable server gui
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 5516888e72adf3f0b39119ed4f24e9aab09b1f37..13e5362e12eb857b0cc27277c95efe085e77348d 100644
index b51636545036ee7492c9f907f94295b1dd66a811..f381bc0b15018609f80722debbf0159b33e5588a 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -293,6 +293,7 @@ public class Main {
@@ -292,6 +292,7 @@ public class Main {
*/
boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] additions to PlayerGameModeChangeEvent
diff --git a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java
index 2e4fd72da147393581027fc35702d6c3fd989765..1bf4c5b36f53ef1e71d50d1a9af8e1410e5dff60 100644
index 50e581613156cca765dfd8e3596dcb3b58520cec..04fd33e9d50eb675ed1d4633bf0903ec526d32d0 100644
--- a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java
+++ b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java
@@ -25,9 +25,13 @@ public class DefaultGameModeCommands {
@ -25,10 +25,10 @@ index 2e4fd72da147393581027fc35702d6c3fd989765..1bf4c5b36f53ef1e71d50d1a9af8e141
}
diff --git a/src/main/java/net/minecraft/server/commands/GameModeCommand.java b/src/main/java/net/minecraft/server/commands/GameModeCommand.java
index d47f3d255eddd652fedb4aa55286b756fe962995..27c0aaf123c3e945eb24e8a3892bd8ac42115733 100644
index aee8618e27b893b72931e925724dd683d2e6d2aa..3131a9ee89ce0598626da4ce4983d4a8d3be91d1 100644
--- a/src/main/java/net/minecraft/server/commands/GameModeCommand.java
+++ b/src/main/java/net/minecraft/server/commands/GameModeCommand.java
@@ -44,9 +44,14 @@ public class GameModeCommand {
@@ -48,9 +48,14 @@ public class GameModeCommand {
int i = 0;
for(ServerPlayer serverPlayer : targets) {
@ -45,10 +45,10 @@ index d47f3d255eddd652fedb4aa55286b756fe962995..27c0aaf123c3e945eb24e8a3892bd8ac
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ed9c6a4664b995fb62c97f86ce69a473b47f7efb..47d2bf15871e50e46c0e5df725f2bbacfe12a869 100644
index e38638cc2995ca9c49acb5fa50508db1c0ce00fd..75fef72efe7e85bf494bce6184b6814487f2c900 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1841,8 +1841,15 @@ public class ServerPlayer extends Player {
@@ -1843,8 +1843,16 @@ public class ServerPlayer extends Player {
}
public boolean setGameMode(GameType gameMode) {
@ -58,7 +58,8 @@ index ed9c6a4664b995fb62c97f86ce69a473b47f7efb..47d2bf15871e50e46c0e5df725f2bbac
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = this.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
+ return event == null ? false : event.isCancelled();
+ }
+ public org.bukkit.event.player.PlayerGameModeChangeEvent setGameMode(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, net.kyori.adventure.text.Component message) {
+ @Nullable
+ public org.bukkit.event.player.PlayerGameModeChangeEvent setGameMode(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, @Nullable net.kyori.adventure.text.Component message) {
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = this.gameMode.changeGameModeForPlayer(gameMode, cause, message);
+ if (event == null || event.isCancelled()) {
+ // Paper end
@ -66,7 +67,7 @@ index ed9c6a4664b995fb62c97f86ce69a473b47f7efb..47d2bf15871e50e46c0e5df725f2bbac
} else {
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId()));
if (gameMode == GameType.SPECTATOR) {
@@ -1854,7 +1861,7 @@ public class ServerPlayer extends Player {
@@ -1856,7 +1864,7 @@ public class ServerPlayer extends Player {
this.onUpdateAbilities();
this.updateEffectVisibility();
@ -75,7 +76,7 @@ index ed9c6a4664b995fb62c97f86ce69a473b47f7efb..47d2bf15871e50e46c0e5df725f2bbac
}
}
@@ -2273,6 +2280,16 @@ public class ServerPlayer extends Player {
@@ -2275,6 +2283,16 @@ public class ServerPlayer extends Player {
}
public void loadGameTypes(@Nullable CompoundTag nbt) {
@ -93,18 +94,19 @@ index ed9c6a4664b995fb62c97f86ce69a473b47f7efb..47d2bf15871e50e46c0e5df725f2bbac
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index e6154cf74df39d0c87fc820027adc9641156f888..5461e6ff769be93054b3d8369a7aa286d1244875 100644
index 95173754148848bf1772a0426173dcea89e6b9b8..34def52e9380a4587c5008f1d133a07e72621f56 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -73,21 +73,27 @@ public class ServerPlayerGameMode {
@@ -73,21 +73,28 @@ public class ServerPlayerGameMode {
}
public boolean changeGameModeForPlayer(GameType gameMode) {
+ // Paper end
+ PlayerGameModeChangeEvent event = this.changeGameModeForPlayer(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
+ return event == null ? false : event.isCancelled();
+ return event != null && event.isCancelled();
+ }
+ public PlayerGameModeChangeEvent changeGameModeForPlayer(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, net.kyori.adventure.text.Component cancelMessage) {
+ @Nullable
+ public PlayerGameModeChangeEvent changeGameModeForPlayer(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, @Nullable net.kyori.adventure.text.Component cancelMessage) {
+ // Paper end
if (gameMode == this.gameModeForPlayer) {
- return false;
@ -129,23 +131,23 @@ index e6154cf74df39d0c87fc820027adc9641156f888..5461e6ff769be93054b3d8369a7aa286
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e6cbeae6800d22017b1762eaf9465419fbbe925f..43f02b1de7176f335f88ca6080b6d88bdf6f3fae 100644
index 8d8fa01795a99481d29d5d0d5382656dce676a6a..aa06947183a0207d3e42c230dc0546529eaca7c9 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2790,7 +2790,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2782,7 +2782,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
if (this.server.isHardcore()) {
- this.player.setGameMode(GameType.SPECTATOR);
+ this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper
((GameRules.BooleanValue) this.player.getLevel().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 207032804244857b849e38f87479f0fbe2902633..45b338d33fae5017ab2eab3af6b83b8109e67c1f 100644
index f46cd227faa3cfc9a8c660516afd8e0209f991d6..b4f6b3aa01b02d0ea77217a9725f07886880f158 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1561,7 +1561,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1492,7 +1492,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
throw new IllegalArgumentException("Mode cannot be null");
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack repair check API
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 451d36303f12d3b6d22baba9d1d17c2a4eba3206..a08b404dbf2b6f53b29c7a6e86cac1871976ae4c 100644
index fb24efa54510fc77a7d4541462242113e16d2f53..236ab23039fd78d2fae8bcfa879d51100aeec8c7 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -545,6 +545,14 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -5,10 +5,10 @@ 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 f71463e6ffaedbd52c3c38d5e5e99580a523c537..42235dd332a45d8112c14379f06072a2f4d46351 100644
index aa06947183a0207d3e42c230dc0546529eaca7c9..6906795c257ec7928a0e73af80aa0b44cb4c4dce 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1813,6 +1813,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1805,6 +1805,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (itemstack.isItemEnabled(worldserver.enabledFeatures())) {
BlockHitResult movingobjectpositionblock = packet.getHitResult();
Vec3 vec3d = movingobjectpositionblock.getLocation();

Datei anzeigen

@ -247,7 +247,7 @@ index 0000000000000000000000000000000000000000..513833c2ea23df5b079d157bc5cb89d5
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 13e5362e12eb857b0cc27277c95efe085e77348d..1619da8a904785e0cc00ddbcfba1c3fa2b8d9b93 100644
index f381bc0b15018609f80722debbf0159b33e5588a..e3187ce6c5000bc701b9378d7305df5cc33a8226 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -18,6 +18,7 @@ import java.nio.file.Paths;
@ -258,7 +258,7 @@ index 13e5362e12eb857b0cc27277c95efe085e77348d..1619da8a904785e0cc00ddbcfba1c3fa
import joptsimple.NonOptionArgumentSpec;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
@@ -351,6 +352,15 @@ public class Main {
@@ -350,6 +351,15 @@ public class Main {
return new WorldLoader.InitConfig(worldloader_d, Commands.CommandSelection.DEDICATED, serverPropertiesHandler.functionPermissionLevel);
}
@ -275,7 +275,7 @@ index 13e5362e12eb857b0cc27277c95efe085e77348d..1619da8a904785e0cc00ddbcfba1c3fa
Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, dimensionOptionsRegistry, eraseCache);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fd9790dfd445481ed245b82255e05f5bc1459eae..027f49e9b42564b276a6dea7106e6ffbcc1e4d7f 100644
index 84bc412a8169b07f63e9d0395df1b1f42e0f6a83..701fdff646298a15d2f8cad82dce59389d38a9e8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -554,11 +554,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -306,10 +306,10 @@ index fd9790dfd445481ed245b82255e05f5bc1459eae..027f49e9b42564b276a6dea7106e6ffb
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 1770c97a3190a89a9b1dbde126b94a42662efea0..8a6f01af6d9a210fbd5cf14002c426c2e36fc51b 100644
index 485e45962dcbcdcf720ff70e06092dd846e74031..3da3de6a442c3b398a96fff26cd0d81a8130fc01 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -185,6 +185,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -183,6 +183,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
@ -326,14 +326,16 @@ index 1770c97a3190a89a9b1dbde126b94a42662efea0..8a6f01af6d9a210fbd5cf14002c426c2
return this.world;
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index b294ef87fb93e7f4651dc04128124f297575860d..65fd57609e45ccd49ebfc1ba80d25243da13ab6e 100644
index 867755f9a2c1245f9e3ec0028abee4b798c8b2d4..2cfa9ba07d985985e883187e051e901a0876f78b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -32,6 +32,28 @@ public class RegionFileStorage implements AutoCloseable {
@@ -31,6 +31,31 @@ public class RegionFileStorage implements AutoCloseable {
this.sync = dsync;
}
// Paper start
+ public static @Nullable ChunkPos getRegionFileCoordinates(Path file) {
+ // Paper start
+ @Nullable
+ public static ChunkPos getRegionFileCoordinates(Path file) {
+ String fileName = file.getFileName().toString();
+ if (!fileName.startsWith("r.") || !fileName.endsWith(".mca")) {
+ return null;
@ -354,12 +356,13 @@ index b294ef87fb93e7f4651dc04128124f297575860d..65fd57609e45ccd49ebfc1ba80d25243
+ return null;
+ }
+ }
+ // Paper end
+
public synchronized RegionFile getRegionFileIfLoaded(ChunkPos chunkcoordintpair) {
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()));
}
private RegionFile getRegionFile(ChunkPos chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit
long i = ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ());
RegionFile regionfile = (RegionFile) this.regionCache.getAndMoveToFirst(i);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2de98ed395e645111671e6a66b31da9b301f0194..dad38e93aba899b250155a5075fc85fc988d6a8a 100644
index 0e98716d722a325158746cc088e838ede70aa59f..b8f5f17b9759d82e39d2e619ce58704f7d74d3c1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1229,12 +1229,7 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -11,7 +11,7 @@ Tested-by: Mariell Hoversholm <proximyst@proximyst.com>
Reviewed-by: Mariell Hoversholm <proximyst@proximyst.com>
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 8eb18e794845a2e7df5e7e6bc11134e4d132e06e..7dcffb49a982a8db00d66441a03e2951b1d29ff9 100644
index 6bd0e3acb2d1cac9f65fba4b7f986b6dc1e55504..32fe93da2f0c220660de198fa416cc9015af0fe4 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -219,6 +219,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -53,10 +53,10 @@ index 8eb18e794845a2e7df5e7e6bc11134e4d132e06e..7dcffb49a982a8db00d66441a03e2951
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 29a0a720f22f56ca3d844efef1ecde3980fb1c12..838244e3680ea6020701e10bafbde7f52976eaa1 100644
index deda8fca63fc1ed71d3c309d403167fa17a509a9..d86830ea180bebb409fc20ed43dd25cd0856f623 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -77,7 +77,12 @@ public class ServerConnectionListener {
@@ -75,7 +75,12 @@ public class ServerConnectionListener {
this.running = true;
}
@ -69,7 +69,7 @@ index 29a0a720f22f56ca3d844efef1ecde3980fb1c12..838244e3680ea6020701e10bafbde7f5
List list = this.channels;
synchronized (this.channels) {
@@ -85,7 +90,11 @@ public class ServerConnectionListener {
@@ -83,7 +88,11 @@ public class ServerConnectionListener {
LazyLoadedValue lazyinitvar;
if (Epoll.isAvailable() && this.server.isEpollEnabled()) {
@ -81,7 +81,7 @@ index 29a0a720f22f56ca3d844efef1ecde3980fb1c12..838244e3680ea6020701e10bafbde7f5
lazyinitvar = ServerConnectionListener.SERVER_EPOLL_EVENT_GROUP;
ServerConnectionListener.LOGGER.info("Using epoll channel type");
} else {
@@ -115,7 +124,7 @@ public class ServerConnectionListener {
@@ -112,7 +121,7 @@ public class ServerConnectionListener {
((Connection) object).setListener(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object));
io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper
}
@ -91,10 +91,10 @@ index 29a0a720f22f56ca3d844efef1ecde3980fb1c12..838244e3680ea6020701e10bafbde7f5
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index de25c0c55ef0089032e8c74befceba44543b8009..6fa63190a39343c50c2d49fe7fa09f7163db7101 100644
index 6906795c257ec7928a0e73af80aa0b44cb4c4dce..accf7751f486ce524fbbeb4f51040f428709fe98 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2625,6 +2625,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2617,6 +2617,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Spigot Start
public SocketAddress getRawAddress()
{
@ -107,7 +107,7 @@ index de25c0c55ef0089032e8c74befceba44543b8009..6fa63190a39343c50c2d49fe7fa09f71
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 7675adce108df5790a34f90145a8fabcf9704c0f..de25fde984d17a3228803a8a274372b0fe27da5e 100644
index 50c79be12cf8778a2ce451a8c9bb2cdc277d6830..8393c1a2d15d5ad255c9808b0d0edd6aeb447893 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -45,6 +45,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL

Datei anzeigen

@ -17,7 +17,7 @@ index 4066dd6a638cf2186c628905915f635326442b3e..f89234dbfd03ba5192423bb75d58f895
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 3db122c61452ea209e80c98dead1823bc489e43b..6a0edfc5082865daf27eaa4f9331d0c4dcced3e1 100644
index b51e18d01fa9a06a3478694884f465f12dd89b8a..ee4b3ac212483995bb8ae990bebfb8aa2fbe86a5 100644
--- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
@@ -72,6 +72,7 @@ public abstract class BasePressurePlateBlock extends Block {
@ -29,7 +29,7 @@ index 3db122c61452ea209e80c98dead1823bc489e43b..6a0edfc5082865daf27eaa4f9331d0c4
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 cb557c99cc84a79966c32523e2de9b5b9e60c842..8537581e7ca1f4efb492a2e734f46f947f36cffa 100644
index 2a3cf17cdf7ec5eb9a6326a9ca93ad0b756ca0a7..7455847cf8a05ed237d2df84ae2d9b1d2f2d7176 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
@ -65,10 +65,10 @@ index d35618520daafb50de747f6bc200160ea17ef656..3e792514d042f05ff6848b7d6506472a
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 f5c21d510351ea8ff76d89fe859f187a3106cc30..7579946ce222b6ab3685a7fd9821bcd5a4babe33 100644
index 2c3bbe4f295be9782c11af13c2cf9c05f27313d9..0003fb51ae3a6575575e10b4c86719f3061e2577 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 {
@@ -114,6 +114,7 @@ public class CactusBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -89,7 +89,7 @@ index dffd1a48e54b4b15195ba066dc9d73c7a91650ea..219c87dcf065e86512f330fbeec59e55
org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = CraftBlock.at(world, pos); // CraftBukkit
entity.hurt(world.damageSources().inFire(), (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 4597bfbe2268f14262c56f1e5266aa7d344f16d1..519d02a2009c4f09c9e8be7196a701f0f042012d 100644
index 90aeb66e0ed95485774707afc64d7383d51150aa..448c958a7a40258132add92da74fa689cf2ac046 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 {
@ -137,7 +137,7 @@ index b63835fe3eda974746163e7a9e26080da7538c4d..834c5e3fbff3819f3f72e95a1072d9b9
this.destroyBlock(world, pos);
}
diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
index 42f4cd2154d013537451a29a864eabc40a3b849a..29efe50dd3911a1d7ef5175034e82191130b8fd1 100644
index f2206cea243b2281471bc9e939dd79971b0025eb..745f33ce496a7ce8c788f24c093b37933a74148a 100644
--- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
@@ -54,6 +54,7 @@ public class HoneyBlock extends HalfTransparentBlock {
@ -233,10 +233,10 @@ index 5e1133bf2cba55a6ec5559d8db41e1a3db582d06..4e2fb4ee8e46b3c363992ff23e26f5a6
if (!(Boolean) state.getValue(TripWireBlock.POWERED)) {
this.checkPressed(world, pos);
diff --git a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
index 2b2a28d0383ccc8c0e7debd90331570b02b5e65f..bd4295f8d24ca9fd8c3af31abcd13da24db1c5d5 100644
index 2b09aa352d484ac6e23360af55784b1a317ee803..9f364f6d3bfc87337aec6efd70d293f6f8429235 100644
--- a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
@@ -25,6 +25,7 @@ public class WaterlilyBlock extends BushBlock {
@@ -24,6 +24,7 @@ public class WaterlilyBlock extends BushBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
super.entityInside(state, world, pos, entity);

Datei anzeigen

@ -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 a08b404dbf2b6f53b29c7a6e86cac1871976ae4c..ec47babe5f34198ae213679d4a4b2bc27bdc1eab 100644
index 236ab23039fd78d2fae8bcfa879d51100aeec8c7..fea31b187fd5965bf479548835e5603e78f3f3f1 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -553,6 +553,19 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -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 421bec0fead072a8f0e8756f9ba3670d8465842f..e93a1713505d52d719738b36ea59859c547553b7 100644
index 010024a8ea56455ebfb16d70fffd1d51a169b411..ff7b9b47c9c29949cc4ee8da162b77ef17909bdb 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -531,8 +531,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -445,8 +445,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 421bec0fead072a8f0e8756f9ba3670d8465842f..e93a1713505d52d719738b36ea59859c
}
@Override
@@ -944,8 +944,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -855,8 +855,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 421bec0fead072a8f0e8756f9ba3670d8465842f..e93a1713505d52d719738b36ea59859c
}
this.oThunderLevel = this.thunderLevel;
@@ -1011,14 +1011,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -922,14 +922,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
private void resetWeatherCycle() {
// CraftBukkit start
@ -48,10 +48,10 @@ index 421bec0fead072a8f0e8756f9ba3670d8465842f..e93a1713505d52d719738b36ea59859c
// 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 543d578eb87da6ff526cad7e65c8af76b1043e84..936b7f464097c30fe4dfbe4cee1c1490df8c3a58 100644
index 626b861ef2f323a5fc50ab5178d3e108e0f9cc25..31c31a9138cb5f6e41de01a6210f84e72fd7dc58 100644
--- a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
+++ b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
@@ -359,6 +359,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -394,6 +394,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@Override
public void setThundering(boolean thundering) {
@ -63,7 +63,7 @@ index 543d578eb87da6ff526cad7e65c8af76b1043e84..936b7f464097c30fe4dfbe4cee1c1490
// CraftBukkit start
if (this.thundering == thundering) {
return;
@@ -366,7 +371,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -401,7 +406,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
if (world != null) {
@ -72,7 +72,7 @@ index 543d578eb87da6ff526cad7e65c8af76b1043e84..936b7f464097c30fe4dfbe4cee1c1490
Bukkit.getServer().getPluginManager().callEvent(thunder);
if (thunder.isCancelled()) {
return;
@@ -393,6 +398,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -428,6 +433,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@Override
public void setRaining(boolean raining) {
@ -85,7 +85,7 @@ index 543d578eb87da6ff526cad7e65c8af76b1043e84..936b7f464097c30fe4dfbe4cee1c1490
// CraftBukkit start
if (this.raining == raining) {
return;
@@ -400,7 +411,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -435,7 +446,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
if (world != null) {
@ -95,10 +95,10 @@ index 543d578eb87da6ff526cad7e65c8af76b1043e84..936b7f464097c30fe4dfbe4cee1c1490
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 d997691ab27b94f3eccaa7669922e53396966087..d2c7730a63118612eb0a60853b3221fab3b6f37e 100644
index 0fcc04f4a4838bd6bee948e10707b527903984de..44d59c9f5053cd6affddf7a51e37ed4b7bd43b08 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1181,7 +1181,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1186,7 +1186,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setStorm(boolean hasStorm) {
@ -107,7 +107,7 @@ index d997691ab27b94f3eccaa7669922e53396966087..d2c7730a63118612eb0a60853b3221fa
this.setWeatherDuration(0); // Reset weather duration (legacy behaviour)
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
}
@@ -1203,7 +1203,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1208,7 +1208,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setThundering(boolean thundering) {

Datei anzeigen

@ -5,19 +5,17 @@ Subject: [PATCH] Limit item frame cursors on maps
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index fdf56fa2c26babf3496d326d2e7c7968f1844792..50348a5eec1e2ffabfc8405d708461376a162913 100644
index 7a6fbd4be33e93c7f09b1ed146ae25fe6c6b503c..3b12030b49b1c539684d75ca3896eb498400ef99 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@@ -295,8 +295,12 @@ public class MapItemSavedData extends SavedData {
@@ -295,8 +295,10 @@ public class MapItemSavedData extends SavedData {
MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId());
+ // Paper start
+ if (this.decorations.size() < player.level.paperConfig().maps.itemFrameCursorLimit) {
this.addDecoration(MapDecoration.Type.FRAME, player.level, "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null);
+ if (this.decorations.size() < player.level().paperConfig().maps.itemFrameCursorLimit) { // Paper
this.addDecoration(MapDecoration.Type.FRAME, player.level(), "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null);
this.frameMarkers.put(worldmapframe1.getId(), worldmapframe1);
+ }
+ // Paper end
+ } // Paper
}
CompoundTag nbttagcompound = stack.getTag();

Datei anzeigen

@ -36,10 +36,10 @@ index b5f54ee82905e3e6ab5bfde35ab625f5feeb1393..c0a80824a0307ea673805015119cc834
public boolean shouldDisconnect() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 027f49e9b42564b276a6dea7106e6ffbcc1e4d7f..416bfdeb0ce8ec1828288a7d84990ed3f027e1fa 100644
index 701fdff646298a15d2f8cad82dce59389d38a9e8..0804933adf246f5e8f46ebd1883ffe53e41b0fbe 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2152,7 +2152,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2159,7 +2159,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)
@ -49,10 +49,10 @@ index 027f49e9b42564b276a6dea7106e6ffbcc1e4d7f..416bfdeb0ce8ec1828288a7d84990ed3
}
diff --git a/src/main/java/net/minecraft/server/commands/BanIpCommands.java b/src/main/java/net/minecraft/server/commands/BanIpCommands.java
index af5e45143312a08a19065499aa665b415e06f1d8..bac6c3140438aaf5626724f9a5558325e244f66d 100644
index 78345cf28be16b2e9bf2237ea60a3be424a8dabf..5397a5013bee9589b59c76ce5a2c00a7dc3ec262 100644
--- a/src/main/java/net/minecraft/server/commands/BanIpCommands.java
+++ b/src/main/java/net/minecraft/server/commands/BanIpCommands.java
@@ -58,7 +58,7 @@ public class BanIpCommands {
@@ -62,7 +62,7 @@ public class BanIpCommands {
}
for(ServerPlayer serverPlayer : list) {
@ -62,11 +62,11 @@ index af5e45143312a08a19065499aa665b415e06f1d8..bac6c3140438aaf5626724f9a5558325
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 991d9a2bfd8d577c9c25e559833af9ddf690f1dc..458b9a730a1f629bd605c26a4ec4440e8ee84b1d 100644
index e4ed0df0fa83a3d0f05fff3fd59a7ba8fc983963..eda2083ede81def0ad5c1518bdd183902454430d 100644
--- a/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
+++ b/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
@@ -42,7 +42,7 @@ public class BanPlayerCommands {
source.sendSuccess(Component.translatable("commands.ban.success", ComponentUtils.getDisplayName(gameProfile), userBanListEntry.getReason()), true);
@@ -44,7 +44,7 @@ public class BanPlayerCommands {
}, true);
ServerPlayer serverPlayer = source.getServer().getPlayerList().getPlayer(gameProfile.getId());
if (serverPlayer != null) {
- serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.banned"));
@ -75,7 +75,7 @@ index 991d9a2bfd8d577c9c25e559833af9ddf690f1dc..458b9a730a1f629bd605c26a4ec4440e
}
}
diff --git a/src/main/java/net/minecraft/server/commands/KickCommand.java b/src/main/java/net/minecraft/server/commands/KickCommand.java
index 65637a33ba171a4b598f70cd943d24b0ee44a69f..57a9146bf2dee7a60aab16716e25348fad7ba127 100644
index c68bac4727f6b2ca95fc8c438303097af14286f2..bb629ec263959c8268de88ca807bddb62e9f877e 100644
--- a/src/main/java/net/minecraft/server/commands/KickCommand.java
+++ b/src/main/java/net/minecraft/server/commands/KickCommand.java
@@ -22,7 +22,7 @@ public class KickCommand {
@ -84,11 +84,11 @@ index 65637a33ba171a4b598f70cd943d24b0ee44a69f..57a9146bf2dee7a60aab16716e25348f
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(Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason), true);
}
source.sendSuccess(() -> {
return 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 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089ea641b81b 100644
index accf7751f486ce524fbbeb4f51040f428709fe98..9140806ac0bcf36bb76d666c160e183534b314a0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -362,7 +362,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -120,7 +120,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
if (elapsedTime >= 15000L) { // 15 seconds
@@ -433,7 +433,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
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() * 1000L * 60L) {
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
- 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
@ -177,15 +177,15 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
this.cserver.getPluginManager().callEvent(event);
@@ -564,7 +574,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) {
- 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();
@@ -762,7 +772,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -770,7 +780,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) {
- this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"));
@ -193,23 +193,16 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
return;
}
@@ -819,13 +829,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async
@@ -827,7 +837,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - run this async
// CraftBukkit start
if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
- 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(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
@@ -978,7 +988,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// CraftBukkit end
@@ -979,7 +989,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// 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());
@ -218,7 +211,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
return;
}
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
@@ -1165,7 +1175,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1162,7 +1172,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
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!");
@ -227,7 +220,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
return;
}
byteTotal += byteLength;
@@ -1188,14 +1198,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1185,14 +1195,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
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());
@ -244,16 +237,16 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
return;
}
this.lastBookTick = MinecraftServer.currentTick;
@@ -1319,7 +1329,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1316,7 +1326,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
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(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();
ServerLevel worldserver = this.player.serverLevel();
@@ -1735,7 +1745,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1727,7 +1737,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.dropCount++;
if (this.dropCount >= 20) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
@ -262,8 +255,8 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
return;
}
}
@@ -1947,7 +1957,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -1939,7 +1949,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
- this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"));
@ -271,7 +264,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
}
// Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
@@ -2063,7 +2073,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2055,7 +2065,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player.resetLastActionTime();
} else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -280,7 +273,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
}
}
@@ -2076,7 +2086,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2068,7 +2078,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
// CraftBukkit end
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) {
@ -289,7 +282,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages());
@@ -2110,7 +2120,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2102,7 +2112,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleChatCommand(ServerboundChatCommandPacket packet) {
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) {
@ -298,7 +291,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages());
@@ -2165,7 +2175,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2157,7 +2167,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
if (exception.shouldDisconnect()) {
@ -307,7 +300,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
} else {
this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED));
}
@@ -2196,7 +2206,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2188,7 +2198,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
if (!this.updateChatOrder(timestamp)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message);
@ -316,7 +309,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
return Optional.empty();
} else {
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(acknowledgment);
@@ -2219,7 +2229,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2211,7 +2221,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (optional.isEmpty()) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -325,7 +318,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
}
return optional;
@@ -2442,7 +2452,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2434,7 +2444,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// this.chatSpamTickCount += 20;
if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
// CraftBukkit end
@ -334,7 +327,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
}
}
@@ -2454,7 +2464,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2446,7 +2456,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
synchronized (this.lastSeenMessages) {
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -343,7 +336,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
}
}
@@ -2597,7 +2607,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2589,7 +2599,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
if (i > 4096) {
@ -352,7 +345,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
}
}
@@ -2643,7 +2653,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2635,7 +2645,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Spigot Start
if ( entity == this.player && !this.player.isSpectator() )
{
@ -361,7 +354,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
return;
}
// Spigot End
@@ -2742,7 +2752,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2734,7 +2744,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// CraftBukkit end
}
} else {
@ -370,16 +363,16 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
}
@@ -3150,7 +3160,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3143,7 +3153,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
- 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
if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
- this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper
+ this.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;
}
}
@@ -3358,7 +3368,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3314,7 +3324,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> {
@ -388,7 +381,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
});
// Paper end
}
@@ -3404,7 +3414,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3360,7 +3370,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -397,7 +390,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
}
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try {
@@ -3414,7 +3424,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3370,7 +3380,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -406,7 +399,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
}
} else {
try {
@@ -3432,7 +3442,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3388,7 +3398,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@ -415,7 +408,7 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
}
}
@@ -3474,7 +3484,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3430,7 +3440,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) {
if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) {
@ -423,8 +416,8 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
+ this.disconnect(ProfilePublicKey.EXPIRED_PROFILE_PUBLIC_KEY, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes
} else {
try {
SignatureValidator signaturevalidator = this.server.getServiceSignatureValidator();
@@ -3482,7 +3492,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator();
@@ -3443,7 +3453,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator, Duration.ZERO));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
@ -434,10 +427,10 @@ index 6fa63190a39343c50c2d49fe7fa09f7163db7101..18bf0ab7e897d4c75134359fee7e089e
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index b5a2805999dd93b9af2ee96a3af9684367c80af6..32295fa4016b375800a27a961c42047013d14d1d 100644
index d7397f81d7f379d57f9271eaf5b91027676c273f..75bb6a8fa53734b8b6548a9f203e0ff574ae08dc 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -671,7 +671,7 @@ public abstract class PlayerList {
@@ -678,7 +678,7 @@ public abstract class PlayerList {
while (iterator.hasNext()) {
entityplayer = (ServerPlayer) iterator.next();
this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved
@ -446,7 +439,7 @@ index b5a2805999dd93b9af2ee96a3af9684367c80af6..32295fa4016b375800a27a961c420470
}
// Instead of kicking then returning, we need to store the kick reason
@@ -1307,8 +1307,8 @@ public abstract class PlayerList {
@@ -1314,8 +1314,8 @@ public abstract class PlayerList {
// Paper end
// CraftBukkit start - disconnect safely
for (ServerPlayer player : this.players) {
@ -458,7 +451,7 @@ index b5a2805999dd93b9af2ee96a3af9684367c80af6..32295fa4016b375800a27a961c420470
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
index a24e7a66d52eddbdad8db71cf5e45f1a458c389f..e1c13ac7b11fb0080435fc34502208c8fa3790e8 100644
index 984c288abf94d9fe47fada33722fea035b832f3b..addd20237b87c9a87bb09fd7addb101a2b7c7d4e 100644
--- a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
+++ b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
@@ -24,9 +24,9 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) {
@ -491,10 +484,10 @@ index a24e7a66d52eddbdad8db71cf5e45f1a458c389f..e1c13ac7b11fb0080435fc34502208c8
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 45b338d33fae5017ab2eab3af6b83b8109e67c1f..fd7d05c097dcb300aab5320b395e7133dc54998f 100644
index b4f6b3aa01b02d0ea77217a9725f07886880f158..1b206a58cb9bc92e8b9a6ac1919bff95f341ede9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -609,7 +609,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -534,7 +534,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot
if (this.getHandle().connection == null) return;
@ -503,7 +496,7 @@ index 45b338d33fae5017ab2eab3af6b83b8109e67c1f..fd7d05c097dcb300aab5320b395e7133
}
// Paper start
@@ -621,10 +621,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -546,10 +546,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void kick(final net.kyori.adventure.text.Component message) {
@ -520,6 +513,15 @@ index 45b338d33fae5017ab2eab3af6b83b8109e67c1f..fd7d05c097dcb300aab5320b395e7133
}
}
@@ -616,7 +621,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper start - improve chat handling
if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) {
- this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
+ this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - kick event causes
} else {
if (msg.startsWith("/")) {
this.getHandle().connection.handleCommand(msg);
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
index 92d97a5810a379b427a99b4c63fb9844d823a84f..160115bf8a153ff981ba308599d22c4c08026fb6 100644
--- a/src/main/java/org/spigotmc/RestartCommand.java

Datei anzeigen

@ -5,12 +5,12 @@ Subject: [PATCH] Add PufferFishStateChangeEvent
diff --git a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
index 3d465f655a18967ebacb36b4f3a5ac81d4c1f390..9aa5aa0d66257bf1413a904c516293aea30d2ca8 100644
index 50ffcbb50e061f0b3307a5b963bbab81427cac3e..a197337f2e09f53cf382022569c8836745d78769 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
@@ -95,25 +95,39 @@ public class Pufferfish extends AbstractFish {
public void tick() {
if (!this.level.isClientSide && this.isAlive() && this.isEffectiveAi()) {
if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) {
if (this.inflateCounter > 0) {
+ boolean increase = true; // Paper - Add PufferFishStateChangeEvent
if (this.getPuffState() == 0) {

Datei anzeigen

@ -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 f165b6e83a76d837257d5c30fa6ea838889cfc72..5c6aa9c464784ad5ee366412d080c72d3d22a76f 100644
index 5510098be25ce06bc5f92eab2f83dc1086c4838f..578c3db52dda4c169b5ea615a4ce4a79f15a4cad 100644
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
@@ -40,6 +40,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
@@ -39,6 +39,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
public class BucketItem extends Item implements DispensibleContainerItem {
@ -18,7 +18,7 @@ index f165b6e83a76d837257d5c30fa6ea838889cfc72..5c6aa9c464784ad5ee366412d080c72d
public final Fluid content;
public BucketItem(Fluid fluid, Item.Properties settings) {
@@ -121,6 +123,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
@@ -120,6 +122,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
}
public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
@ -32,7 +32,7 @@ index f165b6e83a76d837257d5c30fa6ea838889cfc72..5c6aa9c464784ad5ee366412d080c72d
return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack;
}
@@ -152,6 +161,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
@@ -150,6 +159,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
return false;
}

Datei anzeigen

@ -14,11 +14,11 @@ 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 34804dc42c7a18108126c14c1b5f3d5a9a46f83d..4cbceb1c18dbee75ac5154ff0c15a4e79bd31575 100644
index cd82985b0aa821dccc0484f328407381d58ec81f..a8dc502fffdce89c44ec16cb158b04c30fb1a9cf 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>, PalettedContainer
private final T @org.jetbrains.annotations.Nullable [] presetValues; // Paper - Anti-Xray - Add preset values
@@ -31,14 +31,14 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
public final IdMap<T> registry;
private volatile PalettedContainer.Data<T> data;
private final PalettedContainer.Strategy strategy;
- private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer");
@ -34,17 +34,17 @@ index 34804dc42c7a18108126c14c1b5f3d5a9a46f83d..4cbceb1c18dbee75ac5154ff0c15a4e7
+ // this.threadingDetector.checkAndUnlock(); // Paper - disable this
}
// Paper start - Anti-Xray - Add preset values
@@ -129,7 +129,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) {
@@ -90,7 +90,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
@Override
- public int onResize(int newBits, T object) {
+ public synchronized int onResize(int newBits, T object) { // Paper - synchronize
PalettedContainer.Data<T> data = this.data;
// Paper start - Anti-Xray - Add preset values
@@ -176,7 +176,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
PalettedContainer.Data<T> data2 = this.createOrReuseData(data, newBits);
data2.copyFrom(data.palette, data.storage);
@@ -115,7 +115,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
return this.getAndSet(this.strategy.getIndex(x, y, z), value);
}
@ -53,7 +53,7 @@ index 34804dc42c7a18108126c14c1b5f3d5a9a46f83d..4cbceb1c18dbee75ac5154ff0c15a4e7
int i = this.data.palette.idFor(value);
int j = this.data.storage.getAndSet(index, i);
return this.data.palette.valueFor(j);
@@ -193,7 +193,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -132,7 +132,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
@ -62,7 +62,7 @@ index 34804dc42c7a18108126c14c1b5f3d5a9a46f83d..4cbceb1c18dbee75ac5154ff0c15a4e7
int i = this.data.palette.idFor(value);
this.data.storage.set(index, i);
}
@@ -218,7 +218,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -157,7 +157,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
});
}
@ -71,16 +71,16 @@ index 34804dc42c7a18108126c14c1b5f3d5a9a46f83d..4cbceb1c18dbee75ac5154ff0c15a4e7
this.acquire();
try {
@@ -238,7 +238,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -173,7 +173,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
@Override
@Deprecated @io.papermc.paper.annotation.DoNotUse public void write(FriendlyByteBuf buf) { this.write(buf, null, 0); }
@Override
- 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
- public void write(FriendlyByteBuf buf) {
+ public synchronized void write(FriendlyByteBuf buf) { // Paper - synchronize
this.acquire();
try {
@@ -300,7 +300,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -228,7 +228,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
@Override

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to fix items merging through walls
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 028fd9c7cb927cde84ee2d078681d122d7d928aa..d9d50c2658aa3db77948e051d068876d2f5042e6 100644
index 7678199278324cce4ce736197cb8766c134a0f87..998fe14ef28aaaf9246a05d8670c4caa8306c4d1 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -252,6 +252,14 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -257,6 +257,14 @@ public class ItemEntity extends Entity implements TraceableEntity {
ItemEntity entityitem = (ItemEntity) iterator.next();
if (entityitem.isMergable()) {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Fix invulnerable end crystals
MC-108513
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
index af71d534048f195e72ee0f7955740467f3ada8a2..64f17b4a22454b59968787089253eaba0a04c1f2 100644
index e6d137cd6d89ac8cca76105edbab75c506c966d6..13514a583c04a3bc555099dffa5997c79fce1d69 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
@@ -29,6 +29,7 @@ public class EndCrystal extends Entity {