mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-04 01:39:54 +01:00
ef0e5a642d
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API 48c0c547 PR-786: Add methods to get sounds from entities CraftBukkit Changes: 5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event 4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation 4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API e5d6a9bbf PR-1100: Add methods to get sounds from entities b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta Spigot Changes: 4c157bb4 Rebuild patches
76 lines
4.0 KiB
Diff
76 lines
4.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: DigitalRegent <misterwener@gmail.com>
|
|
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 c59e90ba0de83eeda3719b6303bee9796b4a1af0..da6a0171bd63ac68635de1c23fc9eafa732503bd 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -298,6 +298,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.lastSeenMessagesValidator = new LastSeenMessagesValidator();
|
|
@@ -3453,6 +3455,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());
|
|
@@ -3480,6 +3484,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);
|
|
@@ -3489,6 +3502,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 0fda8c27c717bd030b826c5c7267b880f9d1f6b9..10e1be2349df779b911848f70e4b8f0e351b1de7 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -2681,6 +2681,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;
|