2022-04-20 20:21:38 +08:00
|
|
|
package emu.grasscutter.command;
|
|
|
|
|
|
|
|
import emu.grasscutter.Grasscutter;
|
2022-04-27 12:24:25 +08:00
|
|
|
import emu.grasscutter.game.player.Player;
|
2022-04-20 20:21:38 +08:00
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public interface CommandHandler {
|
2022-05-08 10:33:53 +08:00
|
|
|
|
2022-04-20 20:21:38 +08:00
|
|
|
/**
|
|
|
|
* Send a message to the target.
|
|
|
|
*
|
|
|
|
* @param player The player to send the message to, or null for the server console.
|
|
|
|
* @param message The message to send.
|
|
|
|
*/
|
2022-04-27 12:21:57 +08:00
|
|
|
static void sendMessage(Player player, String message) {
|
2022-04-20 20:21:38 +08:00
|
|
|
if (player == null) {
|
|
|
|
Grasscutter.getLogger().info(message);
|
|
|
|
} else {
|
|
|
|
player.dropMessage(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-21 00:17:56 +08:00
|
|
|
/**
|
|
|
|
* Called when a player/console invokes a command.
|
|
|
|
* @param sender The player/console that invoked the command.
|
|
|
|
* @param args The arguments to the command.
|
|
|
|
*/
|
2022-05-04 14:32:09 +08:00
|
|
|
default void execute(Player sender, Player targetPlayer, List<String> args) {
|
2022-04-20 20:21:38 +08:00
|
|
|
}
|
|
|
|
}
|