Passed
Push — main ( 0a34c4...a3bd4e )
by Etienne
01:29
created

register(LiteralArgumentBuilder)   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 4
cc 1
rs 10
1
package de.kleiner3.lasertag.command.lasertag.game;
2
3
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
4
import com.mojang.brigadier.context.CommandContext;
5
import de.kleiner3.lasertag.command.CommandFeedback;
6
import de.kleiner3.lasertag.command.ServerFeedbackCommand;
7
import net.minecraft.server.command.ServerCommandSource;
8
9
import java.util.Optional;
10
11
import static net.minecraft.server.command.CommandManager.literal;
12
13
/**
14
 * The stop lasertag game command
15
 *
16
 * @author Étienne Muser
17
 */
18
public class StopLasertagGameCommand extends ServerFeedbackCommand {
19
    protected Optional<CommandFeedback> execute(CommandContext<ServerCommandSource> context) {
20
        context.getSource().getServer().stopLasertagGame();
21
22
        return Optional.empty();
23
    }
24
25
    static void register(LiteralArgumentBuilder<ServerCommandSource> lab) {
26
        lab.then(literal("stopLasertagGame")
27
                .requires(s -> s.hasPermissionLevel(1))
28
                .executes(new StopLasertagGameCommand()));
29
    }
30
}
31