Skip to content

Commit

Permalink
more more more more more more more more more more work
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahvdAa committed Sep 22, 2023
1 parent 4875ee4 commit 3aa8e7e
Show file tree
Hide file tree
Showing 32 changed files with 102 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ index e05eb08a9c229b371887676da510df948b896a85..ceeedbd88c56c08ec8b047c9ca2f14cc
Date date = new Date();

diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0a980eb63e6116f91322fd8bf94db7c5dae7b79a..6c8fc3a00109c3c64f9dc32ecdcc98e1b5d0d622 100644
index 17eaf05dbf0542f7867e92421148cf4edf47bd80..097ceaa948469f6b63362dfa00525cd0fd01d907 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1774,7 +1774,7 @@ public final class CraftServer implements Server {
@@ -1777,7 +1777,7 @@ public final class CraftServer implements Server {
// Paper end
Set<CommandSender> recipients = new HashSet<>();
for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ The previous solution caused a bunch of bandaid fixes inorder to resolve edge ca
Just simply prevent them from being added to the world instead.

diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 653c9c41ab7c5cd332565436564396d18f26c17c..06df21e55fdb70558b85fc095a04b3bb64fbe770 100644
index 0a57c11f1b9811e4fb980268bc561df4290494cf..565b5aca5854876ae640d9d93b3ae24da6e12b70 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1645,6 +1645,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1296,6 +1296,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Add Player#getFishHook


diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 3f64d57b7d92820226c323d1d560432f5c27e650..6f694f68c2792da7088c2aba1d2b201f802b3a5c 100644
index 268d0abadb1c6de78f7b2de964808ca7029970a8..beefbb0d04bd995bc8750707487183c3ffc22239 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -161,6 +161,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Add various missing EntityDropItemEvent calls


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 34f5919448a408e7f4c72299fe72d8daabe34402..f9704cefbc1a3b6546dfefd0708fa5485e0a8e72 100644
index a45f7b96fb3afc9ebe1354d9c61c4a66a67fae69..56060d5d962a1827873d3b2311f30b766c64575f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2677,6 +2677,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2559,6 +2559,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe

entityitem.setDefaultPickUpDelay();
Expand Down Expand Up @@ -37,10 +37,10 @@ index 1c4b8b29faac3dbcfc14a07b24c64650982ece00..8448c5d778998390cf2b683f36e4e18c
}
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
index 24ae11d300d0856350f185f03552ba592f3d218a..5052bcf16bb09b7bcf39566fef1378b1c4970fe6 100644
index df06cad9447982ebe57d07c9967cb68c6dd20ca3..9f24fb3ea75b9dcb41f70f6e4b0d6cd5dca57ff6 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
@@ -503,14 +503,14 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
@@ -509,14 +509,14 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
entityitem.setPickUpDelay(40);
entityitem.setThrower(this.getUUID());
this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F);
Expand All @@ -58,10 +58,10 @@ index 24ae11d300d0856350f185f03552ba592f3d218a..5052bcf16bb09b7bcf39566fef1378b1

