From 0c6521806cff271eea0ebaa5acbc0a976c80bdca Mon Sep 17 00:00:00 2001 From: muhammadeko Date: Tue, 17 May 2022 23:24:01 +0700 Subject: [PATCH] add CommandResponseEvent --- .../grasscutter/command/CommandHandler.java | 4 ++++ .../event/game/CommandResponseEvent.java | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/main/java/emu/grasscutter/server/event/game/CommandResponseEvent.java diff --git a/src/main/java/emu/grasscutter/command/CommandHandler.java b/src/main/java/emu/grasscutter/command/CommandHandler.java index f4fe12b3f..6e19e7bc9 100644 --- a/src/main/java/emu/grasscutter/command/CommandHandler.java +++ b/src/main/java/emu/grasscutter/command/CommandHandler.java @@ -2,6 +2,8 @@ package emu.grasscutter.command; import emu.grasscutter.Grasscutter; import emu.grasscutter.game.player.Player; +import emu.grasscutter.server.event.game.CommandResponseEvent; +import emu.grasscutter.server.event.types.ServerEvent; import java.util.List; @@ -19,6 +21,8 @@ public interface CommandHandler { } else { player.dropMessage(message); } + CommandResponseEvent event = new CommandResponseEvent(ServerEvent.Type.GAME,player, message); + event.call(); } /** diff --git a/src/main/java/emu/grasscutter/server/event/game/CommandResponseEvent.java b/src/main/java/emu/grasscutter/server/event/game/CommandResponseEvent.java new file mode 100644 index 000000000..c3c8fd89a --- /dev/null +++ b/src/main/java/emu/grasscutter/server/event/game/CommandResponseEvent.java @@ -0,0 +1,24 @@ +package emu.grasscutter.server.event.game; + +import emu.grasscutter.game.player.Player; +import emu.grasscutter.server.event.types.GameEvent; +import emu.grasscutter.server.event.types.ServerEvent; + +public class CommandResponseEvent extends ServerEvent { + private String message; + private Player player; + + public CommandResponseEvent(Type type, Player player,String message) { + super(type); + this.message = message; + this.player = player; + } + + public String getMessage() { + return message; + } + + public Player getPlayer() { + return player; + } +}