9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-28 03:19:22 +00:00

Make appleskin protocol check channel

This commit is contained in:
violetc
2023-09-17 13:20:26 +08:00
parent a3ce3bced8
commit 2baf8392ee

View File

@@ -56,10 +56,10 @@ index 3417c4184f7a9516c3910d4ccf8f139ba96e3224..47b27712c6ed11fc5c2cd7de04482870
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
diff --git a/src/main/java/top/leavesmc/leaves/protocol/AppleSkinProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/AppleSkinProtocol.java
new file mode 100644
index 0000000000000000000000000000000000000000..6f0b2140df822dc86e360837780768f2f5203041
index 0000000000000000000000000000000000000000..7b8f543a6f5b1671d3a9c3feaa831c058ed5920f
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/AppleSkinProtocol.java
@@ -0,0 +1,95 @@
@@ -0,0 +1,99 @@
+package top.leavesmc.leaves.protocol;
+
+import io.netty.buffer.Unpooled;
@@ -132,6 +132,10 @@ index 0000000000000000000000000000000000000000..6f0b2140df822dc86e360837780768f2
+ public static void tick() {
+ if (LeavesConfig.appleskinProtocol) {
+ for (ServerPlayer player : players) {
+ if (!player.getBukkitEntity().getListeningPluginChannels().contains(SATURATION_KEY.toString())) {
+ continue;
+ }
+
+ FoodData data = player.getFoodData();
+
+ float saturation = data.getSaturationLevel();