1
0
Fork 0
minecraft-tweaks-2a03/src/main/java/party/_2a03/mc/command/FlyCommand.java

32 lines
1.1 KiB
Java
Raw Normal View History

2020-05-29 07:26:43 +00:00
package party._2a03.mc.command;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
2020-12-01 03:27:23 +00:00
import party._2a03.mc.util.Config;
2020-05-29 07:26:43 +00:00
public class FlyCommand {
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
dispatcher.register(CommandManager.literal("fly").executes(ctx -> {
ServerCommandSource source = ctx.getSource();
2022-01-30 01:18:37 +00:00
//if (Config.getBool("disableFlyCommand")) {
2020-12-01 03:27:23 +00:00
source.sendFeedback(new LiteralText("The /fly command is disabled"), true);
return 0;
2022-01-30 01:18:37 +00:00
/*}
2020-05-29 07:26:43 +00:00
ServerPlayerEntity sender = source.getPlayer();
boolean flight = sender.abilities.allowFlying;
sender.abilities.allowFlying = !flight;
if (!flight)
source.sendFeedback(new LiteralText("I wanna fly like an eagle... to the sea!"), true);
else {
source.sendFeedback(new LiteralText("Flight disabled"), true);
sender.abilities.flying = false;
}
sender.sendAbilitiesUpdate();
2022-01-30 01:18:37 +00:00
return 1;*/
2020-05-29 07:26:43 +00:00
}));
}
}