More more more work

This commit is contained in:
Nassim Jahnke
2021-06-12 14:58:17 +02:00
parent 21c7efe18c
commit 3a483825e0
11 changed files with 52 additions and 55 deletions

View File

@@ -1,14 +0,0 @@
# Shit to check
* Mini: "Optimize World Server Map": Figure out how to fill PaperWorldMap, it needs a dim key which doesnt exist anymore?
* Mini: "MC-50319": fix if still works
* Make sure the flat bedrock setting doesn't do anything stupid
* Check DataBits foreach
* lighting is bork (load chunk, fly away, come back, everything or parts are black)
* chunk generation seems slow with a lot of it happening
* Fix IDE Debug JVM Flag for new versions of minecraft
* Check if `PlayerEditBookEvent`: https://github.com/PaperMC/Paper/pull/1751
The PlayerEditBookEvent is straight up not called anymore.
The method to call it must now be `PlayerConnection#a(List<String>, int)` (CB bug).
The item is presumably edited with the new page contents before it ever reaches this method?

View File

@@ -8,13 +8,13 @@ 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 ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
boolean flag = d8 > 0.0D; boolean flag = d8 > 0.0D;
if (this.player.isOnGround() && !packet.isOnGround() && flag) { if (this.player.isOnGround() && !packet.isOnGround() && flag) {
- this.player.jumpFromGround(); - this.player.jumpFromGround();
+ // Paper start - Add player jump event + // Paper start - Add player jump event
+ Player player = this.getPlayer(); + Player player = this.getCraftPlayer();
+ Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. + Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location.
+ Location to = player.getLocation().clone(); // Start off the To location as the Players current location. + Location to = player.getLocation().clone(); // Start off the To location as the Players current location.
+ +
@@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.player.jumpFromGround(); + this.player.jumpFromGround();
+ } else { + } else {
+ from = event.getFrom(); + from = event.getFrom();
+ this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet()); + this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet(), false);
+ return; + return;
+ } + }
+ // Paper end + // Paper end

View File

@@ -74,18 +74,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public Connection(PacketFlow side) { public Connection(PacketFlow side) {
this.receiving = side; this.receiving = side;
diff --git a/src/main/java/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java b/src/main/java/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java
@@ -0,0 +0,0 @@ public class ClientIntentionPacket implements Packet<ServerHandshakePacketListen
return this.intention;
}
+ public int getProtocolVersion() { return getProtocolVersion(); } // Paper - OBFHELPER
public int getProtocolVersion() {
return this.protocolVersion;
}
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -95,8 +83,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ // Paper start - NetworkClient implementation + // Paper start - NetworkClient implementation
+ this.getNetworkManager().protocolVersion = packet.getProtocolVersion(); + this.connection.protocolVersion = packet.getProtocolVersion();
+ this.getNetworkManager().virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(packet.hostName, packet.port); + this.connection.virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(packet.hostName, packet.port);
+ // Paper end + // Paper end
} }

View File

@@ -14,19 +14,32 @@ the root logger, the Minecraft/Mojang loggers and the Bukkit loggers.
This may cause additional prefixes to be disabled for plugins bypassing This may cause additional prefixes to be disabled for plugins bypassing
the plugin logger. the plugin logger.
diff --git a/build.gradle.kts b/build.gradle.kts
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -0,0 +0,0 @@ dependencies {
all its classes to check if they are plugins.
Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/
- runtimeOnly("org.apache.logging.log4j:log4j-core:2.14.1")
+ implementation("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - implementation
// Paper end
implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper
implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
<dependency> <groupId>com.googlecode.json-simple</groupId>
<groupId>org.apache.logging.log4j</groupId> <artifactId>json-simple</artifactId>
<artifactId>log4j-core</artifactId> <version>1.1.1</version>
- <scope>runtime</scope> - <scope>runtime</scope>
+ <scope>compile</scope> + <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.xerial</groupId>
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
@@ -34,8 +47,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class SpigotConfig @@ -0,0 +0,0 @@ public class SpigotConfig
private static void playerSample() private static void playerSample()
{ {
playerSample = getInt( "settings.sample-count", 12 ); SpigotConfig.playerSample = SpigotConfig.getInt( "settings.sample-count", 12 );
- System.out.println( "Server Ping Player Sample Count: " + playerSample ); - System.out.println( "Server Ping Player Sample Count: " + SpigotConfig.playerSample );
+ Bukkit.getLogger().log( Level.INFO, "Server Ping Player Sample Count: {0}", playerSample ); // Paper - Use logger + Bukkit.getLogger().log( Level.INFO, "Server Ping Player Sample Count: {0}", playerSample ); // Paper - Use logger
} }

View File

@@ -8,6 +8,14 @@ diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -0,0 +0,0 @@ public abstract class BaseSpawner {
// Spigot End
}
entity.spawnedViaMobSpawner = true; // Paper
+ flag = true; // Paper
// Spigot Start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
Entity vehicle = entity.getVehicle();
@@ -0,0 +0,0 @@ public abstract class BaseSpawner { @@ -0,0 +0,0 @@ public abstract class BaseSpawner {
((Mob) entity).spawnAnim(); ((Mob) entity).spawnAnim();
} }

View File

@@ -18,7 +18,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 ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override @Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) { public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
@@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.keepAlivePending = false; this.keepAlivePending = false;
} else if (!this.isSingleplayerOwner()) { } else if (!this.isSingleplayerOwner()) {
+ // Paper start - This needs to be handled on the main thread for plugins + // Paper start - This needs to be handled on the main thread for plugins
+ server.scheduleOnMain(() -> { + server.submit(() -> {
this.disconnect(new TranslatableComponent("disconnect.timeout")); this.disconnect(new TranslatableComponent("disconnect.timeout"));
+ }); + });
+ // Paper end + // Paper end

View File

@@ -20,16 +20,20 @@ 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 ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private final MinecraftServer server; private final MinecraftServer server;
public ServerPlayer player; public ServerPlayer player;
private int tickCount; private int tickCount;
- private long keepAliveTime; private void setLastPing(long lastPing) { this.keepAliveTime = lastPing;}; private long getLastPing() { return this.keepAliveTime;}; // Paper - OBFHELPER - private long keepAliveTime; private void setLastPing(long lastPing) { this.keepAliveTime = lastPing;}; private long getLastPing() { return this.keepAliveTime;}; // Paper - OBFHELPER
+ private long keepAliveTime = Util.getMillis(); private void setLastPing(long lastPing) { this.keepAliveTime = lastPing;}; private long getLastPing() { return this.keepAliveTime;}; // Paper - OBFHELPER - private boolean keepAlivePending; private void setPendingPing(boolean isPending) { this.keepAlivePending = isPending;}; private boolean isPendingPing() { return this.keepAlivePending;}; // Paper - OBFHELPER
private boolean keepAlivePending; private void setPendingPing(boolean isPending) { this.keepAlivePending = isPending;}; private boolean isPendingPing() { return this.keepAlivePending;}; // Paper - OBFHELPER - private long keepAliveChallenge; private void setKeepAliveID(long keepAliveID) { this.keepAliveChallenge = keepAliveID;}; private long getKeepAliveID() {return this.keepAliveChallenge; }; // Paper - OBFHELPER
private long keepAliveChallenge; private void setKeepAliveID(long keepAliveID) { this.keepAliveChallenge = keepAliveID;}; private long getKeepAliveID() {return this.keepAliveChallenge; }; // Paper - OBFHELPER + private long keepAliveTime = Util.getMillis();
+ private boolean keepAlivePending;
+ private long keepAliveChallenge;
// CraftBukkit start - multithreaded fields // CraftBukkit start - multithreaded fields
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { private AtomicInteger chatSpamTickCount = new AtomicInteger();
// CraftBukkit end
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private int aboveGroundVehicleTickCount; private int aboveGroundVehicleTickCount;
private int receivedMovePacketCount; private int receivedMovePacketCount;
private int knownMovePacketCount; private int knownMovePacketCount;
@@ -37,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.server = server; this.server = server;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
this.server.getProfiler().push("keepAlive"); this.server.getProfiler().push("keepAlive");
@@ -47,26 +51,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (this.keepAlivePending) { - if (this.keepAlivePending) {
- this.disconnect(new TranslatableComponent("disconnect.timeout")); - this.disconnect(new TranslatableComponent("disconnect.timeout"));
- } else { - } else {
- this.keepAlivePending = true;
- this.keepAliveTime = i;
- this.keepAliveChallenge = i;
- this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge));
+ // 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();
+ long elapsedTime = currentTime - this.getLastPing(); + long elapsedTime = currentTime - this.keepAliveTime;
+ +
+ if (this.isPendingPing()) { + 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(new TranslatableComponent("disconnect.timeout", new Object[0])); + this.disconnect(new TranslatableComponent("disconnect.timeout", new Object[0]));
+ } + }
+ } else { + } else {
+ if (elapsedTime >= 15000L) { // 15 seconds + if (elapsedTime >= 15000L) { // 15 seconds
+ this.setPendingPing(true); this.keepAlivePending = true;
+ this.setLastPing(currentTime); - this.keepAliveTime = i;
+ this.setKeepAliveID(currentTime); - this.keepAliveChallenge = i;
+ this.send(new ClientboundKeepAlivePacket(this.getKeepAliveID())); + this.keepAliveTime = currentTime;
+ this.keepAliveChallenge = currentTime;
this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge));
} }
} }
+ // Paper end + // Paper end