diff --git a/src/main/java/com/minelittlepony/unicopia/command/Commands.java b/src/main/java/com/minelittlepony/unicopia/command/Commands.java index c182bb62..54079c61 100644 --- a/src/main/java/com/minelittlepony/unicopia/command/Commands.java +++ b/src/main/java/com/minelittlepony/unicopia/command/Commands.java @@ -20,8 +20,10 @@ public class Commands { CommandRegistrationCallback.EVENT.register((dispatcher, access, environment) -> { RacelistCommand.register(dispatcher); EmoteCommand.register(dispatcher); + if (Unicopia.getConfig().enableCheats.get() || environment.dedicated) { + SpeciesCommand.register(dispatcher, environment); + } if (Unicopia.getConfig().enableCheats.get()) { - SpeciesCommand.register(dispatcher); GravityCommand.register(dispatcher); DisguiseCommand.register(dispatcher, access); if (Debug.DEBUG_COMMANDS) { diff --git a/src/main/java/com/minelittlepony/unicopia/command/SpeciesCommand.java b/src/main/java/com/minelittlepony/unicopia/command/SpeciesCommand.java index e8eb3b6f..a971374d 100644 --- a/src/main/java/com/minelittlepony/unicopia/command/SpeciesCommand.java +++ b/src/main/java/com/minelittlepony/unicopia/command/SpeciesCommand.java @@ -1,6 +1,7 @@ package com.minelittlepony.unicopia.command; import com.minelittlepony.unicopia.Race; +import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.entity.player.Pony; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.builder.LiteralArgumentBuilder; @@ -9,6 +10,7 @@ import net.minecraft.command.argument.EntityArgumentType; import net.minecraft.command.argument.RegistryKeyArgumentType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.command.CommandManager; +import net.minecraft.server.command.CommandManager.RegistrationEnvironment; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.text.MutableText; import net.minecraft.text.Text; @@ -17,9 +19,17 @@ import net.minecraft.util.Identifier; import net.minecraft.world.GameRules; class SpeciesCommand { - static void register(CommandDispatcher dispatcher) { + static void register(CommandDispatcher dispatcher, RegistrationEnvironment environment) { LiteralArgumentBuilder builder = CommandManager.literal("race"); + if (environment.dedicated) { + if (Unicopia.getConfig().enableCheats.get()) { + builder = builder.requires(source -> source.hasPermissionLevel(2)); + } else { + builder = builder.requires(source -> source.hasPermissionLevel(4)); + } + } + RegistryKeyArgumentType raceArgument = Race.argument(); builder.then(CommandManager.literal("get")