• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CyclopsMC / IntegratedDynamics / 20210191346

14 Dec 2025 03:32PM UTC coverage: 19.514% (-33.5%) from 53.061%
20210191346

push

github

rubensworks
Remove deprecations

663 of 8728 branches covered (7.6%)

Branch coverage included in aggregate %.

6786 of 29445 relevant lines covered (23.05%)

1.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/cyclops/integrateddynamics/command/CommandNetworkDiagnostics.java
1
package org.cyclops.integrateddynamics.command;
2

3
import com.mojang.brigadier.Command;
4
import com.mojang.brigadier.arguments.IntegerArgumentType;
5
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
6
import com.mojang.brigadier.context.CommandContext;
7
import com.mojang.brigadier.exceptions.CommandSyntaxException;
8
import net.minecraft.commands.CommandSourceStack;
9
import net.minecraft.commands.Commands;
10
import org.cyclops.cyclopscore.command.argument.ArgumentTypeEnum;
11
import org.cyclops.integrateddynamics.GeneralConfig;
12
import org.cyclops.integrateddynamics.IntegratedDynamics;
13
import org.cyclops.integrateddynamics.network.packet.NetworkDiagnosticsTriggerClient;
14

15
/**
16
 * Command for opening the network diagnostics gui.
17
 * @author rubensworks
18
 *
19
 */
20
public class CommandNetworkDiagnostics implements Command<CommandSourceStack> {
21

22
    private final boolean operationArg;
23
    private final boolean portArg;
24

25
    public CommandNetworkDiagnostics(boolean operationArg, boolean portArg) {
×
26
        this.operationArg = operationArg;
×
27
        this.portArg = portArg;
×
28
    }
×
29

30
    @Override
31
    public int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
32
        StartStop operation = this.operationArg ? ArgumentTypeEnum.getValue(context, "operation", StartStop.class) : StartStop.START;
×
33
        int port = this.portArg ? IntegerArgumentType.getInteger(context, "port") : GeneralConfig.diagnosticsWebServerPort;
×
34
        IntegratedDynamics._instance.getPacketHandler().sendToPlayer
×
35
                (new NetworkDiagnosticsTriggerClient(operation == StartStop.START, port),
×
36
                context.getSource().getPlayerOrException()
×
37
        );
38
        return 0;
×
39
    }
40

41
    public static LiteralArgumentBuilder<CommandSourceStack> make() {
42
        return Commands.literal("networkdiagnostics")
×
43
                .requires((commandSource) -> commandSource.hasPermission(2))
×
44
                .executes(new CommandNetworkDiagnostics(false, false))
×
45
                .then(Commands.argument("operation", new ArgumentTypeEnum(StartStop.class))
×
46
                        .executes(new CommandNetworkDiagnostics(true, false))
×
47
                        .then(Commands.argument("port", IntegerArgumentType.integer())
×
48
                            .executes(new CommandNetworkDiagnostics(true, true))));
×
49
    }
50

51
    public static enum StartStop {
×
52
        START,
×
53
        STOP;
×
54
    }
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc