mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-12 16:14:24 +01:00
Fix crash with quilt. Fixes #84
This commit is contained in:
parent
3cac5a8020
commit
980355851b
1 changed files with 20 additions and 3 deletions
|
@ -1,16 +1,33 @@
|
||||||
package com.minelittlepony.unicopia;
|
package com.minelittlepony.unicopia;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.fabricmc.loader.impl.util.Arguments;
|
|
||||||
|
|
||||||
public final class Debug {
|
public final class Debug {
|
||||||
public static final boolean DEBUG_SPELLBOOK_CHAPTERS;
|
public static final boolean DEBUG_SPELLBOOK_CHAPTERS;
|
||||||
public static final boolean DEBUG_COMMANDS;
|
public static final boolean DEBUG_COMMANDS;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Arguments args = new Arguments();
|
Map<String, String> args = parseArguments(FabricLoader.getInstance().getLaunchArguments(true));
|
||||||
args.parse(FabricLoader.getInstance().getLaunchArguments(true));
|
|
||||||
DEBUG_SPELLBOOK_CHAPTERS = "true".equalsIgnoreCase(args.getOrDefault("unicopia.debug.spellbookChapters", "false"));
|
DEBUG_SPELLBOOK_CHAPTERS = "true".equalsIgnoreCase(args.getOrDefault("unicopia.debug.spellbookChapters", "false"));
|
||||||
DEBUG_COMMANDS = "true".equalsIgnoreCase(args.getOrDefault("unicopia.debug.commands", "false"));
|
DEBUG_COMMANDS = "true".equalsIgnoreCase(args.getOrDefault("unicopia.debug.commands", "false"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue