mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
more more more more more work
This commit is contained in:
parent
7b6a88056c
commit
4aa42e8aea
36 changed files with 57 additions and 68 deletions
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||||
java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId();
|
java.util.UUID uniqueId = gameprofile.getId();
|
||||||
final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server;
|
final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server;
|
||||||
|
|
||||||
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
|
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
|
|
@ -19,7 +19,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,10 +37,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper
|
+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Paper start
|
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
||||||
}
|
|
||||||
// Paper end
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
+ // Paper start - async tab completion
|
+ // Paper start - async tab completion
|
||||||
+ TAB_COMPLETE_EXECUTOR.execute(() -> {
|
+ TAB_COMPLETE_EXECUTOR.execute(() -> {
|
||||||
|
@ -54,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
-
|
-
|
||||||
- this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
- 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
|
- 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 String command = packet.getCommand();
|
||||||
+ final com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getCraftPlayer(), command, true, null);
|
+ final com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getCraftPlayer(), command, true, null);
|
||||||
+ event.callEvent();
|
+ event.callEvent();
|
|
@ -12,7 +12,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
this.internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet());
|
this.internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet());
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ //double blockRange = (reducedRange) ? Math.pow(chunkRange << 4, 2) : 16384.0D; // Paper - use from event
|
+ //double blockRange = (reducedRange) ? Math.pow(chunkRange << 4, 2) : 16384.0D; // Paper - use from event
|
||||||
+ double blockRange = 16384.0D; // Paper
|
+ double blockRange = 16384.0D; // Paper
|
||||||
// Spigot end
|
// Spigot end
|
||||||
long i = chunkcoordintpair.toLong();
|
if (!this.distanceManager.hasPlayersNearby(chunkcoordintpair.toLong())) {
|
||||||
|
return false;
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,5 +76,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||||
+ public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // 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 ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
|
||||||
public io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
|
@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}).limit(5L).collect(Collectors.toList());
|
}).limit(5L).collect(Collectors.toList());
|
||||||
|
|
||||||
if (list1.size() >= requiredCount) {
|
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
|
+ 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);
|
list.forEach(GolemSensor::golemDetected);
|
||||||
}
|
}
|
|
@ -12,13 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
if (this.state == ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT) {
|
if (this.state == ServerLoginPacketListenerImpl.State.VERIFYING) {
|
||||||
- this.handleAcceptedLogin();
|
+ if (this.connection.isConnected()) { // Paper - prevent logins to be processed even though disconnect was called
|
||||||
+ // Paper start - prevent logins to be processed even though disconnect was called
|
this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile));
|
||||||
+ if (connection.isConnected()) {
|
+ } // Paper
|
||||||
+ this.handleAcceptedLogin();
|
}
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
} else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) {
|
|
||||||
ServerPlayer entityplayer = this.server.getPlayerList().getPlayer(this.gameProfile.getId());
|
|
||||||
|
|
||||||
|
if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) {
|
|
@ -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,
|
from networking or during connections flood of chunk packets on slower clients,
|
||||||
at the cost of dead connections being kept open for longer.
|
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
|
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||||
public ServerPlayer player;
|
private static final Component TIMEOUT_DISCONNECTION_MESSAGE = Component.translatable("disconnect.timeout");
|
||||||
private int tickCount;
|
protected final MinecraftServer server;
|
||||||
private int ackBlockChangesUpTo = -1;
|
public final Connection connection; // Paper
|
||||||
- private long keepAliveTime;
|
- private long keepAliveTime;
|
||||||
+ private long keepAliveTime = Util.getMillis();
|
+ private long keepAliveTime = Util.getMillis(); // Paper
|
||||||
private boolean keepAlivePending;
|
private boolean keepAlivePending;
|
||||||
private long keepAliveChallenge;
|
private long keepAliveChallenge;
|
||||||
// CraftBukkit start - multithreaded fields
|
private int latency;
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
private volatile boolean suspendFlushingOnServerThread = false;
|
||||||
private final LastSeenMessagesValidator lastSeenMessages;
|
|
||||||
private final MessageSignatureCache messageSignatureCache;
|
|
||||||
private final FutureChain chatMessageChain;
|
|
||||||
+ private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
|
+ 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) {
|
public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit
|
||||||
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
|
this.server = minecraftserver;
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||||
}
|
|
||||||
|
|
||||||
|
protected void keepConnectionAlive() {
|
||||||
this.server.getProfiler().push("keepAlive");
|
this.server.getProfiler().push("keepAlive");
|
||||||
- long i = Util.getMillis();
|
- long i = Util.getMillis();
|
||||||
-
|
-
|
||||||
- if (i - this.keepAliveTime >= 25000L) { // CraftBukkit
|
- if (i - this.keepAliveTime >= 25000L) { // CraftBukkit
|
||||||
- if (this.keepAlivePending) {
|
- 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
|
+ // 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
|
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2
|
||||||
+ long currentTime = Util.getMillis();
|
+ long currentTime = Util.getMillis();
|
||||||
|
@ -55,7 +50,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ if (this.keepAlivePending) {
|
+ if (this.keepAlivePending) {
|
||||||
+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
+ 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
|
+ 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 {
|
+ } else {
|
||||||
+ if (elapsedTime >= 15000L) { // 15 seconds
|
+ if (elapsedTime >= 15000L) { // 15 seconds
|
||||||
|
@ -70,4 +66,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
||||||
this.server.getProfiler().pop();
|
this.server.getProfiler().pop();
|
||||||
// CraftBukkit start
|
}
|
Loading…
Reference in a new issue