From 95d589adc277597b4337514bb3d61bfecdfa9b86 Mon Sep 17 00:00:00 2001 From: 17TheWord <17theword@gmail.com> Date: Wed, 14 Aug 2024 01:14:56 +0800 Subject: [PATCH 01/55] :sparkles: Add fabric, forge and spigot events --- .../FabricServerCommandMessageEvent.java | 9 +++ ...bricServerLivingEntityAfterDeathEvent.java | 10 ++++ .../fabric/FabricServerMessageEvent.java | 9 +++ ...icServerPlayConnectionDisconnectEvent.java | 9 +++ .../FabricServerPlayConnectionJoinEvent.java | 9 +++ .../event/fabric/FabricServerPlayer.java | 40 +++++++++++++ .../event/forge/ForgeCommandEvent.java | 9 +++ .../event/forge/ForgePlayerDeathEvent.java | 10 ++++ .../event/forge/ForgePlayerLoggedInEvent.java | 9 +++ .../forge/ForgePlayerLoggedOutEvent.java | 9 +++ .../event/forge/ForgeServerChatEvent.java | 10 ++++ .../event/forge/ForgeServerPlayer.java | 45 ++++++++++++++ .../spigot/SpigotAsyncPlayerChatEvent.java | 10 ++++ .../queqiao/event/spigot/SpigotPlayer.java | 58 +++++++++++++++++++ .../SpigotPlayerCommandPreprocessEvent.java | 10 ++++ .../event/spigot/SpigotPlayerDeathEvent.java | 10 ++++ .../event/spigot/SpigotPlayerJoinEvent.java | 11 ++++ .../event/spigot/SpigotPlayerQuitEvent.java | 10 ++++ 18 files changed, 287 insertions(+) create mode 100644 fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerCommandMessageEvent.java create mode 100644 fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerLivingEntityAfterDeathEvent.java create mode 100644 fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerMessageEvent.java create mode 100644 fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayConnectionDisconnectEvent.java create mode 100644 fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayConnectionJoinEvent.java create mode 100644 fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayer.java create mode 100644 forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeCommandEvent.java create mode 100644 forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerDeathEvent.java create mode 100644 forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerLoggedInEvent.java create mode 100644 forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerLoggedOutEvent.java create mode 100644 forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeServerChatEvent.java create mode 100644 forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeServerPlayer.java create mode 100644 spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotAsyncPlayerChatEvent.java create mode 100644 spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayer.java create mode 100644 spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerCommandPreprocessEvent.java create mode 100644 spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerDeathEvent.java create mode 100644 spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerJoinEvent.java create mode 100644 spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerQuitEvent.java diff --git a/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerCommandMessageEvent.java b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerCommandMessageEvent.java new file mode 100644 index 0000000..0c02d64 --- /dev/null +++ b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerCommandMessageEvent.java @@ -0,0 +1,9 @@ +package com.github.theword.queqiao.event.fabric; + +import com.github.theword.queqiao.tool.event.BaseCommandEvent; + +public class FabricServerCommandMessageEvent extends BaseCommandEvent { + public FabricServerCommandMessageEvent(String messageId, FabricServerPlayer player, String message) { + super("ServerCommandMessageEvent", messageId, player, message); + } +} \ No newline at end of file diff --git a/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerLivingEntityAfterDeathEvent.java b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerLivingEntityAfterDeathEvent.java new file mode 100644 index 0000000..524dfe3 --- /dev/null +++ b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerLivingEntityAfterDeathEvent.java @@ -0,0 +1,10 @@ +package com.github.theword.queqiao.event.fabric; + +import com.github.theword.queqiao.tool.event.BasePlayerDeathEvent; + +public class FabricServerLivingEntityAfterDeathEvent extends BasePlayerDeathEvent { + + public FabricServerLivingEntityAfterDeathEvent(String messageId, FabricServerPlayer player, String message) { + super("ServerLivingEntityAfterDeathEvent", messageId, player, message); + } +} \ No newline at end of file diff --git a/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerMessageEvent.java b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerMessageEvent.java new file mode 100644 index 0000000..4f40953 --- /dev/null +++ b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerMessageEvent.java @@ -0,0 +1,9 @@ +package com.github.theword.queqiao.event.fabric; + +import com.github.theword.queqiao.tool.event.BasePlayerChatEvent; + +public class FabricServerMessageEvent extends BasePlayerChatEvent { + public FabricServerMessageEvent(String messageId, FabricServerPlayer player, String message) { + super("ServerMessageEvent", messageId, player, message); + } +} \ No newline at end of file diff --git a/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayConnectionDisconnectEvent.java b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayConnectionDisconnectEvent.java new file mode 100644 index 0000000..60812ec --- /dev/null +++ b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayConnectionDisconnectEvent.java @@ -0,0 +1,9 @@ +package com.github.theword.queqiao.event.fabric; + +import com.github.theword.queqiao.tool.event.BasePlayerQuitEvent; + +public class FabricServerPlayConnectionDisconnectEvent extends BasePlayerQuitEvent { + public FabricServerPlayConnectionDisconnectEvent(FabricServerPlayer player) { + super("ServerPlayConnectionDisconnectEvent", player); + } +} \ No newline at end of file diff --git a/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayConnectionJoinEvent.java b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayConnectionJoinEvent.java new file mode 100644 index 0000000..9a25168 --- /dev/null +++ b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayConnectionJoinEvent.java @@ -0,0 +1,9 @@ +package com.github.theword.queqiao.event.fabric; + +import com.github.theword.queqiao.tool.event.BasePlayerJoinEvent; + +public class FabricServerPlayConnectionJoinEvent extends BasePlayerJoinEvent { + public FabricServerPlayConnectionJoinEvent(FabricServerPlayer player) { + super("ServerPlayConnectionJoinEvent", player); + } +} \ No newline at end of file diff --git a/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayer.java b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayer.java new file mode 100644 index 0000000..7b3be08 --- /dev/null +++ b/fabric/origin/src/main/java/com/github/theword/queqiao/event/fabric/FabricServerPlayer.java @@ -0,0 +1,40 @@ +package com.github.theword.queqiao.event.fabric; + +import com.github.theword.queqiao.tool.event.BasePlayer; +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class FabricServerPlayer extends BasePlayer { + private String ip; + @SerializedName("display_name") + private String displayName; + @SerializedName("movement_speed") + private float movementSpeed; + + @SerializedName("block_x") + private int blockX; + @SerializedName("block_y") + private int blockY; + @SerializedName("block_z") + private int blockZ; + + @SerializedName("is_creative") + private boolean isCreative; + @SerializedName("is_spectator") + private boolean isSpectator; + @SerializedName("is_sneaking") + private boolean isSneaking; + @SerializedName("is_sleeping") + private boolean isSleeping; + @SerializedName("is_climbing") + private boolean isClimbing; + @SerializedName("is_swimming") + private boolean isSwimming; +} \ No newline at end of file diff --git a/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeCommandEvent.java b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeCommandEvent.java new file mode 100644 index 0000000..0c474b2 --- /dev/null +++ b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeCommandEvent.java @@ -0,0 +1,9 @@ +package com.github.theword.queqiao.event.forge; + +import com.github.theword.queqiao.tool.event.BaseCommandEvent; + +public class ForgeCommandEvent extends BaseCommandEvent { + public ForgeCommandEvent(String messageId, ForgeServerPlayer player, String command) { + super("CommandEvent", messageId, player, command); + } +} \ No newline at end of file diff --git a/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerDeathEvent.java b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerDeathEvent.java new file mode 100644 index 0000000..1e091a6 --- /dev/null +++ b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerDeathEvent.java @@ -0,0 +1,10 @@ +package com.github.theword.queqiao.event.forge; + +import com.github.theword.queqiao.tool.event.BasePlayerDeathEvent; + +public class ForgePlayerDeathEvent extends BasePlayerDeathEvent { + + public ForgePlayerDeathEvent(String messageId, ForgeServerPlayer player, String message) { + super("PlayerDeathEvent", messageId, player, message); + } +} \ No newline at end of file diff --git a/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerLoggedInEvent.java b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerLoggedInEvent.java new file mode 100644 index 0000000..2aaf58e --- /dev/null +++ b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerLoggedInEvent.java @@ -0,0 +1,9 @@ +package com.github.theword.queqiao.event.forge; + +import com.github.theword.queqiao.tool.event.BasePlayerJoinEvent; + +public final class ForgePlayerLoggedInEvent extends BasePlayerJoinEvent { + public ForgePlayerLoggedInEvent(ForgeServerPlayer player) { + super("PlayerLoggedInEvent", player); + } +} \ No newline at end of file diff --git a/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerLoggedOutEvent.java b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerLoggedOutEvent.java new file mode 100644 index 0000000..6f0fc29 --- /dev/null +++ b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgePlayerLoggedOutEvent.java @@ -0,0 +1,9 @@ +package com.github.theword.queqiao.event.forge; + +import com.github.theword.queqiao.tool.event.BasePlayerQuitEvent; + +public final class ForgePlayerLoggedOutEvent extends BasePlayerQuitEvent { + public ForgePlayerLoggedOutEvent(ForgeServerPlayer player) { + super("PlayerLoggedOutEvent", player); + } +} \ No newline at end of file diff --git a/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeServerChatEvent.java b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeServerChatEvent.java new file mode 100644 index 0000000..31aa1d6 --- /dev/null +++ b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeServerChatEvent.java @@ -0,0 +1,10 @@ +package com.github.theword.queqiao.event.forge; + +import com.github.theword.queqiao.tool.event.BasePlayerChatEvent; + +public final class ForgeServerChatEvent extends BasePlayerChatEvent { + public ForgeServerChatEvent(String messageId, ForgeServerPlayer player, String message) { + super("ServerChatEvent", messageId, player, message); + } + +} \ No newline at end of file diff --git a/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeServerPlayer.java b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeServerPlayer.java new file mode 100644 index 0000000..e2c222b --- /dev/null +++ b/forge/origin/src/main/java/com/github/theword/queqiao/event/forge/ForgeServerPlayer.java @@ -0,0 +1,45 @@ +package com.github.theword.queqiao.event.forge; + +import com.github.theword.queqiao.tool.event.BasePlayer; +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class ForgeServerPlayer extends BasePlayer { + + @SerializedName("display_name") + private String displayName; + + @SerializedName("ip_address") + private String ipAddress; + + private float speed; + @SerializedName("flying_speed") + private float flyingSpeed; + + @SerializedName("is_flying") + private boolean isFlying; + + @SerializedName("is_swimming") + private boolean isSwimming; + @SerializedName("is_sleeping") + private boolean isSleeping; + @SerializedName("is_blocking") + private boolean isBlocking; + + @SerializedName("game_mode") + private String gameMode; + + @SerializedName("block_x") + private int blockX; + @SerializedName("block_y") + private int blockY; + @SerializedName("block_z") + private int blockZ; +} \ No newline at end of file diff --git a/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotAsyncPlayerChatEvent.java b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotAsyncPlayerChatEvent.java new file mode 100644 index 0000000..c306f6f --- /dev/null +++ b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotAsyncPlayerChatEvent.java @@ -0,0 +1,10 @@ +package com.github.theword.queqiao.event.spigot; + +import com.github.theword.queqiao.tool.event.BasePlayerChatEvent; + +public class SpigotAsyncPlayerChatEvent extends BasePlayerChatEvent { + + public SpigotAsyncPlayerChatEvent(SpigotPlayer player, String message) { + super("AsyncPlayerChatEvent", "", player, message); + } +} \ No newline at end of file diff --git a/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayer.java b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayer.java new file mode 100644 index 0000000..0bce464 --- /dev/null +++ b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayer.java @@ -0,0 +1,58 @@ +package com.github.theword.queqiao.event.spigot; + +import com.github.theword.queqiao.tool.event.BasePlayer; +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + + +@Data +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SpigotPlayer extends BasePlayer { + + @SerializedName("display_name") + private String displayName; + @SerializedName("player_list_name") + private String playerListName; + private String address; + + @SerializedName("is_health_scaled") + private boolean isHealthScaled; + @SerializedName("health_scale") + private double healthScale; + + private float exp; + + @SerializedName("total_exp") + private int totalExp; + private int level; + + private String locale; + + private int ping; + @SerializedName("player_time") + private long playerTime; + @SerializedName("is_player_time_relative") + private boolean isPlayerTimeRelative; + @SerializedName("player_time_offset") + private long playerTimeOffset; + @SerializedName("walk_speed") + private float walkSpeed; + @SerializedName("fly_speed") + private float flySpeed; + @SerializedName("allow_flight") + private boolean allowFlight; + @SerializedName("is_sprinting") + private boolean isSprinting; + @SerializedName("is_sneaking") + private boolean isSneaking; + @SerializedName("is_flying") + private boolean isFlying; + @SerializedName("is_op") + private boolean isOp; + +} \ No newline at end of file diff --git a/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerCommandPreprocessEvent.java b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerCommandPreprocessEvent.java new file mode 100644 index 0000000..faf21b0 --- /dev/null +++ b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerCommandPreprocessEvent.java @@ -0,0 +1,10 @@ +package com.github.theword.queqiao.event.spigot; + +import com.github.theword.queqiao.tool.event.BaseCommandEvent; + +public class SpigotPlayerCommandPreprocessEvent extends BaseCommandEvent { + + public SpigotPlayerCommandPreprocessEvent(SpigotPlayer player, String command) { + super("PlayerCommandPreprocessEvent", "", player, command); + } +} \ No newline at end of file diff --git a/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerDeathEvent.java b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerDeathEvent.java new file mode 100644 index 0000000..186709c --- /dev/null +++ b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerDeathEvent.java @@ -0,0 +1,10 @@ +package com.github.theword.queqiao.event.spigot; + +import com.github.theword.queqiao.tool.event.BasePlayerDeathEvent; + +public class SpigotPlayerDeathEvent extends BasePlayerDeathEvent { + + public SpigotPlayerDeathEvent(SpigotPlayer player, String message) { + super("PlayerDeathEvent", "", player, message); + } +} \ No newline at end of file diff --git a/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerJoinEvent.java b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerJoinEvent.java new file mode 100644 index 0000000..6f60c71 --- /dev/null +++ b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerJoinEvent.java @@ -0,0 +1,11 @@ +package com.github.theword.queqiao.event.spigot; + +import com.github.theword.queqiao.tool.event.BasePlayerJoinEvent; + +public class SpigotPlayerJoinEvent extends BasePlayerJoinEvent { + + public SpigotPlayerJoinEvent(SpigotPlayer player) { + super("PlayerJoinEvent", player); + } + +} \ No newline at end of file diff --git a/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerQuitEvent.java b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerQuitEvent.java new file mode 100644 index 0000000..f9810ed --- /dev/null +++ b/spigot/origin/src/main/java/com/github/theword/queqiao/event/spigot/SpigotPlayerQuitEvent.java @@ -0,0 +1,10 @@ +package com.github.theword.queqiao.event.spigot; + +import com.github.theword.queqiao.tool.event.BasePlayerQuitEvent; + +public class SpigotPlayerQuitEvent extends BasePlayerQuitEvent { + + public SpigotPlayerQuitEvent(SpigotPlayer player) { + super("PlayerQuitEvent", player); + } +} \ No newline at end of file From 6d1891dcd93e3aafb99ee0f5b6d32e5aa59f98dc Mon Sep 17 00:00:00 2001 From: 17TheWord <17theword@gmail.com> Date: Wed, 14 Aug 2024 01:16:08 +0800 Subject: [PATCH 02/55] :heavy_plus_sign: Add lombok --- forge/origin/build.gradle | 3 +++ spigot/origin/build.gradle | 3 +++ 2 files changed, 6 insertions(+) diff --git a/forge/origin/build.gradle b/forge/origin/build.gradle index 9ec2d6f..37996a8 100644 --- a/forge/origin/build.gradle +++ b/forge/origin/build.gradle @@ -95,6 +95,9 @@ tasks.named ('jarJar') { dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" + annotationProcessor "org.projectlombok:lombok:${project.lombok_version}" + implementation "org.projectlombok:lombok:${project.lombok_version}" + minecraftLibrary("com.github.theword.queqiao:queqiao-tool:${tool_version}") { exclude group: 'org.slf4j', module: 'slf4j-api' } diff --git a/spigot/origin/build.gradle b/spigot/origin/build.gradle index 7acf068..6df12c5 100644 --- a/spigot/origin/build.gradle +++ b/spigot/origin/build.gradle @@ -51,6 +51,9 @@ dependencies { compileOnly "org.spigotmc:spigot-api:${project.spigot_version}" compileOnly "org.jetbrains:annotations:${project.jetbrains_annotations_version}" + annotationProcessor "org.projectlombok:lombok:${project.lombok_version}" + implementation "org.projectlombok:lombok:${project.lombok_version}" + implementation "com.github.theword.queqiao:queqiao-tool:${tool_version}" implementation "org.slf4j:slf4j-api:${slf4j_version}" implementation "org.slf4j:slf4j-simple:${slf4j_version}" From ed7e351c9fd075e8b5dc7c2224c70d1d456327d8 Mon Sep 17 00:00:00 2001 From: 17TheWord <17theword@gmail.com> Date: Wed, 14 Aug 2024 01:19:28 +0800 Subject: [PATCH 03/55] :sparkles: Add private message API demo --- .../theword/queqiao/handle/HandleApiService.java | 14 ++++++++++++++ .../theword/queqiao/handle/HandleApiService.java | 14 ++++++++++++++ .../theword/queqiao/handle/HandleApiService.java | 16 +++++++++++++++- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/fabric/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java b/fabric/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java index a21f5ac..e79e8b6 100644 --- a/fabric/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java +++ b/fabric/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java @@ -25,6 +25,7 @@ import org.java_websocket.WebSocket; import java.util.List; +import java.util.UUID; // IF <= fabric-1.18.2 //import java.util.UUID; // @@ -88,6 +89,19 @@ public void handleActionBarMessage(WebSocket webSocket, List messageList) { + webSocket.send("Unsupported API now."); + } + private void sendPacket(Packet packet) { for (ServerPlayerEntity player : minecraftServer.getPlayerManager().getPlayerList()) { player.networkHandler.sendPacket(packet); diff --git a/forge/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java b/forge/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java index c0f0b9e..f8f2327 100644 --- a/forge/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java +++ b/forge/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java @@ -30,6 +30,7 @@ import org.java_websocket.WebSocket; import java.util.List; +import java.util.UUID; import static com.github.theword.queqiao.QueQiao.minecraftServer; @@ -107,6 +108,19 @@ public void handleActionBarMessage(WebSocket webSocket, List messageList) { + webSocket.send("Unsupported API now."); + } + // IF > forge-1.16.5 // private void sendPacket(Packet packet) { // for (ServerPlayer serverPlayer : minecraftServer.getPlayerList().getPlayers()) { diff --git a/spigot/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java b/spigot/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java index f296d26..7a43535 100644 --- a/spigot/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java +++ b/spigot/origin/src/main/java/com/github/theword/queqiao/handle/HandleApiService.java @@ -13,6 +13,7 @@ import org.java_websocket.WebSocket; import java.util.List; +import java.util.UUID; import static com.github.theword.queqiao.QueQiao.instance; @@ -43,6 +44,19 @@ public void handleSendTitleMessage(WebSocket webSocket, CommonSendTitle sendTitl } } + /** + * 私聊消息 + * + * @param webSocket websocket + * @param targetPlayerName 目标玩家名称 + * @param targetPlayerUuid 目标玩家 UUID + * @param messageList 消息体 + */ + @Override + public void handlePrivateMessage(WebSocket webSocket, String targetPlayerName, UUID targetPlayerUuid, List messageList) { + webSocket.send("Unsupported API now."); + } + @Override public void handleActionBarMessage(WebSocket webSocket, List messageList) { TextComponent actionTextComponent = parseJsonToEvent.parseMessageToTextComponent(messageList); @@ -50,4 +64,4 @@ public void handleActionBarMessage(WebSocket webSocket, List Date: Wed, 14 Aug 2024 01:47:08 +0800 Subject: [PATCH 04/55] (feat: Update QueQiao project to include help section and link to Wiki) --- .idea/compiler.xml | 46 ++++++++++++++++++++++++++++++++++++++++------ .idea/misc.xml | 1 + .idea/modules.xml | 21 +++++++++++++++++++++ 3 files changed, 62 insertions(+), 6 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 77f1f1d..8031c66 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -4,15 +4,47 @@ - @@ -33,6 +65,8 @@ + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 384f7cb..034ed60 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -19,6 +19,7 @@ + From 05ec3195b73915105da738bd3150de47fd35bec6 Mon Sep 17 00:00:00 2001 From: 17TheWord <17theword@gmail.com> Date: Wed, 14 Aug 2024 14:22:27 +0800 Subject: [PATCH 21/55] :construction_worker: Move part of release to release.yml --- .github/workflows/build.yml | 40 --------------------------- .github/workflows/release.yml | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c134d08..54f3431 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,46 +13,6 @@ env: GH_TOKEN: ${{ github.token }} jobs: - create-release: - if: ${{ github.event_name == 'push' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Read version.txt and save to variable - shell: pwsh - run: | - $mod_version = Get-Content version.txt - Write-Host "Version: $mod_version" - echo "MOD_VERSION=$mod_version" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_ENV - - - name: Check if Release exists - id: check-release - run: | - # Check if the release exists - RESPONSE=$(gh release view v${{ env.MOD_VERSION }} -R ${{ github.repository }} 2>&1 || true) - if echo "$RESPONSE" | grep -q "Not Found"; then - echo "Release v${{ env.MOD_VERSION }} does not exist. Skipping deletion." - echo "RELEASE_EXISTS=false" >> $GITHUB_ENV - else - echo "Release v${{ env.MOD_VERSION }} exists." - echo "RELEASE_EXISTS=true" >> $GITHUB_ENV - fi - - - name: Delete Release if exists - if: env.RELEASE_EXISTS == 'true' - run: | - # Try to delete the release and handle errors gracefully - set +e - gh release delete v${{ env.MOD_VERSION }} -R ${{ github.repository }} -y --cleanup-tag - if [ $? -eq 0 ]; then - echo "Release v${{ env.MOD_VERSION }} deleted successfully." - else - echo "Failed to delete release v${{ env.MOD_VERSION }}. It might not exist or there might be another issue." - fi - - - name: Create Release with temp note - run: gh release create v${{ env.MOD_VERSION }} --generate-notes - generate-matrix: runs-on: windows-latest outputs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a7a7195 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Create Release + +on: + push: + branches: + - main + +permissions: + contents: write + +env: + GH_TOKEN: ${{ github.token }} + +jobs: + create-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Read version.txt and save to variable + shell: pwsh + run: | + $mod_version = Get-Content version.txt + Write-Host "Version: $mod_version" + echo "MOD_VERSION=$mod_version" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_ENV + + - name: Check if Release exists + id: check-release + run: | + # Check if the release exists + RESPONSE=$(gh release view v${{ env.MOD_VERSION }} -R ${{ github.repository }} 2>&1 || true) + if echo "$RESPONSE" | grep -q "Not Found"; then + echo "Release v${{ env.MOD_VERSION }} does not exist. Skipping deletion." + echo "RELEASE_EXISTS=false" >> $GITHUB_ENV + else + echo "Release v${{ env.MOD_VERSION }} exists." + echo "RELEASE_EXISTS=true" >> $GITHUB_ENV + fi + + - name: Delete Release if exists + run: | + # Try to delete the release and handle errors gracefully + set +e + gh release delete v${{ env.MOD_VERSION }} -R ${{ github.repository }} -y --cleanup-tag + if [ $? -eq 0 ]; then + echo "Release v${{ env.MOD_VERSION }} deleted successfully." + else + echo "Failed to delete release v${{ env.MOD_VERSION }}. It might not exist or there might be another issue." + fi + + - name: Create Release with temp note + run: gh release create v${{ env.MOD_VERSION }} --generate-notes \ No newline at end of file From 6ca4aefcb3d6d5a1eab85567bad3bf2b9eb613ff Mon Sep 17 00:00:00 2001 From: 17TheWord <17theword@gmail.com> Date: Wed, 14 Aug 2024 14:22:44 +0800 Subject: [PATCH 22/55] :sparkles: Add velocity jobs --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54f3431..5204637 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: id: set-matrix shell: pwsh run: | - .\matrix.ps1 -path "fabric","forge","spigot" + .\matrix.ps1 -path "fabric","forge","spigot","velocity" build: runs-on: windows-latest From 9be235fe098bea8e815af3e2a3633dc9f8c3a5fa Mon Sep 17 00:00:00 2001 From: 17TheWord <17theword@gmail.com> Date: Wed, 14 Aug 2024 14:32:10 +0800 Subject: [PATCH 23/55] (feat: Update Java version configuration in build.gradle) --- velocity/origin/build.gradle | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/velocity/origin/build.gradle b/velocity/origin/build.gradle index c187de8..eedd53b 100644 --- a/velocity/origin/build.gradle +++ b/velocity/origin/build.gradle @@ -63,7 +63,11 @@ dependencies { def targetJavaVersion = Integer.parseInt(project.java_version) java { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) + def javaVersion = JavaVersion.toVersion(targetJavaVersion) + sourceCompatibility = javaVersion + targetCompatibility = javaVersion + if (JavaVersion.current() < javaVersion) + toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) } tasks.withType(JavaCompile).configureEach { @@ -102,4 +106,4 @@ shadowJar { tasks.build { dependsOn shadowJar -} +} \ No newline at end of file From b888ae557a935ac8d24c6662efd9c3fad54d661c Mon Sep 17 00:00:00 2001 From: 17TheWord <17theword@gmail.com> Date: Wed, 14 Aug 2024 14:32:47 +0800 Subject: [PATCH 24/55] (feat: Update velocity project configuration and dependencies) --- .idea/compiler.xml | 6 +++--- .idea/gradle.xml | 8 ++++++++ .idea/jarRepositories.xml | 5 +++++ .idea/modules.xml | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 8031c66..445ff4b 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -44,7 +44,7 @@ - + @@ -65,8 +65,8 @@ - - + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index af924a8..4bd2044 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -103,6 +103,14 @@ + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index f4abeec..5a9e971 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -126,5 +126,10 @@