From 4ba3e35bf0780ce36f94da6e5809ae02d9a7711e Mon Sep 17 00:00:00 2001 From: carm Date: Tue, 5 Jul 2022 00:40:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(msg):=20=E4=B8=BA=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E6=98=BE=E7=A4=BA=E5=AE=8C=E6=88=90=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parkourcompetition/conf/PluginMessages.java | 6 +++++- .../parkourcompetition/listener/GameListener.java | 11 ++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/cc/carm/outsource/plugin/parkourcompetition/conf/PluginMessages.java b/src/main/java/cc/carm/outsource/plugin/parkourcompetition/conf/PluginMessages.java index d3ac731..3fb7b53 100644 --- a/src/main/java/cc/carm/outsource/plugin/parkourcompetition/conf/PluginMessages.java +++ b/src/main/java/cc/carm/outsource/plugin/parkourcompetition/conf/PluginMessages.java @@ -53,9 +53,13 @@ public static final class GAME { .build(); public static final ConfiguredMessageList FINISH = list() - .defaults("&e&l恭喜!&f您完成了本次跑酷比赛,总耗时 &6%(time)秒 &f,排名为 &6#%(index) &f!") + .defaults("&e&l恭喜!&f您完成了本次跑酷比赛,总用时 &6%(time)秒 &f,排名为 &6#%(index) &f!") .params("time", "index").build(); + public static final ConfiguredMessageList FINISH_OTHER = list() + .defaults("&f恭喜 &e&l%(player) &f作为 &6第%(index)名 &f完成了本次跑酷比赛,用时 &6%(time)秒 &f!") + .params("player", "time", "index").build(); + public static final ConfiguredMessageList END = list() .defaults( diff --git a/src/main/java/cc/carm/outsource/plugin/parkourcompetition/listener/GameListener.java b/src/main/java/cc/carm/outsource/plugin/parkourcompetition/listener/GameListener.java index b91c195..01c8f56 100644 --- a/src/main/java/cc/carm/outsource/plugin/parkourcompetition/listener/GameListener.java +++ b/src/main/java/cc/carm/outsource/plugin/parkourcompetition/listener/GameListener.java @@ -8,8 +8,10 @@ import cc.carm.outsource.plugin.parkourcompetition.util.FireworkUtils; import me.block2block.hubparkour.api.events.player.ParkourPlayerFinishEvent; import org.bukkit.Location; +import org.bukkit.command.BlockCommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.server.ServerCommandEvent; import org.bukkit.plugin.Plugin; import java.text.NumberFormat; @@ -19,6 +21,13 @@ public class GameListener extends EasyListener { public GameListener(Plugin plugin) { super(plugin); + + handleEvent(ServerCommandEvent.class) + .filter(e -> e.getSender() instanceof BlockCommandSender) + .handle(e -> { + BlockCommandSender sender = (BlockCommandSender) e.getSender(); + Main.getInstance().log(sender.getBlock().getLocation().toString()); + }); } @EventHandler @@ -51,8 +60,8 @@ public void onFinish(ParkourPlayerFinishEvent event) { PluginConfig.GAME.FINISH.SOUND.playTo(player); PluginConfig.GAME.FINISH.TITLE.send(player, seconds); + PluginMessages.GAME.FINISH_OTHER.broadcast(player.getName(), seconds, parkour.getFinishTime().size()); PluginMessages.GAME.FINISH.send(player, seconds, parkour.getFinishTime().size()); - } }