Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
Handle new brand payload type
Dieser Commit ist enthalten in:
Ursprung
5923b7d085
Commit
5cbce366b2
@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index d1808bf9dc19fad84da5eb3b4c3d549bc624b00a..cce6febce229abdad859f183716cdefbec4a8f2e 100644
|
||||
index d1808bf9dc19fad84da5eb3b4c3d549bc624b00a..f4f410f99b475b9c2f7992a3917e3b5c2a2800ba 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -54,6 +54,8 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@ -17,11 +17,23 @@ index d1808bf9dc19fad84da5eb3b4c3d549bc624b00a..cce6febce229abdad859f183716cdefb
|
||||
|
||||
public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit
|
||||
this.server = minecraftserver;
|
||||
@@ -140,6 +142,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -109,6 +111,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
|
||||
@Override
|
||||
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
|
||||
+ // Paper start - handle brand payload packet
|
||||
+ if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload brandPayload) {
|
||||
+ this.clientBrandName = brandPayload.brand();
|
||||
+ }
|
||||
+ // Paper end - handle brand payload
|
||||
if (!(packet.payload() instanceof ServerboundCustomPayloadPacket.UnknownPayload)) {
|
||||
return;
|
||||
}
|
||||
@@ -140,6 +147,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
try {
|
||||
byte[] data = new byte[payload.readableBytes()];
|
||||
payload.readBytes(data);
|
||||
+ // Paper start - Brand support
|
||||
+ // Paper start - Brand support - Retain this incase upstream decides to 'break' the new mechanism in favour of backwards compat...
|
||||
+ if (identifier.equals(MINECRAFT_BRAND)) {
|
||||
+ try {
|
||||
+ this.clientBrandName = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.copiedBuffer(data)).readUtf(256);
|
||||
@ -33,7 +45,7 @@ index d1808bf9dc19fad84da5eb3b4c3d549bc624b00a..cce6febce229abdad859f183716cdefb
|
||||
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
|
||||
} catch (Exception ex) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
|
||||
@@ -149,6 +160,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -149,6 +165,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
|
||||
}
|
||||
|
||||
|
@ -37,10 +37,10 @@ index 4a4002b666c70c7065cad0743377cd13e443aa37..576fe4a114c7ad0edde3ce7b2cf1b397
|
||||
// Paper start - replace player chunk loader
|
||||
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));
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index cce6febce229abdad859f183716cdefbec4a8f2e..a38ad79aaf4ef5a928370152bdc5c0cc4c59d93e 100644
|
||||
index f4f410f99b475b9c2f7992a3917e3b5c2a2800ba..6e9062656a3b137b3589c43805c8f1d1105ba4db 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -305,6 +305,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -310,6 +310,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
|
||||
// CraftBukkit end
|
||||
|
||||
|
@ -88,7 +88,7 @@ index c68bac4727f6b2ca95fc8c438303097af14286f2..bb629ec263959c8268de88ca807bddb6
|
||||
return Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason);
|
||||
}, true);
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index a38ad79aaf4ef5a928370152bdc5c0cc4c59d93e..2f39206c85dbf4e34dca591d1e0ab9f372730013 100644
|
||||
index 6e9062656a3b137b3589c43805c8f1d1105ba4db..7b57657b204204e2a1971c0e1c63812fea14c496 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -95,7 +95,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@ -100,7 +100,7 @@ index a38ad79aaf4ef5a928370152bdc5c0cc4c59d93e..2f39206c85dbf4e34dca591d1e0ab9f3
|
||||
});
|
||||
// Paper endg
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -131,7 +131,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
|
||||
@ -109,7 +109,7 @@ index a38ad79aaf4ef5a928370152bdc5c0cc4c59d93e..2f39206c85dbf4e34dca591d1e0ab9f3
|
||||
}
|
||||
} else if (identifier.equals(CUSTOM_UNREGISTER)) {
|
||||
try {
|
||||
@@ -136,7 +136,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -141,7 +141,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
|
||||
@ -118,7 +118,7 @@ index a38ad79aaf4ef5a928370152bdc5c0cc4c59d93e..2f39206c85dbf4e34dca591d1e0ab9f3
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@@ -154,7 +154,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -159,7 +159,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
|
||||
} catch (Exception ex) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
|
||||
@ -127,7 +127,7 @@ index a38ad79aaf4ef5a928370152bdc5c0cc4c59d93e..2f39206c85dbf4e34dca591d1e0ab9f3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -182,7 +182,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, (BlockableEventLoop) this.server);
|
||||
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
|
||||
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.playerProfile().getName());
|
||||
@ -136,7 +136,7 @@ index a38ad79aaf4ef5a928370152bdc5c0cc4c59d93e..2f39206c85dbf4e34dca591d1e0ab9f3
|
||||
}
|
||||
// Paper start
|
||||
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.getAction().ordinal()];
|
||||
@@ -197,7 +197,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -202,7 +202,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
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
|
||||
@ -145,7 +145,7 @@ index a38ad79aaf4ef5a928370152bdc5c0cc4c59d93e..2f39206c85dbf4e34dca591d1e0ab9f3
|
||||
}
|
||||
} else {
|
||||
if (elapsedTime >= 15000L) { // 15 seconds
|
||||
@@ -250,18 +250,28 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -255,18 +255,28 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@ -178,7 +178,7 @@ index a38ad79aaf4ef5a928370152bdc5c0cc4c59d93e..2f39206c85dbf4e34dca591d1e0ab9f3
|
||||
// Paper end
|
||||
// CraftBukkit start - fire PlayerKickEvent
|
||||
if (this.processedDisconnect) {
|
||||
@@ -271,7 +281,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -276,7 +286,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
Waitable waitable = new Waitable() {
|
||||
@Override
|
||||
protected Object evaluate() {
|
||||
@ -187,7 +187,7 @@ index a38ad79aaf4ef5a928370152bdc5c0cc4c59d93e..2f39206c85dbf4e34dca591d1e0ab9f3
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -290,7 +300,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -295,7 +305,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
|
||||
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
|
||||
|
||||
|
@ -17,7 +17,7 @@ index 1d8328bc7acde64f3a0cff4d20bdca44baddd409..a75377cf94c70011a967e7ede93f903a
|
||||
public boolean isRealPlayer; // Paper
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index 2f39206c85dbf4e34dca591d1e0ab9f372730013..ff01c0e7f1d84a4a6e2684446ef1172754ddc570 100644
|
||||
index 7b57657b204204e2a1971c0e1c63812fea14c496..231150bac0ae61e9722c2cdfd70d6f7d254681e4 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -77,6 +77,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@ -32,7 +32,7 @@ index 2f39206c85dbf4e34dca591d1e0ab9f372730013..ff01c0e7f1d84a4a6e2684446ef11727
|
||||
if (this.isSingleplayerOwner()) {
|
||||
ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out");
|
||||
this.server.halt(false);
|
||||
@@ -310,7 +315,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -315,7 +320,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
// Do not kick the player
|
||||
return;
|
||||
}
|
||||
@ -40,7 +40,7 @@ index 2f39206c85dbf4e34dca591d1e0ab9f372730013..ff01c0e7f1d84a4a6e2684446ef11727
|
||||
// Send the possibly modified leave message
|
||||
final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
|
||||
// CraftBukkit end
|
||||
@@ -319,7 +323,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -324,7 +328,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
|
||||
this.connection.disconnect(ichatbasecomponent);
|
||||
}));
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren