mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-10 21:00:36 +01:00
Add chat preview command
This commit is contained in:
parent
24c3fbf4f3
commit
74ceb81704
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user