Allow console to let player change death screen

This commit is contained in:
Electroid 2017-08-27 16:29:25 -07:00
parent 5375c4fa98
commit e4bed714f8
1 changed files with 19 additions and 0 deletions

View File

@ -148,6 +148,25 @@ public class MiscCommands implements Commands {
);
}
@Command(
aliases = { "change-death-screen" },
usage = "<player> <+1/-1>",
desc = "Allow a player to change their death screen",
min = 2
)
public void deathScreen(final CommandContext args, final CommandSender sender) throws CommandException {
if(!(sender instanceof ConsoleCommandSender)) throw new CommandPermissionsException();
boolean enable = args.getInteger(1, +1) > 0;
flexecutor.callback(
userFinder.findLocalPlayer(sender, args, 0),
response -> {
if((response.user.death_screen() == null) != enable) {
userService.update(response.user, (UserDoc.DeathScreen) () -> enable ? "default" : null);
}
}
);
}
@Command(
aliases = { "sudo" },
usage = "<player> [command... (rand|mode|near|color|*)=value]",