Passed
Pull Request — master (#172)
by Vincent
14:22
created

fr.quatrevieux.araknemu.game.admin.Command   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 35
ccs 1
cts 1
cp 1
rs 10
c 1
b 0
f 0
wmc 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
permissions() 0 1 ?
help() 0 1 ?
A createArguments() 0 2 1
name() 0 1 ?
execute(AdminPerformer,A) 0 1 ?
description() 0 1 ?
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