|
1
|
|
|
/* |
|
2
|
|
|
* This file is part of Araknemu. |
|
3
|
|
|
* |
|
4
|
|
|
* Araknemu is free software: you can redistribute it and/or modify |
|
5
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
|
6
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
|
7
|
|
|
* (at your option) any later version. |
|
8
|
|
|
* |
|
9
|
|
|
* Araknemu is distributed in the hope that it will be useful, |
|
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12
|
|
|
* GNU Lesser General Public License for more details. |
|
13
|
|
|
* |
|
14
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
|
15
|
|
|
* along with Araknemu. If not, see <https://www.gnu.org/licenses/>. |
|
16
|
|
|
* |
|
17
|
|
|
* Copyright (c) 2017-2020 Vincent Quatrevieux |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
package fr.quatrevieux.araknemu.game.admin; |
|
21
|
|
|
|
|
22
|
|
|
import fr.quatrevieux.araknemu.common.account.Permission; |
|
23
|
|
|
import fr.quatrevieux.araknemu.game.admin.exception.AdminException; |
|
24
|
|
|
|
|
25
|
|
|
import java.util.Set; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* A console command |
|
29
|
|
|
*/ |
|
30
|
|
|
public interface Command<A> { |
|
31
|
|
|
/** |
|
32
|
|
|
* Get the command name |
|
33
|
|
|
*/ |
|
34
|
|
|
public String name(); |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Get a simple description for the command |
|
38
|
|
|
*/ |
|
39
|
|
|
public String description(); |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Get the help message |
|
43
|
|
|
*/ |
|
44
|
|
|
public String help(); |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Execute the command |
|
48
|
|
|
* |
|
49
|
|
|
* @param performer The command performer |
|
50
|
|
|
* @param arguments The command arguments |
|
51
|
|
|
*/ |
|
52
|
|
|
public void execute(AdminPerformer performer, A arguments) throws AdminException; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Create the command arguments POJO or default value |
|
56
|
|
|
*/ |
|
57
|
|
|
public default A createArguments() { |
|
58
|
1 |
|
return null; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Get list of required permissions |
|
63
|
|
|
*/ |
|
64
|
|
|
public Set<Permission> permissions(); |
|
65
|
|
|
} |
|
66
|
|
|
|