Add chat preview command

This commit is contained in:
Noel Németh 2022-06-12 14:30:30 +02:00
parent 24c3fbf4f3
commit 74ceb81704

View File

@ -0,0 +1,20 @@
package net.minestom.demo.commands;
import net.minestom.server.command.builder.Command;
import net.minestom.server.command.builder.arguments.ArgumentBoolean;
import net.minestom.server.command.builder.arguments.ArgumentType;
import net.minestom.server.entity.Player;
public class ChatPreviewCommand extends Command {
private static final ArgumentBoolean on = ArgumentType.Boolean("on");
public ChatPreviewCommand() {
super("preview");
addSyntax(((sender, context) -> {
if (sender instanceof Player player) {
player.toggleChatPreview(context.get(on));
}
}), on);
}
}