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 8dd32a0..aef509e 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/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]); diff --git a/src/main/java/cn/lunadeer/essentialsd/events/ChatPrefixEvent.java b/src/main/java/cn/lunadeer/essentialsd/events/ChatPrefixEvent.java index fc11904..a0230fe 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.getPrefixChatFormat()); - EssentialsD.instance.getServer().sendMessage(Component.text(formated).append(event.message())); + formated += event.getMessage(); + EssentialsD.instance.getServer().broadcastMessage(formated); } }