2022-10-11 17:19:50 +02:00
|
|
|
package com.minelittlepony.unicopia;
|
|
|
|
|
2022-12-04 16:37:52 +01:00
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2022-10-11 17:19:50 +02:00
|
|
|
import net.fabricmc.loader.api.FabricLoader;
|
|
|
|
|
|
|
|
public final class Debug {
|
|
|
|
public static final boolean DEBUG_SPELLBOOK_CHAPTERS;
|
|
|
|
public static final boolean DEBUG_COMMANDS;
|
|
|
|
|
|
|
|
static {
|
2022-12-04 16:37:52 +01:00
|
|
|
Map<String, String> args = parseArguments(FabricLoader.getInstance().getLaunchArguments(true));
|
2022-10-11 17:19:50 +02:00
|
|
|
DEBUG_SPELLBOOK_CHAPTERS = "true".equalsIgnoreCase(args.getOrDefault("unicopia.debug.spellbookChapters", "false"));
|
|
|
|
DEBUG_COMMANDS = "true".equalsIgnoreCase(args.getOrDefault("unicopia.debug.commands", "false"));
|
|
|
|
}
|
2022-12-04 16:37:52 +01:00
|
|
|
|
|
|
|
static Map<String, String> parseArguments(String[] args) {
|
|
|
|
Map<String, String> arguments = new HashMap<>();
|
|
|
|
|
|
|
|
for (int i = 0; i < args.length; i++) {
|
|
|
|
String arg = args[i];
|
|
|
|
String next = i < args.length - 1 ? args[i + 1] : null;
|
|
|
|
|
|
|
|
if (arg.startsWith("--") && next != null && !next.startsWith("--")) {
|
|
|
|
arguments.put(arg, next);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return arguments;
|
|
|
|
}
|
2022-10-11 17:19:50 +02:00
|
|
|
}
|