3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 23:00:08 +01:00

[ci skip] Add more identifying patch comments

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-01-20 12:50:16 +01:00
Ursprung 8e41ef4cc5
Commit 68c3297947
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
75 geänderte Dateien mit 381 neuen und 395 gelöschten Zeilen

Datei anzeigen

@ -5,19 +5,19 @@ Subject: [PATCH] Cache block data strings
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 706e8a5e17ccd87266a5c154cd938974d380cb21..1eaf509c37c176ad94035d0612f69d6ef53b3626 100644
index 1b67fbad7c14186e70919946938a512950077635..eb77196548f5cac77d0814f3523c35074d57fd6c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2134,6 +2134,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().reloadResources();
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
+ org.bukkit.craftbukkit.block.data.CraftBlockData.reloadCache(); // Paper - cache block data strings, they can be defined by datapacks so refresh it here
+ org.bukkit.craftbukkit.block.data.CraftBlockData.reloadCache(); // Paper - cache block data strings; they can be defined by datapacks so refresh it here
}, this);
if (this.isSameThread()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index 85ee8a3d6db6610104f8a10d77d7cad5dc9b667e..bbf58089dd5de3e38a236bb662ea3e139d159161 100644
index 85ee8a3d6db6610104f8a10d77d7cad5dc9b667e..d95f56356a8d1fc82f548d93038bd81c57f46f9e 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -154,7 +154,7 @@ public class CraftBlockData implements BlockData {
@ -25,7 +25,7 @@ index 85ee8a3d6db6610104f8a10d77d7cad5dc9b667e..bbf58089dd5de3e38a236bb662ea3e13
}
- private static final Map<Class<? extends Enum<?>>, Enum<?>[]> ENUM_VALUES = new HashMap<>();
+ private static final Map<Class<? extends Enum<?>>, Enum<?>[]> ENUM_VALUES = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - make thread safe
+ private static final Map<Class<? extends Enum<?>>, Enum<?>[]> ENUM_VALUES = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - cache block data strings; make thread safe
/**
* Convert an NMS Enum (usually a BlockStateEnum) to its appropriate Bukkit
@ -46,7 +46,7 @@ index 85ee8a3d6db6610104f8a10d77d7cad5dc9b667e..bbf58089dd5de3e38a236bb662ea3e13
+ stringDataCache.clear();
+ Block.BLOCK_STATE_REGISTRY.forEach(blockData -> stringDataCache.put(blockData.toString(), blockData.createCraftBlockData()));
+ }
+ // Paper end
+ // Paper end - cache block data strings
+
public static CraftBlockData newData(Material material, String data) {
Preconditions.checkArgument(material == null || material.isBlock(), "Cannot get data for not block %s", material);

Datei anzeigen

@ -9,7 +9,7 @@ as this is how Vanilla teleports entities.
Cancel any pending motion when teleported.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 101871664077577c5cbe159d5d1a31b0e30ec68d..5550f60424d827616c935e3b0036f1b4f6144e5c 100644
index 101871664077577c5cbe159d5d1a31b0e30ec68d..0a2f711b7feba83b39c042df71b3dc6546601ed8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -657,7 +657,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -17,7 +17,7 @@ index 101871664077577c5cbe159d5d1a31b0e30ec68d..5550f60424d827616c935e3b0036f1b4
}
- this.player.absMoveTo(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
+ this.player.moveTo(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); // Paper - use proper moveTo for teleportation
+ this.player.moveTo(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); // Paper - Fix Entity Teleportation and cancel velocity if teleported
this.lastGoodX = this.awaitingPositionFromClient.x;
this.lastGoodY = this.awaitingPositionFromClient.y;
this.lastGoodZ = this.awaitingPositionFromClient.z;
@ -26,19 +26,19 @@ index 101871664077577c5cbe159d5d1a31b0e30ec68d..5550f60424d827616c935e3b0036f1b4
this.awaitingTeleportTime = this.tickCount;
- this.player.absMoveTo(d0, d1, d2, f, f1);
+ this.player.moveTo(d0, d1, d2, f, f1); // Paper - use proper moveTo for teleportation
+ this.player.moveTo(d0, d1, d2, f, f1); // Paper - Fix Entity Teleportation and cancel velocity if teleported
this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a1172531baf637915a65fbdee8ca08f08034811d..ec224193e9ca7734fe533d5cfc0e316d5eed2adb 100644
index e1ce61dcadf325633ed809eef92fc07bac4cbf05..8a613a8a874b8b3949630fcadc25cf39b7fb0659 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -162,6 +162,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
+ public boolean preserveMotion = true; // Paper - keep initial motion on first setPositionRotation
+ public boolean preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; keep initial motion on first setPositionRotation
static boolean isLevelAtLeast(CompoundTag tag, int level) {
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
@ -46,25 +46,25 @@ index a1172531baf637915a65fbdee8ca08f08034811d..ec224193e9ca7734fe533d5cfc0e316d
}
public void moveTo(double x, double y, double z, float yaw, float pitch) {
+ // Paper - cancel entity velocity if teleported
+ // Paper - Fix Entity Teleportation and cancel velocity if teleported
+ if (!preserveMotion) {
+ this.deltaMovement = Vec3.ZERO;
+ } else {
+ this.preserveMotion = false;
+ }
+ // Paper end
+ // Paper end - Fix Entity Teleportation and cancel velocity if teleported
this.setPosRaw(x, y, z);
this.setYRot(yaw);
this.setXRot(pitch);
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 0578ac12d92f9af0b0113587db9351b4a41bedd5..9f677a695bdb8ebde457452e4b70c674e2016830 100644
index 0578ac12d92f9af0b0113587db9351b4a41bedd5..76486e2045739d3e8706194f4d71f5108d055780 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -169,6 +169,7 @@ public abstract class BaseSpawner {
return;
}
+ entity.preserveMotion = true; // Paper - preserve entity motion from tag
+ entity.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; preserve entity motion from tag
entity.moveTo(entity.getX(), entity.getY(), entity.getZ(), randomsource.nextFloat() * 360.0F, 0.0F);
if (entity instanceof Mob) {
Mob entityinsentient = (Mob) entity;

Datei anzeigen

@ -30,17 +30,17 @@ This patch will significantly reduce CPU use on startup, reduce memory usage,
and improve server startup time.
diff --git a/src/main/java/com/mojang/datafixers/DataFixerBuilder.java b/src/main/java/com/mojang/datafixers/DataFixerBuilder.java
index cd812f3fe362de5ddc414862dedab2e9727ca776..f6598fcf4ed1bd61e1c87cd7107869d49ffe4566 100644
index cd812f3fe362de5ddc414862dedab2e9727ca776..2bc69e84b4e2ba8f816322d649e42570ab9242e5 100644
--- a/src/main/java/com/mojang/datafixers/DataFixerBuilder.java
+++ b/src/main/java/com/mojang/datafixers/DataFixerBuilder.java
@@ -30,8 +30,10 @@ public class DataFixerBuilder {
private final Int2ObjectSortedMap<Schema> schemas = new Int2ObjectAVLTreeMap<>();
private final List<DataFix> globalList = Lists.newArrayList();
private final IntSortedSet fixerVersions = new IntAVLTreeSet();
+ private final int minDataFixPrecacheVersion; // Paper
+ private final int minDataFixPrecacheVersion; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand
public DataFixerBuilder(final int dataVersion) {
+ minDataFixPrecacheVersion = Integer.getInteger("Paper.minPrecachedDatafixVersion", dataVersion+1) * 10; // Paper - default to precache nothing - mojang stores versions * 10 to allow for 'sub versions'
+ minDataFixPrecacheVersion = Integer.getInteger("Paper.minPrecachedDatafixVersion", dataVersion+1) * 10; // Paper - Perf: default to precache nothing - mojang stores versions * 10 to allow for 'sub versions'
this.dataVersion = dataVersion;
}
@ -48,7 +48,7 @@ index cd812f3fe362de5ddc414862dedab2e9727ca776..f6598fcf4ed1bd61e1c87cd7107869d4
final IntBidirectionalIterator iterator = fixerUpper.fixerVersions().iterator();
while (iterator.hasNext()) {
final int versionKey = iterator.nextInt();
+ if (versionKey < minDataFixPrecacheVersion) continue; // Paper
+ if (versionKey < minDataFixPrecacheVersion) continue; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand
final Schema schema = schemas.get(versionKey);
for (final String typeName : schema.types()) {
if (!requiredTypeNames.contains(typeName)) {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Extend block drop capture to capture all items added to the
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 307f2d8adae141cfb7f5fd3c08e68863ce3ed75f..902f3a7ae5ba9c15b634bb2f214be7d85c6d5a00 100644
index 307f2d8adae141cfb7f5fd3c08e68863ce3ed75f..897c149c38fc17a7af4d922ff6eecc08d43cd366 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1532,6 +1532,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -18,26 +18,26 @@ index 307f2d8adae141cfb7f5fd3c08e68863ce3ed75f..902f3a7ae5ba9c15b634bb2f214be7d8
+ captureDrops.add((net.minecraft.world.entity.item.ItemEntity) entity);
+ return true;
+ }
+ // Paper end
+ // Paper end - capture all item additions to the world
// SPIGOT-6415: Don't call spawn event when reason is null. For example when an entity teleports to a new world.
if (spawnReason != null && !CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
return false;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index a9ede0d719e866655ab48fb5d0263c7d1bdcff60..c61754976fab6654f55b1403d769eb1721871dca 100644
index a9ede0d719e866655ab48fb5d0263c7d1bdcff60..49d29e4b3395d2ebea1ed13338f26c7cfbaa5f72 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -431,10 +431,12 @@ public class ServerPlayerGameMode {
// return true; // CraftBukkit
}
// CraftBukkit start
+ java.util.List<net.minecraft.world.entity.item.ItemEntity> itemsToDrop = this.level.captureDrops; // Paper - store current list
+ this.level.captureDrops = null; // Paper - Remove this earlier so that we can actually drop stuff
+ java.util.List<net.minecraft.world.entity.item.ItemEntity> itemsToDrop = this.level.captureDrops; // Paper - capture all item additions to the world
+ this.level.captureDrops = null; // Paper - capture all item additions to the world; Remove this earlier so that we can actually drop stuff
if (event.isDropItems()) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, this.level.captureDrops);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - use stored ref
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - capture all item additions to the world
}
- this.level.captureDrops = null;
+ //this.level.captureDrops = null; // Paper - move up
+ //this.level.captureDrops = null; // Paper - capture all item additions to the world; move up
// Drop event experience
if (flag && event != null) {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1f245a40358309f2e71f473af6df8e71739e8082..2b8706dfccd263c2843dd8661a260536134ad3f8 100644
index 8a613a8a874b8b3949630fcadc25cf39b7fb0659..9b723b5c429fcb356cc056dc56e1c7be1d20a728 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4510,4 +4510,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -14,11 +14,11 @@ index 1f245a40358309f2e71f473af6df8e71739e8082..2b8706dfccd263c2843dd8661a260536
void accept(Entity entity, double x, double y, double z);
}
+
+ // Paper start
+ // Paper start - Expose entity id counter
+ public static int nextEntityId() {
+ return ENTITY_COUNTER.incrementAndGet();
+ }
+ // Paper end
+ // Paper end - Expose entity id counter
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 2ff5d2c357a4832e2624ef53fb0110d61fddc6fc..88deea72f7456c178f54f6a245c84a64ffab6926 100644

Datei anzeigen

@ -14,14 +14,14 @@ this breaks your workflow you can always force all scoreboards to be tracked wit
settings.track-plugin-scoreboards in paper.yml.
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
index 5681630159bb52628e6cc391db324bbafe333414..fdb30a7e728798c59742b812ef28c5094d6093fc 100644
index 5681630159bb52628e6cc391db324bbafe333414..c650fc3712de01184509a03f1d1b388859e163d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
@@ -20,6 +20,7 @@ import org.bukkit.scoreboard.Team;
public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
final Scoreboard board;
+ boolean registeredGlobally = false; // Paper
+ boolean registeredGlobally = false; // Paper - Lazily track plugin scoreboards by default
CraftScoreboard(Scoreboard board) {
this.board = board;
@ -34,7 +34,7 @@ index 5681630159bb52628e6cc391db324bbafe333414..fdb30a7e728798c59742b812ef28c509
+ net.minecraft.server.MinecraftServer.getServer().server.getScoreboardManager().registerScoreboardForVanilla(this);
+ this.registeredGlobally = true;
+ }
+ // Paper end
+ // Paper end - lazily track plugin scoreboards
net.minecraft.world.scores.Objective objective = this.board.addObjective(name, ((CraftCriteria) criteria).criteria, io.papermc.paper.adventure.PaperAdventure.asVanilla(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType), true, null);
return new CraftObjective(this, objective);
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Entity#isTicking
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2b8706dfccd263c2843dd8661a260536134ad3f8..cdfc00e4bee78fc7ac7dc9f52301f16cd7846698 100644
index 9b723b5c429fcb356cc056dc56e1c7be1d20a728..bf7d307c26c52035f3799ca80dccc8e8798d8f89 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4515,5 +4515,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -16,7 +16,7 @@ index 2b8706dfccd263c2843dd8661a260536134ad3f8..cdfc00e4bee78fc7ac7dc9f52301f16c
+ public boolean isTicking() {
+ return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
+ }
// Paper end
// Paper end - Expose entity id counter
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index d5e8c8ed7528cdac203a7594ccf9576db0e5f019..6e302dff4c0b48694d234091b1637ff3b7b4b098 100644

Datei anzeigen

@ -6,14 +6,14 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1eaf509c37c176ad94035d0612f69d6ef53b3626..6a23b1ad4c7fd9deaff05e8d00ad6a77a6ed0cec 100644
index eb77196548f5cac77d0814f3523c35074d57fd6c..7d08e0750db1653685d31f1595593943c65770a1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2217,13 +2217,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.isEnforceWhitelist()) {
PlayerList playerlist = source.getServer().getPlayerList();
UserWhiteList whitelist = playerlist.getWhiteList();
+ if (!((DedicatedServer)getServer()).getProperties().whiteList.get()) return; // Paper - white list not enabled
+ if (!((DedicatedServer) getServer()).getProperties().whiteList.get()) return; // Paper - whitelist not enabled
List<ServerPlayer> list = Lists.newArrayList(playerlist.getPlayers());
Iterator iterator = list.iterator();

Datei anzeigen

@ -7,7 +7,7 @@ if multiple threads from worldgen sort at same time, it will crash.
So make a copy of the list for sorting purposes.
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
index 281b5cf91135984a37ad013614c910f7d4d2fee3..4190acc01b8bf91b02d92143391979df58f6935c 100644
index 281b5cf91135984a37ad013614c910f7d4d2fee3..79e7a7adf9f9d8b9fee7ae3bb3bebab86fa7fd72 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
@@ -17,7 +17,7 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E>
@ -15,37 +15,37 @@ index 281b5cf91135984a37ad013614c910f7d4d2fee3..4190acc01b8bf91b02d92143391979df
private final GateBehavior.OrderPolicy orderPolicy;
private final GateBehavior.RunningPolicy runningPolicy;
- private final ShufflingList<BehaviorControl<? super E>> behaviors = new ShufflingList<>();
+ private final ShufflingList<BehaviorControl<? super E>> behaviors = new ShufflingList<>(false); // Paper - don't use a clone
+ private final ShufflingList<BehaviorControl<? super E>> behaviors = new ShufflingList<>(false); // Paper - Fix Concurrency issue in ShufflingList during worldgen
private Behavior.Status status = Behavior.Status.STOPPED;
public GateBehavior(Map<MemoryModuleType<?>, MemoryStatus> requiredMemoryState, Set<MemoryModuleType<?>> memoriesToForgetWhenStopped, GateBehavior.OrderPolicy order, GateBehavior.RunningPolicy runMode, List<Pair<? extends BehaviorControl<? super E>, Integer>> tasks) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
index 9fb20cd00568aeea25284ea0e80fe52cb1c3eede..731ef21dbbd25d6924717de42f4569a9b5935643 100644
index 9fb20cd00568aeea25284ea0e80fe52cb1c3eede..9d01471da0571c92a60cd57ebd22a5f0b5648fb4 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
@@ -16,12 +16,25 @@ import net.minecraft.util.RandomSource;
public class ShufflingList<U> implements Iterable<U> {
protected final List<ShufflingList.WeightedEntry<U>> entries;
private final RandomSource random = RandomSource.create();
+ private final boolean isUnsafe; // Paper
+ private final boolean isUnsafe; // Paper - Fix Concurrency issue in ShufflingList during worldgen
public ShufflingList() {
+ // Paper start
+ // Paper start - Fix Concurrency issue in ShufflingList during worldgen
+ this(true);
+ }
+ public ShufflingList(boolean isUnsafe) {
+ this.isUnsafe = isUnsafe;
+ // Paper end
+ // Paper end - Fix Concurrency issue in ShufflingList during worldgen
this.entries = Lists.newArrayList();
}
private ShufflingList(List<ShufflingList.WeightedEntry<U>> list) {
+ // Paper start
+ // Paper start - Fix Concurrency issue in ShufflingList during worldgen
+ this(list, true);
+ }
+ private ShufflingList(List<ShufflingList.WeightedEntry<U>> list, boolean isUnsafe) {
+ this.isUnsafe = isUnsafe;
+ // Paper end
+ // Paper end - Fix Concurrency issue in ShufflingList during worldgen
this.entries = Lists.newArrayList(list);
}
@ -58,12 +58,12 @@ index 9fb20cd00568aeea25284ea0e80fe52cb1c3eede..731ef21dbbd25d6924717de42f4569a9
- });
- this.entries.sort(Comparator.comparingDouble(ShufflingList.WeightedEntry::getRandWeight));
- return this;
+ // Paper start - make concurrent safe, work off a clone of the list
+ // Paper start - Fix Concurrency issue in ShufflingList during worldgen
+ List<ShufflingList.WeightedEntry<U>> list = this.isUnsafe ? Lists.newArrayList(this.entries) : this.entries;
+ list.forEach(entry -> entry.setRandom(this.random.nextFloat()));
+ list.sort(Comparator.comparingDouble(ShufflingList.WeightedEntry::getRandWeight));
+ return this.isUnsafe ? new ShufflingList<>(list, this.isUnsafe) : this;
+ // Paper end
+ // Paper end - Fix Concurrency issue in ShufflingList during worldgen
}
public Stream<U> stream() {

Datei anzeigen

@ -11,14 +11,14 @@ This ensures the crystals/pillars are in expected state when the dragon spawns.
See #3522
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 e70273664b4a38ef4ba803c60409a24a07d5bed7..7be3405a93fbb9f43075983825d1ac9299cbe7b9 100644
index e70273664b4a38ef4ba803c60409a24a07d5bed7..359438ba07b48bb7bf7079f026485bb13d2c3ac2 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
@@ -472,6 +472,7 @@ public class EndDragonFight {
entityenderdragon.moveTo((double) this.origin.getX(), (double) (128 + this.origin.getY()), (double) this.origin.getZ(), this.level.random.nextFloat() * 360.0F, 0.0F);
this.level.addFreshEntity(entityenderdragon);
this.dragonUUID = entityenderdragon.getUUID();
+ this.resetSpikeCrystals(); // Paper
+ this.resetSpikeCrystals(); // Paper - Reset ender crystals on dragon spawn
}
return entityenderdragon;

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Fix for large move vectors crashing server
Check movement distance also based on current position.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5550f60424d827616c935e3b0036f1b4f6144e5c..27b84c1db793af21c947ab31e7732a3b371da40a 100644
index 0a2f711b7feba83b39c042df71b3dc6546601ed8..6e1bfe5342e23a0dd97dfbc06a43bf77dfab23cc 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -473,9 +473,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -22,7 +22,7 @@ index 5550f60424d827616c935e3b0036f1b4f6144e5c..27b84c1db793af21c947ab31e7732a3b
double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX()); final double toX = d3; // Paper - OBFHELPER
double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY()); final double toY = d4; // Paper - OBFHELPER
double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ()); final double toZ = d5; // Paper - OBFHELPER
@@ -485,7 +485,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -485,7 +485,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
double d7 = d4 - this.vehicleFirstGoodY;
double d8 = d5 - this.vehicleFirstGoodZ;
double d9 = entity.getDeltaMovement().lengthSqr();
@ -32,9 +32,6 @@ index 5550f60424d827616c935e3b0036f1b4f6144e5c..27b84c1db793af21c947ab31e7732a3b
+ double currDeltaY = toY - fromY;
+ double currDeltaZ = toZ - fromZ;
+ double d10 = Math.max(d6 * d6 + d7 * d7 + d8 * d8, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1);
+ // Paper end - fix large move vectors killing the server
+
+ // Paper start - fix large move vectors killing the server
+ double otherFieldX = d3 - this.vehicleLastGoodX;
+ double otherFieldY = d4 - this.vehicleLastGoodY - 1.0E-6D;
+ double otherFieldZ = d5 - this.vehicleLastGoodZ;
@ -43,7 +40,7 @@ index 5550f60424d827616c935e3b0036f1b4f6144e5c..27b84c1db793af21c947ab31e7732a3b
// CraftBukkit start - handle custom speeds and skipped ticks
this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick;
@@ -531,9 +543,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -531,9 +540,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
boolean flag = worldserver.noCollision(entity, entity.getBoundingBox().deflate(0.0625D));
@ -56,7 +53,7 @@ index 5550f60424d827616c935e3b0036f1b4f6144e5c..27b84c1db793af21c947ab31e7732a3b
boolean flag1 = entity.verticalCollisionBelow;
if (entity instanceof LivingEntity) {
@@ -1272,7 +1284,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1272,7 +1281,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
double d7 = d1 - this.firstGoodY;
double d8 = d2 - this.firstGoodZ;
double d9 = this.player.getDeltaMovement().lengthSqr();
@ -66,8 +63,6 @@ index 5550f60424d827616c935e3b0036f1b4f6144e5c..27b84c1db793af21c947ab31e7732a3b
+ double currDeltaY = toY - prevY;
+ double currDeltaZ = toZ - prevZ;
+ double d10 = Math.max(d6 * d6 + d7 * d7 + d8 * d8, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1);
+ // Paper end - fix large move vectors killing the server
+ // Paper start - fix large move vectors killing the server
+ double otherFieldX = d0 - this.lastGoodX;
+ double otherFieldY = d1 - this.lastGoodY;
+ double otherFieldZ = d2 - this.lastGoodZ;
@ -76,7 +71,7 @@ index 5550f60424d827616c935e3b0036f1b4f6144e5c..27b84c1db793af21c947ab31e7732a3b
if (this.player.isSleeping()) {
if (d10 > 1.0D) {
@@ -1326,9 +1349,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1326,9 +1344,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
AABB axisalignedbb = this.player.getBoundingBox();

Datei anzeigen

@ -5,25 +5,25 @@ Subject: [PATCH] Villager#resetOffers
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
index 0ded8ee2deb51bea7506a8fa2d21f5e160694d54..66b7a2c9a7dc18a98bf2c3aac863a10cbc3ae9f9 100644
index 0ded8ee2deb51bea7506a8fa2d21f5e160694d54..ddc002f269527201724457c0b820788200441e0c 100644
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
@@ -114,6 +114,13 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
return this.tradingPlayer != null;
}
+ // Paper start
+ // Paper start - Villager#resetOffers
+ public void resetOffers() {
+ this.offers = new MerchantOffers();
+ this.updateTrades();
+ }
+ // Paper end
+ // Paper end - Villager#resetOffers
+
@Override
public MerchantOffers getOffers() {
if (this.offers == null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
index 19833c1fc6ee85e031e3c6aac3b00f44730c5e02..8db2c70d3600555bcb419260cafd56409478b227 100644
index 19833c1fc6ee85e031e3c6aac3b00f44730c5e02..34e4c763c7ec971885147ab2509281fad56e1ca6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
@@ -70,4 +70,11 @@ public class CraftAbstractVillager extends CraftAgeable implements AbstractVilla
@ -31,10 +31,10 @@ index 19833c1fc6ee85e031e3c6aac3b00f44730c5e02..8db2c70d3600555bcb419260cafd5640
return this.getMerchant().getTrader();
}
+
+ // Paper start
+ // Paper start - Villager#resetOffers
+ @Override
+ public void resetOffers() {
+ getHandle().resetOffers();
+ }
+ // Paper end
+ // Paper end - Villager#resetOffers
}

Datei anzeigen

@ -10,7 +10,7 @@ In general, look at making this logic more robust (i.e properly handling
cases where a captured entry is overriden) - but for now this will do.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index a7fca2d662e013809fef088213cf0275b596629d..3588ad0b5e8510a00b1a65c73defec39ee7fb108 100644
index a7fca2d662e013809fef088213cf0275b596629d..0aebd1d8555b6aab24c11cd543e24eb1a6d6cb6f 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -160,7 +160,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -18,7 +18,7 @@ index a7fca2d662e013809fef088213cf0275b596629d..3588ad0b5e8510a00b1a65c73defec39
public boolean captureTreeGeneration = false;
public Map<BlockPos, org.bukkit.craftbukkit.block.CraftBlockState> capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper
- public Map<BlockPos, BlockEntity> capturedTileEntities = new HashMap<>();
+ public Map<BlockPos, BlockEntity> capturedTileEntities = new java.util.LinkedHashMap<>(); // Paper
+ public Map<BlockPos, BlockEntity> capturedTileEntities = new java.util.LinkedHashMap<>(); // Paper - Retain block place order when capturing blockstates
public List<ItemEntity> captureDrops;
public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>();
// Paper start

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Reduce blockpos allocation from pathfinding
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
index 8e90b284fb576738b834626bb52c9962ccbc5ad2..2aca9b193db5dadc4fb90b8d7548277b698924aa 100644
index 8e90b284fb576738b834626bb52c9962ccbc5ad2..1e96bac6f22b1fddd22fc239126ff2f823c2abd0 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
@@ -479,7 +479,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
@ -13,7 +13,7 @@ index 8e90b284fb576738b834626bb52c9962ccbc5ad2..2aca9b193db5dadc4fb90b8d7548277b
}
- if (world.getFluidState(pos).is(FluidTags.WATER)) {
+ if (blockState.getFluidState().is(FluidTags.WATER)) {
+ if (blockState.getFluidState().is(FluidTags.WATER)) { // Paper - Perf: Reduce blockpos allocation from pathfinding
return BlockPathTypes.WATER_BORDER;
}
@ -22,7 +22,7 @@ index 8e90b284fb576738b834626bb52c9962ccbc5ad2..2aca9b193db5dadc4fb90b8d7548277b
return BlockPathTypes.COCOA;
} else if (!blockState.is(Blocks.WITHER_ROSE) && !blockState.is(Blocks.POINTED_DRIPSTONE)) {
- FluidState fluidState = world.getFluidState(pos);
+ FluidState fluidState = blockState.getFluidState(); // Paper - remove another getFluidState call
+ FluidState fluidState = blockState.getFluidState(); // Paper - Perf: Reduce blockpos allocation from pathfinding
if (fluidState.is(FluidTags.LAVA)) {
return BlockPathTypes.LAVA;
} else if (isBurningBlock(blockState)) {

Datei anzeigen

@ -7,7 +7,7 @@ Fixes #4259 by not flooring the blockposition among other weirdness
Vanilla Issue: MC-267622
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 c4cf6abf0a962794ddbb4d7a691406054062ffee..f706c787f7608f7440a5f5e05e7e9c4cb582368c 100644
index c4cf6abf0a962794ddbb4d7a691406054062ffee..3a2afa6c1f6dfad7dc18d93b743cbea1eef0e4b8 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
@@ -82,7 +82,14 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@ -15,14 +15,14 @@ index c4cf6abf0a962794ddbb4d7a691406054062ffee..f706c787f7608f7440a5f5e05e7e9c4c
itemstack1 = CraftItemStack.asNMSCopy(result);
// CraftBukkit end
- Containers.dropItemStack(world, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), itemstack1);
+ // Paper start
+ // Paper start - Fix item locations dropped from campfires
+ double deviation = 0.05F * RandomSource.GAUSSIAN_SPREAD_FACTOR;
+ while (!itemstack1.isEmpty()) {
+ net.minecraft.world.entity.item.ItemEntity droppedItem = new net.minecraft.world.entity.item.ItemEntity(world, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, itemstack1.split(world.random.nextInt(21) + 10));
+ droppedItem.setDeltaMovement(world.random.triangle(0.0D, deviation), world.random.triangle(0.2D, deviation), world.random.triangle(0.0D, deviation));
+ world.addFreshEntity(droppedItem);
+ }
+ // Paper end
+ // Paper end - Fix item locations dropped from campfires
campfire.items.set(i, ItemStack.EMPTY);
world.sendBlockUpdated(pos, state, state, 3);
world.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(state));

Datei anzeigen

@ -1,23 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: giacomo <32515303+giacomozama@users.noreply.github.com>
Date: Sat, 10 Oct 2020 12:15:33 +0200
Subject: [PATCH] Fixed TileEntityBell memory leak
Subject: [PATCH] Fix bell block entity memory leak
TileEntityBell has a list of entities (entitiesAtRing) that was not being cleared at the right time, causing leaks whenever a bell would be rung near a crowd of entities.
BellBlockEntity has a list of entities (entitiesAtRing) that was not being cleared at the right time, causing leaks whenever a bell would be rung near a crowd of entities.
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
index 30e9d4b20005dc6d20baf578f2ae958bdfcea02a..b446d6549922f3dabaaa05793d8ee3eb45566ac3 100644
index 30e9d4b20005dc6d20baf578f2ae958bdfcea02a..d21f7e9712ac2d9088ce19d415e4ba7863d8cebf 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
@@ -63,6 +63,11 @@ public class BellBlockEntity extends BlockEntity {
if (blockEntity.ticks >= 50) {
blockEntity.shaking = false;
+ // Paper start
+ // Paper start - Fix bell block entity memory leak
+ if (!blockEntity.resonating) {
+ blockEntity.nearbyEntities.clear();
+ }
+ // Paper end
+ // Paper end - Fix bell block entity memory leak
blockEntity.ticks = 0;
}
@ -25,7 +25,7 @@ index 30e9d4b20005dc6d20baf578f2ae958bdfcea02a..b446d6549922f3dabaaa05793d8ee3eb
++blockEntity.resonationTicks;
} else {
bellEffect.run(world, pos, blockEntity.nearbyEntities);
+ blockEntity.nearbyEntities.clear(); // Paper
+ blockEntity.nearbyEntities.clear(); // Paper - Fix bell block entity memory leak
blockEntity.resonating = false;
}
}
@ -33,7 +33,7 @@ index 30e9d4b20005dc6d20baf578f2ae958bdfcea02a..b446d6549922f3dabaaa05793d8ee3eb
}
}
+ this.nearbyEntities.removeIf(e -> !e.isAlive()); // Paper
+ this.nearbyEntities.removeIf(e -> !e.isAlive()); // Paper - Fix bell block entity memory leak
}
private static boolean areRaidersNearby(BlockPos pos, List<LivingEntity> hearingEntities) {

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Add ignore discounts API
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index c0aa370367856a159412dd141f683b7d51e11c8b..363d1f469862c2e980624ff69f74be015c19412d 100644
index c0aa370367856a159412dd141f683b7d51e11c8b..b33fa26d6e3cf8999fb24137069d0a4178f82caf 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -508,6 +508,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
while (iterator.hasNext()) {
MerchantOffer merchantrecipe = (MerchantOffer) iterator.next();
+ if (merchantrecipe.ignoreDiscounts) continue; // Paper
+ if (merchantrecipe.ignoreDiscounts) continue; // Paper - Add ignore discounts API
merchantrecipe.addToSpecialPriceDiff(-Mth.floor((float) i * merchantrecipe.getPriceMultiplier()));
}
@ -20,19 +20,19 @@ index c0aa370367856a159412dd141f683b7d51e11c8b..363d1f469862c2e980624ff69f74be01
while (iterator1.hasNext()) {
MerchantOffer merchantrecipe1 = (MerchantOffer) iterator1.next();
+ if (merchantrecipe1.ignoreDiscounts) continue; // Paper
+ if (merchantrecipe1.ignoreDiscounts) continue; // Paper - Add ignore discounts API
double d0 = 0.3D + 0.0625D * (double) j;
int k = (int) Math.floor(d0 * (double) merchantrecipe1.getBaseCostA().getCount());
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
index 1d755d04515f20dbd69931084b4cc894e52d35c9..4f7457578ab3118d10e0d5dfc23d79c9b20c2f44 100644
index 1d755d04515f20dbd69931084b4cc894e52d35c9..4cedc095bc9d1d119e2b1ae54969007ced788877 100644
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
@@ -19,6 +19,7 @@ public class MerchantOffer {
public int demand;
public float priceMultiplier;
public int xp;
+ public boolean ignoreDiscounts; // Paper
+ public boolean ignoreDiscounts; // Paper - Add ignore discounts API
// CraftBukkit start
private CraftMerchantRecipe bukkitHandle;
@ -41,7 +41,7 @@ index 1d755d04515f20dbd69931084b4cc894e52d35c9..4f7457578ab3118d10e0d5dfc23d79c9
public MerchantOffer(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int uses, int maxUses, int experience, float priceMultiplier, int demand, CraftMerchantRecipe bukkit) {
- this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, demand);
+ // Paper start - add ignoreDiscounts param
+ // Paper start - Add ignore discounts API
+ this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, demand, false, bukkit);
+ }
+ public MerchantOffer(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int uses, int maxUses, int experience, float priceMultiplier, boolean ignoreDiscounts, CraftMerchantRecipe bukkit) {
@ -49,7 +49,7 @@ index 1d755d04515f20dbd69931084b4cc894e52d35c9..4f7457578ab3118d10e0d5dfc23d79c9
+ }
+ public MerchantOffer(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int uses, int maxUses, int experience, float priceMultiplier, int demand, boolean ignoreDiscounts, CraftMerchantRecipe bukkit) {
+ this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, demand, ignoreDiscounts);
+ // Paper end
+ // Paper end - Add ignore discounts API
this.bukkitHandle = bukkit;
}
// CraftBukkit end
@ -57,7 +57,7 @@ index 1d755d04515f20dbd69931084b4cc894e52d35c9..4f7457578ab3118d10e0d5dfc23d79c9
this.specialPriceDiff = nbt.getInt("specialPrice");
this.demand = nbt.getInt("demand");
+ this.ignoreDiscounts = nbt.getBoolean("Paper.IgnoreDiscounts"); // Paper
+ this.ignoreDiscounts = nbt.getBoolean("Paper.IgnoreDiscounts"); // Paper - Add ignore discounts API
}
public MerchantOffer(ItemStack buyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) {
@ -66,7 +66,7 @@ index 1d755d04515f20dbd69931084b4cc894e52d35c9..4f7457578ab3118d10e0d5dfc23d79c9
public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier) {
- this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, merchantExperience, priceMultiplier, 0);
+ // Paper start - add ignoreDiscounts param
+ // Paper start - Add ignore discounts API
+ this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, merchantExperience, priceMultiplier, false);
+ }
+ public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, boolean ignoreDiscounts) {
@ -78,7 +78,7 @@ index 1d755d04515f20dbd69931084b4cc894e52d35c9..4f7457578ab3118d10e0d5dfc23d79c9
+ }
+ public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, int demandBonus, boolean ignoreDiscounts) {
+ this.ignoreDiscounts = ignoreDiscounts;
+ // Paper end
+ // Paper end - Add ignore discounts API
this.rewardExp = true;
this.xp = 1;
this.baseCostA = firstBuyItem;
@ -86,7 +86,7 @@ index 1d755d04515f20dbd69931084b4cc894e52d35c9..4f7457578ab3118d10e0d5dfc23d79c9
nbttagcompound.putFloat("priceMultiplier", this.priceMultiplier);
nbttagcompound.putInt("specialPrice", this.specialPriceDiff);
nbttagcompound.putInt("demand", this.demand);
+ nbttagcompound.putBoolean("Paper.IgnoreDiscounts", this.ignoreDiscounts); // Paper
+ nbttagcompound.putBoolean("Paper.IgnoreDiscounts", this.ignoreDiscounts); // Paper - Add ignore discounts API
return nbttagcompound;
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Toggle for removing existing dragon
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 7be3405a93fbb9f43075983825d1ac9299cbe7b9..7741b27816636aaa48277b2fe14fd7b88cd3d78a 100644
index 7be3405a93fbb9f43075983825d1ac9299cbe7b9..23fa0f0683874fb43b1160a27e05646282bb66e1 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
@@ -209,7 +209,7 @@ public class EndDragonFight {
@ -13,7 +13,7 @@ index 7be3405a93fbb9f43075983825d1ac9299cbe7b9..7741b27816636aaa48277b2fe14fd7b8
EndDragonFight.LOGGER.info("Found that there's a dragon still alive ({})", entityenderdragon);
this.dragonKilled = false;
- if (!flag) {
+ if (!flag && this.level.paperConfig().entities.behavior.shouldRemoveDragon) {
+ if (!flag && this.level.paperConfig().entities.behavior.shouldRemoveDragon) { // Paper - Toggle for removing existing dragon
EndDragonFight.LOGGER.info("But we didn't have a portal, let's remove it.");
entityenderdragon.discard();
this.dragonUUID = null;

Datei anzeigen

@ -15,7 +15,7 @@ manually reload the advancement data for all players, which
normally takes place as a part of the datapack reloading.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 88deea72f7456c178f54f6a245c84a64ffab6926..bcf88a137616b83f3400afd18c6fe9f3b2b2db34 100644
index 88deea72f7456c178f54f6a245c84a64ffab6926..f48702923beb6d99b23dfa2466396bf4d4e8fbc8 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -329,7 +329,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@ -23,13 +23,13 @@ index 88deea72f7456c178f54f6a245c84a64ffab6926..bcf88a137616b83f3400afd18c6fe9f3
}
- MinecraftServer.getServer().getPlayerList().reloadResources();
+ // Paper start
+ // Paper start - Fix client lag on advancement loading
+ //MinecraftServer.getServer().getPlayerList().reload();
+ MinecraftServer.getServer().getPlayerList().getPlayers().forEach(player -> {
+ player.getAdvancements().reload(MinecraftServer.getServer().getAdvancements());
+ player.getAdvancements().flushDirty(player);
+ });
+ // Paper end
+ // Paper end - Fix client lag on advancement loading
return bukkit;
}

Datei anzeigen

@ -16,7 +16,7 @@ This lets us get faster foreach iteration, as well as avoids map lookups on
the values when needed.
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
index 8519383a9abd45434c1e9888e77548941a80c79c..d23481453717f715124156b5d83f6448f720d049 100644
index 8519383a9abd45434c1e9888e77548941a80c79c..1d51e113b17a5c522fa7812b1c1f38bf790d8335 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
@@ -38,9 +38,12 @@ public class PathFinder {
@ -26,12 +26,12 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..d23481453717f715124156b5d83f6448
- Map<Target, BlockPos> map = positions.stream().collect(Collectors.toMap((pos) -> {
- return this.nodeEvaluator.getGoal((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
- }, Function.identity()));
+ // Paper start - remove streams - and optimize collection
+ // Paper start - Perf: remove streams and optimize collection
+ List<Map.Entry<Target, BlockPos>> map = Lists.newArrayList();
+ for (BlockPos pos : positions) {
+ map.add(new java.util.AbstractMap.SimpleEntry<>(this.nodeEvaluator.getGoal(pos.getX(), pos.getY(), pos.getZ()), pos));
+ }
+ // Paper end
+ // Paper end - Perf: remove streams and optimize collection
Path path = this.findPath(world.getProfiler(), node, map, followRange, distance, rangeMultiplier);
this.nodeEvaluator.done();
return path;
@ -40,7 +40,7 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..d23481453717f715124156b5d83f6448
@Nullable
- private Path findPath(ProfilerFiller profiler, Node startNode, Map<Target, BlockPos> positions, float followRange, int distance, float rangeMultiplier) {
+ // Paper start - optimize collection
+ // Paper start - Perf: remove streams and optimize collection - optimize collection
+ private Path findPath(ProfilerFiller profiler, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
profiler.push("find_path");
profiler.markForCharting(MetricCategory.PATH_FINDING);
@ -73,12 +73,12 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..d23481453717f715124156b5d83f6448
target.setReached();
- set3.add(target);
+ entryList.add(entry);
+ // Paper end
+ // Paper end - Perf: remove streams and optimize collection
}
}
- if (!set3.isEmpty()) {
+ if (!entryList.isEmpty()) { // Paper - rename variable
+ if (!entryList.isEmpty()) { // Paper - Perf: remove streams and optimize collection; rename
break;
}
@ -87,7 +87,7 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..d23481453717f715124156b5d83f6448
node2.cameFrom = node;
node2.g = g;
- node2.h = this.getBestH(node2, set) * 1.5F;
+ node2.h = this.getBestH(node2, positions) * 1.5F; // Paper - list instead of set
+ node2.h = this.getBestH(node2, positions) * 1.5F; // Paper - Perf: remove streams and optimize collection
if (node2.inOpenSet()) {
this.openSet.changeCost(node2, node2.g + node2.h);
} else {
@ -102,7 +102,7 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..d23481453717f715124156b5d83f6448
- }).min(Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount));
- profiler.pop();
- return optional.isEmpty() ? null : optional.get();
+ // Paper start - remove streams - and optimize collection
+ // Paper start - Perf: remove streams and optimize collection
+ Path best = null;
+ boolean entryListIsEmpty = entryList.isEmpty();
+ Comparator<Path> comparator = entryListIsEmpty ? Comparator.comparingInt(Path::getNodeCount)
@ -113,7 +113,7 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..d23481453717f715124156b5d83f6448
+ best = path;
+ }
+ return best;
+ // Paper end
+ // Paper end - Perf: remove streams and optimize collection
}
protected float distance(Node a, Node b) {
@ -121,14 +121,14 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..d23481453717f715124156b5d83f6448
}
- private float getBestH(Node node, Set<Target> targets) {
+ private float getBestH(Node node, List<Map.Entry<Target, BlockPos>> targets) { // Paper - optimize collection - Set<Target> -> List<Map.Entry<Target, BlockPos>>
+ private float getBestH(Node node, List<Map.Entry<Target, BlockPos>> targets) { // Paper - Perf: remove streams and optimize collection; Set<Target> -> List<Map.Entry<Target, BlockPos>>
float f = Float.MAX_VALUE;
- for(Target target : targets) {
+ // Paper start - optimize collection
+ // Paper start - Perf: remove streams and optimize collection
+ for (int i = 0, targetsSize = targets.size(); i < targetsSize; i++) {
+ final Target target = targets.get(i).getKey();
+ // Paper end
+ // Paper end - Perf: remove streams and optimize collection
float g = node.distanceTo(target);
target.updateBest(g, node);
f = Math.min(g, f);

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Beacon API - custom effect ranges
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 cd28ee0cbc69713a641a21c9a626c694a4bcbfc9..3a50fe20294048a1c818ae717a918bb1aed74dea 100644
index cd28ee0cbc69713a641a21c9a626c694a4bcbfc9..0669219b230b127a09741d0073929b2ff68c64af 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
@@ -82,6 +82,26 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
return (BeaconBlockEntity.hasSecondaryEffect(this.levels, this.primaryPower, this.secondaryPower)) ? CraftPotionUtil.toBukkit(new MobEffectInstance(this.secondaryPower, BeaconBlockEntity.getLevel(this.levels), BeaconBlockEntity.getAmplification(this.levels, this.primaryPower, this.secondaryPower), true, true)) : null;
}
// CraftBukkit end
+ // Paper start - add field/methods for custom range
+ // Paper start - Custom beacon ranges
+ private final String PAPER_RANGE_TAG = "Paper.Range";
+ private double effectRange = -1;
+
@ -31,7 +31,7 @@ index cd28ee0cbc69713a641a21c9a626c694a4bcbfc9..3a50fe20294048a1c818ae717a918bb1
+ public void resetEffectRange() {
+ this.effectRange = -1;
+ }
+ // Paper end
+ // Paper end - Custom beacon ranges
@Nullable
static MobEffect filterEffect(@Nullable MobEffect effect) {
@ -40,7 +40,7 @@ index cd28ee0cbc69713a641a21c9a626c694a4bcbfc9..3a50fe20294048a1c818ae717a918bb1
if (blockEntity.levels > 0 && !blockEntity.beamSections.isEmpty()) {
- BeaconBlockEntity.applyEffects(world, pos, blockEntity.levels, blockEntity.primaryPower, blockEntity.secondaryPower);
+ BeaconBlockEntity.applyEffects(world, pos, blockEntity.levels, blockEntity.primaryPower, blockEntity.secondaryPower, blockEntity); // Paper
+ BeaconBlockEntity.applyEffects(world, pos, blockEntity.levels, blockEntity.primaryPower, blockEntity.secondaryPower, blockEntity); // Paper - Custom beacon ranges
BeaconBlockEntity.playSound(world, pos, SoundEvents.BEACON_AMBIENT);
}
}
@ -48,14 +48,14 @@ index cd28ee0cbc69713a641a21c9a626c694a4bcbfc9..3a50fe20294048a1c818ae717a918bb1
}
public static List getHumansInRange(Level world, BlockPos blockposition, int i) {
+ // Paper start
+ // Paper start - Custom beacon ranges
+ return BeaconBlockEntity.getHumansInRange(world, blockposition, i, null);
+ }
+ public static List getHumansInRange(Level world, BlockPos blockposition, int i, @Nullable BeaconBlockEntity blockEntity) {
+ // Paper end
+ // Paper end - Custom beacon ranges
{
- double d0 = (double) (i * 10 + 10);
+ double d0 = blockEntity != null ? blockEntity.getEffectRange() : (i * 10 + 10);// Paper - custom beacon ranges
+ double d0 = blockEntity != null ? blockEntity.getEffectRange() : (i * 10 + 10);// Paper - Custom beacon ranges
AABB axisalignedbb = (new AABB(blockposition)).inflate(d0).expandTowards(0.0D, (double) world.getHeight(), 0.0D);
List<Player> list = world.getEntitiesOfClass(Player.class, axisalignedbb);
@ -63,18 +63,18 @@ index cd28ee0cbc69713a641a21c9a626c694a4bcbfc9..3a50fe20294048a1c818ae717a918bb1
}
private static void applyEffects(Level world, BlockPos pos, int beaconLevel, @Nullable MobEffect primaryEffect, @Nullable MobEffect secondaryEffect) {
+ // Paper start
+ // Paper start - Custom beacon ranges
+ BeaconBlockEntity.applyEffects(world, pos, beaconLevel, primaryEffect, secondaryEffect, null);
+ }
+ private static void applyEffects(Level world, BlockPos pos, int beaconLevel, @Nullable MobEffect primaryEffect, @Nullable MobEffect secondaryEffect, @Nullable BeaconBlockEntity blockEntity) {
+ // Paper end
+ // Paper end - Custom beacon ranges
if (!world.isClientSide && primaryEffect != null) {
double d0 = (double) (beaconLevel * 10 + 10);
byte b0 = BeaconBlockEntity.getAmplification(beaconLevel, primaryEffect, secondaryEffect);
int j = BeaconBlockEntity.getLevel(beaconLevel);
- List list = BeaconBlockEntity.getHumansInRange(world, pos, beaconLevel);
+ List list = BeaconBlockEntity.getHumansInRange(world, pos, beaconLevel, blockEntity); // Paper
+ List list = BeaconBlockEntity.getHumansInRange(world, pos, beaconLevel, blockEntity); // Paper - Custom beacon ranges
BeaconBlockEntity.applyEffect(list, primaryEffect, j, b0, true, pos); // Paper - BeaconEffectEvent
@ -82,7 +82,7 @@ index cd28ee0cbc69713a641a21c9a626c694a4bcbfc9..3a50fe20294048a1c818ae717a918bb1
}
this.lockKey = LockCode.fromTag(nbt);
+ this.effectRange = nbt.contains(PAPER_RANGE_TAG, 6) ? nbt.getDouble(PAPER_RANGE_TAG) : -1; // Paper
+ this.effectRange = nbt.contains(PAPER_RANGE_TAG, 6) ? nbt.getDouble(PAPER_RANGE_TAG) : -1; // Paper - Custom beacon ranges
}
@Override
@ -90,12 +90,12 @@ index cd28ee0cbc69713a641a21c9a626c694a4bcbfc9..3a50fe20294048a1c818ae717a918bb1
}
this.lockKey.addToTag(nbt);
+ nbt.putDouble(PAPER_RANGE_TAG, this.effectRange); // Paper
+ nbt.putDouble(PAPER_RANGE_TAG, this.effectRange); // Paper - Custom beacon ranges
}
public void setCustomName(@Nullable Component customName) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
index c4890927419e27fd35e4e373fb09dcb182234fbf..7d90360bac08d6ec796ba44f1809793f3a3c1b3f 100644
index c4890927419e27fd35e4e373fb09dcb182234fbf..2d77ee30f87491bd413d11687d9fd6def843104c 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
@@ -32,7 +32,7 @@ public class CraftBeacon extends CraftBlockEntityState<BeaconBlockEntity> implem
@ -103,7 +103,7 @@ index c4890927419e27fd35e4e373fb09dcb182234fbf..7d90360bac08d6ec796ba44f1809793f
BeaconBlockEntity beacon = (BeaconBlockEntity) tileEntity;
- Collection<Player> nms = BeaconBlockEntity.getHumansInRange(beacon.getLevel(), beacon.getBlockPos(), beacon.levels);
+ Collection<Player> nms = BeaconBlockEntity.getHumansInRange(beacon.getLevel(), beacon.getBlockPos(), beacon.levels, beacon); // Paper
+ Collection<Player> nms = BeaconBlockEntity.getHumansInRange(beacon.getLevel(), beacon.getBlockPos(), beacon.levels, beacon); // Paper - Custom beacon ranges
Collection<LivingEntity> bukkit = new ArrayList<LivingEntity>(nms.size());
for (Player human : nms) {

Datei anzeigen

@ -5,51 +5,51 @@ Subject: [PATCH] Add API for quit reason
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 4df0342c38f8ff763a08a145ec94325bcd50689d..2db208427447b94cdfdb22b38b6dc6697b1067bd 100644
index 4df0342c38f8ff763a08a145ec94325bcd50689d..673dfdcd212a9a02e2e690084c280b4af904a470 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -183,12 +183,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
this.handlingFault = true;
if (this.channel.isOpen()) {
+ net.minecraft.server.level.ServerPlayer player = this.getPlayer(); // Paper
+ net.minecraft.server.level.ServerPlayer player = this.getPlayer(); // Paper - Add API for quit reason
if (throwable instanceof TimeoutException) {
Connection.LOGGER.debug("Timeout", throwable);
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.TIMED_OUT; // Paper
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.TIMED_OUT; // Paper - Add API for quit reason
this.disconnect(Component.translatable("disconnect.timeout"));
} else {
MutableComponent ichatmutablecomponent = Component.translatable("disconnect.genericReason", "Internal Exception: " + throwable);
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.ERRONEOUS_STATE; // Paper
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.ERRONEOUS_STATE; // Paper - Add API for quit reason
if (flag) {
Connection.LOGGER.debug("Failed to sent packet", throwable);
if (this.getSending() == PacketFlow.CLIENTBOUND) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 8eb1d297ff0317ac679e85e03d0b4546fa1ed315..ff75234d76e4f6a939841c982a6fc3e33b36ea61 100644
index 8eb1d297ff0317ac679e85e03d0b4546fa1ed315..d1de7aedc4ecaffed53c356224e3e670fd70256c 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -279,6 +279,7 @@ public class ServerPlayer extends Player {
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public @Nullable String clientBrandName = null; // Paper - Brand name
+ public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
+ public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
// Paper start - replace player chunk loader
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index f489b207cd3b62a33723f2e9ed0f46020d7f4fd1..0616a8e89931680602da2dbc640906708aebd5ca 100644
index 81d4613a23dd0ffc442f0a4e2cbc84d82134dda7..98751a16f1dc372e2f517d48e8a7584b0370e65e 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -315,6 +315,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end
+ this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper
+ this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper - Add API for quit reason
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
this.connection.disconnect(ichatbasecomponent);
}));
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 29b535dae6eff1c6b47a5d2818fbf0653cd32b8f..ccdb911e723d8cf5ffbfc162778ab948eb4d1bc2 100644
index 29b535dae6eff1c6b47a5d2818fbf0653cd32b8f..35d9aae5ae0618e6509a3d452e0609326e2737c0 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -579,7 +579,7 @@ public abstract class PlayerList {
@ -57,7 +57,7 @@ index 29b535dae6eff1c6b47a5d2818fbf0653cd32b8f..ccdb911e723d8cf5ffbfc162778ab948
}
- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure
+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName())), entityplayer.quitReason); // Paper - Adventure & quit reason
+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName())), entityplayer.quitReason); // Paper - Adventure & Add API for quit reason
this.cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());

Datei anzeigen

@ -11,7 +11,7 @@ in IWorldServerData are removed as they were only used in certain places, with h
values used in other places.
diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
index 83d0db5a9f03ee3ead10d9f61e5f425330eae0e9..5d199fe497bd852827d3d18fb7566a09e70331a3 100644
index 83d0db5a9f03ee3ead10d9f61e5f425330eae0e9..a089f72695b5fb49c7918e89fd5015e8c3a3dd0e 100644
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
+++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
@@ -40,43 +40,53 @@ public class WanderingTraderSpawner implements CustomSpawner {
@ -27,7 +27,7 @@ index 83d0db5a9f03ee3ead10d9f61e5f425330eae0e9..5d199fe497bd852827d3d18fb7566a09
- this.spawnChance = 25;
- properties.setWanderingTraderSpawnChance(this.spawnChance);
- }
+ // Paper start
+ // Paper start - Add Wandering Trader spawn rate config options
+ this.tickDelay = Integer.MIN_VALUE;
+ //this.spawnDelay = properties.getWanderingTraderSpawnDelay(); // Paper - This value is read from the world file only for the first spawn, after which vanilla uses a hardcoded value
+ //this.spawnChance = properties.getWanderingTraderSpawnChance(); // Paper - This value is read from the world file only for the first spawn, after which vanilla uses a hardcoded value
@ -37,13 +37,13 @@ index 83d0db5a9f03ee3ead10d9f61e5f425330eae0e9..5d199fe497bd852827d3d18fb7566a09
+ // this.spawnChance = 25;
+ // properties.setWanderingTraderSpawnChance(this.spawnChance);
+ //}
+ // Paper end
+ // Paper end - Add Wandering Trader spawn rate config options
}
@Override
public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) {
+ // Paper start
+ // Paper start - Add Wandering Trader spawn rate config options
+ if (this.tickDelay == Integer.MIN_VALUE) {
+ this.tickDelay = world.paperConfig().entities.spawning.wanderingTrader.spawnMinuteLength;
+ this.spawnDelay = world.paperConfig().entities.spawning.wanderingTrader.spawnDayLength;
@ -81,7 +81,7 @@ index 83d0db5a9f03ee3ead10d9f61e5f425330eae0e9..5d199fe497bd852827d3d18fb7566a09
} else if (this.spawn(world)) {
- this.spawnChance = 25;
+ this.spawnChance = world.paperConfig().entities.spawning.wanderingTrader.spawnChanceMin;
+ // Paper end
+ // Paper end - Add Wandering Trader spawn rate config options
return 1;
} else {
return 0;

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Expose world spawn angle
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index ccdb911e723d8cf5ffbfc162778ab948eb4d1bc2..d727e401b311eea832315cc681fa7d73886c3f99 100644
index 35d9aae5ae0618e6509a3d452e0609326e2737c0..f81ca5918b43eb9ac74925988abcd0cfc65fe3d3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -849,7 +849,7 @@ public abstract class PlayerList {
@ -13,7 +13,7 @@ index ccdb911e723d8cf5ffbfc162778ab948eb4d1bc2..d727e401b311eea832315cc681fa7d73
worldserver1 = this.server.getLevel(Level.OVERWORLD);
blockposition = entityplayer1.getSpawnPoint(worldserver1);
- location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld()).add(0.5F, 0.1F, 0.5F);
+ location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld(), worldserver1.levelData.getSpawnAngle(), 0.0F).add(0.5F, 0.1F, 0.5F); // Paper - use world spawn angle
+ location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld(), worldserver1.levelData.getSpawnAngle(), 0.0F).add(0.5F, 0.1F, 0.5F); // Paper - Expose world spawn angle
}
Player respawnPlayer = entityplayer1.getBukkitEntity();

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Add PlayerItemCooldownEvent
diff --git a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java
index 47283d2a49209839002212e663a503a82ea86587..ce026600b3b5c846d991a0dfe599708caf2a2962 100644
index 47283d2a49209839002212e663a503a82ea86587..2cc8be27ac71d281ac62a2612723caca111f522e 100644
--- a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java
+++ b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java
@@ -10,6 +10,16 @@ public class ServerItemCooldowns extends ItemCooldowns {
this.player = player;
}
+ // Paper start
+ // Paper start - Add PlayerItemCooldownEvent
+ @Override
+ public void addCooldown(Item item, int duration) {
+ io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent(this.player.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), duration);
@ -20,7 +20,7 @@ index 47283d2a49209839002212e663a503a82ea86587..ce026600b3b5c846d991a0dfe599708c
+ super.addCooldown(item, event.getCooldown());
+ }
+ }
+ // Paper end
+ // Paper end - Add PlayerItemCooldownEvent
+
@Override
protected void onCooldownStarted(Item item, int duration) {

Datei anzeigen

@ -12,14 +12,14 @@ Co-authored-by: Dylan Xaldin <Puremin0rez515@gmail.com>
Co-authored-by: pop4959 <pop4959@gmail.com>
diff --git a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
index fac92f37c32e0398ebc05d9a0378446fcabaef1a..1beacd84bb0eee1f3e8f451fc1c514e23cc62826 100644
index fac92f37c32e0398ebc05d9a0378446fcabaef1a..01b60aaf484e1e327ca42d3573fd86d2abd749fa 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
@@ -490,6 +490,16 @@ public final class DensityFunctions {
public static final KeyDispatchDataCodec<DensityFunctions.EndIslandDensityFunction> CODEC = KeyDispatchDataCodec.of(MapCodec.unit(new DensityFunctions.EndIslandDensityFunction(0L)));
private static final float ISLAND_THRESHOLD = -0.9F;
private final SimplexNoise islandNoise;
+ // Paper start
+ // Paper start - Perf: Optimize end generation
+ private static final class NoiseCache {
+ public long[] keys = new long[8192];
+ public float[] values = new float[8192];
@ -28,7 +28,7 @@ index fac92f37c32e0398ebc05d9a0378446fcabaef1a..1beacd84bb0eee1f3e8f451fc1c514e2
+ }
+ }
+ private static final ThreadLocal<java.util.Map<SimplexNoise, NoiseCache>> noiseCache = ThreadLocal.withInitial(java.util.WeakHashMap::new);
+ // Paper end
+ // Paper end - Perf: Optimize end generation
public EndIslandDensityFunction(long seed) {
RandomSource randomSource = new LegacyRandomSource(seed);
@ -36,14 +36,14 @@ index fac92f37c32e0398ebc05d9a0378446fcabaef1a..1beacd84bb0eee1f3e8f451fc1c514e2
float f = 100.0F - Mth.sqrt((long) x * (long) x + (long) z * (long) z) * 8.0F; // Paper - cast ints to long to avoid integer overflow
f = Mth.clamp(f, -100.0F, 80.0F);
+ NoiseCache cache = noiseCache.get().computeIfAbsent(sampler, noiseKey -> new NoiseCache()); // Paper
+ NoiseCache cache = noiseCache.get().computeIfAbsent(sampler, noiseKey -> new NoiseCache()); // Paper - Perf: Optimize end generation
for(int m = -12; m <= 12; ++m) {
for(int n = -12; n <= 12; ++n) {
long o = (long)(i + m);
long p = (long)(j + n);
- if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < (double)-0.9F) {
- float g = (Mth.abs((float)o) * 3439.0F + Mth.abs((float)p) * 147.0F) % 13.0F + 9.0F;
+ // Paper start - Significantly improve end generation performance by using a noise cache
+ // Paper start - Perf: Optimize end generation by using a noise cache
+ long key = net.minecraft.world.level.ChunkPos.asLong((int) o, (int) p);
+ int index = (int) it.unimi.dsi.fastutil.HashCommon.mix(key) & 8191;
+ float g = Float.MIN_VALUE;
@ -57,7 +57,7 @@ index fac92f37c32e0398ebc05d9a0378446fcabaef1a..1beacd84bb0eee1f3e8f451fc1c514e2
+ cache.values[index] = g;
+ }
+ if (g != Float.MIN_VALUE) {
+ // Paper end
+ // Paper end - Perf: Optimize end generation
float h = (float)(k - m * 2);
float q = (float)(l - n * 2);
float r = 100.0F - Mth.sqrt(h * h + q * q) * g;

Datei anzeigen

@ -5,46 +5,46 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4a1245fb3ad821ee997b35f180390a07bc871982..82eb980dd463c423b2b30a3149166a227608bb96 100644
index cdfc00e4bee78fc7ac7dc9f52301f16cd7846698..180f87a67c84fc0cf3f54755da9801365d4158f8 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2064,6 +2064,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public boolean isPushable() {
+ // Paper start
+ // Paper start - Climbing should not bypass cramming gamerule
+ return isCollidable(false);
+ }
+
+ public boolean isCollidable(boolean ignoreClimbing) {
+ // Paper end
+ // Paper end - Climbing should not bypass cramming gamerule
return false;
}
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
index 68e4440765636295a74ea942862d772d47282ad6..93a41156a01a1638f3ef469b1518a07e7961f378 100644
index 68e4440765636295a74ea942862d772d47282ad6..7bd719db017425627c982728abec7b7f99edbc66 100644
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
@@ -46,11 +46,16 @@ public final class EntitySelector {
}
public static Predicate<Entity> pushableBy(Entity entity) {
+ // Paper start - ignoreClimbing param
+ // Paper start - Climbing should not bypass cramming gamerule
+ return pushable(entity, false);
+ }
+ public static Predicate<Entity> pushable(Entity entity, boolean ignoreClimbing) {
+ // Paper end
+ // Paper end - Climbing should not bypass cramming gamerule
PlayerTeam scoreboardteam = entity.getTeam();
Team.CollisionRule scoreboardteambase_enumteampush = scoreboardteam == null ? Team.CollisionRule.ALWAYS : scoreboardteam.getCollisionRule();
return (Predicate) (scoreboardteambase_enumteampush == Team.CollisionRule.NEVER ? Predicates.alwaysFalse() : EntitySelector.NO_SPECTATORS.and((entity1) -> {
- if (!entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API
+ if (!entity1.isCollidable(ignoreClimbing) || !entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API // Paper - isCollidable
+ if (!entity1.isCollidable(ignoreClimbing) || !entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API // Paper - Climbing should not bypass cramming gamerule
return false;
} else if (entity.level().isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
return false;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 05fe4828af59e3cd894c9979ecb08ad0e1c6b2d3..7d72477cdeaa8238da1291c0a902d090463b95c8 100644
index 05fe4828af59e3cd894c9979ecb08ad0e1c6b2d3..720b889796cd023308cf6f8e8a75b2548ca0e45f 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3426,7 +3426,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -52,7 +52,7 @@ index 05fe4828af59e3cd894c9979ecb08ad0e1c6b2d3..7d72477cdeaa8238da1291c0a902d090
}
// Paper end - don't run getEntities if we're not going to use its result
- List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this));
+ List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule
+ List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - Climbing should not bypass cramming gamerule
if (!list.isEmpty()) {
// Paper - moved up
@ -60,7 +60,7 @@ index 05fe4828af59e3cd894c9979ecb08ad0e1c6b2d3..7d72477cdeaa8238da1291c0a902d090
return !this.isRemoved() && this.collides; // CraftBukkit
}
+ // Paper start
+ // Paper start - Climbing should not bypass cramming gamerule
@Override
public boolean isPushable() {
- return this.isAlive() && !this.isSpectator() && !this.onClimbable() && this.collides; // CraftBukkit
@ -70,12 +70,12 @@ index 05fe4828af59e3cd894c9979ecb08ad0e1c6b2d3..7d72477cdeaa8238da1291c0a902d090
+ @Override
+ public boolean isCollidable(boolean ignoreClimbing) {
+ return this.isAlive() && !this.isSpectator() && (ignoreClimbing || !this.onClimbable()) && this.collides; // CraftBukkit
+ // Paper end
+ // Paper end - Climbing should not bypass cramming gamerule
}
// CraftBukkit start - collidable API
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
index bc9a710a92662b1f69b0f5b289780fe0a0d5ed32..6b614818b14ecfc8fc82b523eeb7e21fdf9bf1ba 100644
index bc9a710a92662b1f69b0f5b289780fe0a0d5ed32..44fa2d4f90389f5526746bd94a2450c03340bd0b 100644
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
@@ -90,7 +90,7 @@ public class Bat extends AmbientCreature {
@ -83,12 +83,12 @@ index bc9a710a92662b1f69b0f5b289780fe0a0d5ed32..6b614818b14ecfc8fc82b523eeb7e21f
@Override
- public boolean isPushable() {
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
return false;
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
index fbad0e512b990c3d6885ecf92766ba6fd851cc20..4c34edc55fa0e136ccf49a3aef001f413274dfac 100644
index fbad0e512b990c3d6885ecf92766ba6fd851cc20..f3f48225c2a1e4bd3d0091d1b4b7e4e150850ed2 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
@@ -383,8 +383,8 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
@ -97,13 +97,13 @@ index fbad0e512b990c3d6885ecf92766ba6fd851cc20..4c34edc55fa0e136ccf49a3aef001f41
@Override
- public boolean isPushable() {
- return super.isPushable(); // CraftBukkit - collidable API
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
+ return super.isCollidable(ignoreClimbing); // CraftBukkit - collidable API // Paper
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
+ return super.isCollidable(ignoreClimbing); // CraftBukkit - collidable API // Paper - Climbing should not bypass cramming gamerule
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index 6b7453281e32aae20778f26b4098df418401c45b..a13a1725356ca4430f1f0a6d121fc08679de62db 100644
index 6b7453281e32aae20778f26b4098df418401c45b..8fc65fd7347340a89dba0b9839497aadfcc67d79 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -286,7 +286,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@ -111,12 +111,12 @@ index 6b7453281e32aae20778f26b4098df418401c45b..a13a1725356ca4430f1f0a6d121fc086
@Override
- public boolean isPushable() {
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
return !this.isVehicle();
}
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index 4f9afae94a4cbf28a532e889d441c63df50642d9..d46b3b346540cc78cb93f3ce8bc8adc89b3d9b3d 100644
index 4f9afae94a4cbf28a532e889d441c63df50642d9..e29d1801f15c4c5680b683783e97a7aae3da753e 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -343,7 +343,7 @@ public class ArmorStand extends LivingEntity {
@ -124,12 +124,12 @@ index 4f9afae94a4cbf28a532e889d441c63df50642d9..d46b3b346540cc78cb93f3ce8bc8adc8
@Override
- public boolean isPushable() {
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
return false;
}
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 e390735d411d815dcc4591da58db7017452acf31..82ffd50017dc234a9718db551fca0e73a6deded0 100644
index e390735d411d815dcc4591da58db7017452acf31..be16ab6da56d2aa2a21ee378cfc44dbb14e108b3 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -172,7 +172,7 @@ public abstract class AbstractMinecart extends VehicleEntity {
@ -137,12 +137,12 @@ index e390735d411d815dcc4591da58db7017452acf31..82ffd50017dc234a9718db551fca0e73
@Override
- public boolean isPushable() {
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
return true;
}
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 e6a7bf9a27fb66d8c2210678dbe8afa8bbf5e7c8..6b0ec9da5a368775924f5b97c74acc5bfd609fa1 100644
index e6a7bf9a27fb66d8c2210678dbe8afa8bbf5e7c8..0178eb918179b12d7d8eb56cd72e5bfc34cfdbaf 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -157,7 +157,7 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
@ -150,7 +150,7 @@ index e6a7bf9a27fb66d8c2210678dbe8afa8bbf5e7c8..6b0ec9da5a368775924f5b97c74acc5b
@Override
- public boolean isPushable() {
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
return true;
}

Datei anzeigen

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Mon, 16 Nov 2020 12:01:52 -0800
Subject: [PATCH] Added missing default perms for commands
Subject: [PATCH] Add missing default perms for commands
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerShearBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
index 44e72176a0da08a77fa192ee31c0fcd53f0dc22d..f82cd3677da96d3cf051c983d08a8ff302400b18 100644
index 44e72176a0da08a77fa192ee31c0fcd53f0dc22d..65d3311cfa251b0d3246413d0714acff7d31e844 100644
--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
@@ -127,7 +127,7 @@ public class BeehiveBlock extends BaseEntityBlock {
@ -13,7 +13,7 @@ index 44e72176a0da08a77fa192ee31c0fcd53f0dc22d..f82cd3677da96d3cf051c983d08a8ff3
public static void dropHoneycomb(Level world, BlockPos pos) {
- popResource(world, pos, new ItemStack(Items.HONEYCOMB, 3));
+ popResource(world, pos, new ItemStack(Items.HONEYCOMB, 3)); // Paper - conflict on change, item needs to be set below
+ popResource(world, pos, new ItemStack(Items.HONEYCOMB, 3)); // Paper - Add PlayerShearBlockEvent; conflict on change, item needs to be set below
}
@Override
@ -34,12 +34,12 @@ index 44e72176a0da08a77fa192ee31c0fcd53f0dc22d..f82cd3677da96d3cf051c983d08a8ff3
+ for (org.bukkit.inventory.ItemStack itemDrop : event.getDrops()) {
+ popResource(world, pos, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(itemDrop));
+ }
+ // Paper end
+ // Paper end - Add PlayerShearBlockEvent
itemstack.hurtAndBreak(1, player, (entityhuman1) -> {
entityhuman1.broadcastBreakEvent(hand);
});
diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
index df11efd22682c2ed799dabf15d2cfa5973e8dca9..58bc92f70892a1ff1af3bd2c1b6d8eb57e92aced 100644
index df11efd22682c2ed799dabf15d2cfa5973e8dca9..0f07ba8e01d437eb5fe32566616f27dd2e2f0bbd 100644
--- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
@@ -35,13 +35,24 @@ public class PumpkinBlock extends Block {
@ -52,7 +52,7 @@ index df11efd22682c2ed799dabf15d2cfa5973e8dca9..58bc92f70892a1ff1af3bd2c1b6d8eb5
+ if (!event.callEvent()) {
+ return InteractionResult.PASS;
+ }
+ // Paper end
+ // Paper end - Add PlayerShearBlockEvent
Direction direction = hit.getDirection();
Direction direction2 = direction.getAxis() == Direction.Axis.Y ? player.getDirection().getOpposite() : direction;
world.playSound((Player)null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F);
@ -61,7 +61,7 @@ index df11efd22682c2ed799dabf15d2cfa5973e8dca9..58bc92f70892a1ff1af3bd2c1b6d8eb5
+ // Paper start - Add PlayerShearBlockEvent
+ for (org.bukkit.inventory.ItemStack item : event.getDrops()) {
+ ItemEntity itemEntity = new ItemEntity(world, (double) pos.getX() + 0.5D + (double) direction2.getStepX() * 0.65D, (double) pos.getY() + 0.1D, (double) pos.getZ() + 0.5D + (double) direction2.getStepZ() * 0.65D, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item));
+ // Paper end
+ // Paper end - Add PlayerShearBlockEvent
itemEntity.setDeltaMovement(0.05D * (double)direction2.getStepX() + world.random.nextDouble() * 0.02D, 0.05D, 0.05D * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02D);
world.addFreshEntity(itemEntity);
+ } // Paper - Add PlayerShearBlockEvent

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Limit recipe packets
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 27b84c1db793af21c947ab31e7732a3b371da40a..3683e3b56da96e5528d63319892b5ec76075d86c 100644
index 6e1bfe5342e23a0dd97dfbc06a43bf77dfab23cc..a3715ab0d5f7ae33ba64e69b391e12a00b2e59e9 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -258,6 +258,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -20,22 +20,22 @@ index 27b84c1db793af21c947ab31e7732a3b371da40a..3683e3b56da96e5528d63319892b5ec7
// CraftBukkit start
for (int spam; (spam = this.chatSpamTickCount.get()) > 0 && !this.chatSpamTickCount.compareAndSet(spam, spam - 1); ) ;
if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable
+ if (recipeSpamPackets.get() > 0) recipeSpamPackets.getAndDecrement(); // Paper
+ if (recipeSpamPackets.get() > 0) recipeSpamPackets.getAndDecrement(); // Paper - auto recipe limit
/* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount;
@@ -2990,6 +2992,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2985,6 +2987,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
+ // Paper start
+ // Paper start - auto recipe limit
+ 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) {
+ this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper
+ return;
+ }
+ }
+ // Paper end
+ // Paper end - auto recipe limit
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
this.player.resetLastActionTime();
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) {

Datei anzeigen

@ -5,18 +5,18 @@ Subject: [PATCH] Player Chunk Load/Unload Events
diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
index 19b3f4fa7678a038bf25efc2a8b46ddad0193fde..cfeb85b89a7f3dbc856fe7ebdf0bd6a9f3761f1c 100644
index 19b3f4fa7678a038bf25efc2a8b46ddad0193fde..fb1863d235a61ec977e8ad87a289d935a9c5d0e4 100644
--- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
+++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
@@ -46,6 +46,11 @@ public class PlayerChunkSender {
public static void dropChunkStatic(ServerPlayer player, ChunkPos pos) {
player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(pos.toLong()).removePlayer(player);
player.connection.send(new ClientboundForgetLevelChunkPacket(pos));
+ // Paper start
+ // Paper start - PlayerChunkUnloadEvent
+ if (io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0) {
+ new io.papermc.paper.event.packet.PlayerChunkUnloadEvent(player.getBukkitEntity().getWorld().getChunkAt(pos.longKey), player.getBukkitEntity()).callEvent();
+ }
+ // Paper end
+ // Paper end - PlayerChunkUnloadEvent
}
// Paper end - rewrite player chunk loader

Datei anzeigen

@ -12,14 +12,14 @@ JSON representation of the NBT object.
Now we will just skip the value when 99.9999% of the time the text is never even printed.
diff --git a/src/main/java/com/mojang/serialization/Dynamic.java b/src/main/java/com/mojang/serialization/Dynamic.java
index a24cc02a62585d7c04d36456739b11bddccf1a15..683f516b86f246792dcb3d6f9a738fc14155d2f6 100644
index a24cc02a62585d7c04d36456739b11bddccf1a15..984e41619230db4579b028af18670c471aa13096 100644
--- a/src/main/java/com/mojang/serialization/Dynamic.java
+++ b/src/main/java/com/mojang/serialization/Dynamic.java
@@ -17,6 +17,7 @@ import java.util.stream.Stream;
@SuppressWarnings("unused")
public class Dynamic<T> extends DynamicLike<T> {
+ private static final boolean DEBUG_MISSING_KEYS = Boolean.getBoolean("Paper.debugDynamicMissingKeys"); // Paper
+ private static final boolean DEBUG_MISSING_KEYS = Boolean.getBoolean("Paper.debugDynamicMissingKeys"); // Paper - Perf: Skip toString on values like NBT
private final T value;
public Dynamic(final DynamicOps<T> ops) {
@ -28,7 +28,7 @@ index a24cc02a62585d7c04d36456739b11bddccf1a15..683f516b86f246792dcb3d6f9a738fc1
final T value = m.get(key);
if (value == null) {
- return DataResult.error(() -> "key missing: " + key + " in " + this.value);
+ return DataResult.error(() -> DEBUG_MISSING_KEYS ? "key missing: " + key + " in " + this.value : "key missing: " + key); // Paper
+ return DataResult.error(() -> DEBUG_MISSING_KEYS ? "key missing: " + key + " in " + this.value : "key missing: " + key); // Paper - Perf: Skip toString on values like NBT
}
return DataResult.success(new Dynamic<>(ops, value));
}));

Datei anzeigen

@ -1,12 +1,12 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 27 Dec 2020 11:31:06 +0000
Subject: [PATCH] Do not crash from invalid ingredient lists in
Subject: [PATCH] Fix crash from invalid ingredient lists in
VillagerAcquireTradeEvent
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
index 66b7a2c9a7dc18a98bf2c3aac863a10cbc3ae9f9..73bc45000b5285ccf5b06e2f372d6c82bf843b82 100644
index 66b7a2c9a7dc18a98bf2c3aac863a10cbc3ae9f9..1ec236f6c141c28a26658f6a0c43df4ab2ec2f7a 100644
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
@@ -261,7 +261,11 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
@ -14,11 +14,11 @@ index 66b7a2c9a7dc18a98bf2c3aac863a10cbc3ae9f9..73bc45000b5285ccf5b06e2f372d6c82
}
if (!event.isCancelled()) {
- recipeList.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
+ // Paper start
+ // Paper start - Fix crash from invalid ingredient list
+ final CraftMerchantRecipe craftMerchantRecipe = CraftMerchantRecipe.fromBukkit(event.getRecipe());
+ if (craftMerchantRecipe.getIngredients().isEmpty()) return;
+ recipeList.add(craftMerchantRecipe.toMinecraft());
+ // Paper end
+ // Paper end - Fix crash from invalid ingredient list
}
// CraftBukkit end
++j;

Datei anzeigen

@ -6,14 +6,14 @@ Subject: [PATCH] Add PlayerTradeEvent and PlayerPurchaseEvent
Co-authored-by: Alexander <protonull@protonmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
index 73bc45000b5285ccf5b06e2f372d6c82bf843b82..5a591c439c5cef6b7e7e6f836ab813cb4f29b08c 100644
index 1ec236f6c141c28a26658f6a0c43df4ab2ec2f7a..c3b100b8d1068b2a77a344de7fcd205a1c36e5a7 100644
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
@@ -137,11 +137,24 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
@Override
public void overrideXp(int experience) {}
+ // Paper start
+ // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent
+ @Override
+ public void processTrade(MerchantOffer recipe, @Nullable io.papermc.paper.event.player.PlayerPurchaseEvent event) { // The MerchantRecipe passed in here is the one set by the PlayerPurchaseEvent
+ if (event == null || event.willIncreaseTradeUses()) {
@ -24,34 +24,34 @@ index 73bc45000b5285ccf5b06e2f372d6c82bf843b82..5a591c439c5cef6b7e7e6f836ab813cb
+ }
+ this.notifyTrade(recipe);
+ }
+ // Paper end
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
+
@Override
public void notifyTrade(MerchantOffer offer) {
- offer.increaseUses();
+ // offer.increaseUses(); // Paper - handled in processTrade
+ // offer.increaseUses(); // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
this.ambientSoundTime = -this.getAmbientSoundInterval();
- this.rewardTradeXp(offer);
+ // this.rewardTradeXp(offer); // Paper - handled in processTrade
+ // this.rewardTradeXp(offer); // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
if (this.tradingPlayer instanceof ServerPlayer) {
CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, offer.getResult());
}
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 52e57fa3b25dce10c17682964cbd4bcb4c130dc6..c6ac55cdece9e2901e5d17a23408171c6c49ff69 100644
index 52e57fa3b25dce10c17682964cbd4bcb4c130dc6..1465dbc29fc34bfe6ebb53e95fa6a4cbf2127a6c 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -760,6 +760,14 @@ public abstract class AbstractContainerMenu {
public abstract boolean stillValid(Player player);
protected boolean moveItemStackTo(ItemStack stack, int startIndex, int endIndex, boolean fromLast) {
+ // Paper start
+ // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent
+ return this.moveItemStackTo(stack, startIndex, endIndex, fromLast, false);
+ }
+ protected boolean moveItemStackTo(ItemStack stack, int startIndex, int endIndex, boolean fromLast, boolean isCheck) {
+ if (isCheck) {
+ stack = stack.copy();
+ }
+ // Paper end
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
boolean flag1 = false;
int k = startIndex;
@ -59,27 +59,27 @@ index 52e57fa3b25dce10c17682964cbd4bcb4c130dc6..c6ac55cdece9e2901e5d17a23408171c
slot = (Slot) this.slots.get(k);
itemstack1 = slot.getItem();
+ // Paper start - clone if only a check
+ // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent; clone if only a check
+ if (isCheck) {
+ itemstack1 = itemstack1.copy();
+ }
+ // Paper end
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
if (!itemstack1.isEmpty() && ItemStack.isSameItemSameTags(stack, itemstack1)) {
int l = itemstack1.getCount() + stack.getCount();
if (l <= stack.getMaxStackSize()) {
stack.setCount(0);
itemstack1.setCount(l);
+ if (!isCheck) { // Paper - dont update if only a check
+ if (!isCheck) { // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
slot.setChanged();
+ } // Paper
+ } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
flag1 = true;
} else if (itemstack1.getCount() < stack.getMaxStackSize()) {
stack.shrink(stack.getMaxStackSize() - itemstack1.getCount());
itemstack1.setCount(stack.getMaxStackSize());
+ if (!isCheck) { // Paper - dont update if only a check
+ if (!isCheck) { // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
slot.setChanged();
+ } // Paper
+ } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
flag1 = true;
}
}
@ -87,38 +87,38 @@ index 52e57fa3b25dce10c17682964cbd4bcb4c130dc6..c6ac55cdece9e2901e5d17a23408171c
slot = (Slot) this.slots.get(k);
itemstack1 = slot.getItem();
+ // Paper start - clone if only a check
+ // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent
+ if (isCheck) {
+ itemstack1 = itemstack1.copy();
+ }
+ // Paper end
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
if (itemstack1.isEmpty() && slot.mayPlace(stack)) {
if (stack.getCount() > slot.getMaxStackSize()) {
+ // Paper start - dont set slot if only check
+ // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent
+ if (isCheck) {
+ stack.shrink(slot.getMaxStackSize());
+ } else {
+ // Paper end
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
slot.setByPlayer(stack.split(slot.getMaxStackSize()));
+ } // Paper
+ } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
} else {
+ // Paper start - dont set slot if only check
+ // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent
+ if (isCheck) {
+ stack.shrink(stack.getCount());
+ } else {
+ // Paper end
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
slot.setByPlayer(stack.split(stack.getCount()));
+ } // Paper
+ } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
}
+ if (!isCheck) { // Paper - dont update if only check
+ if (!isCheck) { // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
slot.setChanged();
+ } // Paper
+ } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
flag1 = true;
break;
}
diff --git a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java
index 743a2adc465be5477d204185967265389d7102de..8eab7596e1f7d1beb9ab0d70d1310d26822262e9 100644
index 743a2adc465be5477d204185967265389d7102de..9c17c14de888ef3fbf4139cbad3889ece1d74aa1 100644
--- a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java
@@ -134,12 +134,12 @@ public class MerchantMenu extends AbstractContainerMenu {
@ -126,13 +126,13 @@ index 743a2adc465be5477d204185967265389d7102de..8eab7596e1f7d1beb9ab0d70d1310d26
itemstack = itemstack1.copy();
if (slot == 2) {
- if (!this.moveItemStackTo(itemstack1, 3, 39, true)) {
+ if (!this.moveItemStackTo(itemstack1, 3, 39, true, true)) { // Paper
+ if (!this.moveItemStackTo(itemstack1, 3, 39, true, true)) { // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
return ItemStack.EMPTY;
}
- slot1.onQuickCraft(itemstack1, itemstack);
- this.playTradeSound();
+ // slot1.onQuickCraft(itemstack1, itemstack); // Paper - moved to after the non-check moveItemStackTo call
+ // slot1.onQuickCraft(itemstack1, itemstack); // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent; moved to after the non-check moveItemStackTo call
+ // this.playTradeSound();
} else if (slot != 0 && slot != 1) {
if (slot >= 3 && slot < 30) {
@ -141,7 +141,7 @@ index 743a2adc465be5477d204185967265389d7102de..8eab7596e1f7d1beb9ab0d70d1310d26
return ItemStack.EMPTY;
}
+ if (slot != 2) { // Paper - moved down for slot 2
+ if (slot != 2) { // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent; moved down for slot 2
if (itemstack1.isEmpty()) {
slot1.setByPlayer(ItemStack.EMPTY);
} else {
@ -149,7 +149,7 @@ index 743a2adc465be5477d204185967265389d7102de..8eab7596e1f7d1beb9ab0d70d1310d26
}
slot1.onTake(player, itemstack1);
+ } // Paper start - handle slot 2
+ } // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent; handle slot 2
+ if (slot == 2) { // is merchant result slot
+ slot1.onTake(player, itemstack1);
+ if (itemstack1.isEmpty()) {
@ -163,12 +163,12 @@ index 743a2adc465be5477d204185967265389d7102de..8eab7596e1f7d1beb9ab0d70d1310d26
+ this.playTradeSound();
+ slot1.set(ItemStack.EMPTY); // itemstack1 should ALWAYS be empty
+ }
+ // Paper end
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
}
return itemstack;
diff --git a/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java b/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java
index e49bbb803399ef696665c5844a18b55a551654f6..1f2b9a9a3fa167e2ba021c823dd142b0bb18a695 100644
index e49bbb803399ef696665c5844a18b55a551654f6..23c1ba476869c9846a63138a8a11154bfd9379a2 100644
--- a/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java
+++ b/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java
@@ -47,13 +47,32 @@ public class MerchantResultSlot extends Slot {
@ -176,9 +176,9 @@ index e49bbb803399ef696665c5844a18b55a551654f6..1f2b9a9a3fa167e2ba021c823dd142b0
@Override
public void onTake(Player player, ItemStack stack) {
- this.checkTakeAchievements(stack);
+ // this.checkTakeAchievements(stack); // Paper - move to after event is called and not cancelled
+ // this.checkTakeAchievements(stack); // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent; move to after event is called and not cancelled
MerchantOffer merchantOffer = this.slots.getActiveOffer();
+ // Paper start
+ // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent
+ io.papermc.paper.event.player.PlayerPurchaseEvent event = null;
+ if (merchantOffer != null && player instanceof net.minecraft.server.level.ServerPlayer serverPlayer) {
+ if (this.merchant instanceof net.minecraft.world.entity.npc.AbstractVillager abstractVillager) {
@ -196,13 +196,13 @@ index e49bbb803399ef696665c5844a18b55a551654f6..1f2b9a9a3fa167e2ba021c823dd142b0
+ }
+ }
+ this.checkTakeAchievements(stack);
+ // Paper end
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
if (merchantOffer != null) {
ItemStack itemStack = this.slots.getItem(0);
ItemStack itemStack2 = this.slots.getItem(1);
if (merchantOffer.take(itemStack, itemStack2) || merchantOffer.take(itemStack2, itemStack)) {
- this.merchant.notifyTrade(merchantOffer);
+ this.merchant.processTrade(merchantOffer, event); // Paper
+ this.merchant.processTrade(merchantOffer, event); // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
player.awardStat(Stats.TRADED_WITH_VILLAGER);
this.slots.setItem(0, itemStack);
this.slots.setItem(1, itemStack2);
@ -219,14 +219,14 @@ index 5a350948a4735902f5c612592bc9d100445a0c8a..716b30dcd7e63c66736c448dd136c9f7
void notifyTradeUpdated(ItemStack stack);
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java
index adf22ce4f0bcd3bd57dc2030c6c92d3df96566e3..05af1f1cfb38e4ae4ea0ecc2d0a943cbc4063c77 100644
index adf22ce4f0bcd3bd57dc2030c6c92d3df96566e3..e33ddcd967a427abfda9e6692338da4996a81c6c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java
@@ -74,10 +74,25 @@ public class CraftMerchantCustom extends CraftMerchant {
return this.trades;
}
+ // Paper start
+ // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent
+ @Override
+ public void processTrade(MerchantOffer merchantRecipe, @javax.annotation.Nullable io.papermc.paper.event.player.PlayerPurchaseEvent event) { // The MerchantRecipe passed in here is the one set by the PlayerPurchaseEvent
+ /** Based on {@link net.minecraft.world.entity.npc.AbstractVillager#processTrade(MerchantOffer, io.papermc.paper.event.player.PlayerPurchaseEvent)} */
@ -240,12 +240,12 @@ index adf22ce4f0bcd3bd57dc2030c6c92d3df96566e3..05af1f1cfb38e4ae4ea0ecc2d0a943cb
+ }
+ this.notifyTrade(merchantRecipe);
+ }
+ // Paper end
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
@Override
public void notifyTrade(MerchantOffer offer) {
// increase recipe's uses
- offer.increaseUses();
+ // offer.increaseUses(); // Paper - handled above in processTrade
+ // offer.increaseUses(); // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent; handled above in processTrade
}
@Override

Datei anzeigen

@ -1,21 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Wed, 25 Nov 2020 23:20:44 -0800
Subject: [PATCH] Implement TargetHitEvent
Subject: [PATCH] Add TargetHitEvent
diff --git a/src/main/java/net/minecraft/world/level/block/TargetBlock.java b/src/main/java/net/minecraft/world/level/block/TargetBlock.java
index 5ea231aadfafdfc6d08aae472827ff1e3d62f4eb..3fdc994a9b27eb099e5483c019d673c1b390434c 100644
index 5ea231aadfafdfc6d08aae472827ff1e3d62f4eb..e885f8defd5fd5059c895ee7906664f9e4561de0 100644
--- a/src/main/java/net/minecraft/world/level/block/TargetBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TargetBlock.java
@@ -42,6 +42,10 @@ public class TargetBlock extends Block {
@Override
public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) {
int i = updateRedstoneOutput(world, state, hit, projectile);
+ // Paper start
+ // Paper start - Add TargetHitEvent
+ }
+ private static void awardTargetHitCriteria(Projectile projectile, BlockHitResult hit, int i) {
+ // Paper end
+ // Paper end - Add TargetHitEvent
Entity entity = projectile.getOwner();
if (entity instanceof ServerPlayer serverPlayer) {
serverPlayer.awardStat(Stats.TARGET_HIT);
@ -23,7 +23,7 @@ index 5ea231aadfafdfc6d08aae472827ff1e3d62f4eb..3fdc994a9b27eb099e5483c019d673c1
private static int updateRedstoneOutput(LevelAccessor world, BlockState state, BlockHitResult hitResult, Entity entity) {
int i = getRedstoneStrength(hitResult, hitResult.getLocation());
int j = entity instanceof AbstractArrow ? 20 : 8;
+ // Paper start
+ // Paper start - Add TargetHitEvent
+ if (entity instanceof Projectile) {
+ final Projectile projectile = (Projectile) entity;
+ final org.bukkit.craftbukkit.block.CraftBlock craftBlock = org.bukkit.craftbukkit.block.CraftBlock.at(world, hitResult.getBlockPos());
@ -36,7 +36,7 @@ index 5ea231aadfafdfc6d08aae472827ff1e3d62f4eb..3fdc994a9b27eb099e5483c019d673c1
+ return i;
+ }
+ }
+ // Paper end
+ // Paper end - Add TargetHitEvent
if (!world.getBlockTicks().hasScheduledTick(hitResult.getBlockPos(), state.getBlock())) {
setOutputPower(world, state, i, hitResult.getBlockPos(), j);
}

Datei anzeigen

@ -9,7 +9,7 @@ loss, which forces the server to lose the same precision as the client
keeping them in sync.
diff --git a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
index 05ac41e136da43284fb24a6b698ebd36318278fb..33d9131e9c75ef23cd637f5d6c39a2704a0c92a5 100644
index 05ac41e136da43284fb24a6b698ebd36318278fb..3c4ac79c094dc2fff7de94150a34b7bf814ac0de 100644
--- a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
+++ b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
@@ -9,12 +9,12 @@ public class VecDeltaCodec {
@ -17,25 +17,25 @@ index 05ac41e136da43284fb24a6b698ebd36318278fb..33d9131e9c75ef23cd637f5d6c39a270
@VisibleForTesting
static long encode(double value) {
- return Math.round(value * 4096.0D);
+ return Math.round(value * 4096.0D); // Paper - diff on change
+ return Math.round(value * 4096.0D); // Paper - Fix MC-4; diff on change
}
@VisibleForTesting
static double decode(long value) {
- return (double)value / 4096.0D;
+ return (double)value / 4096.0D; // Paper - diff on change
+ return (double)value / 4096.0D; // Paper - Fix MC-4; diff on change
}
public Vec3 decode(long x, long y, long z) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 02b102b2d3e8e8ca9d0c95d3a44a56a88bee3b18..3a8572ded5c9bdf621a8c16123707da9ceb70d54 100644
index 180f87a67c84fc0cf3f54755da9801365d4158f8..9085eeffaa7b50e5e59a794d0323cae83248f242 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4286,6 +4286,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return;
}
// Paper end - rewrite chunk system
+ // Paper start - fix MC-4
+ // Paper start - Fix MC-4
+ if (this instanceof ItemEntity) {
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.fixEntityPositionDesync) {
+ // encode/decode from ClientboundMoveEntityPacket
@ -44,7 +44,7 @@ index 02b102b2d3e8e8ca9d0c95d3a44a56a88bee3b18..3a8572ded5c9bdf621a8c16123707da9
+ z = Mth.lfloor(z * 4096.0D) * (1 / 4096.0D);
+ }
+ }
+ // Paper end - fix MC-4
+ // Paper end - Fix MC-4
if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z);
int i = Mth.floor(x);

Datei anzeigen

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 30 Dec 2020 19:43:01 -0500
Subject: [PATCH] Additional Block Material API's
Subject: [PATCH] Additional Block Material API
Faster version for isSolid() that utilizes NMS's state for isSolid instead of the slower
process to do this in the Bukkit API

Datei anzeigen

@ -8,7 +8,7 @@ Before this patch, instant effects would be applied before the potion ItemStack
This patch makes it so that instant effects are applied after the potion ItemStack is removed, and the glass bottle is only put into the player's inventory if the player is not dead. Otherwise, the glass bottle is dropped on the ground.
diff --git a/src/main/java/net/minecraft/world/item/PotionItem.java b/src/main/java/net/minecraft/world/item/PotionItem.java
index bb19a00c24e92058e05076b2ca0278dcae1890ae..d7ef159cc44787558ba41964f57a79f048371e97 100644
index bb19a00c24e92058e05076b2ca0278dcae1890ae..5c62741e3a3854a7f674bfec49758f837f3bb9a0 100644
--- a/src/main/java/net/minecraft/world/item/PotionItem.java
+++ b/src/main/java/net/minecraft/world/item/PotionItem.java
@@ -50,6 +50,7 @@ public class PotionItem extends Item {
@ -36,14 +36,14 @@ index bb19a00c24e92058e05076b2ca0278dcae1890ae..d7ef159cc44787558ba41964f57a79f0
+ for (MobEffectInstance mobeffect : instantLater) {
+ mobeffect.getEffect().applyInstantenousEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D);
+ }
+ // Paper end
+ // Paper end - Fix harming potion dupe
if (entityhuman == null || !entityhuman.getAbilities().instabuild) {
+ // Paper start - Fix harming potion dupe
+ if (user.getHealth() <= 0 && !user.level().getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_KEEPINVENTORY)) {
+ user.spawnAtLocation(new ItemStack(Items.GLASS_BOTTLE), 0);
+ return ItemStack.EMPTY;
+ }
+ // Paper end
+ // Paper end - Fix harming potion dupe
if (stack.isEmpty()) {
return new ItemStack(Items.GLASS_BOTTLE);
}

Datei anzeigen

@ -11,10 +11,10 @@ Subject: [PATCH] Fix interact event not being called sometimes
Co-authored-by: Moulberry <james.jenour@protonmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 3683e3b56da96e5528d63319892b5ec76075d86c..046ee4ce24248d1b24ee4e731324f6d1d600da7e 100644
index a3715ab0d5f7ae33ba64e69b391e12a00b2e59e9..54ca7e759897c054127e8532b9df62dca33b8e9d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1765,7 +1765,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1760,7 +1760,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
MutableComponent ichatmutablecomponent = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED);
this.player.sendSystemMessage(ichatmutablecomponent, true);
@ -23,7 +23,7 @@ index 3683e3b56da96e5528d63319892b5ec76075d86c..046ee4ce24248d1b24ee4e731324f6d1
this.player.swing(enumhand, true);
}
}
@@ -2311,13 +2311,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2306,13 +2306,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
double d3 = this.player.gameMode.getGameModeForPlayer() == GameType.CREATIVE ? 5.0D : 4.5D;
// SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
// SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add ServerResourcesReloadedEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c0546f796cac661684e3fe394d93f1a7d2a55a74..8d3b3524a939d483aa4d451a8ca0fed3a9c87d26 100644
index 7d08e0750db1653685d31f1595593943c65770a1..7dfc7a01f2604cb9a5e305a689ecfdeea35f7a31 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2094,7 +2094,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -25,7 +25,7 @@ index c0546f796cac661684e3fe394d93f1a7d2a55a74..8d3b3524a939d483aa4d451a8ca0fed3
@@ -2135,6 +2141,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
org.bukkit.craftbukkit.block.data.CraftBlockData.reloadCache(); // Paper - cache block data strings, they can be defined by datapacks so refresh it here
org.bukkit.craftbukkit.block.data.CraftBlockData.reloadCache(); // Paper - cache block data strings; they can be defined by datapacks so refresh it here
+ new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper - Add ServerResourcesReloadedEvent; fire after everything has been reloaded
}, this);

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 48815e94a0eacbdd03ea8630ae4a53f1a4747520..49914e966296b23736ecf5efc2dbaa0e1fefa091 100644
index 54ca7e759897c054127e8532b9df62dca33b8e9d..07d15cceaf03b297356ea5fea80b81491de9c6f0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1757,7 +1757,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1752,7 +1752,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
int i = this.player.level().getMaxBuildHeight();
if (blockposition.getY() < i) {

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 06f6f39e8ac9f2ebc05d63c3c34eb2b1bdb6aa1d..24c4a0dd076b1c4c9eac2dfece0581fc796c53a6 100644
index 07d15cceaf03b297356ea5fea80b81491de9c6f0..77aa411f79eb6617a7d53068d82533f3109ed903 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1190,7 +1190,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1187,7 +1187,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
itemstack.addTagElement("pages", nbttaglist);

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 24c4a0dd076b1c4c9eac2dfece0581fc796c53a6..91e1a5fb981dd8468bb13098424b54da1c90a998 100644
index 77aa411f79eb6617a7d53068d82533f3109ed903..d5e002dd0d17f3c5087ace3440d5bf348cd40d5a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1926,6 +1926,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1921,6 +1921,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

@ -6,10 +6,10 @@ Subject: [PATCH] Expand PlayerRespawnEvent, fix passed parameter issues
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d58d0748e218349fca1927263ad986ca824d4bda..8a6d9ae5b0735884a39fa2ded6f1d94909043eb7 100644
index d5e002dd0d17f3c5087ace3440d5bf348cd40d5a..ba02b3004de6efe2d1f69cda0ba759c9f0192767 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2644,7 +2644,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2639,7 +2639,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;
@ -19,7 +19,7 @@ index d58d0748e218349fca1927263ad986ca824d4bda..8a6d9ae5b0735884a39fa2ded6f1d949
} 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 5c63a7719b2a4a4bb2c64d460b007d2976cbdbf9..a622d91ecdea6ab4deaf0ef4ae90cba71c49b319 100644
index abfa9d1a12caca37b4af203887689bd9c43a7d0f..a0f1d9ca16551adef2cacb16576b91810eefa292 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -781,6 +781,12 @@ public abstract class PlayerList {

Datei anzeigen

@ -45,7 +45,7 @@ index aee8618e27b893b72931e925724dd683d2e6d2aa..f7c9127346261d83413ca03a1cdaa849
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 33477a639304c1491b5eea8585051e266ec93bc7..ce9555b3ccb3c3caa85e549e05e471230ee27680 100644
index 300bae3e97bf5bc0c2340a8e360312e77b7f4c6f..4f8239829565568c1381e2f1ebc1d633cb301ac6 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1989,8 +1989,16 @@ public class ServerPlayer extends Player {
@ -94,7 +94,7 @@ index 33477a639304c1491b5eea8585051e266ec93bc7..ce9555b3ccb3c3caa85e549e05e47123
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index c61754976fab6654f55b1403d769eb1721871dca..2e80e2d80bc2ec981e47a42b9c30257898afa4ad 100644
index 49d29e4b3395d2ebea1ed13338f26c7cfbaa5f72..45f7270fb15aa091772aa921d1e7d82e2547b358 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 c61754976fab6654f55b1403d769eb1721871dca..2e80e2d80bc2ec981e47a42b9c302578
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8a6d9ae5b0735884a39fa2ded6f1d94909043eb7..f6f57a349fc7385a88299526f563df6e022f1feb 100644
index ba02b3004de6efe2d1f69cda0ba759c9f0192767..6a32c25dbef4d8d8b9db96a69ac8c6baf1d640a6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2653,7 +2653,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2648,7 +2648,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
if (this.server.isHardcore()) {
@ -144,7 +144,7 @@ index 8a6d9ae5b0735884a39fa2ded6f1d94909043eb7..f6f57a349fc7385a88299526f563df6e
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 8a924ae677a93a177651aa1ec0728e3b8d5528a6..b7abab7eaa4f7401396a27fee79bf6367c3d4cc8 100644
index 298380e217f41f01d0818767a6d8f1da5a004037..b602c6dfece70580971baedd638e465e8e25bd02 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1559,7 +1559,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

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 f6f57a349fc7385a88299526f563df6e022f1feb..886b47805a1abdabcd05e8463620c1e211b9ece1 100644
index 6a32c25dbef4d8d8b9db96a69ac8c6baf1d640a6..a16cd74540eca9aed47afe53af518335fcf92f33 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1743,6 +1743,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1738,6 +1738,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (itemstack.isItemEnabled(worldserver.enabledFeatures())) {
BlockHitResult movingobjectpositionblock = packet.getHitResult();
Vec3 vec3d = movingobjectpositionblock.getLocation();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add Unix domain socket support
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index e30efd5b0715ac777b9284ba441358bc4b7a5d03..3389fca10dac966b8ec61e5bb3ef3f78c3d1dc7f 100644
index c89430f2274473be72ebaf2243517092f8b93899..373b39ffefd57d0e737705c748ef13e450446405 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
@ -87,10 +87,10 @@ index 4414b12218a5693fecaa8c1e7c7676a58bcad324..c0ae3ccf4ddf14a4967c86548ec7305c
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 886b47805a1abdabcd05e8463620c1e211b9ece1..364c010be9cc32efa05f58e9a4cdd9acd8a23200 100644
index a16cd74540eca9aed47afe53af518335fcf92f33..8b45e0fa29cd4bfb31e3d19df876da38567899f6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2476,6 +2476,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2471,6 +2471,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot Start
public SocketAddress getRawAddress()
{

Datei anzeigen

@ -48,7 +48,7 @@ index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92
public boolean shouldDisconnect() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7bfd8307555a9447d4c546a8945341806041cc32..970dafebf8143ab6de44bfffdeff2475685f99fa 100644
index 6f51ff7e3486049ee6f5186bfe54078d13eae805..eeead619212e475007557a2826e69e45b441bf14 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2236,7 +2236,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -100,7 +100,7 @@ index b9560b4ae5c0867396006119c5dadd7f3b47f78b..f3e32da770f379d46c65a0ba5a100b5f
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 0616a8e89931680602da2dbc640906708aebd5ca..70458ff8c9bf6f3263868b0f5570840fe3d89ed2 100644
index 98751a16f1dc372e2f517d48e8a7584b0370e65e..761dd36bcf0318e28613d852f95566879d835912 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
@ -209,7 +209,7 @@ index 0616a8e89931680602da2dbc640906708aebd5ca..70458ff8c9bf6f3263868b0f5570840f
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 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea492ee1dd 100644
index 8b45e0fa29cd4bfb31e3d19df876da38567899f6..29f1a054c31d00fe7ba4c5d171c47efa9275f32d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -342,7 +342,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -248,7 +248,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
} else {
Entity entity = this.player.getRootVehicle();
@@ -667,7 +667,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -664,7 +664,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) {
@ -257,7 +257,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
return;
}
@@ -725,7 +725,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -722,7 +722,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
@ -266,7 +266,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
return;
}
// Paper start
@@ -884,7 +884,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -881,7 +881,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());
@ -275,7 +275,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
return;
}
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
@@ -1069,7 +1069,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1066,7 +1066,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!");
@ -284,7 +284,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
return;
}
byteTotal += byteLength;
@@ -1092,14 +1092,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1089,14 +1089,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());
@ -301,7 +301,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
return;
}
this.lastBookTick = MinecraftServer.currentTick;
@@ -1243,7 +1243,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1240,7 +1240,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))) {
@ -310,7 +310,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
} else {
ServerLevel worldserver = this.player.serverLevel();
@@ -1665,7 +1665,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1660,7 +1660,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.dropCount++;
if (this.dropCount >= 20) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
@ -319,7 +319,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
return;
}
}
@@ -1948,7 +1948,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1943,7 +1943,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.resetLastActionTime();
} else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -328,7 +328,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
}
}
@@ -1961,7 +1961,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1956,7 +1956,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
// CraftBukkit end
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) {
@ -337,7 +337,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.lastSeenMessages());
@@ -1993,7 +1993,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1988,7 +1988,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleChatCommand(ServerboundChatCommandPacket packet) {
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) {
@ -346,7 +346,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.lastSeenMessages());
@@ -2049,7 +2049,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2044,7 +2044,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to update secure chat state for {}: '{}'", this.player.getGameProfile().getName(), exception.getComponent().getString());
if (exception.shouldDisconnect()) {
@ -355,7 +355,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
} else {
this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED));
}
@@ -2097,7 +2097,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2092,7 +2092,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (optional.isEmpty()) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -364,7 +364,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
}
return optional;
@@ -2283,7 +2283,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2278,7 +2278,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// this.chatSpamTickCount += 20;
if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
// CraftBukkit end
@ -373,7 +373,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
}
}
@@ -2295,7 +2295,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2290,7 +2290,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());
@ -382,7 +382,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
}
}
@@ -2448,7 +2448,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2443,7 +2443,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
if (i > 4096) {
@ -391,7 +391,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
}
}
@@ -2505,7 +2505,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2500,7 +2500,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot Start
if ( entity == this.player && !this.player.isSpectator() )
{
@ -400,7 +400,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
return;
}
// Spigot End
@@ -2604,7 +2604,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2599,7 +2599,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// CraftBukkit end
}
} else {
@ -409,8 +409,8 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
}
@@ -3013,7 +3013,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start
@@ -3008,7 +3008,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start - auto recipe limit
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) {
- this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper
@ -418,7 +418,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
return;
}
}
@@ -3248,7 +3248,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3243,7 +3243,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) {
if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) {
@ -427,7 +427,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
} else {
try {
SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator();
@@ -3261,7 +3261,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3256,7 +3256,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());
@ -437,7 +437,7 @@ index 364c010be9cc32efa05f58e9a4cdd9acd8a23200..4f7dea59cd4aed5a9acb6be5fbbbc9ea
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index a622d91ecdea6ab4deaf0ef4ae90cba71c49b319..f3f8c7b7391370455fe913206a1bc9b80bdaadf8 100644
index a0f1d9ca16551adef2cacb16576b91810eefa292..3e88b648cf4fcc19598fb50ca5651af1a52a0a84 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -684,7 +684,7 @@ public abstract class PlayerList {
@ -491,7 +491,7 @@ index 6724d0a1af13e97bc1d3bd94fd43fef742a0deab..20ba0a0c9eae28658888a77dd2170f62
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b7abab7eaa4f7401396a27fee79bf6367c3d4cc8..f1b52cccb8bb82def47c6dee8a63d51a095c112b 100644
index b602c6dfece70580971baedd638e465e8e25bd02..c1e35f2a37b7078e484669d4bbb411df118e6d34 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -591,7 +591,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4f7dea59cd4aed5a9acb6be5fbbbc9ea492ee1dd..b502b3bf5f4f0a820b75434e8f620b3df01e18e2 100644
index 29f1a054c31d00fe7ba4c5d171c47efa9275f32d..60be2ae945514aaec70a2350df2044df53ed3224 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1099,7 +1099,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1096,7 +1096,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper end
// CraftBukkit start
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerArmSwingEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7e4868e776c95820385d31aaccb9b821f9d62403..bf93470be313017c125e58fdb24a0d6a14e2bb33 100644
index 60be2ae945514aaec70a2350df2044df53ed3224..c477c6c47d6b707fcee671152bfb516eeea2cebd 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2333,7 +2333,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2328,7 +2328,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} // Paper end - Call interact event
// Arm swing animation

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Fix kick event leave message not being sent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 592f8a1277cba26bf07623782bf85110e959be8c..c9842d0641b43c10b857ccc89f90b167150f359d 100644
index eabab52143ff490c4ec646628a9dc96cf15efb72..d848119476e5ba254ce86873f1d997d0fe3da876 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -273,7 +273,6 @@ public class ServerPlayer extends Player {
@ -17,7 +17,7 @@ index 592f8a1277cba26bf07623782bf85110e959be8c..c9842d0641b43c10b857ccc89f90b167
public boolean isRealPlayer; // Paper
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 70458ff8c9bf6f3263868b0f5570840fe3d89ed2..134a84841a1e05b212794c00477f20eb30e53ec5 100644
index 761dd36bcf0318e28613d852f95566879d835912..5d0500ee2740977c6b6eb89ed51e29b5a2e66760 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -77,6 +77,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@ -50,10 +50,10 @@ index 70458ff8c9bf6f3263868b0f5570840fe3d89ed2..134a84841a1e05b212794c00477f20eb
MinecraftServer minecraftserver = this.server;
Connection networkmanager = this.connection;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 17cf920cc7bbd662a08b075466b8c534f0493802..d3d1195522e50b00663b274f68fae1cc5ed9d021 100644
index c477c6c47d6b707fcee671152bfb516eeea2cebd..8fb479bcf55f71857404d9b34eef6cd26cf0babf 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1887,6 +1887,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1882,6 +1882,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void onDisconnect(Component reason) {
@ -66,7 +66,7 @@ index 17cf920cc7bbd662a08b075466b8c534f0493802..d3d1195522e50b00663b274f68fae1cc
// CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) {
return;
@@ -1895,11 +1901,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1890,11 +1896,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
// CraftBukkit end
ServerGamePacketListenerImpl.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), reason.getString());
@ -86,7 +86,7 @@ index 17cf920cc7bbd662a08b075466b8c534f0493802..d3d1195522e50b00663b274f68fae1cc
this.chatMessageChain.close();
// CraftBukkit start - Replace vanilla quit message handling with our own.
/*
@@ -1909,7 +1921,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1904,7 +1916,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.disconnect();
// Paper start - Adventure
@ -96,7 +96,7 @@ index 17cf920cc7bbd662a08b075466b8c534f0493802..d3d1195522e50b00663b274f68fae1cc
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
// Paper end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f3f8c7b7391370455fe913206a1bc9b80bdaadf8..2a1b64e5d30cde7b2b2696a6cf5f3163071ab2d6 100644
index 3e88b648cf4fcc19598fb50ca5651af1a52a0a84..60e60166485bc87a5ff9919f9c1603dc4eaeecc9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -570,6 +570,11 @@ public abstract class PlayerList {
@ -111,12 +111,3 @@ index f3f8c7b7391370455fe913206a1bc9b80bdaadf8..2a1b64e5d30cde7b2b2696a6cf5f3163
ServerLevel worldserver = entityplayer.serverLevel();
entityplayer.awardStat(Stats.LEAVE_GAME);
@@ -580,7 +585,7 @@ public abstract class PlayerList {
entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper
}
- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName())), entityplayer.quitReason); // Paper - Adventure & quit reason
+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), leaveMessage, entityplayer.quitReason); // Paper - Adventure & quit reason
this.cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());

Datei anzeigen

@ -17,10 +17,10 @@ Async catch modifications to critical entity state
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a1cb119e52005e09138930f5a07f919015402424..2168a16bd954f07de004d9b98ea1dbfecf1f23ae 100644
index 09ce054d260bd7143eb9d58611144de2666166f3..5bc6b7298c253bd2ee1d5a16b8f237c824f8719a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1575,6 +1575,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1570,6 +1570,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) { // Paper
@ -29,7 +29,7 @@ index a1cb119e52005e09138930f5a07f919015402424..2168a16bd954f07de004d9b98ea1dbfe
if (player.isRemoved()) {
LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName());
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 394af8382455d2a039534b87142679f52dc8f2a6..b49ae2a36a426deb5ce393d854df762c5a256fbd 100644
index 0292ca014fd8319fe9f5e7a1465ee5c112ef6515..4516b12d1856653c0a28f8edfc28d4644316f763 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1118,7 +1118,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -166,7 +166,7 @@ index bbbf6dd8e566ecdca8794e3b03765fe7e426a2bd..66ab901956ca394c251c420338643d39
PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", new Object[]{this.entity, SectionPos.of(this.currentSectionKey), reason});
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index ca0af0011159834919c8e071ceac051a0e600b84..305a525815d7a3ea3f5dd3c093a76af0252c2f7e 100644
index 40ca827fed0e69c50ad8857ec29cfa99570b1d07..e3faafc565c180467c235aa1695e80b746c03cf1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1803,6 +1803,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -202,7 +202,7 @@ index ca0af0011159834919c8e071ceac051a0e600b84..305a525815d7a3ea3f5dd3c093a76af0
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(new ResourceLocation(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index bd5e80a04a035f670160a5eef94805ab90372cf6..3e79a73e42875936e373f797dcde6a60a904a880 100644
index 711f4ca8ee42a14e40af86d93a9685b4b9a2ba99..269664d3894835e5bafc39e65ee5245ae1d74d78 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -463,6 +463,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] Detail more information in watchdog dumps
- Dump player name, player uuid, position, and world for packet handling
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 634b20f73d51141cb36115d2a0dda4c6d10cf266..f4807a005442111909fa0a1cffa2decb85667a63 100644
index c48316527013dce0d572524c28b2f5d135e82c71..db18b41e300cb48b3bede8670295aa76e89069ad 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -521,7 +521,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -76,7 +76,7 @@ index 7de24c39b460e43d27839b3821e67213508ece81..7297bca9224c12d7ace0e1967340d994
});
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index bff754626913969c6946757cee968c02281f59b3..b4711272fb36b631d4426ee5b5e29fb6f11e3d1d 100644
index e61a5e2b1ba1f8f54aac14bb61efb8c5ffca2bf9..bf88a776a600a63ddcc079aa981c5838c995521a 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1244,7 +1244,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -122,7 +122,7 @@ index bff754626913969c6946757cee968c02281f59b3..b4711272fb36b631d4426ee5b5e29fb6
private void tickPassenger(Entity vehicle, Entity passenger) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 82db53692f3fc38625d63f9371f2d842159c454c..873ae06dc0b5de6cc69e2e8a24a882ca90ee8663 100644
index 563c26b7f25f51ae8f256d516b2085ccedac7bcd..d84d696146214f5075bb13a484c4535149faa72f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1031,7 +1031,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -194,7 +194,7 @@ index 82db53692f3fc38625d63f9371f2d842159c454c..873ae06dc0b5de6cc69e2e8a24a882ca
public void addDeltaMovement(Vec3 velocity) {
@@ -4375,7 +4419,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
// Paper end - fix MC-4
// Paper end - Fix MC-4
if (this.position.x != x || this.position.y != y || this.position.z != z) {
+ synchronized (this.posLock) { // Paper
this.position = new Vec3(x, y, z);

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2168a16bd954f07de004d9b98ea1dbfecf1f23ae..c067bbd0f333c0604554c6314cc19d4a121b7e27 100644
index 5bc6b7298c253bd2ee1d5a16b8f237c824f8719a..f93d3a933fb980c3fdc1f136c79807ce8517a235 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -736,6 +736,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -733,6 +733,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
// Paper end
// CraftBukkit end

Datei anzeigen

@ -18,10 +18,10 @@ index 945a0317e9e49a159a1f42882a0a267a2141e86d..e9fd9590e90e58fd4c31985a704a4511
}
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c067bbd0f333c0604554c6314cc19d4a121b7e27..c44c07776006cd447946a53f2a1aca17e6067986 100644
index f93d3a933fb980c3fdc1f136c79807ce8517a235..643b98097bf77c55961cf1722faad6fb63504abd 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2566,8 +2566,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2561,8 +2561,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Refresh the current entity metadata
entity.getEntityData().refresh(ServerGamePacketListenerImpl.this.player);
// SPIGOT-7136 - Allays
@ -33,7 +33,7 @@ index c067bbd0f333c0604554c6314cc19d4a121b7e27..c44c07776006cd447946a53f2a1aca17
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index de1e496c2cb75932dee84eb2b7532ad48340c504..d3a1fcd144f513d20fbc9a5688a45fa750f512ae 100644
index e7d72a7495d07c793ce3f5110d476f1cc3ed4469..551100c72bd20d7ff224acf3750fe3dc9d73a483 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3190,7 +3190,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -8,10 +8,10 @@ Move collision logic to just the hasNewCollision call instead of getCubes + hasN
CHECK ME
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c44c07776006cd447946a53f2a1aca17e6067986..af43b1cf239a319f765058ff082485764528e01e 100644
index 643b98097bf77c55961cf1722faad6fb63504abd..ffe050bed7096b147b327f3adb7d1d0d699bce7a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -543,7 +543,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -540,7 +540,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return;
}
@ -20,7 +20,7 @@ index c44c07776006cd447946a53f2a1aca17e6067986..af43b1cf239a319f765058ff08248576
d6 = d3 - this.vehicleLastGoodX; // Paper - diff on change, used for checking large move vectors above
d7 = d4 - this.vehicleLastGoodY - 1.0E-6D; // Paper - diff on change, used for checking large move vectors above
@@ -559,6 +559,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -556,6 +556,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8));
@ -28,7 +28,7 @@ index c44c07776006cd447946a53f2a1aca17e6067986..af43b1cf239a319f765058ff08248576
double d11 = d7;
d6 = d3 - entity.getX();
@@ -572,15 +573,23 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -569,15 +570,23 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
boolean flag2 = false;
if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
@ -55,7 +55,7 @@ index c44c07776006cd447946a53f2a1aca17e6067986..af43b1cf239a319f765058ff08248576
entity.absMoveTo(d0, d1, d2, f, f1);
this.player.absMoveTo(d0, d1, d2, this.player.getYRot(), this.player.getXRot()); // CraftBukkit
this.send(new ClientboundMoveVehiclePacket(entity));
@@ -659,7 +668,32 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -656,7 +665,32 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
private boolean noBlocksAround(Entity entity) {
@ -89,7 +89,7 @@ index c44c07776006cd447946a53f2a1aca17e6067986..af43b1cf239a319f765058ff08248576
}
@Override
@@ -1258,7 +1292,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1255,7 +1289,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
if (this.awaitingPositionFromClient != null) {
@ -98,7 +98,7 @@ index c44c07776006cd447946a53f2a1aca17e6067986..af43b1cf239a319f765058ff08248576
this.awaitingTeleportTime = this.tickCount;
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
}
@@ -1354,7 +1388,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1349,7 +1383,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
}
@ -107,7 +107,7 @@ index c44c07776006cd447946a53f2a1aca17e6067986..af43b1cf239a319f765058ff08248576
d6 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above
d7 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above
@@ -1396,6 +1430,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1391,6 +1425,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.move(MoverType.PLAYER, new Vec3(d6, d7, d8));
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move
@ -115,7 +115,7 @@ index c44c07776006cd447946a53f2a1aca17e6067986..af43b1cf239a319f765058ff08248576
// Paper start - prevent position desync
if (this.awaitingPositionFromClient != null) {
return; // ... thanks Mojang for letting move calls teleport across dimensions.
@@ -1414,11 +1449,23 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1409,11 +1444,23 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
boolean flag2 = false;
if (!this.player.isChangingDimension() && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot
@ -141,7 +141,7 @@ index c44c07776006cd447946a53f2a1aca17e6067986..af43b1cf239a319f765058ff08248576
this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packet.isOnGround());
} else {
@@ -1509,6 +1556,33 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1504,6 +1551,33 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity copies loading chunks
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index fb8b6fa69bf516bbaf50541e742e5375fc8c00ff..5e0466b0522ea325b2c37e3d4c80f3d61c1816fe 100644
index 55f4dcaa58142f8710b54505d42f7f3e74bb7ce1..cae9c718ddd7b1f1978fe00d8adfbb5edef64ded 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3197,7 +3197,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3192,7 +3192,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
if (this.player.level().isLoaded(blockposition)) {

Datei anzeigen

@ -18,10 +18,10 @@ index 3fb0d020493db8e5bde9f6fc76637c74b80fd791..0f562a8e0c5d4b2907174c9409977570
if (dedicatedserverproperties.enableQuery) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7eba2244e1e92dec7b81dea44b05d5e59887d242..2301445fb77cb8777632d81b60cbc04a42d86533 100644
index cae9c718ddd7b1f1978fe00d8adfbb5edef64ded..4500a638c48c224dc38e0cfbc2f04e8bea0277ed 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2761,7 +2761,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2756,7 +2756,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
if (this.server.isHardcore()) {
this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - Expand PlayerGameModeChangeEvent

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Do not accept invalid client settings
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5433681fc3765d744193556217169995fbbb3c7d..97f95c0732aef7dd9d125f183994373414584432 100644
index 4500a638c48c224dc38e0cfbc2f04e8bea0277ed..2a603cd36fc98d9c80a6c7d9ea2be51cde369297 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3321,6 +3321,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3316,6 +3316,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix Spigot Config not using commands.spam-exclusions
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 97f95c0732aef7dd9d125f183994373414584432..4f26336ce8c9a6ca245b95a0014b8190b54466fe 100644
index 2a603cd36fc98d9c80a6c7d9ea2be51cde369297..7342cc06b5b88f7dce5cd499a5aecd057463ec8f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2378,7 +2378,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2373,7 +2373,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
// Spigot end
// this.chatSpamTickCount += 20;

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] More Teleport API
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4f26336ce8c9a6ca245b95a0014b8190b54466fe..aa37c08c4ede225439f4c52ac7787b757461f3e1 100644
index 7342cc06b5b88f7dce5cd499a5aecd057463ec8f..e610c0209c65a7f8c645f3a626c662a78bd7382c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1637,11 +1637,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1632,11 +1632,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return false; // CraftBukkit - Return event status
}
@ -29,7 +29,7 @@ index 4f26336ce8c9a6ca245b95a0014b8190b54466fe..aa37c08c4ede225439f4c52ac7787b75
d0 = to.getX();
d1 = to.getY();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 1879ec9e275194cb83f30ec47930a3814fbe1da3..027fa02e855e14b1554ddd141d0a937a64ec99e0 100644
index b7df71633527dce2e4f954caee249e3b31b82226..ee1dc74b2f48bf8d684562de895ab631cf792a30 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -218,15 +218,36 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@ -72,7 +72,7 @@ index 1879ec9e275194cb83f30ec47930a3814fbe1da3..027fa02e855e14b1554ddd141d0a937a
// Let the server handle cross world teleports
if (location.getWorld() != null && !location.getWorld().equals(this.getWorld())) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 4a900f3026d9fffbf528c944871b8763f9807352..8850e7af1bc3668a7bec95ffc8c25053cfb07f21 100644
index 1d43b01c96f00cb08c6e72d2f9496f2300da6634..0de707a3400d42249b49e8f1899879d7e361b2a8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1207,13 +1207,101 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -7,7 +7,7 @@ Minecraft's prediction system does not handle block entities, so if we are manua
block breaking we need to set it after the prediction is finished. This fixes block entities not showing when cancelling the BlockBreakEvent.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 3574fe0ce7c161a13a78b66ab881463def8cc461..c14ab35c4336c025c242e8a350ac4b8d1b1d5c78 100644
index 313c989a0148bbcbeb756f88c0480887ef91a5be..4b0c44dff5c532a5ed7304bf4438aec2d7959fdb 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -62,6 +62,8 @@ public class ServerPlayerGameMode {
@ -57,10 +57,10 @@ index 3574fe0ce7c161a13a78b66ab881463def8cc461..c14ab35c4336c025c242e8a350ac4b8d
}
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index aa37c08c4ede225439f4c52ac7787b757461f3e1..ff7a6977166892421e3ae8348aa15a847ebde30e 100644
index e610c0209c65a7f8c645f3a626c662a78bd7382c..1db6455f72ce9b91b04d0b5ba76d0a1d29b98110 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1783,8 +1783,28 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1778,8 +1778,28 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return;
}
// Paper end - Don't allow digging in unloaded chunks

Datei anzeigen

@ -85,10 +85,10 @@ index d088479d160dbd2fc90b48a30553be141db8eef2..ccb7d92b6c36b6225a2e640f8cea6c0d
public static class DataItem<T> {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ff7a6977166892421e3ae8348aa15a847ebde30e..3af7160fc36b6f706e9448f584c19b8859919cea 100644
index 1db6455f72ce9b91b04d0b5ba76d0a1d29b98110..3d7dd28e73c3d4419766ad37b9c494b3ce2e2d21 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2658,7 +2658,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2653,7 +2653,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) {
@ -98,7 +98,7 @@ index ff7a6977166892421e3ae8348aa15a847ebde30e..3af7160fc36b6f706e9448f584c19b88
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index cd0f6f3c1cf2a4004e238d0e23104209d6384c4e..824bd2bf2ad24001b7f3aa3d8f5a78f36b0baef4 100644
index 12a3aa585ca60b47107da85d88b3a7d502a0ae9f..66296aa930a1afe3c3d89afe69d5619e5ed146bc 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -376,7 +376,7 @@ public abstract class PlayerList {
@ -125,7 +125,7 @@ index 37596c7b65f280be00e8e59ae18bd1aceae21080..eca18540aeb0b0d4098477d73b14c78a
}
entity.playSound(((Bucketable) entity).getPickupSound(), 1.0F, 1.0F);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 763462e4cf8abdd654b582150fab09f05e64f990..7cda23cf7400edcfa1436f6457edd7566cd42323 100644
index dab7108644aefe69448b5e361099d97354c8db1a..49e5a9fa95ebf4568eb875953f3032b8a7142080 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -947,7 +947,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

Datei anzeigen

@ -40,10 +40,10 @@ index 536f0c496ce36ca3248fc6eeac9bbd77214a36f9..31718823250a1490b783f426fff65bf5
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 3af7160fc36b6f706e9448f584c19b8859919cea..8ccfa8b68b1f43da0a4730d3b09e100bf846ef73 100644
index 3d7dd28e73c3d4419766ad37b9c494b3ce2e2d21..332464e238ea49544f28306c1a4a8ed3f8381761 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3395,7 +3395,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3390,7 +3390,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add missing SpigotConfig logCommands check
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8ccfa8b68b1f43da0a4730d3b09e100bf846ef73..21331fb6f71aeb80504f516271c5eb99dd94727a 100644
index 332464e238ea49544f28306c1a4a8ed3f8381761..0a70260f8d01ebbf6d35f852461a1d7710bb4b1b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2139,7 +2139,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2134,7 +2134,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void performChatCommand(ServerboundChatCommandPacket packet, LastSeenMessages lastSeenMessages) {
// CraftBukkit start
String command = "/" + packet.command();

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Use single player info update packet on join
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 21331fb6f71aeb80504f516271c5eb99dd94727a..2d67f8126850bf3efe91cd6a7c6180776b8e83fc 100644
index 0a70260f8d01ebbf6d35f852461a1d7710bb4b1b..8bcd8a7fa65e05ccef0a205319cad9e84b4341b5 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3425,7 +3425,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3420,7 +3420,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID());
this.chatMessageChain.append(() -> {
this.player.setChatSession(session);
@ -18,7 +18,7 @@ index 21331fb6f71aeb80504f516271c5eb99dd94727a..2d67f8126850bf3efe91cd6a7c618077
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 824bd2bf2ad24001b7f3aa3d8f5a78f36b0baef4..0e3f2b10a3edf129263783c68c4b25c1f7dfb8f1 100644
index 66296aa930a1afe3c3d89afe69d5619e5ed146bc..79e2fbad2c03d6187671a073553a573022aeb060 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -358,6 +358,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Treat sequence violations like they should be
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2d67f8126850bf3efe91cd6a7c6180776b8e83fc..73494f622e86bb6141f49e6d73aca1a0c1a78d21 100644
index 8bcd8a7fa65e05ccef0a205319cad9e84b4341b5..166dbfb6a06ac69774ecfe2e8c0b0c6f22a44d19 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2043,6 +2043,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2038,6 +2038,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void ackBlockChangesUpTo(int sequence) {
if (sequence < 0) {

Datei anzeigen

@ -24,7 +24,7 @@ index 0e54e8faa48751a651b953bec72543a94edf74bc..d43106eb89b14667e85cd6e8fa047d64
UPDATE_GAME_MODE((serialized, buf) -> {
serialized.gameMode = GameType.byId(buf.readVarInt());
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 73494f622e86bb6141f49e6d73aca1a0c1a78d21..a6870c5f386905a4a2f4b884683aff7640649a50 100644
index 166dbfb6a06ac69774ecfe2e8c0b0c6f22a44d19..253d37d7e8677e438d8463eee557682aade86a1e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -287,6 +287,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -49,7 +49,7 @@ index 73494f622e86bb6141f49e6d73aca1a0c1a78d21..a6870c5f386905a4a2f4b884683aff76
}
public void resetPosition() {
@@ -3423,6 +3431,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3418,6 +3426,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void resetPlayerChatState(RemoteChatSession session) {
this.chatSession = session;

Datei anzeigen

@ -10,7 +10,7 @@ The underlying issue of this is that the client modifies their synced data value
them in order for the client to reset their using item state.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 6c415090035fdbba6e0e3533aa2f1c3b401ab9ff..41c647c46585d454f3b10a860a2b6d979d1199a3 100644
index d0210fb4347cce1010499b9e2f7986e55ee9022c..4fdcff0ab2fb83cebbd05b00f5d6ed287cfc58ac 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -557,6 +557,7 @@ public class ServerPlayerGameMode {
@ -34,10 +34,10 @@ index 6c415090035fdbba6e0e3533aa2f1c3b401ab9ff..41c647c46585d454f3b10a860a2b6d97
return enuminteractionresult;
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a6870c5f386905a4a2f4b884683aff7640649a50..ead7c202ba8ed11ee180767f3acaa003f60c2b28 100644
index 253d37d7e8677e438d8463eee557682aade86a1e..5d1a1b2abc62f15251d954e90e8e51dac184e8dd 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1955,6 +1955,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1950,6 +1950,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
if (cancelled) {
@ -46,7 +46,7 @@ index a6870c5f386905a4a2f4b884683aff7640649a50..ead7c202ba8ed11ee180767f3acaa003
return;
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 202819877d5920e8d0429a8c1bf06af4b9af950f..e9839d0dc8339ce62a6eb01c7094a2a3cf0fa816 100644
index 75ab201ecd32b1ff2cf84466ff6a2a2029134ca2..ec37b97abd1d47331b31fc9f6637ac59ee3e7f97 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3814,6 +3814,11 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -7,11 +7,11 @@ For larger ranges, it's better to iterate over the player list
than the entity slices.
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 c7b0590b742a57d524de41151fc08fc596097d9c..6efd46c2c5a83a3e4f5ab8fee4519476de3459c0 100644
index 720d798e9eb38aa97f39c5aa8c3c03671d72bdad..2250d77b0ec5ea77e3b757e03b62b26ced89a02f 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
@@ -329,7 +329,22 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
double d0 = blockEntity != null ? blockEntity.getEffectRange() : (i * 10 + 10);// Paper - custom beacon ranges
double d0 = blockEntity != null ? blockEntity.getEffectRange() : (i * 10 + 10);// Paper - Custom beacon ranges
AABB axisalignedbb = (new AABB(blockposition)).inflate(d0).expandTowards(0.0D, (double) world.getHeight(), 0.0D);
- List<Player> list = world.getEntitiesOfClass(Player.class, axisalignedbb);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerFailMoveEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ead7c202ba8ed11ee180767f3acaa003f60c2b28..4453c4238182bdee6a955a51bc219a4d8a92e3f2 100644
index 5d1a1b2abc62f15251d954e90e8e51dac184e8dd..894eec92eaa993c0cb5335f780195e204a64ef2d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1316,8 +1316,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1313,8 +1313,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX())); final double toX = d0; // Paper - OBFHELPER
double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY())); final double toY = d1;
double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ())); final double toZ = d2; // Paper - OBFHELPER
@ -19,7 +19,7 @@ index ead7c202ba8ed11ee180767f3acaa003f60c2b28..4453c4238182bdee6a955a51bc219a4d
if (this.player.isPassenger()) {
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
@@ -1384,8 +1384,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1379,8 +1379,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
// Paper start - Prevent moving into unloaded chunks
if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) {
@ -36,7 +36,7 @@ index ead7c202ba8ed11ee180767f3acaa003f60c2b28..4453c4238182bdee6a955a51bc219a4d
}
// Paper end
@@ -1394,9 +1400,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1389,9 +1395,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
// CraftBukkit end
@ -56,7 +56,7 @@ index ead7c202ba8ed11ee180767f3acaa003f60c2b28..4453c4238182bdee6a955a51bc219a4d
}
}
}
@@ -1462,8 +1475,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1457,8 +1470,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
boolean flag2 = false;
if (!this.player.isChangingDimension() && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot
@ -72,7 +72,7 @@ index ead7c202ba8ed11ee180767f3acaa003f60c2b28..4453c4238182bdee6a955a51bc219a4d
}
// Paper start - optimise out extra getCubes
@@ -1476,6 +1496,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1471,6 +1491,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (didCollide || !axisalignedbb.equals(newBox)) {
// note: only call after setLocation, or else getBoundingBox is wrong
teleportBack = this.hasNewCollision(worldserver, this.player, axisalignedbb, newBox);
@ -88,7 +88,7 @@ index ead7c202ba8ed11ee180767f3acaa003f60c2b28..4453c4238182bdee6a955a51bc219a4d
} // else: no collision at all detected, why do we care?
}
if (!this.player.noPhysics && !this.player.isSleeping() && teleportBack) { // Paper end - optimise out extra getCubes
@@ -1569,6 +1598,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1564,6 +1593,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
}

Datei anzeigen

@ -1148,7 +1148,7 @@ index 0000000000000000000000000000000000000000..d306f911757a4d556c82c0070d4837db
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5868f13fa3a3791704ba8e344b9c51d88786f41b..2344efd039773a0b3052d6e08ba204b1efe8963c 100644
index e9ec17c4dfb44f6f562dedd20d123064492ef736..ffb87573b1c5df4e6f4d36d0331738da221e0f38 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1629,6 +1629,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -1173,7 +1173,7 @@ index 5868f13fa3a3791704ba8e344b9c51d88786f41b..2344efd039773a0b3052d6e08ba204b1
this.profiler.push("commandFunctions");
MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0e3f2b10a3edf129263783c68c4b25c1f7dfb8f1..492ffa9eae3978dd352c68952e10b3c9c1e4aaa1 100644
index 79e2fbad2c03d6187671a073553a573022aeb060..5ee35035639374185c18477c9b9ab0dc8a2fae20 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -649,6 +649,7 @@ public abstract class PlayerList {
@ -1185,7 +1185,7 @@ index 0e3f2b10a3edf129263783c68c4b25c1f7dfb8f1..492ffa9eae3978dd352c68952e10b3c9
this.players.remove(entityplayer);
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d08ce34e1d1ce4ac239f6b7ecf0579ab130fa976..c59494078ee587c8dd89e7943db85863868ae15f 100644
index d29ded9946138418af7c993fba6267e16a24c00c..037f21e5cfe1c399c708721d26b456583cd3d924 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -249,11 +249,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -1332,7 +1332,7 @@ index 5f24bab8b21452e502af70a925ceeaecbedd4a6c..78acd7d97608c4862f1d39e36785d3f3
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
ConfigurationSerialization.registerClass(CraftPlayerProfile.class);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index e7f967e8f88e6fc5bcfdc033d14bb2b65dda3e67..e20aa42c570185566577e6b72547e416ac23240d 100644
index e1a3d047743befa9fbc26e7491cb982df19b2f0c..a7ae0e0c69a4b78bcef746763a208897f7678a94 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -67,6 +67,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

Datei anzeigen

@ -11,10 +11,10 @@ This patch prevents server from sending namespaced commands when player
requests tab-complete only commands.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4453c4238182bdee6a955a51bc219a4d8a92e3f2..cf94050bc6dc4b2f0aff9bf3ca5241d9caafb0bf 100644
index 894eec92eaa993c0cb5335f780195e204a64ef2d..57e7a1d60ae3644fa33ed619e8fdb4441fc3f8ce 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -807,6 +807,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -804,6 +804,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerPickItemEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index cf94050bc6dc4b2f0aff9bf3ca5241d9caafb0bf..1abbd10f1d5c298fbc5e18e80ee8854c3f0ba187 100644
index 57e7a1d60ae3644fa33ed619e8fdb4441fc3f8ce..96d44798583ee876ca8121c381638cd741d8338c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -944,8 +944,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -941,8 +941,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
return;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add slot sanity checks in container clicks
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1abbd10f1d5c298fbc5e18e80ee8854c3f0ba187..e5d734234ae0543b0772e8a12da3f60b3a97a6cb 100644
index 96d44798583ee876ca8121c381638cd741d8338c..ba6d22426398546b70760c2205ce625cead11803 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2992,6 +2992,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2987,6 +2987,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
break;
case SWAP:
if ((packet.getButtonNum() >= 0 && packet.getButtonNum() < 9) || packet.getButtonNum() == 40) {
@ -22,7 +22,7 @@ index 1abbd10f1d5c298fbc5e18e80ee8854c3f0ba187..e5d734234ae0543b0772e8a12da3f60b
Slot clickedSlot = this.player.containerMenu.getSlot(packet.getSlotNum());
if (clickedSlot.mayPickup(this.player)) {
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 9eef711958443726249a75e6b4fac70a1714397e..fd4caf18698ad51c789a57dec58e135c5de7ca19 100644
index cdd23fb468f30bff52fdf8555b6106f13d0f5552..4183afe565a46ebc52ff520b046fef405e3b22f7 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -423,6 +423,7 @@ public abstract class AbstractContainerMenu {