1
0
Fork 0

Add disableFlyCommand config option

This commit is contained in:
Ryan Fox 2020-12-01 03:27:23 +00:00
parent 95412f6cf8
commit 5e3a9793e6
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
3 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -36,6 +36,7 @@ public class Config {
}
setDefault("persistentFlight", true);
setDefault("disableFlyCommand", true);
setDefault("disableTntExplosions", false);
setDefault("disableRespawnAnchorExplosions", false);
setDefault("iphubApiKey", "");