@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
index a3a5dbaed7a7647249747154ac0c024bddd7eb13..c7b914cc0d702c6dd04add5247ec509d5870abb3 100644
index 3ec2f590dfe9410f1a9d2afb530eebfcce917798..363892e0c26bab89d2abaa44d8736e2fd84d292f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
@@ -355,8 +355,7 @@ public class Goat extends Animal {
@@ -357,8 +357,7 @@ public class Goat extends Animal {
double d2 = (double) Mth.randomBetween(this.random, -0.2F, 0.2F);
ItemEntity entityitem = new ItemEntity(this.level(), vec3d.x(), vec3d.y(), vec3d.z(), itemstack, d0, d1, d2);

Expand All @@ -72,10 +72,10 @@ index a3a5dbaed7a7647249747154ac0c024bddd7eb13..c7b914cc0d702c6dd04add5247ec509d
}

diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index c0f19138c6a00ce6ae837c972ae4af522ddd2895..3de0424a18e0a3b0cd2f755adfa859e474d5c643 100644
index 1d9913cbc7fd0c6e29278b02c38703b52af1245b..36b3945832733b5ad66d25aa3a31335234d2acff 100644
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -355,8 +355,9 @@ public class Sniffer extends Animal {
@@ -352,8 +352,9 @@ public class Sniffer extends Animal {

entityitem.setDefaultPickUpDelay();
this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob) null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Subject: [PATCH] Add some minimal debug information to chat packet errors
TODO: potentially add some kick leeway

diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5c4a4b7efff2a00d7a35d902b4e18e02d4489122..e60478b96c6dc67a16b08e418971aa3bef63c0fc 100644
index aabd4a28cef4a31e0eed34d2e7c490199203bfd5..5d62bf8a1031295ca63289ebbdc11cf0910ccb14 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2295,7 +2295,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2134,7 +2134,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl

private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
if (!this.updateChatOrder(timestamp)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 e60478b96c6dc67a16b08e418971aa3bef63c0fc..f876cd2320788570137d9f59411bf7e908e9e81b 100644
index 5d62bf8a1031295ca63289ebbdc11cf0910ccb14..4428b7310bcce3fd1471e5b89bc4eb9ec16deb4e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2515,7 +2515,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2354,7 +2354,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
// Spigot end
// this.chatSpamTickCount += 20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Subject: [PATCH] More Teleport API
public net.minecraft.server.network.ServerGamePacketListenerImpl internalTeleport(DDDFFLjava/util/Set;Z)V

diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index f876cd2320788570137d9f59411bf7e908e9e81b..13e5c0bc9e3cef3dd68f2d415649a183583eb606 100644
index 4428b7310bcce3fd1471e5b89bc4eb9ec16deb4e..57d2bffd55db5f7833121c6781984985689c4188 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1713,11 +1713,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1591,11 +1591,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return false; // CraftBukkit - Return event status
}

Expand All @@ -31,7 +31,7 @@ index f876cd2320788570137d9f59411bf7e908e9e81b..13e5c0bc9e3cef3dd68f2d415649a183
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 f61d3cd3cdbfe17f6818fbbb163f80ba3de50ca1..df554fa92065bc4c8566a9638f4f6f6ca9ba54db 100644
index 87c303ff576cd05291d50d5676e86ca93a13b301..b19665fd570c86274caef62dc3e365f0e6a7ca8e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -567,15 +567,36 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
Expand Down Expand Up @@ -74,10 +74,10 @@ index f61d3cd3cdbfe17f6818fbbb163f80ba3de50ca1..df554fa92065bc4c8566a9638f4f6f6c
// 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 166c7d1c23862b65b332ca6573a2a75c5926c9e8..5ad3f284f0d25ec4f7ea8789c2205f88b349f715 100644
index 91d572075ea018e4768f11115723d67b06018bf0..17a4390514b72481de6dc0676eb8130428fabf89 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1210,13 +1210,101 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1170,13 +1170,101 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

@Override
public void setRotation(float yaw, float pitch) {
Expand Down Expand Up @@ -180,7 +180,7 @@ index 166c7d1c23862b65b332ca6573a2a75c5926c9e8..5ad3f284f0d25ec4f7ea8789c2205f88
location.checkFinite();

ServerPlayer entity = this.getHandle();
@@ -1229,7 +1317,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1189,7 +1277,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return false;
}

Expand All @@ -189,7 +189,7 @@ index 166c7d1c23862b65b332ca6573a2a75c5926c9e8..5ad3f284f0d25ec4f7ea8789c2205f88
return false;
}

@@ -1247,7 +1335,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1207,7 +1295,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}

// If this player is riding another entity, we must dismount before teleporting.
Expand All @@ -198,7 +198,7 @@ index 166c7d1c23862b65b332ca6573a2a75c5926c9e8..5ad3f284f0d25ec4f7ea8789c2205f88

