75 lines
3.6 KiB
Diff
75 lines
3.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrHua269 <novau233@163.com>
|
|
Date: Sat, 27 Jan 2024 13:38:56 +0000
|
|
Subject: [PATCH] Do not process any packet if the leaves protocol supports are
|
|
disabled
|
|
|
|
|
|
diff --git a/src/main/java/top/leavesmc/leaves/protocol/PcaSyncProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/PcaSyncProtocol.java
|
|
index ebd28033ddf0fe6a354585dc2818a9b481d90ed4..33c7221a1f33cdb81dfac92fc3332f92cf3cd2d9 100644
|
|
--- a/src/main/java/top/leavesmc/leaves/protocol/PcaSyncProtocol.java
|
|
+++ b/src/main/java/top/leavesmc/leaves/protocol/PcaSyncProtocol.java
|
|
@@ -1,5 +1,6 @@
|
|
package top.leavesmc.leaves.protocol;
|
|
|
|
+import me.earthme.luminol.LuminolConfig;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.nbt.CompoundTag;
|
|
import net.minecraft.network.FriendlyByteBuf;
|
|
diff --git a/src/main/java/top/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java
|
|
index de92ebdf9d51a4f9a58a7650b09f070e51710ef0..b309963dcf41f16a7b53e4cc2816975523ccba55 100644
|
|
--- a/src/main/java/top/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java
|
|
+++ b/src/main/java/top/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java
|
|
@@ -35,6 +35,9 @@ public class MsptSyncProtocol {
|
|
|
|
@ProtocolHandler.Init
|
|
public static void init() {
|
|
+ if (!LuminolConfig.msptSyncProtocol){
|
|
+ return;
|
|
+ }
|
|
BladerenProtocol.registerFeature("mspt_sync", (player, compoundTag) -> {
|
|
if (compoundTag.getString("Value").equals("true")) {
|
|
onPlayerSubmit(player);
|
|
diff --git a/src/main/java/top/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java b/src/main/java/top/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java
|
|
index 4c2aa74795b0883f280eaa721a83ea6891ffdab2..19277aa7b9bd16b3e70d581d38a4c28e60165f65 100644
|
|
--- a/src/main/java/top/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java
|
|
+++ b/src/main/java/top/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java
|
|
@@ -2,6 +2,7 @@ package top.leavesmc.leaves.protocol.syncmatica;
|
|
|
|
import com.mojang.authlib.GameProfile;
|
|
import io.netty.buffer.Unpooled;
|
|
+import me.earthme.luminol.LuminolConfig;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.network.FriendlyByteBuf;
|
|
import net.minecraft.network.chat.Component;
|
|
@@ -68,6 +69,9 @@ public class CommunicationManager {
|
|
|
|
@ProtocolHandler.PlayerJoin
|
|
public static void onPlayerJoin(ServerPlayer player) {
|
|
+ if (!LuminolConfig.syncmaticaProtocol){
|
|
+ return;
|
|
+ }
|
|
final ExchangeTarget newPlayer = player.connection.exchangeTarget;
|
|
final VersionHandshakeServer hi = new VersionHandshakeServer(newPlayer);
|
|
playerMap.put(newPlayer, player);
|
|
@@ -78,6 +82,9 @@ public class CommunicationManager {
|
|
|
|
@ProtocolHandler.PlayerLeave
|
|
public static void onPlayerLeave(ServerPlayer player) {
|
|
+ if (!LuminolConfig.syncmaticaProtocol){
|
|
+ return;
|
|
+ }
|
|
final ExchangeTarget oldPlayer = player.connection.exchangeTarget;
|
|
final Collection<Exchange> potentialMessageTarget = oldPlayer.getExchanges();
|
|
if (potentialMessageTarget != null) {
|
|
@@ -92,6 +99,9 @@ public class CommunicationManager {
|
|
|
|
@ProtocolHandler.PayloadReceiver(payload = LeavesProtocolManager.LeavesPayload.class, ignoreId = true, payloadId = "")
|
|
public static void onPacketGet(ServerPlayer player, LeavesProtocolManager.LeavesPayload payload) {
|
|
+ if (!LuminolConfig.syncmaticaProtocol){
|
|
+ return;
|
|
+ }
|
|
onPacket(player.connection.exchangeTarget, payload.id(), payload.data());
|
|
}
|
|
|