CommandHandler.java 836 Bytes
Newer Older
Jaida Wu's avatar
Jaida Wu committed
1
2
3
package emu.grasscutter.command;

import emu.grasscutter.Grasscutter;
Melledy's avatar
Melledy committed
4
import emu.grasscutter.game.player.Player;
Jaida Wu's avatar
Jaida Wu committed
5
6
7
8
9
10
11
12
13
14

import java.util.List;

public interface CommandHandler {
    /**
     * 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.
     */
15
    static void sendMessage(Player player, String message) {
Jaida Wu's avatar
Jaida Wu committed
16
17
18
19
20
21
22
        if (player == null) {
            Grasscutter.getLogger().info(message);
        } else {
            player.dropMessage(message);
        }
    }

KingRainbow44's avatar
KingRainbow44 committed
23
24
25
26
27
    /**
     * Called when a player/console invokes a command.
     * @param sender The player/console that invoked the command.
     * @param args The arguments to the command.
     */
28
    default void execute(Player sender, List<String> args) {
Jaida Wu's avatar
Jaida Wu committed
29
30
    }
}