From 6a7e8b066ab64057486316033bc63917f873f3fe Mon Sep 17 00:00:00 2001 From: zhangyuheng Date: Sun, 11 Aug 2024 11:57:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BA=86=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E5=89=8D=E7=BC=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../cn/lunadeer/essentialsd/events/ChatPrefixEvent.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index bdda6b6..6ce2c4b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.lunadeer EssentialsD - 2.1.0 + 2.1.1 jar EssentialsD diff --git a/src/main/java/cn/lunadeer/essentialsd/events/ChatPrefixEvent.java b/src/main/java/cn/lunadeer/essentialsd/events/ChatPrefixEvent.java index b9b68ab..43b2f6d 100644 --- a/src/main/java/cn/lunadeer/essentialsd/events/ChatPrefixEvent.java +++ b/src/main/java/cn/lunadeer/essentialsd/events/ChatPrefixEvent.java @@ -1,19 +1,19 @@ package cn.lunadeer.essentialsd.events; import cn.lunadeer.essentialsd.EssentialsD; -import io.papermc.paper.event.player.AsyncChatEvent; import me.clip.placeholderapi.PlaceholderAPI; -import net.kyori.adventure.text.Component; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.player.AsyncPlayerChatEvent; public class ChatPrefixEvent implements Listener { @EventHandler - public void onChat(AsyncChatEvent event) { + public void onChat(AsyncPlayerChatEvent event) { event.setCancelled(true); String formated = PlaceholderAPI.setPlaceholders(event.getPlayer(), EssentialsD.config.getPrefixFormat()); - EssentialsD.instance.getServer().sendMessage(Component.text(formated).append(event.message())); + formated += event.getMessage(); + EssentialsD.instance.getServer().broadcastMessage(formated); } } From 6381d51950fe88e5075812099aece559c9629fec Mon Sep 17 00:00:00 2001 From: zhangyuheng Date: Sun, 11 Aug 2024 12:00:40 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yml | 4 ++-- pom.xml | 2 +- .../java/cn/lunadeer/essentialsd/events/ChatPrefixEvent.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 16fa5bf..8713d1d 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -15,10 +15,10 @@ jobs: fetch-depth: 0 - name: "Set up Maven" uses: https://ssl.lunadeer.cn:14446/actions/setup-maven@v4 - - name: "Set up JDK 17" + - name: "Set up JDK 21" uses: https://ssl.lunadeer.cn:14446/actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'zulu' cache: maven - name: "Build with Maven" diff --git a/pom.xml b/pom.xml index 409bc8e..b17cd2d 100644 --- a/pom.xml +++ b/pom.xml @@ -80,7 +80,7 @@ io.papermc.paper paper-api - 1.21.1-R0.1-SNAPSHOT + 1.21-R0.1-SNAPSHOT provided diff --git a/src/main/java/cn/lunadeer/essentialsd/events/ChatPrefixEvent.java b/src/main/java/cn/lunadeer/essentialsd/events/ChatPrefixEvent.java index 43b2f6d..a0230fe 100644 --- a/src/main/java/cn/lunadeer/essentialsd/events/ChatPrefixEvent.java +++ b/src/main/java/cn/lunadeer/essentialsd/events/ChatPrefixEvent.java @@ -11,7 +11,7 @@ public class ChatPrefixEvent implements Listener { @EventHandler public void onChat(AsyncPlayerChatEvent event) { event.setCancelled(true); - String formated = PlaceholderAPI.setPlaceholders(event.getPlayer(), EssentialsD.config.getPrefixFormat()); + String formated = PlaceholderAPI.setPlaceholders(event.getPlayer(), EssentialsD.config.getPrefixChatFormat()); formated += event.getMessage(); EssentialsD.instance.getServer().broadcastMessage(formated); } From 06aeb33f506398ee87ab3bc43045d677832ba58e Mon Sep 17 00:00:00 2001 From: zhangyuheng Date: Sun, 18 Aug 2024 12:25:06 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86warp=E5=9C=A8?= =?UTF-8?q?=E4=B8=8D=E6=8C=87=E5=AE=9A=E4=BC=A0=E9=80=81=E7=82=B9=E6=97=B6?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=8F=90=E7=A4=BA=E8=80=8C=E6=98=AF=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../java/cn/lunadeer/essentialsd/commands/warp/DelWarp.java | 5 ++++- .../java/cn/lunadeer/essentialsd/commands/warp/Warp.java | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index b17cd2d..6bf3db3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.lunadeer EssentialsD - 2.2.3 + 2.2.4 jar EssentialsD diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/warp/DelWarp.java b/src/main/java/cn/lunadeer/essentialsd/commands/warp/DelWarp.java index ba39c04..d68c747 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/warp/DelWarp.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/warp/DelWarp.java @@ -3,7 +3,6 @@ package cn.lunadeer.essentialsd.commands.warp; import cn.lunadeer.essentialsd.dtos.WarpPoint; import cn.lunadeer.minecraftpluginutils.Notification; import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.command.TabExecutor; import org.jetbrains.annotations.NotNull; @@ -18,6 +17,10 @@ public class DelWarp implements TabExecutor { */ @Override public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) { + if (strings.length != 1) { + Notification.error(commandSender, "用法: /delwarp "); + return true; + } WarpPoint point = WarpPoint.selectByName(strings[0]); if (point == null) { Notification.error(commandSender, "传送点 %s 不存在", strings[0]); diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/warp/Warp.java b/src/main/java/cn/lunadeer/essentialsd/commands/warp/Warp.java index 4fc3a5a..c65069f 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/warp/Warp.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/warp/Warp.java @@ -2,10 +2,8 @@ package cn.lunadeer.essentialsd.commands.warp; import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.essentialsd.dtos.WarpPoint; -import cn.lunadeer.essentialsd.managers.TeleportManager; import cn.lunadeer.minecraftpluginutils.Notification; import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.command.TabExecutor; import org.bukkit.entity.Player; @@ -26,6 +24,10 @@ public class Warp implements TabExecutor { return true; } Player player = (Player) commandSender; + if (strings.length != 1) { + Notification.error(commandSender, "用法: /warp "); + return true; + } WarpPoint point = WarpPoint.selectByName(strings[0]); if (point == null) { Notification.error(commandSender, "传送点 %s 不存在", strings[0]);