2020-04-15 14:22:03 +02:00
|
|
|
package com.minelittlepony.unicopia.command;
|
|
|
|
|
2022-06-25 00:19:55 +02:00
|
|
|
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
2022-08-27 15:07:29 +02:00
|
|
|
|
2022-10-11 17:19:50 +02:00
|
|
|
import com.minelittlepony.unicopia.Debug;
|
2022-08-27 15:07:29 +02:00
|
|
|
import com.minelittlepony.unicopia.Unicopia;
|
|
|
|
|
2022-06-25 00:19:55 +02:00
|
|
|
import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry;
|
2020-04-15 14:22:03 +02:00
|
|
|
import net.fabricmc.loader.api.FabricLoader;
|
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
|
|
|
|
|
public class Commands {
|
2021-12-28 17:22:08 +01:00
|
|
|
@SuppressWarnings({ "deprecation", "unchecked", "rawtypes" })
|
2020-04-15 14:22:03 +02:00
|
|
|
public static void bootstrap() {
|
2022-08-27 15:07:29 +02:00
|
|
|
ArgumentTypeRegistry.registerArgumentType(
|
|
|
|
Unicopia.id("enumeration"),
|
|
|
|
EnumArgumentType.class,
|
|
|
|
new EnumArgumentType.Serializer()
|
|
|
|
);
|
2022-06-25 00:19:55 +02:00
|
|
|
CommandRegistrationCallback.EVENT.register((dispatcher, access, environment) -> {
|
2020-06-26 11:44:47 +02:00
|
|
|
RacelistCommand.register(dispatcher);
|
2022-01-04 16:57:57 +01:00
|
|
|
EmoteCommand.register(dispatcher);
|
2023-01-22 00:27:23 +01:00
|
|
|
if (Unicopia.getConfig().enableCheats.get() || environment.dedicated) {
|
|
|
|
SpeciesCommand.register(dispatcher, environment);
|
|
|
|
}
|
2022-10-11 17:19:50 +02:00
|
|
|
if (Unicopia.getConfig().enableCheats.get()) {
|
|
|
|
GravityCommand.register(dispatcher);
|
2022-12-18 22:07:24 +01:00
|
|
|
DisguiseCommand.register(dispatcher, access);
|
2022-10-11 17:19:50 +02:00
|
|
|
if (Debug.DEBUG_COMMANDS) {
|
|
|
|
TraitCommand.register(dispatcher);
|
|
|
|
ManaCommand.register(dispatcher);
|
|
|
|
}
|
|
|
|
}
|
2020-06-26 11:44:47 +02:00
|
|
|
});
|
2020-04-15 14:22:03 +02:00
|
|
|
Object game = FabricLoader.getInstance().getGameInstance();
|
|
|
|
if (game instanceof MinecraftServer) {
|
|
|
|
((MinecraftServer)game).setFlightEnabled(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|