13
0
geforkt von Mirrors/Paper

More more more work

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-06-12 14:58:17 +02:00
Ursprung 21c7efe18c
Commit 3a483825e0
11 geänderte Dateien mit 52 neuen und 55 gelöschten Zeilen

Datei anzeigen

@ -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?

Datei anzeigen

@ -8,13 +8,13 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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;
if (this.player.isOnGround() && !packet.isOnGround() && flag) {
- this.player.jumpFromGround();
+ // 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 to = player.getLocation().clone(); // Start off the To location as the Players current location.
+
@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.player.jumpFromGround();
+ } else {
+ 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;
+ }
+ // Paper end

Datei anzeigen

@ -74,18 +74,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public Connection(PacketFlow 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@ -95,8 +83,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // Paper start - NetworkClient implementation
+ this.getNetworkManager().protocolVersion = packet.getProtocolVersion();
+ this.getNetworkManager().virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(packet.hostName, packet.port);
+ this.connection.protocolVersion = packet.getProtocolVersion();
+ this.connection.virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(packet.hostName, packet.port);
+ // Paper end
}

Datei anzeigen

@ -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
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/pom.xml
+++ b/pom.xml
@@ -0,0 +0,0 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
- <scope>runtime</scope>
+ <scope>compile</scope>
</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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
@ -34,8 +47,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class SpigotConfig
private static void playerSample()
{
playerSample = getInt( "settings.sample-count", 12 );
- System.out.println( "Server Ping Player Sample Count: " + playerSample );
SpigotConfig.playerSample = SpigotConfig.getInt( "settings.sample-count", 12 );
- 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
}

Datei anzeigen

@ -8,6 +8,14 @@ diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
((Mob) entity).spawnAnim();
}

Datei anzeigen

@ -18,7 +18,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.keepAlivePending = false;
} else if (!this.isSingleplayerOwner()) {
+ // Paper start - This needs to be handled on the main thread for plugins
+ server.scheduleOnMain(() -> {
+ server.submit(() -> {
this.disconnect(new TranslatableComponent("disconnect.timeout"));
+ });
+ // Paper end

Datei anzeigen

@ -20,16 +20,20 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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;
public ServerPlayer player;
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 = 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 long keepAliveChallenge; private void setKeepAliveID(long keepAliveID) { this.keepAliveChallenge = keepAliveID;}; private long getKeepAliveID() {return this.keepAliveChallenge; }; // 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 keepAliveTime = Util.getMillis();
+ private boolean keepAlivePending;
+ private long keepAliveChallenge;
// 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 receivedMovePacketCount;
private int knownMovePacketCount;
@ -37,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
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");
@ -47,26 +51,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (this.keepAlivePending) {
- this.disconnect(new TranslatableComponent("disconnect.timeout"));
- } 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
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2
+ 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
+ ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
+ this.disconnect(new TranslatableComponent("disconnect.timeout", new Object[0]));
+ }
+ } else {
+ if (elapsedTime >= 15000L) { // 15 seconds
+ this.setPendingPing(true);
+ this.setLastPing(currentTime);
+ this.setKeepAliveID(currentTime);
+ this.send(new ClientboundKeepAlivePacket(this.getKeepAliveID()));
this.keepAlivePending = true;
- this.keepAliveTime = i;
- this.keepAliveChallenge = i;
+ this.keepAliveTime = currentTime;
+ this.keepAliveChallenge = currentTime;
this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge));
}
}
+ // Paper end