summaryrefslogtreecommitdiffhomepage
path: root/patches/unapplied/server/0456-Brand-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/unapplied/server/0456-Brand-support.patch')
-rw-r--r--patches/unapplied/server/0456-Brand-support.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/patches/unapplied/server/0456-Brand-support.patch b/patches/unapplied/server/0456-Brand-support.patch
new file mode 100644
index 0000000000..a982bee0d0
--- /dev/null
+++ b/patches/unapplied/server/0456-Brand-support.patch
@@ -0,0 +1,75 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: DigitalRegent <[email protected]>
+Date: Sat, 11 Apr 2020 13:10:58 +0200
+Subject: [PATCH] Brand support
+
+
+diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+index b4f17b9c195081b54d79494d9afaf0da21f292c0..139daac1cc7359be4eebf73b2a578e07c183c750 100644
+--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+@@ -302,6 +302,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
+ private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
+ private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper
+
++ private String clientBrandName = null; // Paper - Brand name
++
+ public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
+ this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
+ this.lastSeenMessages = new LastSeenMessagesValidator(20);
+@@ -3345,6 +3347,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
+ private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
+ private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
+
++ private static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support
++
+ @Override
+ public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
+ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
+@@ -3372,6 +3376,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
+ try {
+ byte[] data = new byte[packet.data.readableBytes()];
+ packet.data.readBytes(data);
++ // Paper start - Brand support
++ if (packet.identifier.equals(MINECRAFT_BRAND)) {
++ try {
++ this.clientBrandName = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.copiedBuffer(data)).readUtf(256);
++ } catch (StringIndexOutOfBoundsException ex) {
++ this.clientBrandName = "illegal";
++ }
++ }
++ // Paper end
+ this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
+ } catch (Exception ex) {
+ ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
+@@ -3381,6 +3394,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
+
+ }
+
++ // Paper start - brand support
++ public String getClientBrandName() {
++ return clientBrandName;
++ }
++ // Paper end
++
+ public final boolean isDisconnected() {
+ return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
+ }
+diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+index ef7078780b4829e61048233b60150b26f6a9b792..65d311d01b9d18627f20de5dc89585a9b2055367 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+@@ -2975,6 +2975,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
+ // Paper end
+ };
+
++ // Paper start - brand support
++ @Override
++ public String getClientBrandName() {
++ return getHandle().connection != null ? getHandle().connection.getClientBrandName() : null;
++ }
++ // Paper end
++
+ public Player.Spigot spigot()
+ {
+ return this.spigot;