Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public class SafeCommand extends FunctionalCommand {

private final Command command;

static {
SafeMode.ensureInitialized();
}

/**
* Creates a new SafeCommand
* @param command The command to run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class SafeExecuteBlockingCommand extends FunctionalCommand {

private final Command command;

static {
SafeMode.ensureInitialized();
}

public SafeExecuteBlockingCommand(Command command) {
super(
() -> command.initialize(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public class SafeMode {
Lib199Subsystem.registerPeriodic(SafeMode::updateCallbacks);
}

/**
* Ensures that the static block of this class is called, setting up safe-mode.
* It is unlikely that you will need to call this function.
*/
public static void ensureInitialized() {}

/**
* Enables safe-mode
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public class UnsafeCommand extends FunctionalCommand {

private final Command command;

static {
SafeMode.ensureInitialized();
}

public UnsafeCommand(Command command) {
super(
() -> { if(!SafeMode.isEnabled()) command.initialize(); },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class UnsafeExecuteBlockingCommand extends FunctionalCommand {

private final Command command;

static {
SafeMode.ensureInitialized();
}

public UnsafeExecuteBlockingCommand(Command command) {
super(
command::initialize,
Expand Down