CommandHandler.java 850 Bytes
Newer Older
Jaida Wu's avatar
Jaida Wu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package emu.grasscutter.command;

import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.GenshinPlayer;

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.
     */
    static void sendMessage(GenshinPlayer player, String message) {
        if (player == null) {
            Grasscutter.getLogger().info(message);
        } else {
            player.dropMessage(message);
        }
    }

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