3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00

More more more work

Dieser Commit ist enthalten in:
KennyTV 2021-06-12 14:58:17 +02:00
Ursprung 88bc74ec42
Commit 8125b3f1be
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
12 geänderte Dateien mit 73 neuen und 76 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

@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..7b2af1bd72dfbcf4e962a982940fc49b
+
+}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 9cf7adf244335ac7dccbdf11f605a8c6910f7414..04f1a6513711dde8576c9b5c2b04619c56b48d8a 100644
index 22cfa703e4f543c26151b33fe9ee1ab445d1c4fe..a32c4bd276de797f518771460083050fcddc4c5b 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;

Datei anzeigen

@ -5,10 +5,18 @@ Subject: [PATCH] Reset spawner timer when spawner event is cancelled
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index e310c1eb1108780bcff4d7ba9d49cefa2926287c..e3a69ed5ac791d8afb9c5beb924f9cf99dc0b410 100644
index e310c1eb1108780bcff4d7ba9d49cefa2926287c..12a78685848b7fd945a472902d8200ea1d50b9ec 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -190,7 +190,7 @@ public abstract class BaseSpawner {
@@ -167,6 +167,7 @@ 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();
@@ -190,7 +191,7 @@ public abstract class BaseSpawner {
((Mob) entity).spawnAnim();
}

Datei anzeigen

@ -14,28 +14,41 @@ 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 7d969b0c2a4c15c7c12ab1dd0b002a7b53cebeed..ac607a3be84bc02dedb95cab9a5eace40e33b511 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -30,7 +30,7 @@ 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 3841fe3630c090f8a468333d43caeb2b5841329d..f5429f2f1979542fd93956d2f436d20d0e3a66b8 100644
index 2f0e513c9e5d78a22e7d1e1a5aa64bb8f0f360d2..f5e74f74e32095c4ad1f8094a0dd64be8e193f0c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,7 +76,7 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
@@ -68,7 +68,7 @@
<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 0083f979933d4a9035efb992ab0a2f250a56a979..3981ba5957fdc2929d54515f2b98bb7a4611e938 100644
index 2d226fd06759ed92bf5591259fc86f34f606a3ec..e7586c325290ceb8669f9f9d430c73080a37dd05 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -290,7 +290,7 @@ 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

@ -5,16 +5,16 @@ Subject: [PATCH] Add PlayerJumpEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6a922e3522ac99a8e317a5f5f51fbb597baaf63e..f35a976de39f16d100bcbe411b64de357832c5df 100644
index acee61af1b01c7e66c3b5c7e164ddd9a88e53606..049436f5cc373f6d076a62ae2b548b0154a43b78 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1166,7 +1166,34 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -1186,7 +1186,34 @@ 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 6a922e3522ac99a8e317a5f5f51fbb597baaf63e..f35a976de39f16d100bcbe411b64de35
+ 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

@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index f35a976de39f16d100bcbe411b64de357832c5df..f0aab8639c7d8440e4d70dd096200313d7958780 100644
index 049436f5cc373f6d076a62ae2b548b0154a43b78..6049c63b4f7abde0840738638d4bf19172a01200 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2777,14 +2777,18 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -2781,14 +2781,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
@ -31,7 +31,7 @@ index f35a976de39f16d100bcbe411b64de357832c5df..f0aab8639c7d8440e4d70dd096200313
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

@ -60,10 +60,10 @@ index 0000000000000000000000000000000000000000..a5a7624f1f372a26b982836cd31cff15
+
+}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 92c5c5bbcfe364475578b6a0eddfaa85858ace8a..3429c813a5b471cdfa561bd20849a303e5aacead 100644
index 242f76a2ee2ca3d67851647bbb14cd123c378e0b..1d46187969b5792c255d0bf1966b427b905cb69c 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -70,6 +70,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -83,6 +83,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
private float averageSentPackets;
private int tickCount;
private boolean handlingFault;
@ -74,20 +74,8 @@ index 92c5c5bbcfe364475578b6a0eddfaa85858ace8a..3429c813a5b471cdfa561bd20849a303
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 1eae2999ecc57f68ac9cd1d745191cba617b0de2..9ad400b15a2eb2d80bc763de28d648e22432b8f2 100644
--- a/src/main/java/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java
@@ -39,6 +39,7 @@ 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 e56ab94ce65e81bb0383a1626a1790c43bd6920e..45c9dc9c2a580a5cd57fd4e891fbaa2b1336f5c5 100644
index c4ba069f5124ec151e05813beddf293fddc3b804..484221e5a9c246aa91e0eacef3911b0e9ecff401 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -150,6 +150,10 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@ -95,17 +83,17 @@ index e56ab94ce65e81bb0383a1626a1790c43bd6920e..45c9dc9c2a580a5cd57fd4e891fbaa2b
}
+ // 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
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d6d4e5ab7551f802dc2d3ab055d340d471ed0bc2..8a5bf0b83c1e65f07e14da0e053a64c34976b91a 100644
index 1da034d28732a5f5b9bd9b31966da21830efdc9f..ed1c57f22adc8b96012eca426ed1e7b409e7d663 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -186,6 +186,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -191,6 +191,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}

