more more more more more work

This commit is contained in:
Noah van der Aa 2023-09-21 23:04:51 +02:00
parent 7ebfdd5e6d
commit c60dd35989
No known key found for this signature in database
GPG Key ID: 547D90BC6FF753CF
37 changed files with 135 additions and 146 deletions

View File

@ -16,37 +16,32 @@ whereas higher values will make this less sensitive to issues such as spikes
from networking or during connections flood of chunk packets on slower clients,
at the cost of dead connections being kept open for longer.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 63003915799f636af2d60778f059a5667e199baf..51edb4f6be04b9c3b0745bc13fe7ce7cc4868e59 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -261,7 +261,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public ServerPlayer player;
private int tickCount;
private int ackBlockChangesUpTo = -1;
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index e8fb051bf24a4c239ae980c37d8d64f261b5db60..988820d6041f3784fec9321c7bc08e2e84a52ad5 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -48,11 +48,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private static final Component TIMEOUT_DISCONNECTION_MESSAGE = Component.translatable("disconnect.timeout");
protected final MinecraftServer server;
public final Connection connection; // Paper
- private long keepAliveTime;
+ private long keepAliveTime = Util.getMillis();
+ private long keepAliveTime = Util.getMillis(); // Paper
private boolean keepAlivePending;
private long keepAliveChallenge;
// CraftBukkit start - multithreaded fields
@@ -299,6 +299,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private final LastSeenMessagesValidator lastSeenMessages;
private final MessageSignatureCache messageSignatureCache;
private final FutureChain chatMessageChain;
private int latency;
private volatile boolean suspendFlushingOnServerThread = false;
+ private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
@@ -390,18 +391,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit
this.server = minecraftserver;
@@ -170,18 +171,25 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
protected void keepConnectionAlive() {
this.server.getProfiler().push("keepAlive");
- long i = Util.getMillis();
-
- if (i - this.keepAliveTime >= 25000L) { // CraftBukkit
- if (this.keepAlivePending) {
- this.disconnect(Component.translatable("disconnect.timeout"));
- } else {
+ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2
+ long currentTime = Util.getMillis();
@ -55,7 +50,8 @@ index 63003915799f636af2d60778f059a5667e199baf..51edb4f6be04b9c3b0745bc13fe7ce7c
+ if (this.keepAlivePending) {
+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
+ ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
+ this.disconnect(Component.translatable("disconnect.timeout", new Object[0]));
this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE);
- } else {
+ }
+ } else {
+ if (elapsedTime >= 15000L) { // 15 seconds
@ -70,4 +66,4 @@ index 63003915799f636af2d60778f059a5667e199baf..51edb4f6be04b9c3b0745bc13fe7ce7c
+ // Paper end
this.server.getProfiler().pop();
// CraftBukkit start
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 85488adc9c822c89ab5778bc1d48c58e916795c8..9922ab54fa2ea3abef759aba08cca535f70030e8 100644
index 3d333332ae02951af087cd37cbe7f1ecf8b0c932..42663ab48cb8a18c5e724ca840bc6f50d9b91170 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1234,7 +1234,7 @@ public abstract class Player extends LivingEntity {
@@ -1240,7 +1240,7 @@ public abstract class Player extends LivingEntity {
int i = b0 + EnchantmentHelper.getKnockbackBonus(this);
if (this.isSprinting() && flag) {
@ -18,7 +18,7 @@ index 85488adc9c822c89ab5778bc1d48c58e916795c8..9922ab54fa2ea3abef759aba08cca535
++i;
flag1 = true;
}
@@ -1309,7 +1309,7 @@ public abstract class Player extends LivingEntity {
@@ -1315,7 +1315,7 @@ public abstract class Player extends LivingEntity {
}
}
@ -27,7 +27,7 @@ index 85488adc9c822c89ab5778bc1d48c58e916795c8..9922ab54fa2ea3abef759aba08cca535
this.sweepAttack();
}
@@ -1337,15 +1337,15 @@ public abstract class Player extends LivingEntity {
@@ -1343,15 +1343,15 @@ public abstract class Player extends LivingEntity {
}
if (flag2) {
@ -46,7 +46,7 @@ index 85488adc9c822c89ab5778bc1d48c58e916795c8..9922ab54fa2ea3abef759aba08cca535
}
}
@@ -1397,7 +1397,7 @@ public abstract class Player extends LivingEntity {
@@ -1403,7 +1403,7 @@ public abstract class Player extends LivingEntity {
this.causeFoodExhaustion(this.level().spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value
} else {
@ -55,7 +55,7 @@ index 85488adc9c822c89ab5778bc1d48c58e916795c8..9922ab54fa2ea3abef759aba08cca535
if (flag4) {
target.clearFire();
}
@@ -1871,6 +1871,14 @@ public abstract class Player extends LivingEntity {
@@ -1877,6 +1877,14 @@ public abstract class Player extends LivingEntity {
public int getXpNeededForNextLevel() {
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerArmorChangeEvent
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 0470329b43afd4e8c5e033666d1c5f8f0a03fe6a..021f3f81746a6e986c8899aa4b28ef87a67bed44 100644
index a8d39b7257332ec8b3b711aab2c4b76a867e73bc..231ba23fabeb88b659a7ea9702eebe4aad72a209 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1,5 +1,6 @@
@ -15,7 +15,7 @@ index 0470329b43afd4e8c5e033666d1c5f8f0a03fe6a..021f3f81746a6e986c8899aa4b28ef87
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -3016,6 +3017,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3053,6 +3054,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
if (this.equipmentHasChanged(itemstack, itemstack1)) {

View File

@ -0,0 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: killme <killme-git@ibts.me>
Date: Sun, 12 Nov 2017 19:40:01 +0100
Subject: [PATCH] Prevent logins from being processed when the player has
disconnected
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index b98c7bb70a2d8867e1236d3c8d78d2cfffe76e28..1202a60cf955dbfbfc2135c06d3304f215b23c2c 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -79,7 +79,9 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
}
// Paper end
if (this.state == ServerLoginPacketListenerImpl.State.VERIFYING) {
+ if (this.connection.isConnected()) { // Paper - prevent logins to be processed even though disconnect was called
this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile));
+ } // Paper
}
if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 7cfcbc1e38f5e9145c827dfe26299277a3f14cee..22dab285bbcea77d04a8625b025f054c625cadd4 100644
index 776a5a9947c56eb63df7ac9797166be456282af1..e00e9a6ca14622c2baeba71f54710fedc838ffd7 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -805,6 +805,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -800,6 +800,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Spigot start
// Iterator iterator = this.blockEntityTickers.iterator();
int tilesThisCycle = 0;
@ -17,7 +17,7 @@ index 7cfcbc1e38f5e9145c827dfe26299277a3f14cee..22dab285bbcea77d04a8625b025f054c
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(tileTickPosition);
@@ -812,7 +814,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -807,7 +809,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (tickingblockentity == null) {
this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
tilesThisCycle--;
@ -25,7 +25,7 @@ index 7cfcbc1e38f5e9145c827dfe26299277a3f14cee..22dab285bbcea77d04a8625b025f054c
continue;
}
// Spigot end
@@ -820,12 +821,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -815,12 +816,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (tickingblockentity.isRemoved()) {
// Spigot start
tilesThisCycle--;

View File

@ -18,7 +18,7 @@ the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 22dab285bbcea77d04a8625b025f054c625cadd4..ce24a52b2b9fb0ae7cfb085a204de8780bc8f5d6 100644
index e00e9a6ca14622c2baeba71f54710fedc838ffd7..068382daaeae03e67b2859cce7d15e290c92352e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -154,7 +154,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -49,7 +49,7 @@ index 22dab285bbcea77d04a8625b025f054c625cadd4..ce24a52b2b9fb0ae7cfb085a204de878
this.capturedBlockStates.put(pos.immutable(), blockstate);
captured = true;
}
@@ -695,7 +696,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -690,7 +691,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public BlockState getBlockState(BlockPos pos) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {

View File

@ -16,10 +16,10 @@ Also adds isCommand and getLocation to the sync TabCompleteEvent
Co-authored-by: Aikar <aikar@aikar.co>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 51edb4f6be04b9c3b0745bc13fe7ce7cc4868e59..a6e6c82be3a6f397c6cefbd843b17c86bb0ff2f7 100644
index d849ca56d36f4652a5c1526a92f183a2defb3e0d..8e27c443b31566a8e57c29ba29fa914fe4a53275 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -790,12 +790,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -687,27 +687,58 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
@ -37,10 +37,6 @@ index 51edb4f6be04b9c3b0745bc13fe7ce7cc4868e59..a6e6c82be3a6f397c6cefbd843b17c86
+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper
return;
}
// Paper start
@@ -806,18 +810,45 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
// Paper end
// CraftBukkit end
+ // Paper start - async tab completion
+ TAB_COMPLETE_EXECUTOR.execute(() -> {
@ -54,7 +50,7 @@ index 51edb4f6be04b9c3b0745bc13fe7ce7cc4868e59..a6e6c82be3a6f397c6cefbd843b17c86
-
- this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
- if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer
- this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions));
- this.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions));
+ final String command = packet.getCommand();
+ final com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getCraftPlayer(), command, true, null);
+ event.callEvent();
@ -91,10 +87,10 @@ index 51edb4f6be04b9c3b0745bc13fe7ce7cc4868e59..a6e6c82be3a6f397c6cefbd843b17c86
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index baa2d98530f28b21796c15125ee9dcbbba7bbf77..95e08874f993c826839184fa894f82d07224cb12 100644
index 35dc09187b0bed916c9a10f3cf3a900052926a72..659e239a407f793706e4f133f6168a556e9de68b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2129,7 +2129,7 @@ public final class CraftServer implements Server {
@@ -2132,7 +2132,7 @@ public final class CraftServer implements Server {
offers = this.tabCompleteChat(player, message);
}

View File

@ -14,10 +14,10 @@ public net.minecraft.world.entity.ExperienceOrb durabilityToXp(I)I
public net.minecraft.world.entity.ExperienceOrb xpToDurability(I)I
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 4d83b02dd2f00b613bfb1c7be7c93f0bc00bbf58..b71b83b2984e51202e9a40945946ebdd6b999cc2 100644
index e12ae345142f27efa9a4b97c9da522571fc1288a..4eab2d038a247053353f437bada1f3d87b20c92a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1538,7 +1538,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1498,7 +1498,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
@Override

View File

@ -9,10 +9,10 @@ from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 6f30a16595e352e32375530a0482d8c0ee9c1113..8dc2a217d018e0a11fb852cf46d4e9b5290ea6a0 100644
index 17182c7f130853b4b5d942e7d60adaded14f84f6..425a0baa9321e9b484814f38fe28de3c82333443 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -708,7 +708,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1193,7 +1193,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
chunkRange = (chunkRange > 8) ? 8 : chunkRange;
@ -21,9 +21,9 @@ index 6f30a16595e352e32375530a0482d8c0ee9c1113..8dc2a217d018e0a11fb852cf46d4e9b5
+ //double blockRange = (reducedRange) ? Math.pow(chunkRange << 4, 2) : 16384.0D; // Paper - use from event
+ double blockRange = 16384.0D; // Paper
// Spigot end
long i = chunkcoordintpair.toLong();
@@ -725,6 +727,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!this.distanceManager.hasPlayersNearby(chunkcoordintpair.toLong())) {
return false;
@@ -1208,6 +1210,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
entityplayer = (ServerPlayer) iterator.next();
@ -40,10 +40,10 @@ index 6f30a16595e352e32375530a0482d8c0ee9c1113..8dc2a217d018e0a11fb852cf46d4e9b5
return true;
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index b0687dcf8af84af627b67e7fbb68170a2fd28da0..5cb151a7d89c7281b03f24c5f79afb7edf7cbfea 100644
index b1fd6118132ba38f60d2a2b15c09231fa29be8fa..0f38bdf2c9a29f2111c27138b8d997c230633bb8 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -565,6 +565,15 @@ public class ServerChunkCache extends ChunkSource {
@@ -718,6 +718,15 @@ public class ServerChunkCache extends ChunkSource {
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
Collections.shuffle(list);
@ -60,7 +60,7 @@ index b0687dcf8af84af627b67e7fbb68170a2fd28da0..5cb151a7d89c7281b03f24c5f79afb7e
while (iterator1.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 5c855a15f7847ca37c263755f643eeb1fd79668b..3842caf61e388aa65b3a18c587480a7dabb8341b 100644
index 40efa19ffe9275748a62e0546c3fd42bbcb0883d..491dffdcbb065acf5861dc01b403d1a895c92baa 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1,5 +1,6 @@
@ -70,11 +70,11 @@ index 5c855a15f7847ca37c263755f643eeb1fd79668b..3842caf61e388aa65b3a18c587480a7d
import com.google.common.collect.Lists;
import com.google.common.net.InetAddresses;
import com.mojang.authlib.GameProfile;
@@ -260,6 +261,7 @@ public class ServerPlayer extends Player {
@@ -257,6 +258,7 @@ public class ServerPlayer extends Player {
// CraftBukkit end
public boolean isRealPlayer; // Paper
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
+ public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
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));
public io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);

View File

@ -7,10 +7,10 @@ This allows you to create already filled textures on Skulls to avoid texture loo
which commonly cause rate limit issues with Mojang API
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
index cf76e486bc873580c3b28dee88e168a2f3666a79..1325e9140a4b568170f0bd400904fe3c9d00cd4f 100644
index 4650b4cd7f8625ee5e1dba47f47ffa9221e3d097..e193572862fbc78b3adb531fd567c919afdc718e 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
@@ -106,7 +106,22 @@ public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implemen
@@ -107,7 +107,22 @@ public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implemen
}
}
@ -33,7 +33,7 @@ index cf76e486bc873580c3b28dee88e168a2f3666a79..1325e9140a4b568170f0bd400904fe3c
public PlayerProfile getOwnerProfile() {
if (!this.hasOwner()) {
return null;
@@ -116,11 +131,12 @@ public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implemen
@@ -117,11 +132,12 @@ public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implemen
}
@Override
@ -48,10 +48,10 @@ index cf76e486bc873580c3b28dee88e168a2f3666a79..1325e9140a4b568170f0bd400904fe3c
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index 85b9baad074634a2f21c15adbb393ebc5924bdd8..deed77a3d44bc55681483d7f47f148b5220135f2 100644
index f8e2315845b15af230f43521b53f943ee58b9117..fe7a8e48a620630a6365edd22466f348de0dc508 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -184,6 +184,19 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
@@ -187,6 +187,19 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
return this.hasOwner() ? this.profile.getName() : null;
}
@ -71,7 +71,7 @@ index 85b9baad074634a2f21c15adbb393ebc5924bdd8..deed77a3d44bc55681483d7f47f148b5
@Override
public OfflinePlayer getOwningPlayer() {
if (this.hasOwner()) {
@@ -234,6 +247,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
@@ -237,6 +250,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
}
@Override
@ -79,7 +79,7 @@ index 85b9baad074634a2f21c15adbb393ebc5924bdd8..deed77a3d44bc55681483d7f47f148b5
public PlayerProfile getOwnerProfile() {
if (!this.hasOwner()) {
return null;
@@ -243,11 +257,12 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
@@ -246,11 +260,12 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
}
@Override
@ -93,7 +93,7 @@ index 85b9baad074634a2f21c15adbb393ebc5924bdd8..deed77a3d44bc55681483d7f47f148b5
}
}
@@ -301,7 +316,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
@@ -304,7 +319,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
Builder<String, Object> serialize(Builder<String, Object> builder) {
super.serialize(builder);
if (this.profile != null) {

View File

@ -59,10 +59,10 @@ index b77ebe04f1018962b85110258c8a0a2db8612485..028d69907a988e191213a17e072ef227
if (t0 != null) {
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 93a43ef867d0961b46f9ecadc2c7be6a4b17c72b..c2aafe4e1afec2793735bf7b0bbd6af94ad393f8 100644
index cea1a8eaae8dfc36efd09e3ac57a7062bf536aac..5981b2bd5745ac32cdb377c15c4384d074a47680 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -413,6 +413,20 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -414,6 +414,20 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@Nullable
public T spawn(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Consumer<T> consumer, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
// CraftBukkit end
@ -84,14 +84,14 @@ index 93a43ef867d0961b46f9ecadc2c7be6a4b17c72b..c2aafe4e1afec2793735bf7b0bbd6af9
if (t0 != null) {
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 68594d2621267f4b112b4d14d2bec3a0dd6a044a..73a5750dd47cf8869070f92594cfb926193c8761 100644
index b3127238cea62c47d710abab44f6570103ba9364..7d7390dc76f683178fc332ea3c2c945ba8e9b84b 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -966,7 +966,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -975,7 +975,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}).limit(5L).collect(Collectors.toList());
if (list1.size() >= requiredCount) {
- if (SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, world, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isPresent()) { // CraftBukkit
- if (!SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, world, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isEmpty()) { // CraftBukkit
+ if (SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, world, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE, () -> {GolemSensor.golemDetected(this);}).isPresent()) { // CraftBukkit // Paper - Set Golem Last Seen to stop it from spawning another one
list.forEach(GolemSensor::golemDetected);
}
@ -129,7 +129,7 @@ index 20c39481bcf05e0d43c97b7e841ec9f5f6a0d45d..fc7719d12b5f6011aec2e41a36b4bacd
Entity entity = EntityType.loadEntityRecursive(nbttagcompound, world, (entity1) -> {
entity1.moveTo(d0, d1, d2, entity1.getYRot(), entity1.getXRot());
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index b2bb9bbd3af414c50ec3f8e3e171a679e95ef75e..6ac513d3044fab1cb1ca0b0c7e85ff871d49d572 100644
index 92e76dd39dc3575e9466031dd799080a98ad8b8d..b3a7d065900f63b15ee2a8e3c1d69d5513f7b85c 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -213,7 +213,13 @@ public final class NaturalSpawner {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] PlayerAdvancementCriterionGrantEvent
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 8f7ca41726551fd99b028e2fb3ff72df50a36d88..100781852965e09c92aca34785673c5de51c7107 100644
index f5f26c0327f0dae47badcc914fc89a4019c784a3..0128c29bc0a99d4eb4f53b2beb20045c0126db9d 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -228,6 +228,12 @@ public class PlayerAdvancements {
@@ -226,6 +226,12 @@ public class PlayerAdvancements {
boolean flag1 = advancementprogress.isDone();
if (advancementprogress.grantProgress(criterionName)) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Toggleable player crits, helps mitigate hacked clients.
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 9922ab54fa2ea3abef759aba08cca535f70030e8..a668a62da9fb7fc013f078c030580b13a62db3ca 100644
index 42663ab48cb8a18c5e724ca840bc6f50d9b91170..dabd68122861d673fc70cb1c66d24cb176129965 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1241,6 +1241,7 @@ public abstract class Player extends LivingEntity {
@@ -1247,6 +1247,7 @@ public abstract class Player extends LivingEntity {
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity;

View File

@ -12,10 +12,10 @@ flushing on the netty event loop, so it won't do the flush on the main thread.
Renable flushing by passing -Dpaper.explicit-flush=true
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index f2c5764a447d0895e90a5aa73ee28a9feb453483..7065d8e2b0782f1dbaf9932db9201b94ae455a31 100644
index e5e4a5fb2c342a249344d207ffea4000cc998710..2d7f332910328cef616609dc4c89facafcbe66cc 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -119,6 +119,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -114,6 +114,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
// Paper start - NetworkClient implementation
public int protocolVersion;
public java.net.InetSocketAddress virtualHost;
@ -23,7 +23,7 @@ index f2c5764a447d0895e90a5aa73ee28a9feb453483..7065d8e2b0782f1dbaf9932db9201b94
// Paper end
public Connection(PacketFlow side) {
@@ -323,7 +324,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -401,7 +402,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
if (this.channel != null) {

View File

@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..6b0bdc266109cdfb874f08bf74323603
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bb1280569181e8e3acb78ef622b4d2f905007222..9f59ef54ef6f6af8b0fef8567d8cfbefb64bc29f 100644
index 440d1db090dfa62843124cec802224553aad51c0..59864c92d6371e6dbd6afa11aee5f8ad0689379d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -3,6 +3,9 @@ package net.minecraft.server;
@ -194,7 +194,7 @@ index bb1280569181e8e3acb78ef622b4d2f905007222..9f59ef54ef6f6af8b0fef8567d8cfbef
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -1344,7 +1347,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1334,7 +1337,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hidesOnlinePlayers()) {
return new ServerStatus.Players(i, list.size(), List.of());
} else {

View File

@ -6,11 +6,11 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent
This will allow you to change the players name or skin on login.
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 9607c3297c1a977cb33fb730eacb35ce9604b74c..6b31b0894e52ad6fc397624e50587ec04e46c099 100644
index 1202a60cf955dbfbfc2135c06d3304f215b23c2c..1b00de7f44169a10702dab64c4b4f40e08afd3f9 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -329,8 +329,16 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId();
@@ -292,8 +292,16 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
java.util.UUID uniqueId = gameprofile.getId();
final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server;
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);

View File

@ -9,10 +9,10 @@ This can be useful for changing name or skins after a player has logged in.
public-f net.minecraft.world.entity.player.Player gameProfile
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a6e6c82be3a6f397c6cefbd843b17c86bb0ff2f7..d01daadf038b381c4b0d7787553ccd341c0787af 100644
index 8e27c443b31566a8e57c29ba29fa914fe4a53275..2addf6dfbe808d4a74d74812ae024925cb3bdb13 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1540,7 +1540,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1430,7 +1430,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet());
}
@ -22,10 +22,10 @@ index a6e6c82be3a6f397c6cefbd843b17c86bb0ff2f7..d01daadf038b381c4b0d7787553ccd34
if (Float.isNaN(f)) {
f = 0;
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 6b31b0894e52ad6fc397624e50587ec04e46c099..0c7f280bae81bbb492d5780a43e5ffda0f58756a 100644
index 1b00de7f44169a10702dab64c4b4f40e08afd3f9..69564543d143c697db0ffee959c41a2163371bbe 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -330,11 +330,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -293,11 +293,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server;
// Paper start
@ -55,10 +55,10 @@ index b17fe83bcd7bde44ee8c1f872fffa8bf40707c50..aac78c13361b19efa7b43a0c95458390
public Server getServer() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b71b83b2984e51202e9a40945946ebdd6b999cc2..c48205d83eff82decf73724a315d2a9265d197e4 100644
index 4eab2d038a247053353f437bada1f3d87b20c92a..df3baed35f408e2098f6c98522aed8017d61f489 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -269,11 +269,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -229,11 +229,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return server.getPlayer(getUniqueId()) != null;
}
@ -70,7 +70,7 @@ index b71b83b2984e51202e9a40945946ebdd6b999cc2..c48205d83eff82decf73724a315d2a92
@Override
public InetSocketAddress getAddress() {
if (this.getHandle().connection == null) return null;
@@ -1688,8 +1683,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1648,8 +1643,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private void untrackAndHideEntity(org.bukkit.entity.Entity entity) {
// Remove this entity from the hidden player's EntityTrackerEntry
@ -87,7 +87,7 @@ index b71b83b2984e51202e9a40945946ebdd6b999cc2..c48205d83eff82decf73724a315d2a92
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
if (entry != null) {
entry.removePlayer(this.getHandle());
@@ -1702,8 +1704,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1662,8 +1664,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.send(new ClientboundPlayerInfoRemovePacket(List.of(otherPlayer.getUUID())));
}
}
@ -96,7 +96,7 @@ index b71b83b2984e51202e9a40945946ebdd6b999cc2..c48205d83eff82decf73724a315d2a92
}
void resetAndHideEntity(org.bukkit.entity.Entity entity) {
@@ -1768,12 +1768,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1728,12 +1728,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
private void trackAndShowEntity(org.bukkit.entity.Entity entity) {
@ -122,7 +122,7 @@ index b71b83b2984e51202e9a40945946ebdd6b999cc2..c48205d83eff82decf73724a315d2a92
}
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
@@ -1783,6 +1796,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1743,6 +1756,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity));
}
@ -162,7 +162,7 @@ index b71b83b2984e51202e9a40945946ebdd6b999cc2..c48205d83eff82decf73724a315d2a92
void resetAndShowEntity(org.bukkit.entity.Entity entity) {
// SPIGOT-7312: Can't show/hide self
@@ -1794,6 +1840,36 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1754,6 +1800,36 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.trackAndShowEntity(entity);
}
}

View File

@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 95e08874f993c826839184fa894f82d07224cb12..e19ddd1ab4d15ee041c74bb3767e3a9c41072f34 100644
index 659e239a407f793706e4f133f6168a556e9de68b..e6b0b567ccbe8d7e3f21ffdc336ee2b2ddfb34e9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1727,6 +1727,25 @@ public final class CraftServer implements Server {
@@ -1730,6 +1730,25 @@ public final class CraftServer implements Server {
return recipients.size();
}

View File

@ -1,24 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: killme <killme-git@ibts.me>
Date: Sun, 12 Nov 2017 19:40:01 +0100
Subject: [PATCH] Prevent logins from being processed when the player has
disconnected
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 06f3e1f42da85a54187f3decc35c338a3eeb8de4..9607c3297c1a977cb33fb730eacb35ce9604b74c 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -78,7 +78,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
}
// Paper end
if (this.state == ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT) {
- this.handleAcceptedLogin();
+ // Paper start - prevent logins to be processed even though disconnect was called
+ if (connection.isConnected()) {
+ this.handleAcceptedLogin();
+ }
+ // Paper end
} else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) {
ServerPlayer entityplayer = this.server.getPlayerList().getPlayer(this.gameProfile.getId());

View File

@ -11,7 +11,7 @@ index 2f5704b19148f390402c0823030806ba96860286..74f1af3dccddf52965e5c91277be3592
@@ -626,6 +626,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
}
+ // Paper start - move open sign method to HumanEntity
+ @Override
+ public void openSign(final org.bukkit.block.Sign sign, final org.bukkit.block.sign.Side side) {

View File

@ -11,7 +11,7 @@ index a668a62da9fb7fc013f078c030580b13a62db3ca..10dd06a23b34b7c8515c9ccc3988a9e8
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1290,7 +1290,11 @@ public abstract class Player extends LivingEntity {
}
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
- this.setSprinting(false);
+ // Paper start - Configuration option to disable automatic sprint interruption
@ -20,5 +20,5 @@ index a668a62da9fb7fc013f078c030580b13a62db3ca..10dd06a23b34b7c8515c9ccc3988a9e8
+ }
+ // Paper end
}
if (flag3) {

View File

@ -14,7 +14,7 @@ index 084a9bb8ca0ec57fad1efbc540e4b58eacb61970..d2dd4537f8a81d02a4d3570834549d7e
@@ -122,6 +122,12 @@ public class EnderMan extends Monster implements NeutralMob {
this.setTarget(target, EntityTargetEvent.TargetReason.UNKNOWN, true);
}
+ // Paper start
+ private boolean tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason reason) {
+ return new com.destroystokyo.paper.event.entity.EndermanEscapeEvent((org.bukkit.craftbukkit.entity.CraftEnderman) this.getBukkitEntity(), reason).callEvent();
@ -27,7 +27,7 @@ index 084a9bb8ca0ec57fad1efbc540e4b58eacb61970..d2dd4537f8a81d02a4d3570834549d7e
@@ -276,7 +282,7 @@ public class EnderMan extends Monster implements NeutralMob {
if (this.level().isDay() && this.tickCount >= this.targetChangeTime + 600) {
float f = this.getLightLevelDependentMagicValue();
- if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper
this.setTarget((LivingEntity) null);
@ -36,7 +36,7 @@ index 084a9bb8ca0ec57fad1efbc540e4b58eacb61970..d2dd4537f8a81d02a4d3570834549d7e
@@ -402,11 +408,13 @@ public class EnderMan extends Monster implements NeutralMob {
} else {
flag1 = flag && this.hurtWithCleanWater(source, (ThrownPotion) source.getDirectEntity(), amount);
+ if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start
for (int i = 0; i < 64; ++i) {
if (this.teleport()) {
@ -44,7 +44,7 @@ index 084a9bb8ca0ec57fad1efbc540e4b58eacb61970..d2dd4537f8a81d02a4d3570834549d7e
}
}
+ } // Paper end
return flag1;
}
@@ -633,7 +641,7 @@ public class EnderMan extends Monster implements NeutralMob {
@ -55,4 +55,4 @@ index 084a9bb8ca0ec57fad1efbc540e4b58eacb61970..d2dd4537f8a81d02a4d3570834549d7e
+ if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D && this.enderman.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.STARE)) { // Paper
this.enderman.teleport();
}

View File

@ -12,7 +12,7 @@ index 0e13edd23016a6ffe6492de322e1d675137e3c9e..cb161c3d1a08d9c14320104001866429
@@ -17,6 +17,7 @@ public class CraftEnderman extends CraftMonster implements Enderman {
super(server, entity);
}
+ @Override public boolean teleportRandomly() { return getHandle().teleport(); } // Paper
@Override
public MaterialData getCarriedMaterial() {

View File

@ -20,7 +20,7 @@ index 17d9c5a6c357ac5e3eacd9e4d2cff9a05ec0f262..f2eefdeab44ad4f7c0abd0e55e688e74
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2327,6 +2327,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTickingEnd(Entity entity) {
ServerLevel.this.entityTickList.remove(entity);
+ // Paper start - Reset pearls when they stop being ticked
@ -30,7 +30,7 @@ index 17d9c5a6c357ac5e3eacd9e4d2cff9a05ec0f262..f2eefdeab44ad4f7c0abd0e55e688e74
+ }
+ // Paper end
}
public void onTrackingStart(Entity entity) {
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index b4a37d11e381d08c82945966ee5f969364f6e3ee..e9ae25a70c747c173ebd2e393818d205527d5314 100644
@ -42,5 +42,5 @@ index b4a37d11e381d08c82945966ee5f969364f6e3ee..e9ae25a70c747c173ebd2e393818d205
this.cachedOwner = null;
+ if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
}
this.leftOwner = nbt.getBoolean("LeftOwner");

View File

@ -15,7 +15,7 @@ index f2eefdeab44ad4f7c0abd0e55e688e74a83abfff..68257f257dd3b167e237482c8d149590
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1717,12 +1717,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public <T extends ParticleOptions> int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
+ // Paper start - Particle API Expansion
+ return sendParticles(players, sender, t0, d0, d1, d2, i, d3, d4, d5, d6, force);
@ -25,20 +25,20 @@ index f2eefdeab44ad4f7c0abd0e55e688e74a83abfff..68257f257dd3b167e237482c8d149590
ClientboundLevelParticlesPacket packetplayoutworldparticles = new ClientboundLevelParticlesPacket(t0, force, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
// CraftBukkit end
int j = 0;
- for (int k = 0; k < this.players.size(); ++k) {
- ServerPlayer entityplayer = (ServerPlayer) this.players.get(k);
+ for (Player entityhuman : receivers) { // Paper - Particle API Expansion
+ ServerPlayer entityplayer = (ServerPlayer) entityhuman; // Paper - Particle API Expansion
if (sender != null && !entityplayer.getBukkitEntity().canSee(sender.getBukkitEntity())) continue; // CraftBukkit
if (this.sendParticles(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index d348ca56ae452dc80d5dabe874d9f8d72970fc4d..0476f00719d180d28a2a4bab3f4152b00a1e4e67 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1863,11 +1863,17 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {
- if (data != null) {

View File

@ -10,7 +10,7 @@ index 5bd28e1f475aeadaa626a4e9e9e2a1b3a28675f4..148ea4089c4f67894b28e21e961a661a
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -203,9 +203,9 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
Style chatmodifier = signtext.getMessage(i, entityhuman.isTextFilteringEnabled()).getStyle();
if (entityhuman.isTextFilteringEnabled()) {
- signtext = signtext.setMessage(i, Component.literal(filteredtext.filteredOrEmpty()).setStyle(chatmodifier));
+ signtext = signtext.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only
@ -19,4 +19,4 @@ index 5bd28e1f475aeadaa626a4e9e9e2a1b3a28675f4..148ea4089c4f67894b28e21e961a661a
+ signtext = signtext.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.raw())).setStyle(chatmodifier), Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only
}
}

View File

@ -10,7 +10,7 @@ index 331b642c36af97f7f05bd63f96d42d1af443e5a3..a3af96b2518b41f370d09cfda26dc589
--- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
@@ -38,7 +38,8 @@ public class FrostedIceBlock extends IceBlock {
for(Direction direction : Direction.values()) {
mutableBlockPos.setWithOffset(pos, direction);
- BlockState blockState = world.getBlockState(mutableBlockPos);
@ -20,7 +20,7 @@ index 331b642c36af97f7f05bd63f96d42d1af443e5a3..a3af96b2518b41f370d09cfda26dc589
world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - use configurable min/max delay
}
@@ -75,7 +76,10 @@ public class FrostedIceBlock extends IceBlock {
for(Direction direction : Direction.values()) {
mutableBlockPos.setWithOffset(pos, direction);
- if (world.getBlockState(mutableBlockPos).is(this)) {

View File

@ -14,7 +14,7 @@ index d2dd4537f8a81d02a4d3570834549d7e27b749b9..06a0a06f3f4ed20f151ddac35ae7d568
@@ -234,7 +234,15 @@ public class EnderMan extends Monster implements NeutralMob {
this.readPersistentAngerSaveData(this.level(), nbt);
}
- boolean isLookingAtMe(Player player) {
+ // Paper start - EndermanAttackPlayerEvent
+ private boolean isLookingAtMe(Player player) {
@ -26,5 +26,5 @@ index d2dd4537f8a81d02a4d3570834549d7e27b749b9..06a0a06f3f4ed20f151ddac35ae7d568
+ private boolean isLookingAtMe_check(Player player) {
+ // Paper end
ItemStack itemstack = (ItemStack) player.getInventory().armor.get(3);
if (itemstack.is(Blocks.CARVED_PUMPKIN.asItem())) {

View File

@ -10,7 +10,7 @@ index 112c4f203e2c1e3b1e0259e687ee2293c0132953..6a6b8672e65212dc2a1d837563d623b8
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -124,7 +124,11 @@ public class Witch extends Raider implements RangedAttackMob {
this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
if (itemstack.is(Items.POTION)) {
- List<MobEffectInstance> list = PotionUtils.getMobEffects(itemstack);
@ -19,6 +19,6 @@ index 112c4f203e2c1e3b1e0259e687ee2293c0132953..6a6b8672e65212dc2a1d837563d623b8
+
+ List<MobEffectInstance> list = event.callEvent() ? PotionUtils.getMobEffects(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion())) : null;
+ // Paper end
if (list != null) {
Iterator iterator = list.iterator();

View File

@ -12,7 +12,7 @@ index 6a6b8672e65212dc2a1d837563d623b8bce8da28..0341a1cf05865f1a182a25adc5651f80
@@ -236,9 +236,16 @@ public class Witch extends Raider implements RangedAttackMob {
potionregistry = Potions.WEAKNESS;
}
+ // Paper start
+ ItemStack potion = PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potionregistry);
+ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));