CommandHandler.java 770 Bytes
Newer Older
KingRainbow44's avatar
KingRainbow44 committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package emu.grasscutter.commands;

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

import java.util.List;

public interface CommandHandler {
    /* Invoked on player execution. */
    void execute(GenshinPlayer player, List<String> args);
    /* Invoked on server execution. */
    void execute(List<String> args);
    
    /*
     * Utilities.
     */

    /**
     * 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);
    }
}