mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@7569191 Send disguised chat for vanished players PaperMC/Paper@96fd31b Fix chunk sending when the computed time overflows (#8833) PaperMC/Paper@39aef52 Fix `Tick::addTo`/`::between` causing SOE (#8824) PaperMC/Paper@0c3311c Add Entity Body Yaw API (#8822) PaperMC/Paper@0c9ace8 Add AntiXray layered obfuscation mode (#8799) PaperMC/Paper@5eca964 [ci skip] Rebuild patches
61 lines
3.5 KiB
Diff
61 lines
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Fri, 30 Jul 2021 14:31:25 -0500
|
|
Subject: [PATCH] Purpur client support
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index 7d6d3c8556033d289fdadc489e73fba478fce41a..c2ff5d7e4a9f7477b7b207e9d3fb724137a35f11 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -268,6 +268,7 @@ public class ServerPlayer extends Player {
|
|
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
|
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
|
|
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
|
|
+ public boolean purpurClient = false; // Purpur
|
|
|
|
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
|
|
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index d04a30ee940a785b848240ae6b1aa9705deb7902..9c5f191205b5f413890e78e316a08e6f5542bdc1 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -3511,6 +3511,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
|
|
|
|
private static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support
|
|
+ private static final ResourceLocation PURPUR_CLIENT = new ResourceLocation("purpur", "client"); // Purpur
|
|
|
|
@Override
|
|
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
|
|
@@ -3535,6 +3536,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
|
|
this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
|
|
}
|
|
+ // Purpur start
|
|
+ } else if (packet.identifier.equals(PURPUR_CLIENT)) {
|
|
+ try {
|
|
+ player.purpurClient = true;
|
|
+ } catch (Exception ignore) {
|
|
+ }
|
|
+ // Purpur end
|
|
} else {
|
|
try {
|
|
byte[] data = new byte[packet.data.readableBytes()];
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 603cc41df6bcf726d996427e47876299d05d44db..09a806702d39fe4d7e7c5668afbd4168382d0854 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -3048,4 +3048,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
return this.spigot;
|
|
}
|
|
// Spigot end
|
|
+
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public boolean usesPurpurClient() {
|
|
+ return getHandle().purpurClient;
|
|
+ }
|
|
+ // Purpur end
|
|
}
|