mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-23 00:49:31 +00:00
* Unify comment format * More configurable * Remove one extra execute mid-tick task call in level tick when PWT is disabled This may cause extremely rare, weird, strange, magic, mysterious issues with plugins, or potentially more. One example is that it may cause boss mob duplication issue when `ONE MOB ONLY` was enabled in plugin SupremeBosses
77 lines
4.4 KiB
Diff
77 lines
4.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: hayanesuru <hayanesuru@outlook.jp>
|
|
Date: Tue, 6 May 2025 17:44:16 +0900
|
|
Subject: [PATCH] Protocol Core
|
|
|
|
|
|
diff --git a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
|
|
index 56fd1ed7ccaf96e7eedea60fbdbf7f934939d563..d2f522ea6d0a209496848af073c9af1c45d6b6ce 100644
|
|
--- a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
|
|
+++ b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
|
|
@@ -46,6 +46,12 @@ public interface CustomPacketPayload {
|
|
return;
|
|
}
|
|
// Leaves end - protocol core
|
|
+ // Leaf start - Protocol core
|
|
+ if (value instanceof org.dreeam.leaf.protocol.LeafCustomPayload payload) {
|
|
+ org.dreeam.leaf.protocol.Protocols.write(buffer, payload);
|
|
+ return;
|
|
+ }
|
|
+ // Leaf end - Protocol core
|
|
this.writeCap(buffer, value.type(), value);
|
|
}
|
|
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
|
index d3c6f7f78d895cca4abe1da79abb595c51449afc..7306a3273adf5bfa8ebdec42b7aedf3656fb5850 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -1802,6 +1802,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(tickCount); // Leaves - protocol
|
|
+ org.dreeam.leaf.protocol.Protocols.tickServer(this); // Leaf - Protocol core
|
|
|
|
for (int i = 0; i < this.tickables.size(); i++) {
|
|
this.tickables.get(i).run();
|
|
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
|
index b8c59df25999183985538ade4e58e01eb9b5b586..1ac4ad7e9adf9840951d6d22c3a49e072eb3183f 100644
|
|
--- a/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -810,6 +810,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
|
}
|
|
}
|
|
// Purpur end - Ridables
|
|
+ org.dreeam.leaf.protocol.Protocols.tickPlayer(this); // Leaf - Protocol core
|
|
}
|
|
|
|
private void updatePlayerAttributes() {
|
|
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
index f6aec052d8c76df7cb0b734893a857832a4d29b1..751a73384a6c4c57bf100c040da807e6011297cc 100644
|
|
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
@@ -190,6 +190,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
|
|
|
net.minecraft.network.protocol.PacketUtils.ensureRunningOnSameThread(packet, this, this.server);
|
|
|
|
+ // Leaf start - Protocol core
|
|
+ if (this instanceof ServerGamePacketListenerImpl gamePacketListener) {
|
|
+ org.dreeam.leaf.protocol.Protocols.handle(gamePacketListener.player, discardedPayload);
|
|
+ }
|
|
+ // Leaf end - Protocol core
|
|
+
|
|
final net.minecraft.resources.ResourceLocation identifier = packet.payload().type().id();
|
|
final byte[] data = discardedPayload.data();
|
|
try {
|
|
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
|
index e0ca8832b08009bfd6ad906143acd10400b96eb6..178085c71bb5fee0818a8ce88bf1e36a107a4dd1 100644
|
|
--- a/net/minecraft/server/players/PlayerList.java
|
|
+++ b/net/minecraft/server/players/PlayerList.java
|
|
@@ -689,6 +689,7 @@ public abstract class PlayerList {
|
|
}
|
|
public @Nullable net.kyori.adventure.text.Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) {
|
|
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerLeave(player); // Leaves - protocol
|
|
+ org.dreeam.leaf.protocol.Protocols.disconnected(player); // Leaf - Protocol core
|
|
// Paper end - Fix kick event leave message not being sent
|
|
org.purpurmc.purpur.task.BossBarTask.removeFromAll(player.getBukkitEntity()); // Purpur - Implement TPSBar
|
|
net.minecraft.server.network.ServerGamePacketListenerImpl.afkCooldown.remove(player.getBukkitEntity().getUniqueId()); // Leaf - Improve Purpur AFK system
|