// SPIGOT-5509: Wakeup, similar to riding
if (this.isSleeping()) {
@@ -1263,13 +1351,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1223,13 +1311,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
ServerLevel toWorld = ((CraftWorld) to.getWorld()).getHandle();

// Close any foreign inventory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityPortalReadyEvent


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f9704cefbc1a3b6546dfefd0708fa5485e0a8e72..e09a4ebbbcd2e3f55b8b764cbc36d72bc3092085 100644
index 56060d5d962a1827873d3b2311f30b766c64575f..2a13d5f4cf86b4ae5e5cf2d0602fbcd275b1c080 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3016,6 +3016,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2922,6 +2922,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit
this.level().getProfiler().push("portal");
this.portalTime = i;
Expand All @@ -22,7 +22,7 @@ index f9704cefbc1a3b6546dfefd0708fa5485e0a8e72..e09a4ebbbcd2e3f55b8b764cbc36d72b
this.setPortalCooldown();
// CraftBukkit start
if (this instanceof ServerPlayer) {
@@ -3023,6 +3030,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2929,6 +2936,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} else {
this.changeDimension(worldserver1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 96fde7b84ce4d195d0c54deff71df9fcf8447979..6cc9c28032cafd15d884223a01208ce6f027c151 100644
index f968dee743f58fe71935097701866800c0f382a1..73e2948210139e40e234b5e2107f9008f3094964 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 {
Expand Down Expand Up @@ -43,7 +43,7 @@ index 96fde7b84ce4d195d0c54deff71df9fcf8447979..6cc9c28032cafd15d884223a01208ce6
return;
}
// CraftBukkit end
@@ -394,10 +390,12 @@ public class ServerPlayerGameMode {
@@ -392,10 +388,12 @@ public class ServerPlayerGameMode {
}

// Update any tile entity data for this block
Expand All @@ -57,10 +57,10 @@ index 96fde7b84ce4d195d0c54deff71df9fcf8447979..6cc9c28032cafd15d884223a01208ce6
}
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 13e5c0bc9e3cef3dd68f2d415649a183583eb606..bf73cdaa4f05e4415b9d072ad46774361deddad8 100644
index 57d2bffd55db5f7833121c6781984985689c4188..58fdede705e55801c4dff11db1b9d29b2430c19c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1859,8 +1859,28 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1737,8 +1737,28 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return;
}
// Paper end - Don't allow digging in unloaded chunks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Warn on plugins accessing faraway chunks


diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index af7ffeb70ea696e03d3b8188ed167aa4755e308d..6b9b5af04fe06c3f5f20a56955bd12bd2ddb7e5c 100644
index 7d39cdfec62884a8ee98af3ca71aa3c9908cc3d8..aa5879aef6e6e517ead13a422fed7674f715c994 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -505,7 +505,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -440,7 +440,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}

private static boolean isInWorldBoundsHorizontal(BlockPos pos) {
Expand All @@ -18,7 +18,7 @@ index af7ffeb70ea696e03d3b8188ed167aa4755e308d..6b9b5af04fe06c3f5f20a56955bd12bd

private static boolean isOutsideSpawnableHeight(int y) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index e36c535ede104fe6c60348558e31ad5571c5ac2a..550dcb7d595221b221e4710890d8a3cad789fc07 100644
index 2ec9d65ce7c9947021cf95f0827c3bc1cc2166ab..c7e6e73507ab198224de1b549f7c71887341c6a6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -310,9 +310,24 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Expand Down Expand Up @@ -54,39 +54,39 @@ index e36c535ede104fe6c60348558e31ad5571c5ac2a..550dcb7d595221b221e4710890d8a3ca
// Paper start - implement regenerateChunk method
final ServerLevel serverLevel = this.world;
final net.minecraft.server.level.ServerChunkCache serverChunkCache = serverLevel.getChunkSource();
@@ -522,6 +538,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -514,6 +530,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public boolean loadChunk(int x, int z, boolean generate) {
org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot
+ warnUnsafeChunk("loading a faraway chunk", x, z); // Paper
// Paper start - Optimize this method
ChunkPos chunkPos = new ChunkPos(x, z);
ChunkAccess immediate = world.getChunkSource().getChunkAtIfLoadedImmediately(x, z); // Paper
@@ -585,6 +602,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -577,6 +594,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

@Override
public boolean addPluginChunkTicket(int x, int z, Plugin plugin) {
+ warnUnsafeChunk("adding a faraway chunk ticket", x, z); // Paper
Preconditions.checkArgument(plugin != null, "null plugin");
Preconditions.checkArgument(plugin.isEnabled(), "plugin is not enabled");

@@ -653,6 +671,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -658,6 +676,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

@Override
public void setChunkForceLoaded(int x, int z, boolean forced) {
+ warnUnsafeChunk("forceloading a faraway chunk", x, z); // Paper
this.getHandle().setChunkForced(x, z, forced);
}

@@ -965,6 +984,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -970,6 +989,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

@Override
public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) {
+ warnUnsafeChunk("getting a faraway chunk", x >> 4, z >> 4); // Paper
// Transient load for this tick
return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z);
}
@@ -2376,6 +2396,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -2342,6 +2362,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Spigot end
// Paper start
public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) {
Expand Down
Loading

0 comments on commit 3aa8e7e

Please sign in to comment.