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

de.kleiner3.lasertag.command.lasertag.game.StopLasertagGameCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 11
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register(LiteralArgumentBuilder) 0 4 1
A execute(CommandContext) 0 4 1
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