Datei anzeigen

@ -17,19 +17,23 @@ 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 f0aab8639c7d8440e4d70dd096200313d7958780..525728268f56470fdc24c4fd2f19d66943447778 100644
index 6049c63b4f7abde0840738638d4bf19172a01200..b2bbd25e5572f59add71579b676d5a4c719be239 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -221,7 +221,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -222,9 +222,9 @@ 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
@@ -252,6 +252,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
private AtomicInteger chatSpamTickCount = new AtomicInteger();
// CraftBukkit end
@@ -253,6 +253,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private int aboveGroundVehicleTickCount;
private int receivedMovePacketCount;
private int knownMovePacketCount;
@ -37,7 +41,7 @@ index f0aab8639c7d8440e4d70dd096200313d7958780..525728268f56470fdc24c4fd2f19d669
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.server = server;
@@ -338,18 +339,25 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -335,18 +336,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
this.server.getProfiler().push("keepAlive");
@ -47,26 +51,24 @@ index f0aab8639c7d8440e4d70dd096200313d7958780..525728268f56470fdc24c4fd2f19d669
- 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

Datei anzeigen

@ -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 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615f9b1ee72 100644
index 075bbc75d2e33be3a42c6c3ec279eeeba6408333..d3fe3eabf4465101760951113b23edf2ce03e57d 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -28,6 +28,7 @@ import net.minecraft.network.chat.MutableComponent;
@@ -30,6 +30,7 @@ import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket;
@ -17,7 +17,7 @@ index 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
@@ -1123,7 +1124,7 @@ public abstract class Player extends LivingEntity {
@@ -1183,7 +1184,7 @@ public abstract class Player extends LivingEntity {
int i = b0 + EnchantmentHelper.getKnockbackBonus((LivingEntity) this);
if (this.isSprinting() && flag) {
@ -26,7 +26,7 @@ index 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615
++i;
flag1 = true;
}
@@ -1198,7 +1199,7 @@ public abstract class Player extends LivingEntity {
@@ -1258,7 +1259,7 @@ public abstract class Player extends LivingEntity {
}
}
@ -35,7 +35,7 @@ index 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615
this.sweepAttack();
}
@@ -1226,15 +1227,15 @@ public abstract class Player extends LivingEntity {
@@ -1286,15 +1287,15 @@ public abstract class Player extends LivingEntity {
}
if (flag2) {
@ -54,7 +54,7 @@ index 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615
}
}
@@ -1286,7 +1287,7 @@ public abstract class Player extends LivingEntity {
@@ -1346,7 +1347,7 @@ public abstract class Player extends LivingEntity {
this.applyExhaustion(level.spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value
} else {
@ -63,7 +63,7 @@ index 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615
if (flag4) {
target.clearFire();
}
@@ -1721,6 +1722,14 @@ public abstract class Player extends LivingEntity {
@@ -1793,6 +1794,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);
}