13
0
geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Jake Potrebic 2023-09-21 22:41:27 -07:00
Ursprung a62835bbb1
Commit 2cee84193c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5
93 geänderte Dateien mit 449 neuen und 458 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Added world settings for mobs picking up loot
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 4ea7a6bd6fdc98bef30546e19e2676a78fb29007..ef525e5f523966c9af7380e8d09ff5092e56e7c5 100644
index dadb419a04b343d6ba59353c6caa1a50aa07b67f..6be9e8d693bbb084791d7b30a1891ddb803d6b02 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -153,7 +153,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@ -18,10 +18,10 @@ index 4ea7a6bd6fdc98bef30546e19e2676a78fb29007..ef525e5f523966c9af7380e8d09ff509
LocalDate localdate = LocalDate.now();
int i = localdate.get(ChronoField.DAY_OF_MONTH);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 3ca308bb6668392a4f7ce1296e1ef6094060491f..0911a232dcc334503dbeb5f8198d2acc75a954f0 100644
index 6b8315ab1bdd963c04e56f214f6bdfd6b5eb8f48..e28718fb76d6c53c31ed358779e28133de49cd7f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -514,7 +514,7 @@ public class Zombie extends Monster {
@@ -515,7 +515,7 @@ public class Zombie extends Monster {
Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
float f = difficulty.getSpecialMultiplier();

Datei anzeigen

@ -5,37 +5,37 @@ Subject: [PATCH] Implemented BlockFailedDispenseEvent
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
index 504ba1588ae0c35c81934d0a09f0ad70d542d968..9ec043ff2cd38e589066a3eb7f42834e4e7592cf 100644
index e66ed3fcfcbabf4b466c1f7988d337b3b7bcd85d..d86a5f80171e13c2b1a1fd90b4c1471fadd957b4 100644
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
@@ -83,8 +83,10 @@ public class DispenserBlock extends BaseEntityBlock {
int i = tileentitydispenser.getRandomSlot(world.random);
@@ -89,8 +89,10 @@ public class DispenserBlock extends BaseEntityBlock {
int i = tileentitydispenser.getRandomSlot(world.random);
if (i < 0) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) {// Paper - BlockFailedDispenseEvent is called here
world.levelEvent(1001, pos, 0);
world.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState()));
+ } // Paper
} else {
ItemStack itemstack = tileentitydispenser.getItem(i);
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
if (i < 0) {
+ if (orgg.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) {// Paper - BlockFailedDispenseEvent is called here
world.levelEvent(1001, pos, 0);
world.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState()));
+ } // Paper
} else {
ItemStack itemstack = tileentitydispenser.getItem(i);
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
diff --git a/src/main/java/net/minecraft/world/level/block/DropperBlock.java b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
index 1415ad60163f6584619cc7caa61f1848d6ebaa93..801c4c120e98584bcf218a4ef9bd66d7d18c1097 100644
index 7dd0570b2457c612484ab89a8efcedd094c4772c..b1ba2c1da9d7b59a5316574deb8247406b55d28d 100644
--- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
@@ -44,6 +44,7 @@ public class DropperBlock extends DispenserBlock {
int i = tileentitydispenser.getRandomSlot(world.random);
@@ -52,6 +52,7 @@ public class DropperBlock extends DispenserBlock {
int i = tileentitydispenser.getRandomSlot(world.random);
if (i < 0) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - BlockFailedDispenseEvent is called here
world.levelEvent(1001, pos, 0);
} else {
ItemStack itemstack = tileentitydispenser.getItem(i);
if (i < 0) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - BlockFailedDispenseEvent is called here
world.levelEvent(1001, pos, 0);
} else {
ItemStack itemstack = tileentitydispenser.getItem(i);
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index a82a5fd54a962fdcf86f2bc139085ed526cade5e..5c6650892892228dd8e9b4fbd62f4f014d6ddff3 100644
index 84941643036e4dc1cf135a24360e6a1c011969d5..851ac82b242d513015487c15476a66d2b8b2158d 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1995,4 +1995,12 @@ public class CraftEventFactory {
@@ -1997,4 +1997,12 @@ public class CraftEventFactory {
Bukkit.getPluginManager().callEvent(event);
return event;
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Added PlayerLoomPatternSelectEvent
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
index c4766df6d64b484375e5e3474e97dee196c0fef4..0a87996a6ab5b4d67c2aa10daadf6174bc647a44 100644
index 757ee83a0ec5d381eb328f31f3bef636a9b72d57..e28c1cdf4763e9db3e29b3c0f08d65f978017931 100644
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@@ -173,8 +173,35 @@ public class LoomMenu extends AbstractContainerMenu {

Datei anzeigen

@ -10,7 +10,7 @@ public net.minecraft.world.entity.monster.Zombie DOOR_BREAKING_PREDICATE
Co-authored-by: Doc <nachito94@msn.com>
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
index e6139ff42470cfa9bcad02d746f15b99b1096b48..2acc531bd9e948251cac77d979f973678f576394 100644
index 9fec5823d99d1ae8e41d9e21f7ddb8b8e94bf887..ad41bbbf5395ed18c2c9e1e692c7661a6e0cb98c 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
@@ -197,7 +197,7 @@ public class Vindicator extends AbstractIllager {
@ -23,10 +23,10 @@ index e6139ff42470cfa9bcad02d746f15b99b1096b48..2acc531bd9e948251cac77d979f97367
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 0911a232dcc334503dbeb5f8198d2acc75a954f0..e58c3e2163be271ff2668a55098ea8f48f8636ad 100644
index e28718fb76d6c53c31ed358779e28133de49cd7f..b13365fe65507ad2935797a31baa8474b018f516 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -99,7 +99,7 @@ public class Zombie extends Monster {
@@ -100,7 +100,7 @@ public class Zombie extends Monster {
public Zombie(EntityType<? extends Zombie> type, Level world) {
super(type, world);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Empty commands shall not be dispatched
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 87ce129e1d592bcf68169feb559f44d5cda7c486..c034a772b95485a91ab800962b7d9dbf3d074a82 100644
index 148cfe9eac43cafee016d58a1344a97a2e69aa77..c37d9fb4f1fb388e5c264404de378cee298fd253 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -263,6 +263,7 @@ public class Commands {
@@ -269,6 +269,7 @@ public class Commands {
command = event.getCommand();
String[] args = command.split(" ");

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Remove stale POIs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 838907e8ae95d72797d01188836a05bff01d8a14..fb256e7c60f4e82b028f6768f591098882e27dd1 100644
index 720568b34c903c80d916a5915c9733c4ed565dcf..752c7ecd4de3cbeded66f457248941f1604dedf5 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2072,6 +2072,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1831,6 +1831,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
});
optional1.ifPresent((holder) -> {
this.getServer().execute(() -> {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix villager boat exploit
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index a474db28f74b698621342510d01bf38775794a8e..13e2fb9e48ed8722b68b2ce2994d9d84bb22cee4 100644
index ceb8e91ba1f14a6d6ab516753f87bbd5b681a18a..62f2a93fe4c9761251ce63bdb95757c72733da7b 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -598,6 +598,14 @@ public abstract class PlayerList {
@@ -585,6 +585,14 @@ public abstract class PlayerList {
PlayerList.LOGGER.debug("Removing player mount");
entityplayer.stopRiding();
entity.getPassengersAndSelf().forEach((entity1) -> {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 13e2fb9e48ed8722b68b2ce2994d9d84bb22cee4..600bb44d97b477960108ea8cd84a8e734b7e10d0 100644
index 62f2a93fe4c9761251ce63bdb95757c72733da7b..f8645e19492b8fb3ca4c36611e2d6e5cf84cf9d4 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1086,6 +1086,11 @@ public abstract class PlayerList {
@@ -1080,6 +1080,11 @@ public abstract class PlayerList {
}
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
@ -20,7 +20,7 @@ index 13e2fb9e48ed8722b68b2ce2994d9d84bb22cee4..600bb44d97b477960108ea8cd84a8e73
if (player.connection != null) {
byte b0;
@@ -1100,8 +1105,10 @@ public abstract class PlayerList {
@@ -1094,8 +1099,10 @@ public abstract class PlayerList {
player.connection.send(new ClientboundEntityEventPacket(player, b0));
}
@ -32,10 +32,10 @@ index 13e2fb9e48ed8722b68b2ce2994d9d84bb22cee4..600bb44d97b477960108ea8cd84a8e73
public boolean isWhiteListed(GameProfile profile) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 309b489c11387a0a3555813a848b7be978ba2529..04abb49aa5b947e4c265471358981ed41b36ddd6 100644
index f4572fdcb6cfbfed75436cdd3a9a829b7f47fe3f..d6617dd0b7b57914a4449ab72873b027a73bcd7c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -638,6 +638,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -598,6 +598,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
? (org.bukkit.entity.Firework) entity.getBukkitEntity()
: null;
}

Datei anzeigen

@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..09837f6e6c6ab8a1df2aacdb86646993
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index 4da303d7e15496f04f0e27bfb613176bc2a72b76..3c7920721914588a3e7eaf1faff46f7305823416 100644
index d70317d0306a7b55ba88b0d2360c9b190454e049..511d0afbd7f3593c8a41e64ef716eaa6f32f3bf8 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -121,6 +121,24 @@ public abstract class ChunkGenerator {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Collision option for requiring a player participant
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1bca9f5d58c5adfff3610ab1e7296de3647adaec..3d1cde6740e2b68d8d6e372cb52a6485fc3f7316 100644
index 37906167da097b6a6308e8c358d6a344c605d550..f30bafd45d038d6abcb929b138b332a18aa84307 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1919,6 +1919,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1842,6 +1842,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public void push(Entity entity) {
if (!this.isPassengerOfSameVehicle(entity)) {
if (!entity.noPhysics && !this.noPhysics) {
@ -17,7 +17,7 @@ index 1bca9f5d58c5adfff3610ab1e7296de3647adaec..3d1cde6740e2b68d8d6e372cb52a6485
double d1 = entity.getZ() - this.getZ();
double d2 = Mth.absMax(d0, d1);
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index 1f909082eb123bfe37e1078962ee7d71c78a8194..d948850a44464618117c441cca94775b0319b157 100644
index a719ea3cd6714686ead9c1817e9592733a980444..350d931f99bea1291f890d87fca6ae644c1a9fe9 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -840,6 +840,7 @@ public abstract class AbstractMinecart extends Entity {
@ -29,10 +29,10 @@ index 1f909082eb123bfe37e1078962ee7d71c78a8194..d948850a44464618117c441cca94775b
// CraftBukkit start
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
index 415c6fd01dd871729c054f916702f9f3062c346c..a459a7889c7462b9c8e6474d987151f15720a98e 100644
index 7c233b03bac04520f0be9148fcd12282680bd39d..d958715094c8581c5b008568f8384169c507290b 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -246,6 +246,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
@@ -265,6 +265,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
@Override
public void push(Entity entity) {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Return chat component with empty text instead of throwing
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 4ac91ba7dc754b120189fd32d24076d51b17d7c6..19b0ae77e99c972159cb236403f420baa0cc46e0 100644
index 877b80ef3028acd9a783adf933286be0a86227bf..1a19c6dc49cac784ca56d92ec755d6ead9811b20 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -89,7 +89,12 @@ public abstract class AbstractContainerMenu {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max leash distance
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index 5f3a14ca456e65894e824864ccf3cd5fabc9c6bd..d84f49457a759f0dd556df8a9634239b530e2761 100644
index b5964614823059261c28eb2e998ad54249f07e7b..452f219fde958fb4dc775cd2c56c0576c45a8045 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -48,7 +48,7 @@ public abstract class PathfinderMob extends Mob {
@@ -56,7 +56,7 @@ public abstract class PathfinderMob extends Mob {
float f = this.distanceTo(entity);
if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
@ -17,7 +17,7 @@ index 5f3a14ca456e65894e824864ccf3cd5fabc9c6bd..d84f49457a759f0dd556df8a9634239b
this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.dropLeash(true, true);
}
@@ -57,7 +57,7 @@ public abstract class PathfinderMob extends Mob {
@@ -65,7 +65,7 @@ public abstract class PathfinderMob extends Mob {
}
this.onLeashDistance(f);

Datei anzeigen

@ -5,22 +5,22 @@ Subject: [PATCH] Implement BlockPreDispenseEvent
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
index 9ec043ff2cd38e589066a3eb7f42834e4e7592cf..4720b884e1e311f44a012f1219fe648a411247b4 100644
index d86a5f80171e13c2b1a1fd90b4c1471fadd957b4..edcdaac8078d131cffacae25764a1c3c6ad79923 100644
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
@@ -92,6 +92,7 @@ public class DispenserBlock extends BaseEntityBlock {
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
@@ -98,6 +98,7 @@ public class DispenserBlock extends BaseEntityBlock {
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
if (idispensebehavior != DispenseItemBehavior.NOOP) {
if (idispensebehavior != DispenseItemBehavior.NOOP) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - BlockPreDispenseEvent is called here
DispenserBlock.eventFired = false; // CraftBukkit - reset event status
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
}
DispenserBlock.eventFired = false; // CraftBukkit - reset event status
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 5c6650892892228dd8e9b4fbd62f4f014d6ddff3..1886310fe234ec615055d49ac0c2c77bc4fc7a60 100644
index 851ac82b242d513015487c15476a66d2b8b2158d..b6648899c2146dbd41c3e4cafabeb3f7db129738 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -2002,5 +2002,11 @@ public class CraftEventFactory {
@@ -2004,5 +2004,11 @@ public class CraftEventFactory {
io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.BlockFailedDispenseEvent(block);
return event.callEvent();
}

Datei anzeigen

@ -5,12 +5,12 @@ Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
index 79fba896aabe1ff2a19f6c50f5dfdb351587e391..335d0a85378c04dd466fafd42048b2474c815cb9 100644
index e6a4e8dcdbc49b427c2802f1a358f8f9ad04d0f0..685c35419de7e3c4e854a28118a243e65250ef59 100644
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
@@ -158,13 +158,27 @@ public class BeaconMenu extends AbstractContainerMenu {
@@ -169,13 +169,27 @@ public class BeaconMenu extends AbstractContainerMenu {
public MobEffect getSecondaryEffect() {
return MobEffect.byId(this.beaconData.get(2));
return BeaconMenu.decodeEffect(this.beaconData.get(2));
}
+ // Paper start
+ private static @Nullable org.bukkit.potion.PotionEffectType convert(Optional<MobEffect> effect) {
@ -22,17 +22,17 @@ index 79fba896aabe1ff2a19f6c50f5dfdb351587e391..335d0a85378c04dd466fafd42048b247
public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) {
if (this.paymentSlot.hasItem()) {
- this.beaconData.set(1, (Integer) primary.map(MobEffect::getId).orElse(-1));
- this.beaconData.set(2, (Integer) secondary.map(MobEffect::getId).orElse(-1));
- this.beaconData.set(1, BeaconMenu.encodeEffect((MobEffect) primary.orElse(null))); // CraftBukkit - decompile error
- this.beaconData.set(2, BeaconMenu.encodeEffect((MobEffect) secondary.orElse(null))); // CraftBukkit - decompile error
+ // Paper start
+ io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock());
+ if (event.callEvent()) {
+ this.beaconData.set(1, event.getPrimary() == null ? -1 : event.getPrimary().getId());
+ this.beaconData.set(2, event.getSecondary() == null ? -1 : event.getSecondary().getId());
+ if (event.willConsumeItem()) {
+ this.beaconData.set(1, BeaconMenu.encodeEffect(event.getPrimary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getPrimary())));
+ this.beaconData.set(2, BeaconMenu.encodeEffect(event.getSecondary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getSecondary())));
+ if (event.willConsumeItem()) {
+ // Paper end
this.paymentSlot.remove(1);
+ }
+ }
this.access.execute(Level::blockEntityChanged);
+ } // Paper end
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add toggle for always placing the dragon egg
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 774f408b1520646dd32eb7d66e33946a7e1e72df..bdd394d5fc5b08d0f40c75924e5ad22ec6637af8 100644
index 7741b27816636aaa48277b2fe14fd7b88cd3d78a..99321471d2c8c154059ebf345c63f8918a4cd75a 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -407,7 +407,7 @@ public class EndDragonFight {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent
Co-Authored-By: MiniDigger <admin@benndorf.dev>
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
index 00f01ab2eff69c18b50ec07b7623af66c66a28b6..1b1f814770d1a906ed880df578845be2e9a14f46 100644
index 70ecc3f673ebd56b65ad901e10f40c28368cbfac..b430e8cfc3999b7e15183850b0312b8388dca903 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -62,7 +62,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
@@ -63,7 +63,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
public StonecutterMenu(int syncId, Inventory playerInventory, final ContainerLevelAccess context) {
super(MenuType.STONECUTTER, syncId);
@ -18,7 +18,7 @@ index 00f01ab2eff69c18b50ec07b7623af66c66a28b6..1b1f814770d1a906ed880df578845be2
this.recipes = Lists.newArrayList();
this.input = ItemStack.EMPTY;
this.slotUpdateListener = () -> {
@@ -160,7 +160,29 @@ public class StonecutterMenu extends AbstractContainerMenu {
@@ -161,7 +161,29 @@ public class StonecutterMenu extends AbstractContainerMenu {
@Override
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
if (this.isValidRecipeIndex(id)) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index cbdbc859416d51d0311ce5f6032a2b4dfe34d3a7..5b134bd0cc4c2ba20eaf275c190c139d987d9bcb 100644
index 7bbb68bf06e04b58b6c4fa546fe919e387e00b27..c17ea8bdbbd5581b4a2728564fad72f6bb518f66 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1298,12 +1298,15 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1306,12 +1306,15 @@ public abstract class Mob extends LivingEntity implements Targeting {
return InteractionResult.PASS;
} else if (this.getLeashHolder() == player) {
// CraftBukkit start - fire PlayerUnleashEntityEvent
@ -26,7 +26,7 @@ index cbdbc859416d51d0311ce5f6032a2b4dfe34d3a7..5b134bd0cc4c2ba20eaf275c190c139d
this.gameEvent(GameEvent.ENTITY_INTERACT, player);
return InteractionResult.sidedSuccess(this.level().isClientSide);
} else {
@@ -1471,8 +1474,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1479,8 +1482,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@ -40,7 +40,7 @@ index cbdbc859416d51d0311ce5f6032a2b4dfe34d3a7..5b134bd0cc4c2ba20eaf275c190c139d
}
}
@@ -1535,8 +1541,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1543,8 +1549,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
boolean flag1 = super.startRiding(entity, force);
if (flag1 && this.isLeashed()) {
@ -54,7 +54,7 @@ index cbdbc859416d51d0311ce5f6032a2b4dfe34d3a7..5b134bd0cc4c2ba20eaf275c190c139d
}
return flag1;
@@ -1719,8 +1728,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1733,8 +1742,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
@Override
protected void removeAfterChangingDimensions() {
super.removeAfterChangingDimensions();
@ -69,10 +69,10 @@ index cbdbc859416d51d0311ce5f6032a2b4dfe34d3a7..5b134bd0cc4c2ba20eaf275c190c139d
if (!itemstack.isEmpty()) {
itemstack.setCount(0);
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index d84f49457a759f0dd556df8a9634239b530e2761..a4dfe40d30a5abf5d614d0921b3b23023fdbc4b1 100644
index 452f219fde958fb4dc775cd2c56c0576c45a8045..8e362ad31208d87f4a69a1747485610e0588be51 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -49,8 +49,11 @@ public abstract class PathfinderMob extends Mob {
@@ -57,8 +57,11 @@ public abstract class PathfinderMob extends Mob {
if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
@ -86,7 +86,7 @@ index d84f49457a759f0dd556df8a9634239b530e2761..a4dfe40d30a5abf5d614d0921b3b2302
}
return;
@@ -58,8 +61,11 @@ public abstract class PathfinderMob extends Mob {
@@ -66,8 +69,11 @@ public abstract class PathfinderMob extends Mob {
this.onLeashDistance(f);
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
@ -122,10 +122,10 @@ index 16784fcc853e23689a854e7dc6c03ed8182a164e..4eb97572a97a8d98af37c4223f42fc63
flag1 = true;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 1886310fe234ec615055d49ac0c2c77bc4fc7a60..e7e113b9d45dda50a38215088a846cc468a53344 100644
index b6648899c2146dbd41c3e4cafabeb3f7db129738..afa573305f4fff403b72273b2faee76b1cb0e185 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1590,8 +1590,10 @@ public class CraftEventFactory {
@@ -1592,8 +1592,10 @@ public class CraftEventFactory {
return itemInHand;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Reset shield blocking on dimension change
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4581bdf4525c05df235e47ab772fbf5c5f2d6b50..03bb3c6a7cca2c5363d8c4a8836fea865b571df0 100644
index 33f04964a2a56d36853d5ef53b79535bc56e7290..2f91d3938a81b058c95bb1bbd7967e8c309d5c15 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1240,6 +1240,11 @@ public class ServerPlayer extends Player {
@@ -1199,6 +1199,11 @@ public class ServerPlayer extends Player {
this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
// CraftBukkit end
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] add DragonEggFormEvent
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index bdd394d5fc5b08d0f40c75924e5ad22ec6637af8..5c0767a0bc37b5f0aa3f8892826e58f93f11cf97 100644
index 99321471d2c8c154059ebf345c63f8918a4cd75a..c29ccc66c95faba425acb0ca06af15e2783b4bae 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -407,9 +407,23 @@ public class EndDragonFight {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 892830b2d9a15a832040fbeac5fca3d011082c27..d974b6c0f034722a0d2f143843c5a7b280883d5f 100644
index 2d2e7fe673962cdf21a7623b51e2731132cd3c01..8788b893329dcd424af53224338868bbf410e5a2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1503,6 +1503,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1496,6 +1496,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
@ -17,7 +17,7 @@ index 892830b2d9a15a832040fbeac5fca3d011082c27..d974b6c0f034722a0d2f143843c5a7b2
this.profiler.push(() -> {
return worldserver + " " + worldserver.dimension().location();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index fb256e7c60f4e82b028f6768f591098882e27dd1..cfd0e75ac4e7edbd219cc0f5fb802e37737cc4ba 100644
index 752c7ecd4de3cbeded66f457248941f1604dedf5..cc5e6c2de2fb3455aab134b43ab207467b832107 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -220,6 +220,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -29,10 +29,10 @@ index fb256e7c60f4e82b028f6768f591098882e27dd1..cfd0e75ac4e7edbd219cc0f5fb802e37
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e4fd0bc35064e7962c7e43f9d0ee502463a6085f..816f9b66c5d096ac31585ed29b80e11f5fadec87 100644
index 6b877e084caf931f8f0908c657ed0c8b6124a165..c5b9963c07ac6fb0ffeb2782b2ae22ab4cde2c08 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3333,6 +3333,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3362,6 +3362,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.pushEntities();
this.level().getProfiler().pop();

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index cfd0e75ac4e7edbd219cc0f5fb802e37737cc4ba..6fc54777e15cebaef7e30702f8537a9a337ad2ed 100644
index cc5e6c2de2fb3455aab134b43ab207467b832107..b6e2e23d773ca3b9f35c7905bbc0f7681cb4a309 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1652,6 +1652,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1420,6 +1420,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
this.getChunkSource().blockChanged(pos);
@ -16,7 +16,7 @@ index cfd0e75ac4e7edbd219cc0f5fb802e37737cc4ba..6fc54777e15cebaef7e30702f8537a9a
VoxelShape voxelshape = oldState.getCollisionShape(this, pos);
VoxelShape voxelshape1 = newState.getCollisionShape(this, pos);
@@ -1693,6 +1694,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1461,6 +1462,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Allow adding items to BlockDropItemEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index e7e113b9d45dda50a38215088a846cc468a53344..ecf0a23435532cc6a771ef04787bbef190699edb 100644
index afa573305f4fff403b72273b2faee76b1cb0e185..5bb610230e5686dd8a35c5c14c506ffacd5868c9 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -449,13 +449,30 @@ public class CraftEventFactory {
@@ -451,13 +451,30 @@ public class CraftEventFactory {
}
public static void handleBlockDropItemEvent(Block block, BlockState state, ServerPlayer player, List<ItemEntity> items) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] living entity allow attribute registration
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
index 03561cb69c58e4ed8115a9e67df28d5df1f79bc4..dd1102d5291ef6f18e82400a6d8a0a376cc071e9 100644
index d5dfb08f550f5644ff5164170d6c16a3b25a3748..7204b973c3ad9239e82355513f6d538107102e48 100644
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
@@ -150,4 +150,12 @@ public class AttributeMap {
@@ -152,4 +152,12 @@ public class AttributeMap {
}
}
@ -41,7 +41,7 @@ index 233e372ba5d785352c9ac12dac37395bac63315c..0e61caa5c9f21788fbeaa90ed75d23e1
return BuiltInRegistries.ATTRIBUTE.get(CraftNamespacedKey.toMinecraft(attribute.getKey()));
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index eae5d75cd93416235690196cf2c88e7a17e1b97a..918a938732cd08756f8498c5422f4475fd3b531d 100644
index 4d41a73281c851c1ff9506074f7590c06105efbb..13b4873923d64ab4b18795ce7f2dbc9a7abf067e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -710,6 +710,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Expose Tracked Players
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 2a0299d5dcafb9659ffd66fe2cc12843208a7408..fa31c69a84acd20c23f6d466fb0fb36eb4209206 100644
index 3f2a8efc6ad9e6e2043bf96894c47e578c68e263..de7deb9c27ffb7628124270091a5ba81b075c824 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1352,5 +1352,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

Datei anzeigen

@ -21,7 +21,7 @@ index a20d47f54f12dfc0a5f76dd969238e34c958b618..935dac757280731bfeb0a8f033cbe315
this.saveUserBanList();
this.loadIpBanList();
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 31bdf41a3e914c79e42f85b7f0aef439f35288f1..1545acb625ee97e596ccd54d049d47422b8673b3 100644
index 5d90fc103577a5dab63daf9a23ba46da7eba1e18..c733f30d81c15984c3ab2eb5568a9b762a35bc96 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -198,6 +198,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -48,14 +48,14 @@ index 31bdf41a3e914c79e42f85b7f0aef439f35288f1..1545acb625ee97e596ccd54d049d4742
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 600bb44d97b477960108ea8cd84a8e734b7e10d0..6d333b75f898fc34c7e739a1246a202329f1b9ff 100644
index f8645e19492b8fb3ca4c36611e2d6e5cf84cf9d4..4c3d0bee54d6458daea83085e3ad0c9db6e3c759 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -186,6 +186,7 @@ public abstract class PlayerList {
@@ -178,6 +178,7 @@ public abstract class PlayerList {
this.maxPlayers = maxPlayers;
this.playerIo = saveHandler;
}
+ abstract public void loadAndSaveFiles(); // Paper - moved from DedicatedPlayerList constructor
public void placeNewPlayer(Connection connection, ServerPlayer player) {
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
player.isRealPlayer = true; // Paper

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add recipe to cook events
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 5ea9a6e9fa197fd00952c5ade426d7de50497a5e..d1eff8a4c83227d74502b5924df43f87c457a537 100644
index b6e31bede16f7dbc9abb6609f1c39b82883512b2..963386d26c1beef3730bcf65ef74676d881c8c70 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
@@ -437,7 +437,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@ -18,26 +18,28 @@ index 5ea9a6e9fa197fd00952c5ade426d7de50497a5e..d1eff8a4c83227d74502b5924df43f87
if (furnaceSmeltEvent.isCancelled()) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
index ca995270c9b8d7024504a9ba885b1c0214b33a8b..0cd019dc20ff5b3e7ee663866f98595081e991a3 100644
index 24e2063db933bfbc8fc1f34edb8106ae4d7c633c..04b2697ee857e714b1202d02d093b0c60f079a6f 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
@@ -62,7 +62,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -63,8 +63,10 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack});
- ItemStack itemstack1 = (ItemStack) campfire.quickCheck.getRecipeFor(inventorysubcontainer, world).map((recipecampfire) -> {
+ Optional<CampfireCookingRecipe> recipe = campfire.quickCheck.getRecipeFor( inventorysubcontainer, world);
+ ItemStack itemstack1 = (ItemStack) recipe.map((recipecampfire) -> {
- ItemStack itemstack1 = (ItemStack) campfire.quickCheck.getRecipeFor(inventorysubcontainer, world).map((recipeholder) -> {
- return ((CampfireCookingRecipe) recipeholder.value()).assemble(inventorysubcontainer, world.registryAccess());
+ Optional<RecipeHolder<CampfireCookingRecipe>> recipeHolderOptional = campfire.quickCheck.getRecipeFor( inventorysubcontainer, world);
+ ItemStack itemstack1 = (ItemStack) recipeHolderOptional.map((recipeholder) -> {
+ // Paper end
return recipecampfire.assemble(inventorysubcontainer, world.registryAccess());
+ return recipeholder.value().assemble(inventorysubcontainer, world.registryAccess());
}).orElse(itemstack);
@@ -71,7 +73,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
if (itemstack1.isItemEnabled(world.enabledFeatures())) {
@@ -72,7 +74,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
- BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result);
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipe.map(CampfireCookingRecipe::toBukkitRecipe).orElse(null)); // Paper
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeHolderOptional.map(RecipeHolder::toBukkitRecipe).orElse(null)); // Paper
world.getCraftServer().getPluginManager().callEvent(blockCookEvent);
if (blockCookEvent.isCancelled()) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Allow using signs inside spawn protection
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 240b1f8efa672fb6d1967ef2b895c6710596e2cd..8a63c2e82360fc90bf9f75c5ec4c580f40d2436d 100644
index 2921754736ce51b76337e1ef9d052e680af01db5..daca7fecba44a05d61d4537d6660f8707de91941 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1831,7 +1831,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1718,7 +1718,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
int i = this.player.level().getMaxBuildHeight();
if (blockposition.getY() < i) {

Datei anzeigen

@ -20,10 +20,10 @@ index b5981001d8ad4d6c79b965be9a446352971b0d29..0624ba7f1f5b352a5730b6b4736b2499
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f7acc0c4e385c48ca651166baf33caa247e582f6..16b0ab4e66072e4367212a3977cc075b62716efc 100644
index d09fb11e67364a2c54bf6412b1a8a48797ece3be..7396ab40cd4b807babf7bbf3ac05c58efd8eb1df 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1137,9 +1137,15 @@ public final class CraftServer implements Server {
@@ -1140,9 +1140,15 @@ public final class CraftServer implements Server {
File folder = new File(this.getWorldContainer(), name);
World world = this.getWorld(name);
@ -41,7 +41,7 @@ index f7acc0c4e385c48ca651166baf33caa247e582f6..16b0ab4e66072e4367212a3977cc075b
if (folder.exists()) {
Preconditions.checkArgument(folder.isDirectory(), "File (%s) exists and isn't a folder", name);
@@ -1226,7 +1232,7 @@ public final class CraftServer implements Server {
@@ -1229,7 +1235,7 @@ public final class CraftServer implements Server {
} else if (name.equals(levelName + "_the_end")) {
worldKey = net.minecraft.world.level.Level.END;
} else {
@ -50,7 +50,7 @@ index f7acc0c4e385c48ca651166baf33caa247e582f6..16b0ab4e66072e4367212a3977cc075b
}
ServerLevel internal = (ServerLevel) new ServerLevel(this.console, console.executor, worldSession, worlddata, worldKey, worlddimension, this.getServer().progressListenerFactory.create(11),
@@ -1318,6 +1324,15 @@ public final class CraftServer implements Server {
@@ -1321,6 +1327,15 @@ public final class CraftServer implements Server {
return null;
}
@ -67,10 +67,10 @@ index f7acc0c4e385c48ca651166baf33caa247e582f6..16b0ab4e66072e4367212a3977cc075b
// Check if a World already exists with the UID.
if (this.getWorld(world.getUID()) != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index c168dbfa5bc4aa49a1d743fe4b53d8169f01e1a0..16ef907b9443b9feedd768d0116762799fee9ab3 100644
index 0fb0c8238be1e199220ef62576547ea6c9484a9c..1f21a5c60c5472b1694d379326d391c0866456cc 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -523,6 +523,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -524,6 +524,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int nextEntityId() {
return net.minecraft.world.entity.Entity.nextEntityId();
}

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Item Rarity API
public net.minecraft.world.item.Item rarity
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 16ef907b9443b9feedd768d0116762799fee9ab3..2a08fca2c863717b72341772630cd4b690f34968 100644
index 1f21a5c60c5472b1694d379326d391c0866456cc..d50b92daec5fec3056af9620681da28b10222829 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -528,6 +528,20 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -529,6 +529,20 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getMainLevelName() {
return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName;
}

Datei anzeigen

@ -7,10 +7,10 @@ Fixes disappearance of held items, when a player gets disconnected and PlayerDro
Closes #5036
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 6d333b75f898fc34c7e739a1246a202329f1b9ff..f375947876c5c834bdab66a26a06b3a43c08e65d 100644
index 4c3d0bee54d6458daea83085e3ad0c9db6e3c759..b1ade7ad31fb7d42379333c9875d26b664135517 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -591,6 +591,14 @@ public abstract class PlayerList {
@@ -578,6 +578,14 @@ public abstract class PlayerList {
}
// Paper end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] forced whitelist: use configurable kick message
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d974b6c0f034722a0d2f143843c5a7b280883d5f..17e963f927c81dfb6bf10f621c76c6631fd2dd97 100644
index 8788b893329dcd424af53224338868bbf410e5a2..a708e61770ebe77cb43791eb033aeba2f6b3abab 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2147,7 +2147,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2153,7 +2153,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)

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Don't ignore result of PlayerEditBookEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8a63c2e82360fc90bf9f75c5ec4c580f40d2436d..4f3ffde225a46439563c3b33f48a0197bf74bbf1 100644
index daca7fecba44a05d61d4537d6660f8707de91941..84d8775c591a8c9f0cd843c20b2f0076139f0810 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1292,7 +1292,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1179,7 +1179,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
itemstack.addTagElement("pages", nbttaglist);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 2a08fca2c863717b72341772630cd4b690f34968..e540a219e26ecb1b2f93df01a34dd754faea1f10 100644
index d50b92daec5fec3056af9620681da28b10222829..da21cb49d986f899ed174c8c1abd35bcb03d31f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -542,6 +542,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -543,6 +543,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public io.papermc.paper.inventory.ItemRarity getItemStackRarity(org.bukkit.inventory.ItemStack itemStack) {
return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()];
}

Datei anzeigen

@ -208,7 +208,7 @@ index 0000000000000000000000000000000000000000..dd9d77d7c7f1a5a130a1f4c15e5b1e68
+ public void setErrorIndex(final int errorIndex) {}
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 1545acb625ee97e596ccd54d049d47422b8673b3..00a75a9bee2ffac80d334fe60ddd69ee526341fb 100644
index c733f30d81c15984c3ab2eb5568a9b762a35bc96..e9f92a8c225f5f035d35c98743ed7af26cb064c0 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -173,7 +173,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

Datei anzeigen

@ -9,10 +9,10 @@ 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 816f9b66c5d096ac31585ed29b80e11f5fadec87..c0c864bcad6ba6466d7a6453ce920a3603f6066a 100644
index c5b9963c07ac6fb0ffeb2782b2ae22ab4cde2c08..59a377a291927b843b9e4fb4a558eeb729f3d6a8 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3817,6 +3817,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3876,6 +3876,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.level().getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {

Datei anzeigen

@ -8,7 +8,7 @@ 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 4fb1fde4983d81cc35e2c8717984d929460959b8..50c79be12cf8778a2ce451a8c9bb2cdc277d6830 100644
index ec11db0cfdc5977bff6198efd10f716393931335..5d372b390f3046b4ce19296803c5fbfee798e69b 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
@ -25,6 +25,6 @@ index 4fb1fde4983d81cc35e2c8717984d929460959b8..50c79be12cf8778a2ce451a8c9bb2cdc
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
- if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) {
+ if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper
packet.hostName = split[0];
connection.hostname = split[0];
connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
connection.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] );
connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );

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 8d1bbc1ac3dbc10e940a0715ebfa1d5a2674b303..3f64d57b7d92820226c323d1d560432f5c27e650 100644
index c9f4f496a92ff8465a21f22f326dc025aa8bd169..268d0abadb1c6de78f7b2de964808ca7029970a8 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 d1eff8a4c83227d74502b5924df43f87c457a537..436290eaa0dab05a642b67b265117dbe5eceb8b7 100644
index 963386d26c1beef3730bcf65ef74676d881c8c70..6e0969f780df2f75b468fb4969e10d6aecf4ec62 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,10 +5,10 @@ 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 f1d4a66aa55c4328fe6f834830d70686c95bea51..aff140cfb2bbdce8b512080cf394c84c5c4ff807 100644
index 7e703bf1ca3cf824b06b6be731b866cd407aaff1..1afe8a8694c1fd0bf43ce3c0c36a83fda9aec141 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 {
@@ -57,6 +57,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
private int ticksUntilNextAlert;
private static final float ZOMBIFIED_PIGLIN_EYE_HEIGHT = 1.79F;
private static final float ZOMBIFIED_PIGLIN_BABY_EYE_HEIGHT_ADJUSTMENT = 0.82F;
@ -16,7 +16,7 @@ index f1d4a66aa55c4328fe6f834830d70686c95bea51..aff140cfb2bbdce8b512080cf394c84c
public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> type, Level world) {
super(type, world);
@@ -76,7 +77,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
@@ -72,7 +73,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
protected void addBehaviourGoals() {
this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0D, false));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D));
@ -25,7 +25,7 @@ index f1d4a66aa55c4328fe6f834830d70686c95bea51..aff140cfb2bbdce8b512080cf394c84c
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true));
}
@@ -184,6 +185,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
@@ -180,6 +181,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
this.level().getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
this.setPersistentAngerTarget(null);

Datei anzeigen

@ -5,10 +5,10 @@ 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 4f3ffde225a46439563c3b33f48a0197bf74bbf1..d22f9a39a7655ed41ad21f5794b7b2c77d582310 100644
index 84d8775c591a8c9f0cd843c20b2f0076139f0810..0c32edbe85d849a1b0a125ad6a9bfc6a2e50c8b7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2045,6 +2045,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1887,6 +1887,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.isImmobile()) return; // CraftBukkit
if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) {

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 b36492efc3d6338e0099988c1ff31e7211b7d010..b3634a1d92182c746948862fc64b2e47d11320ba 100644
index c44f8ed810b0c9a510d7e1c07987323a8a620ca4..dee00042a780b053cd094081874aad221abf1b2b 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -252,6 +252,11 @@ public abstract class Player extends LivingEntity {
@@ -253,6 +253,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 3e5ba6392c25e2bf9503a5429e96ffb04147ac99..47f8ad80011142aac611441029d71787c85450f2 100644
index c4df1d66ecdecef0aa03d4995d9e951421dae6dd..202ebd562ec1e2b3f1087424da60cadca5da7d01 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2088,6 +2088,69 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -2093,6 +2093,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

@ -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 00a75a9bee2ffac80d334fe60ddd69ee526341fb..36838ed14523c30676762bd8ed8d4ee644ae3422 100644
index e9f92a8c225f5f035d35c98743ed7af26cb064c0..c0e822386bdc3724ca1f24a0ed4fb60e96d9b9eb 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 f375947876c5c834bdab66a26a06b3a43c08e65d..f55c2f6f0b18456565cac50b9def91071497dee0 100644
index b1ade7ad31fb7d42379333c9875d26b664135517..ac52a17c47a35a364c0c6e36b0e4dcd117b3f266 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -810,6 +810,7 @@ public abstract class PlayerList {
@@ -805,6 +805,7 @@ public abstract class PlayerList {
// Paper start
boolean isBedSpawn = false;
@ -17,7 +17,7 @@ index f375947876c5c834bdab66a26a06b3a43c08e65d..f55c2f6f0b18456565cac50b9def9107
boolean isRespawn = false;
boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
// Paper end
@@ -830,6 +831,7 @@ public abstract class PlayerList {
@@ -825,6 +826,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 f375947876c5c834bdab66a26a06b3a43c08e65d..f55c2f6f0b18456565cac50b9def9107
Vec3 vec3d = (Vec3) optional.get();
float f1;
@@ -858,7 +860,7 @@ public abstract class PlayerList {
@@ -853,7 +855,7 @@ public abstract class PlayerList {
}
Player respawnPlayer = entityplayer1.getBukkitEntity();

Datei anzeigen

@ -5,10 +5,10 @@ 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 f3fb7e07ca65cb1c948b110b7f7edc8b0bd83b21..147e808c7e2b3ed16861c989c1ba4a0b99a5be38 100644
index 3a50fe20294048a1c818ae717a918bb1aed74dea..ca91b82a21a46b1a62564b5157882a845eae8737 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
@@ -221,6 +221,15 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
BeaconBlockEntity.playSound(world, pos, SoundEvents.BEACON_AMBIENT);
}
}
@ -24,7 +24,7 @@ index f3fb7e07ca65cb1c948b110b7f7edc8b0bd83b21..147e808c7e2b3ed16861c989c1ba4a0b
if (blockEntity.lastCheckY >= l) {
blockEntity.lastCheckY = world.getMinBuildHeight() - 1;
@@ -269,6 +278,10 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
@@ -278,6 +287,10 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
@Override
public void setRemoved() {

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 d22f9a39a7655ed41ad21f5794b7b2c77d582310..aa0a524ad7200648731fcc5e702470872c0ac3cb 100644
index 0c32edbe85d849a1b0a125ad6a9bfc6a2e50c8b7..961bb94f61b7bea88aa9371bf804b503ca405bcf 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2769,7 +2769,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2621,7 +2621,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;
@ -18,10 +18,10 @@ index d22f9a39a7655ed41ad21f5794b7b2c77d582310..aa0a524ad7200648731fcc5e70247087
} 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 f55c2f6f0b18456565cac50b9def91071497dee0..3dbad6f9ea70db07a9bfa199b28def6a67353d80 100644
index ac52a17c47a35a364c0c6e36b0e4dcd117b3f266..43dd6dbbc510320432aaafc1c5e4e91117fd8189 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -769,6 +769,12 @@ public abstract class PlayerList {
@@ -764,6 +764,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 f55c2f6f0b18456565cac50b9def91071497dee0..3dbad6f9ea70db07a9bfa199b28def6a
entityplayer.stopRiding(); // CraftBukkit
this.players.remove(entityplayer);
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
@@ -860,7 +866,7 @@ public abstract class PlayerList {
@@ -855,7 +861,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 a1467e8edd3ca66c306d01e0688a9fece69652f3..0968827df66057ec73185ce688a62e8b27abba0c 100644
index 7a98ea71fead97d3e18fa9774eb970359c18d931..07fc88f8d057c59070e5de97b91c5bf5760ff09a 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -644,6 +644,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -621,6 +621,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} else {
this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressionThreshold));
}
@ -133,7 +133,7 @@ index a1467e8edd3ca66c306d01e0688a9fece69652f3..0968827df66057ec73185ce688a62e8b
} else {
if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) {
this.channel.pipeline().remove("decompress");
@@ -652,6 +653,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -629,6 +630,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
if (this.channel.pipeline().get("compress") instanceof CompressionEncoder) {
this.channel.pipeline().remove("compress");
}
@ -142,14 +142,14 @@ index a1467e8edd3ca66c306d01e0688a9fece69652f3..0968827df66057ec73185ce688a62e8b
}
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 c98d3c5afcce17a6f13f8d456b9f77b1f2a4f3f0..2ea40a23539898b9c817440aafc91f4b5fd10977 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 {
pending.add(object); // Paper
channelpipeline.addLast("packet_handler", (ChannelHandler) object);
((Connection) object).setListener(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object));
((Connection) object).configurePacketHandler(channelpipeline);
((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object));
+ io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper
}
}).group((EventLoopGroup) lazyinitvar.get()).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
}).group(eventloopgroup).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
}

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 c034a772b95485a91ab800962b7d9dbf3d074a82..14c78028ff51fff6f24174ae16b7c42d34d6041a 100644
index c37d9fb4f1fb388e5c264404de378cee298fd253..5fd7e5aa0644fda8e2f7f57eef9a6f0011534cb9 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -396,7 +396,12 @@ public class Commands {
@@ -402,7 +402,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 65592c41b1519eff77ccd7ddd3c885058f3ed138..2e7de2378e01aed514e237029d6d64e78871c9b4 100644
index 5ea5f424c55f60bf63d3a4d3fe51362939f42f4c..1cef116b692ebdf3ade01cde533d1e5182a05a91 100644
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
+++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
@@ -56,6 +56,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
@@ -60,6 +60,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
@Nullable
private BlockPos wanderTarget;
private int despawnDelay;
@ -19,7 +19,7 @@ index 65592c41b1519eff77ccd7ddd3c885058f3ed138..2e7de2378e01aed514e237029d6d64e7
public WanderingTrader(EntityType<? extends WanderingTrader> type, Level world) {
super(type, world);
@@ -66,10 +70,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
@@ -70,10 +74,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) -> {

Datei anzeigen

@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alvinn8 <42838560+Alvinn8@users.noreply.github.com>
Date: Fri, 8 Jan 2021 20:31:13 +0100
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 d03db10517b2df98b40ab48e450333960508aabf..e38e2e5a7ddba9c140f362021b6be0b0974f7cd1 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -237,11 +237,17 @@ 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.toBukkit())); // CraftBukkit
+ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent
+ final net.kyori.adventure.text.Component message = advancement.value().display().flatMap(info -> java.util.Optional.ofNullable(info.shouldAnnounceChat() ? io.papermc.paper.adventure.PaperAdventure.asAdventure(Component.translatable("chat.type.advancement." + info.getFrame().getName(), this.player.getDisplayName(), Advancement.name(advancement))) : null)).orElse(null);
+ final org.bukkit.event.player.PlayerAdvancementDoneEvent event = new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.toBukkit(), message);
+ this.player.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ // Paper end
advancement.value().rewards().grant(this.player);
advancement.value().display().ifPresent((advancementdisplay) -> {
- if (advancementdisplay.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
- this.playerList.broadcastSystemMessage(Component.translatable("chat.type.advancement." + advancementdisplay.getFrame().getName(), this.player.getDisplayName(), Advancement.name(advancement)), false);
+ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent
+ if (event.message() != null && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
+ this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false);
+ // Paper end
}
});

Datei anzeigen

@ -5,19 +5,19 @@ Subject: [PATCH] Add raw address to AsyncPlayerPreLoginEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index c9f8f61c43428c519c0dac1b7416bad775e3429f..b026c003e1fc02a9ea426f3126acb788fc09a874 100644
index 25afcd025d32c76232910bcc7d6607eef3c4167d..e0070317d7c51e239cef45c248ab7bd7544fe56c 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -331,12 +331,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
public void fireEvents() throws Exception {
String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName();
@@ -289,12 +289,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
public void fireEvents(GameProfile gameprofile) throws Exception {
String playerName = gameprofile.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress();
+ java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.channel.remoteAddress()).getAddress(); // Paper
java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId();
+ java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.channel.remoteAddress()).getAddress(); // Paper
java.util.UUID uniqueId = gameprofile.getId();
final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server;
// Paper start
com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile);
com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(gameprofile);
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile);
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile); // Paper - add rawAddress
server.getPluginManager().callEvent(asyncEvent);

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 ef525e5f523966c9af7380e8d09ff5092e56e7c5..9ca1e9d95e62929c0015d5ca2c2f9c70e421842e 100644
index 6be9e8d693bbb084791d7b30a1891ddb803d6b02..8e9469fec42f7b6a132cf173f6f5a95777a29b3b 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,10 +48,10 @@ index ef525e5f523966c9af7380e8d09ff5092e56e7c5..9ca1e9d95e62929c0015d5ca2c2f9c70
@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 ab639cb2faaafaeb33be91bfe99ffad6d23088db..4a132c3eff6978e927bcd4df56b9ce0306af6d19 100644
index a40852acf5d175cc3a06bc17fb021c76f0c11a28..5b4719dd7c3b8f93c898779f45239568f6a5fe43 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 {
@@ -145,7 +145,7 @@ public class Phantom extends FlyingMob implements Enemy {
@Override
public void aiStep() {
@ -60,7 +60,7 @@ index ab639cb2faaafaeb33be91bfe99ffad6d23088db..4a132c3eff6978e927bcd4df56b9ce03
this.setSecondsOnFire(8);
}
@@ -175,6 +175,9 @@ public class Phantom extends FlyingMob implements Enemy {
@@ -176,6 +176,9 @@ public class Phantom extends FlyingMob implements Enemy {
if (nbt.hasUUID("Paper.SpawningEntity")) {
this.spawningEntity = nbt.getUUID("Paper.SpawningEntity");
}
@ -70,7 +70,7 @@ index ab639cb2faaafaeb33be91bfe99ffad6d23088db..4a132c3eff6978e927bcd4df56b9ce03
// Paper end
}
@@ -189,6 +192,7 @@ public class Phantom extends FlyingMob implements Enemy {
@@ -190,6 +193,7 @@ public class Phantom extends FlyingMob implements Enemy {
if (this.spawningEntity != null) {
nbt.putUUID("Paper.SpawningEntity", this.spawningEntity);
}
@ -78,7 +78,7 @@ index ab639cb2faaafaeb33be91bfe99ffad6d23088db..4a132c3eff6978e927bcd4df56b9ce03
// Paper end
}
@@ -253,6 +257,10 @@ public class Phantom extends FlyingMob implements Enemy {
@@ -258,6 +262,10 @@ public class Phantom extends FlyingMob implements Enemy {
return spawningEntity;
}
public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; }

Datei anzeigen

@ -92,10 +92,10 @@ index 0000000000000000000000000000000000000000..cf4374493c11057451a62a655514415c
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 16b0ab4e66072e4367212a3977cc075b62716efc..dcfb99b289a35b66cd39b88761684e73c50ab2ba 100644
index 7396ab40cd4b807babf7bbf3ac05c58efd8eb1df..5dc8db6134c52442cf5abdca152deaaa86495b4d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -301,6 +301,7 @@ public final class CraftServer implements Server {
@@ -304,6 +304,7 @@ public final class CraftServer implements Server {
public boolean ignoreVanillaPermissions = false;
private final List<CraftPlayer> playerView;
public int reloadCount;
@ -103,7 +103,7 @@ index 16b0ab4e66072e4367212a3977cc075b62716efc..dcfb99b289a35b66cd39b88761684e73
public static Exception excessiveVelEx; // Paper - Velocity warnings
static {
@@ -390,6 +391,7 @@ public final class CraftServer implements Server {
@@ -393,6 +394,7 @@ public final class CraftServer implements Server {
if (this.configuration.getBoolean("settings.use-map-color-cache")) {
MapPalette.setMapColorCache(new CraftMapColorCache(this.logger));
}
@ -111,7 +111,7 @@ index 16b0ab4e66072e4367212a3977cc075b62716efc..dcfb99b289a35b66cd39b88761684e73
}
public boolean getCommandBlockOverride(String command) {
@@ -2842,5 +2844,11 @@ public final class CraftServer implements Server {
@@ -2845,5 +2847,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 27eb466c3f5f4342f892d1c55c15108ae6861912..f035065aa46a8c1a2c3064b82208fbdc5ac4463d 100644
index 6e89b87dec5f9cb5e5657be0a6d23ae5edf7d2bd..cb986e6aa28729b6037ec380ad41c717cfcb7ef3 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -304,6 +304,7 @@ public class Main {
@@ -299,6 +299,7 @@ public class Main {
*/
boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");

Datei anzeigen

@ -45,10 +45,10 @@ index aee8618e27b893b72931e925724dd683d2e6d2aa..5cb15e2209d7b315904a1fc6d650ce1e
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 03bb3c6a7cca2c5363d8c4a8836fea865b571df0..0162c504673f5809b28ca58177773c005460f039 100644
index 2f91d3938a81b058c95bb1bbd7967e8c309d5c15..26733cb73d117af56457f7119f372c33a7dd1649 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1885,8 +1885,16 @@ public class ServerPlayer extends Player {
@@ -1844,8 +1844,16 @@ public class ServerPlayer extends Player {
}
public boolean setGameMode(GameType gameMode) {
@ -67,7 +67,7 @@ index 03bb3c6a7cca2c5363d8c4a8836fea865b571df0..0162c504673f5809b28ca58177773c00
} else {
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId()));
if (gameMode == GameType.SPECTATOR) {
@@ -1898,7 +1906,7 @@ public class ServerPlayer extends Player {
@@ -1857,7 +1865,7 @@ public class ServerPlayer extends Player {
this.onUpdateAbilities();
this.updateEffectVisibility();
@ -76,7 +76,7 @@ index 03bb3c6a7cca2c5363d8c4a8836fea865b571df0..0162c504673f5809b28ca58177773c00
}
}
@@ -2317,6 +2325,16 @@ public class ServerPlayer extends Player {
@@ -2264,6 +2272,16 @@ public class ServerPlayer extends Player {
}
public void loadGameTypes(@Nullable CompoundTag nbt) {
@ -94,7 +94,7 @@ index 03bb3c6a7cca2c5363d8c4a8836fea865b571df0..0162c504673f5809b28ca58177773c00
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index c256423e9dc9d1837b847da44fb2920c58842c8b..0cb9803e30702de1cc530c1205fe9bbb4dcb2c08 100644
index 89f0c3d6e4dc9701f02fa7ed5331c3969de81ffc..0a15cda0919c0adf5009a023c17b3e25cc365623 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -73,21 +73,28 @@ public class ServerPlayerGameMode {
@ -131,10 +131,10 @@ index c256423e9dc9d1837b847da44fb2920c58842c8b..0cb9803e30702de1cc530c1205fe9bbb
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index aa0a524ad7200648731fcc5e702470872c0ac3cb..bb483fbc201c6041bafc75d822b46e5d06cd75dc 100644
index 961bb94f61b7bea88aa9371bf804b503ca405bcf..4d71ba9c16f4ff72a31eaf51a7264711b5e0ce1f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2778,7 +2778,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2630,7 +2630,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
if (this.server.isHardcore()) {
@ -144,10 +144,10 @@ index aa0a524ad7200648731fcc5e702470872c0ac3cb..bb483fbc201c6041bafc75d822b46e5d
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 04abb49aa5b947e4c265471358981ed41b36ddd6..d8c95d53b923b2e269ae3f5afa77a5a93187bab8 100644
index d6617dd0b7b57914a4449ab72873b027a73bcd7c..8b75e41b379c5fb31c579be01dd96e0be88b9bd1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1562,7 +1562,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1522,7 +1522,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Preconditions.checkArgument(mode != null, "GameMode cannot be null");
if (this.getHandle().connection == null) return;

Datei anzeigen

@ -5,10 +5,10 @@ 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 e540a219e26ecb1b2f93df01a34dd754faea1f10..cab2f4ae154a6159ead1b95dbf02ebcbb1051dd8 100644
index da21cb49d986f899ed174c8c1abd35bcb03d31f2..1e70a661ec459edb1bca28ddf0a833c95c2453ac 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -543,6 +543,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -544,6 +544,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()];
}

Datei anzeigen

@ -66,7 +66,7 @@ index 57decf4156f176ebcc988478c17856cbc555c5e4..3d0ce0803e1da8a2681a3cb41096ac94
public net.minecraft.world.item.enchantment.Enchantment getHandle() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 918a938732cd08756f8498c5422f4475fd3b531d..dcc7c8efe0b9d6b57841d8318499d490a3f7aa73 100644
index 13b4873923d64ab4b18795ce7f2dbc9a7abf067e..9d9616a4adcbcc0d2567bdcf0d57efdabda076d4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -949,5 +949,21 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

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 bb483fbc201c6041bafc75d822b46e5d06cd75dc..b7b9575b84f35757c24ad43bd187e2bd623d672c 100644
index 4d71ba9c16f4ff72a31eaf51a7264711b5e0ce1f..60b03c03bd5497acc617b81ef9a47910d9a9a8c9 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1817,6 +1817,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1704,6 +1704,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (itemstack.isItemEnabled(worldserver.enabledFeatures())) {
BlockHitResult movingobjectpositionblock = packet.getHitResult();
Vec3 vec3d = movingobjectpositionblock.getLocation();

Datei anzeigen

@ -247,18 +247,18 @@ index 0000000000000000000000000000000000000000..513833c2ea23df5b079d157bc5cb89d5
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index f035065aa46a8c1a2c3064b82208fbdc5ac4463d..0303b7f80fe0939ce1e50cdfd3d93456f09a8259 100644
index cb986e6aa28729b6037ec380ad41c717cfcb7ef3..06a2210ba7d17fe1676d59794639211e20c1d7ea 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;
@@ -16,6 +16,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.UUID;
import java.util.function.BooleanSupplier;
+import io.papermc.paper.world.ThreadedWorldUpgrader;
import joptsimple.NonOptionArgumentSpec;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
@@ -362,6 +363,15 @@ public class Main {
@@ -357,6 +358,15 @@ public class Main {
return new WorldLoader.InitConfig(worldloader_d, Commands.CommandSelection.DEDICATED, serverPropertiesHandler.functionPermissionLevel);
}
@ -275,10 +275,10 @@ index f035065aa46a8c1a2c3064b82208fbdc5ac4463d..0303b7f80fe0939ce1e50cdfd3d93456
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 17e963f927c81dfb6bf10f621c76c6631fd2dd97..3054716dda1fcfe6c457d81dd89c82bf6acc64a3 100644
index a708e61770ebe77cb43791eb033aeba2f6b3abab..8f24c53f4c0d399d8583a862025da62445b1547d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -551,11 +551,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -540,11 +540,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worlddata = new PrimaryLevelData(worldsettings, worldoptions, worlddimensions_b.specialWorldProperty(), lifecycle);
}
worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
@ -291,7 +291,7 @@ index 17e963f927c81dfb6bf10f621c76c6631fd2dd97..3054716dda1fcfe6c457d81dd89c82bf
PrimaryLevelData iworlddataserver = worlddata;
boolean flag = worlddata.isDebugWorld();
@@ -570,6 +566,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -559,6 +555,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
}
@ -306,10 +306,10 @@ index 17e963f927c81dfb6bf10f621c76c6631fd2dd97..3054716dda1fcfe6c457d81dd89c82bf
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 1577b7317b85708d39d4171321df785a8107bdb2..51dc136b9a5006382de4b12275a9c2f299d5d1f9 100644
index 8236bfd8d0bdd322d1aeee7d4b1e32ae5dc1ae1f..24949c13b6e6c2297812e8a3988d4e52aca9136a 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -184,6 +184,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,10 +326,10 @@ index 1577b7317b85708d39d4171321df785a8107bdb2..51dc136b9a5006382de4b12275a9c2f2
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 29da08c58200c24fd03003937d30eb41234cabc9..d3d4d10a77af51cff4da201201bac325427fc20c 100644
index 390569f89b21c375357fb71d7b7730f0ea789545..16346d727a854996ec1d2adb56ebca2a9ff7ab3b 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
@@ -60,6 +60,31 @@ public class RegionFileStorage implements AutoCloseable {
@@ -30,6 +30,31 @@ public final class RegionFileStorage implements AutoCloseable {
this.sync = dsync;
}
@ -358,14 +358,14 @@ index 29da08c58200c24fd03003937d30eb41234cabc9..d3d4d10a77af51cff4da201201bac325
+ }
+ // Paper end
+
// Paper start
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 dcfb99b289a35b66cd39b88761684e73c50ab2ba..492642f3fad94a0770c94d2090f51a3bdd57638c 100644
index 5dc8db6134c52442cf5abdca152deaaa86495b4d..a1e10f2dc1786b6f0f1058b3fcac69ca7d10cc15 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1214,9 +1214,7 @@ public final class CraftServer implements Server {
@@ -1217,9 +1217,7 @@ public final class CraftServer implements Server {
worlddata.checkName(name);
worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().shouldReportAsModified());
@ -376,7 +376,7 @@ index dcfb99b289a35b66cd39b88761684e73c50ab2ba..492642f3fad94a0770c94d2090f51a3b
long j = BiomeManager.obfuscateSeed(creator.seed());
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
@@ -1227,6 +1225,13 @@ public final class CraftServer implements Server {
@@ -1230,6 +1228,13 @@ public final class CraftServer implements Server {
biomeProvider = generator.getDefaultBiomeProvider(worldInfo);
}

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 36838ed14523c30676762bd8ed8d4ee644ae3422..7d917aa8376fed8004f30e92bf88face17165a92 100644
index c0e822386bdc3724ca1f24a0ed4fb60e96d9b9eb..34728cebe2de88e0a935707ea9969e068c0f6d7e 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 36838ed14523c30676762bd8ed8d4ee644ae3422..7d917aa8376fed8004f30e92bf88face
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 2ea40a23539898b9c817440aafc91f4b5fd10977..2e7540b0e100347cd91624c9d61a5c4688a52b26 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 {
@@ -76,7 +76,12 @@ public class ServerConnectionListener {
this.running = true;
}
@ -69,32 +69,34 @@ index 29a0a720f22f56ca3d844efef1ecde3980fb1c12..838244e3680ea6020701e10bafbde7f5
List list = this.channels;
synchronized (this.channels) {
@@ -85,7 +90,11 @@ public class ServerConnectionListener {
LazyLoadedValue lazyinitvar;
@@ -84,7 +89,13 @@ public class ServerConnectionListener {
EventLoopGroup eventloopgroup;
if (Epoll.isAvailable() && this.server.isEpollEnabled()) {
+ // Paper start
+ if (address instanceof io.netty.channel.unix.DomainSocketAddress) {
+ oclass = io.netty.channel.epoll.EpollServerDomainSocketChannel.class;
+ } else {
oclass = EpollServerSocketChannel.class;
+ }
lazyinitvar = ServerConnectionListener.SERVER_EPOLL_EVENT_GROUP;
+ // Paper end
eventloopgroup = (EventLoopGroup) ServerConnectionListener.SERVER_EPOLL_EVENT_GROUP.get();
ServerConnectionListener.LOGGER.info("Using epoll channel type");
} else {
@@ -115,7 +124,7 @@ public class ServerConnectionListener {
((Connection) object).setListener(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object));
@@ -115,7 +126,7 @@ public class ServerConnectionListener {
((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object));
io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper
}
- }).group((EventLoopGroup) lazyinitvar.get()).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
+ }).group((EventLoopGroup) lazyinitvar.get()).localAddress(address)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit // Paper
- }).group(eventloopgroup).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
+ }).group(eventloopgroup).localAddress(address)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b7b9575b84f35757c24ad43bd187e2bd623d672c..967ed1f44a4d7c97a14d9415541df000698e8aad 100644
index 60b03c03bd5497acc617b81ef9a47910d9a9a8c9..b69d5c474d2cb1bd40c09ff1c644db4546530f80 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2612,6 +2612,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2453,6 +2453,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot Start
public SocketAddress getRawAddress()
{
@ -107,11 +109,11 @@ index b7b9575b84f35757c24ad43bd187e2bd623d672c..967ed1f44a4d7c97a14d9415541df000
}
// 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 50c79be12cf8778a2ce451a8c9bb2cdc277d6830..8393c1a2d15d5ad255c9808b0d0edd6aeb447893 100644
index 5d372b390f3046b4ce19296803c5fbfee798e69b..2824369960130fa3d0ad416a3961024c8f8d5f52 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -45,6 +45,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
this.connection.setProtocol(ConnectionProtocol.LOGIN);
this.connection.setClientboundProtocolAfterHandshake(ClientIntent.LOGIN);
// CraftBukkit start - Connection throttle
try {
+ if (!(this.connection.channel.localAddress() instanceof io.netty.channel.unix.DomainSocketAddress)) { // Paper - the connection throttle is useless when you have a Unix domain socket
@ -132,10 +134,10 @@ index 50c79be12cf8778a2ce451a8c9bb2cdc277d6830..8393c1a2d15d5ad255c9808b0d0edd6a
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper
+ // Paper start - Unix domain socket support
+ java.net.SocketAddress socketAddress = connection.getRemoteAddress();
packet.hostName = split[0];
connection.hostname = split[0];
- connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
+ connection.address = new java.net.InetSocketAddress(split[1], socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0);
+ // Paper end
connection.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] );
connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
} else
{

Datei anzeigen

@ -29,7 +29,7 @@ index b51e18d01fa9a06a3478694884f465f12dd89b8a..ee4b3ac212483995bb8ae990bebfb8aa
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 6b1692368df4165f4170380e58a6c2f93db39449..5921f7ebb56e1d5d3004ae327271873093cff357 100644
index a6f245a516714615cf1f204e54eb7ab5248cafe7..54cf35b0c48d96ecfb27ff13cd685c16a1cd616b 100644
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
@@ -170,6 +170,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
@ -41,10 +41,10 @@ index 6b1692368df4165f4170380e58a6c2f93db39449..5921f7ebb56e1d5d3004ae3272718730
if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) {
// CraftBukkit start - tilt dripleaf
diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
index 3da8d49f7e36d8f1c0873bec32123971e53d2a31..461288cb56793f11e8dac80720b36cb9b42da518 100644
index 42265fa901aeb2bb7a564cc94162a938208c1f90..ed36a378b79f62c3dce3da637a337595415f14ac 100644
--- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
@@ -38,6 +38,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
@@ -40,6 +40,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -77,10 +77,10 @@ index 2c3bbe4f295be9782c11af13c2cf9c05f27313d9..0003fb51ae3a6575575e10b4c86719f3
entity.hurt(world.damageSources().cactus(), 1.0F);
CraftEventFactory.blockDamage = null; // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
index dffd1a48e54b4b15195ba066dc9d73c7a91650ea..219c87dcf065e86512f330fbeec59e55f4675083 100644
index 495be2b5c4c52d4925385a12f63774d827c8907a..7700461b8cd0bde1bf6c0d5e4b73184bed1adc4e 100644
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
@@ -92,6 +92,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
@@ -93,6 +93,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -89,10 +89,10 @@ 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 4ad158fd18ba9d6723d8e1b697147e8488c71abb..08d442713bf0cc4f01f693c9a2fbd1a17a6fa348 100644
index feb82a1c55c94702e484a6170c25e72110ecbe8b..c5608f72a8f2ad2640f32fa63c69a6ef69d746da 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 {
@@ -167,6 +167,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -149,7 +149,7 @@ index f2206cea243b2281471bc9e939dd79971b0025eb..745f33ce496a7ce8c788f24c093b3793
this.maybeDoSlideAchievement(entity, pos);
this.doSlideMovement(entity);
diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
index 151f3e1f8e55b75957b84c495e1c1ed7008a6f28..c8e7e82dd81d9faf8f06612291c40f541304eb82 100644
index 67833347206a913f0eb2d8d9ae14f14fe0e4d181..4311c97edd2a70e9ed8fed3fdf9471c513ddc1d4 100644
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
@@ -200,6 +200,7 @@ public class HopperBlock extends BaseEntityBlock {
@ -197,10 +197,10 @@ index 69f34c566bf825259253abbefd7d7ba2e847231b..a6ab0d0defc05e56a91084c498970596
// CraftBukkit start - Entity in portal
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
index 94e0bf98753d3dee5ad275e4783682025f687ddf..593eae04ecf6dee86c9c3664ddcdc3f86d042e66 100644
index 2762ec1b3404e8761733119a8ead0aecef328c85..20fdd6cc35bec8f707a83fb682257f68163ed6fc 100644
--- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
@@ -96,6 +96,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl
@@ -87,6 +87,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -209,10 +209,10 @@ index 94e0bf98753d3dee5ad275e4783682025f687ddf..593eae04ecf6dee86c9c3664ddcdc3f8
world.destroyBlock(pos, true, entity);
}
diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
index 8a71ef8422be64154dc79eb670def635492fb06a..7e04ecba2a14be0f0d47c917368abd2a2bd64a05 100644
index 022484a7386a8a02468134fc7b2d7916398cf015..e6fcea4482d5d87ed78beefad4c57bc86089460f 100644
--- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
@@ -55,6 +55,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
@@ -56,6 +56,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -221,7 +221,7 @@ index 8a71ef8422be64154dc79eb670def635492fb06a..7e04ecba2a14be0f0d47c917368abd2a
entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D));
if (world.isClientSide) {
diff --git a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
index 9421eb279f509872725544bba3e3112a92bbe5a1..08a11888133b97e52535cb49cad218a1b6c6ac97 100644
index 89c86d10840bc8fa73465a6a548c48fab9ac55ea..34eb7ba1adb51e394bf46a6f643db3529626d9ec 100644
--- a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
@@ -77,6 +77,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock

Datei anzeigen

@ -5,10 +5,10 @@ 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 cab2f4ae154a6159ead1b95dbf02ebcbb1051dd8..7f870317139db136103cb72b2aa57bcba9f6e793 100644
index 1e70a661ec459edb1bca28ddf0a833c95c2453ac..1123bba2af7c707e8237fb1336f0b958861c4119 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -551,6 +551,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -552,6 +552,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
}

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 6fc54777e15cebaef7e30702f8537a9a337ad2ed..e63cb62affc88d1482f9926ae459986e2d213fb0 100644
index b6e2e23d773ca3b9f35c7905bbc0f7681cb4a309..c16d0e4f30e7b3c6d2c0b320353646589a84c6c8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -672,8 +672,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -437,8 +437,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 6fc54777e15cebaef7e30702f8537a9a337ad2ed..e63cb62affc88d1482f9926ae459986e
}
@Override
@@ -1085,8 +1085,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 6fc54777e15cebaef7e30702f8537a9a337ad2ed..e63cb62affc88d1482f9926ae459986e
}
this.oThunderLevel = this.thunderLevel;
@@ -1152,14 +1152,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,7 +48,7 @@ index 6fc54777e15cebaef7e30702f8537a9a337ad2ed..e63cb62affc88d1482f9926ae459986e
// 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 626b861ef2f323a5fc50ab5178d3e108e0f9cc25..31c31a9138cb5f6e41de01a6210f84e72fd7dc58 100644
index 14b8011c8874e05647eb1636ee1eed5d90da8200..7bfc5bbfcf67e5bbf57e99e648ff5bed4d6b477f 100644
--- a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
+++ b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
@@ -394,6 +394,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@ -95,10 +95,10 @@ index 626b861ef2f323a5fc50ab5178d3e108e0f9cc25..31c31a9138cb5f6e41de01a6210f84e7
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 47f8ad80011142aac611441029d71787c85450f2..af8cf7c594dc1c099785559f11f3ed7415676895 100644
index 202ebd562ec1e2b3f1087424da60cadca5da7d01..47a880bfabcd950ff985c2763531c68db80347f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1186,7 +1186,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1191,7 +1191,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setStorm(boolean hasStorm) {
@ -107,7 +107,7 @@ index 47f8ad80011142aac611441029d71787c85450f2..af8cf7c594dc1c099785559f11f3ed74
this.setWeatherDuration(0); // Reset weather duration (legacy behaviour)
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
}
@@ -1208,7 +1208,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1213,7 +1213,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setThundering(boolean thundering) {

Datei anzeigen

@ -5,10 +5,10 @@ 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 7a6fbd4be33e93c7f09b1ed146ae25fe6c6b503c..50713f03c783c63f93710d986d94af544be0615a 100644
index 5992f450f01349ce49286c34b8af56737de01a45..e4c4948e076cd64686dfd16ae0568fafc1437140 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,10 @@ public class MapItemSavedData extends SavedData {
@@ -302,8 +302,10 @@ public class MapItemSavedData extends SavedData {
MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId());
@ -19,7 +19,7 @@ index 7a6fbd4be33e93c7f09b1ed146ae25fe6c6b503c..50713f03c783c63f93710d986d94af54
}
CompoundTag nbttagcompound = stack.getTag();
@@ -478,7 +480,7 @@ public class MapItemSavedData extends SavedData {
@@ -485,7 +487,7 @@ public class MapItemSavedData extends SavedData {
return true;
}

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 3054716dda1fcfe6c457d81dd89c82bf6acc64a3..64081583ee2a29b43d487b3730342dce7ac85e94 100644
index 8f24c53f4c0d399d8583a862025da62445b1547d..ee8d5345e8ce8e0e082d82e9e52f5918f92a242e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2150,7 +2150,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2156,7 +2156,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)
@ -62,10 +62,10 @@ index 78345cf28be16b2e9bf2237ea60a3be424a8dabf..5397a5013bee9589b59c76ce5a2c00a7
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 e4ed0df0fa83a3d0f05fff3fd59a7ba8fc983963..eda2083ede81def0ad5c1518bdd183902454430d 100644
index 46f45b315011d43c081fb3f004ab62f3da67036a..42c930443505e94ca91a02e65a8df86801034280 100644
--- a/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
+++ b/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
@@ -44,7 +44,7 @@ public class BanPlayerCommands {
@@ -43,7 +43,7 @@ public class BanPlayerCommands {
}, true);
ServerPlayer serverPlayer = source.getServer().getPlayerList().getPlayer(gameProfile.getId());
if (serverPlayer != null) {
@ -87,11 +87,111 @@ index c68bac4727f6b2ca95fc8c438303097af14286f2..bb629ec263959c8268de88ca807bddb6
source.sendSuccess(() -> {
return Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason);
}, true);
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index a38ad79aaf4ef5a928370152bdc5c0cc4c59d93e..877dd962a689c016668d1144ad2fef850fdbc31e 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -95,7 +95,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> {
- this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE);
+ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
});
// Paper endg
}
@@ -126,7 +126,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
- this.disconnect("Invalid payload REGISTER!");
+ this.disconnect("Invalid payload REGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
}
} else if (identifier.equals(CUSTOM_UNREGISTER)) {
try {
@@ -136,7 +136,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
- this.disconnect("Invalid payload UNREGISTER!");
+ this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
}
} else {
try {
@@ -154,7 +154,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
- this.disconnect("Invalid custom payload!");
+ this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
}
}
@@ -177,7 +177,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
PacketUtils.ensureRunningOnSameThread(packet, this, (BlockableEventLoop) this.server);
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.playerProfile().getName());
- this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"));
+ this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - kick event cause
}
// Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.getAction().ordinal()];
@@ -250,18 +250,28 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
// CraftBukkit start
- @Deprecated
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
public void disconnect(String s) { // Paper
- this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); // Paper
+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); // Paper
}
// CraftBukkit end
+ // Paper start - kick event cause
+ public void disconnect(String s, PlayerKickEvent.Cause cause) {
+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), cause);
+ }
+
// Paper start
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
public void disconnect(final Component reason) {
- this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason));
+ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
+ }
+
+ public void disconnect(final Component reason, PlayerKickEvent.Cause cause) {
+ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason), cause);
}
- public void disconnect(net.kyori.adventure.text.Component reason) {
+ public void disconnect(net.kyori.adventure.text.Component reason, org.bukkit.event.player.PlayerKickEvent.Cause cause) { // Paper - kick event cause
// Paper end
// CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) {
@@ -271,7 +281,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
- ServerCommonPacketListenerImpl.this.disconnect(reason); // Paper - adventure
+ ServerCommonPacketListenerImpl.this.disconnect(reason, cause); // Paper - adventure
return null;
}
};
@@ -290,7 +300,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
- PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - adventure
+ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage, cause); // Paper - adventure
if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d3065b6df08 100644
index b69d5c474d2cb1bd40c09ff1c644db4546530f80..e73208ed05109b64b3607762224b62a98dd9f9b7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -364,7 +364,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -340,7 +340,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) {
if (++this.aboveGroundTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
@ -100,7 +200,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
return;
}
} else {
@@ -383,7 +383,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -359,7 +359,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
@ -109,16 +209,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
return;
}
} else {
@@ -405,7 +405,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
- this.disconnect(Component.translatable("disconnect.timeout", new Object[0]));
+ this.disconnect(Component.translatable("disconnect.timeout", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
}
} else {
if (elapsedTime >= 15000L) { // 15 seconds
@@ -435,7 +435,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -390,7 +390,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
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
@ -127,55 +218,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
}
}
@@ -458,16 +458,26 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return this.server.isSingleplayerOwner(this.player.getGameProfile());
}
+ @io.papermc.paper.annotation.DoNotUse // Paper
public void disconnect(String s) {
// Paper start
- this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s));
+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
}
+ public void disconnect(String s, PlayerKickEvent.Cause cause) {
+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), cause);
+ }
+
+ @io.papermc.paper.annotation.DoNotUse // Paper
public void disconnect(final Component reason) {
- this.disconnect(PaperAdventure.asAdventure(reason));
+ this.disconnect(PaperAdventure.asAdventure(reason), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
+ }
+
+ public void disconnect(final Component reason, PlayerKickEvent.Cause cause) {
+ this.disconnect(PaperAdventure.asAdventure(reason), cause);
}
- public void disconnect(net.kyori.adventure.text.Component reason) {
+ public void disconnect(net.kyori.adventure.text.Component reason, org.bukkit.event.player.PlayerKickEvent.Cause cause) {
// Paper end
// CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) {
@@ -477,7 +487,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
- ServerGamePacketListenerImpl.this.disconnect(reason); // Paper - adventure
+ ServerGamePacketListenerImpl.this.disconnect(reason, cause); // Paper - adventure, kick event cause
return null;
}
};
@@ -496,7 +506,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
- PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - Adventure
+ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage, cause); // Paper - Adventure & kick event reason
if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event);
@@ -566,7 +576,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -460,7 +460,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) {
@ -184,7 +227,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
} else {
Entity entity = this.player.getRootVehicle();
@@ -772,7 +782,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -666,7 +666,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) {
@ -193,7 +236,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
return;
}
@@ -829,13 +839,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -723,7 +723,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// 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
@ -201,15 +244,8 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
+ 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
return;
}
// Paper end
@@ -988,7 +998,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// CraftBukkit end
@@ -875,7 +875,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// 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 +254,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
return;
}
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
@@ -1171,7 +1181,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1058,7 +1058,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
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 +263,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
return;
}
byteTotal += byteLength;
@@ -1194,14 +1204,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1081,14 +1081,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
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,7 +280,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
return;
}
this.lastBookTick = MinecraftServer.currentTick;
@@ -1325,7 +1335,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1212,7 +1212,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
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))) {
@ -253,7 +289,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
} else {
ServerLevel worldserver = this.player.serverLevel();
@@ -1739,7 +1749,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1626,7 +1626,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.dropCount++;
if (this.dropCount >= 20) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
@ -262,16 +298,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
return;
}
}
@@ -1951,7 +1961,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"));
+ this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - add cause
}
// Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
@@ -2067,7 +2077,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1909,7 +1909,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.resetLastActionTime();
} else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -280,7 +307,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
}
}
@@ -2080,7 +2090,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1922,7 +1922,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
// CraftBukkit end
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) {
@ -289,7 +316,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages());
@@ -2114,7 +2124,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1955,7 +1955,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleChatCommand(ServerboundChatCommandPacket packet) {
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) {
@ -298,7 +325,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages());
@@ -2169,7 +2179,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2010,7 +2010,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
if (exception.shouldDisconnect()) {
@ -307,7 +334,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
} else {
this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED));
}
@@ -2200,7 +2210,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2041,7 +2041,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
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 +343,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
return Optional.empty();
} else {
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(acknowledgment);
@@ -2223,7 +2233,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2064,7 +2064,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (optional.isEmpty()) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -325,7 +352,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
}
return optional;
@@ -2419,7 +2429,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2260,7 +2260,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// this.chatSpamTickCount += 20;
if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
// CraftBukkit end
@ -334,7 +361,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
}
}
@@ -2431,7 +2441,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2272,7 +2272,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
synchronized (this.lastSeenMessages) {
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -343,7 +370,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
}
}
@@ -2584,7 +2594,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2425,7 +2425,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
if (i > 4096) {
@ -352,16 +379,16 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
}
}
@@ -2630,7 +2640,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2482,7 +2482,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot Start
if ( entity == this.player && !this.player.isSpectator() )
{
- this.disconnect( "Cannot interact with self!" );
+ this.disconnect( "Cannot interact with self!", org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - add cause
- disconnect( "Cannot interact with self!" );
+ disconnect( "Cannot interact with self!" , org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - kick event cause
return;
}
// Spigot End
@@ -2729,7 +2739,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2581,7 +2581,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// CraftBukkit end
}
} else {
@ -370,7 +397,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
}
@@ -3139,7 +3149,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2991,7 +2991,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
@ -379,43 +406,7 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
return;
}
}
@@ -3337,7 +3347,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(() -> {
- this.disconnect(Component.translatable("disconnect.timeout"));
+ this.disconnect(Component.translatable("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
});
// Paper end
}
@@ -3383,7 +3393,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
- this.disconnect("Invalid payload REGISTER!");
+ this.disconnect("Invalid payload REGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
}
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try {
@@ -3393,7 +3403,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
- this.disconnect("Invalid payload UNREGISTER!");
+ this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
}
} else {
try {
@@ -3411,7 +3421,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);
- this.disconnect("Invalid custom payload!");
+ this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
}
}
@@ -3453,7 +3463,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3225,7 +3225,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) {
if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) {
@ -424,8 +415,8 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
} else {
try {
SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator();
@@ -3466,7 +3476,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator, Duration.ZERO));
@@ -3238,7 +3238,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
- this.disconnect(profilepublickey_b.getComponent());
@ -434,10 +425,10 @@ index 967ed1f44a4d7c97a14d9415541df000698e8aad..08a69f7a2d153aee1b9637085be04d30
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3dbad6f9ea70db07a9bfa199b28def6a67353d80..77d80170cabc358c75d58ac7ff19054ba6b7617f 100644
index 43dd6dbbc510320432aaafc1c5e4e91117fd8189..53c453814c840ce8afed27cea4c6f5e01cddf17f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -678,7 +678,7 @@ public abstract class PlayerList {
@@ -665,7 +665,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 +437,7 @@ index 3dbad6f9ea70db07a9bfa199b28def6a67353d80..77d80170cabc358c75d58ac7ff19054b
}
// Instead of kicking then returning, we need to store the kick reason
@@ -1314,8 +1314,8 @@ public abstract class PlayerList {
@@ -1308,8 +1308,8 @@ public abstract class PlayerList {
// Paper end
// CraftBukkit start - disconnect safely
for (ServerPlayer player : this.players) {
@ -458,22 +449,19 @@ index 3dbad6f9ea70db07a9bfa199b28def6a67353d80..77d80170cabc358c75d58ac7ff19054b
// 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 984c288abf94d9fe47fada33722fea035b832f3b..addd20237b87c9a87bb09fd7addb101a2b7c7d4e 100644
index 6724d0a1af13e97bc1d3bd94fd43fef742a0deab..20ba0a0c9eae28658888a77dd2170f629bbcb65b 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) {
@@ -24,7 +24,7 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) {
public static ProfilePublicKey createValidated(SignatureValidator servicesSignatureVerifier, UUID playerUuid, ProfilePublicKey.Data publicKeyData, Duration gracePeriod) throws ProfilePublicKey.ValidationException {
if (publicKeyData.hasExpired(gracePeriod)) {
- throw new ProfilePublicKey.ValidationException(EXPIRED_PROFILE_PUBLIC_KEY);
+ throw new ProfilePublicKey.ValidationException(EXPIRED_PROFILE_PUBLIC_KEY, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes
} else if (!publicKeyData.validateSignature(servicesSignatureVerifier, playerUuid)) {
public static ProfilePublicKey createValidated(SignatureValidator servicesSignatureVerifier, UUID playerUuid, ProfilePublicKey.Data publicKeyData) throws ProfilePublicKey.ValidationException {
if (!publicKeyData.validateSignature(servicesSignatureVerifier, playerUuid)) {
- throw new ProfilePublicKey.ValidationException(INVALID_SIGNATURE);
+ throw new ProfilePublicKey.ValidationException(INVALID_SIGNATURE, org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PUBLIC_KEY_SIGNATURE); // Paper - kick event causes
} else {
return new ProfilePublicKey(publicKeyData);
}
@@ -83,8 +83,16 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) {
@@ -81,8 +81,16 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) {
}
public static class ValidationException extends ThrowingComponent {
@ -491,10 +479,10 @@ index 984c288abf94d9fe47fada33722fea035b832f3b..addd20237b87c9a87bb09fd7addb101a
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d8c95d53b923b2e269ae3f5afa77a5a93187bab8..54027efe50942ad1ac3fbe45e9a02b7e7eac0f28 100644
index 8b75e41b379c5fb31c579be01dd96e0be88b9bd1..e19c4f5e016859d702cad249992bebd9016adc5e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -584,7 +584,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -544,7 +544,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot
if (this.getHandle().connection == null) return;
@ -503,7 +491,7 @@ index d8c95d53b923b2e269ae3f5afa77a5a93187bab8..54027efe50942ad1ac3fbe45e9a02b7e
}
// Paper start
@@ -596,10 +596,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -556,10 +556,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void kick(final net.kyori.adventure.text.Component message) {
@ -520,7 +508,7 @@ index d8c95d53b923b2e269ae3f5afa77a5a93187bab8..54027efe50942ad1ac3fbe45e9a02b7e
}
}
@@ -670,7 +675,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -630,7 +635,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper start - Improve chat handling
if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) {

Datei anzeigen

@ -6,7 +6,7 @@ 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 5510098be25ce06bc5f92eab2f83dc1086c4838f..578c3db52dda4c169b5ea615a4ce4a79f15a4cad 100644
index e0ca5316fb66ed94f1c5cf541d096d1cb8774196..277555a26e8281dd1a626e572794b08cf51d00c5 100644
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
@@ -39,6 +39,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
@ -18,7 +18,7 @@ index 5510098be25ce06bc5f92eab2f83dc1086c4838f..578c3db52dda4c169b5ea615a4ce4a79
public final Fluid content;
public BucketItem(Fluid fluid, Item.Properties settings) {
@@ -120,6 +122,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
@@ -122,6 +124,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
}
public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
@ -32,11 +32,11 @@ index 5510098be25ce06bc5f92eab2f83dc1086c4838f..578c3db52dda4c169b5ea615a4ce4a79
return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack;
}
@@ -150,6 +159,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
@@ -181,6 +190,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
return false;
}
+ itemLeftInHandAfterPlayerBucketEmptyEvent = event.getItemStack() != null ? event.getItemStack().equals(CraftItemStack.asNewCraftStack(net.minecraft.world.item.Items.BUCKET)) ? null : CraftItemStack.asNMSCopy(event.getItemStack()) : ItemStack.EMPTY; // Paper - fix empty event result itemstack
}
// CraftBukkit end
if (!flag1) {
if (!flag2) {

Datei anzeigen

@ -1,32 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alvinn8 <42838560+Alvinn8@users.noreply.github.com>
Date: Fri, 8 Jan 2021 20:31:13 +0100
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 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
+ // 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);
+ 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)) {
- 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)) {
+ this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), false);
+ // Paper end
}
}
}