Add disableFlyCommand config option
This commit is contained in:
parent
95412f6cf8
commit
5e3a9793e6
@ -33,6 +33,7 @@ Config
|
||||
|
||||
The config is stored in /config/minecraft-tweaks-2a03/2a03.json
|
||||
|
||||
disableFlyCommand: Disables the /fly command
|
||||
disableTntExplosions: Disables TNT explosions
|
||||
disableRespawnAnchorExplosions: Disables respawn anchor explosions
|
||||
iphubApiKey: API key for iphub.info, currently unused
|
||||
|
@ -5,11 +5,16 @@ import net.minecraft.server.command.CommandManager;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import party._2a03.mc.util.Config;
|
||||
|
||||
public class FlyCommand {
|
||||
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
|
||||
dispatcher.register(CommandManager.literal("fly").executes(ctx -> {
|
||||
ServerCommandSource source = ctx.getSource();
|
||||
if (Config.getBool("disableFlyCommand")) {
|
||||
source.sendFeedback(new LiteralText("The /fly command is disabled"), true);
|
||||
return 0;
|
||||
}
|
||||
ServerPlayerEntity sender = source.getPlayer();
|
||||
boolean flight = sender.abilities.allowFlying;
|
||||
sender.abilities.allowFlying = !flight;
|
||||
|
@ -36,6 +36,7 @@ public class Config {
|
||||
}
|
||||
|
||||
setDefault("persistentFlight", true);
|
||||
setDefault("disableFlyCommand", true);
|
||||
setDefault("disableTntExplosions", false);
|
||||
setDefault("disableRespawnAnchorExplosions", false);
|
||||
setDefault("iphubApiKey", "");
|
||||
|
Loading…
Reference in New Issue
Block a user