mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-21 15:59:33 +00:00
54 lines
2.5 KiB
Diff
54 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Fri, 7 Jul 2023 16:50:06 +0800
|
|
Subject: [PATCH] Leaves protocol
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
index 5b03b63653c6b5586fb8d6ac7766beadb8ce04a9..fc9b8f6e9dbef606ade0f2376a8187ae4ca366cb 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -366,6 +366,7 @@ public abstract class PlayerList {
|
|
top.leavesmc.leaves.protocol.AppleSkinProtocol.onPlayerLoggedIn(player); // Leaves - appleskin
|
|
top.leavesmc.leaves.protocol.CarpetServerProtocol.onPlayerJoin(player); // Leaves - carpet
|
|
top.leavesmc.leaves.protocol.bladeren.MsptSyncProtocol.onPlayerJoin(player); // Leaves - mspt sync
|
|
+ top.leavesmc.leaves.protocol.bladeren.LeavesProtocol.onPlayerJoin(player); // Leaves - leaves protocol
|
|
|
|
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
|
|
|
diff --git a/src/main/java/top/leavesmc/leaves/protocol/bladeren/LeavesProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/bladeren/LeavesProtocol.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..c03d70efd5b6d0b6640c9cc9dd194746cfd19ace
|
|
--- /dev/null
|
|
+++ b/src/main/java/top/leavesmc/leaves/protocol/bladeren/LeavesProtocol.java
|
|
@@ -0,0 +1,29 @@
|
|
+package top.leavesmc.leaves.protocol.bladeren;
|
|
+
|
|
+import io.netty.buffer.Unpooled;
|
|
+import net.minecraft.network.FriendlyByteBuf;
|
|
+import net.minecraft.resources.ResourceLocation;
|
|
+import net.minecraft.server.level.ServerPlayer;
|
|
+import org.jetbrains.annotations.Contract;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import top.leavesmc.leaves.LeavesConfig;
|
|
+import top.leavesmc.leaves.util.ProtocolUtils;
|
|
+
|
|
+public class LeavesProtocol {
|
|
+
|
|
+ public static final String PROTOCOL_ID = "bladeren";
|
|
+
|
|
+ private static final ResourceLocation LAVA_RIPTIDE = id("lava_riptide");
|
|
+
|
|
+ @Contract("_ -> new")
|
|
+ public static @NotNull ResourceLocation id(String path) {
|
|
+ return new ResourceLocation(PROTOCOL_ID, path);
|
|
+ }
|
|
+
|
|
+ public static void onPlayerJoin(@NotNull ServerPlayer player) {
|
|
+ // lava riptide
|
|
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
|
+ buf.writeBoolean(LeavesConfig.lavaRiptide);
|
|
+ ProtocolUtils.sendPayloadPacket(player, LAVA_RIPTIDE, buf);
|
|
+ }
|
|
+}
|