Search in sources :

Example 1 with CommandSpyUserDataModule

use of io.github.nucleuspowered.nucleus.modules.commandspy.datamodules.CommandSpyUserDataModule in project Nucleus by NucleusPowered.

the class CommandSpyCommand method executeCommand.

@Override
public CommandResult executeCommand(Player src, CommandContext args) throws Exception {
    ModularUserService service = Nucleus.getNucleus().getUserDataManager().getUnchecked(src);
    CommandSpyUserDataModule c = service.get(CommandSpyUserDataModule.class);
    boolean to = args.<Boolean>getOne(truefalse).orElseGet(() -> !c.isCommandSpy());
    c.setCommandSpy(to);
    MessageProvider mp = plugin.getMessageProvider();
    src.sendMessage(mp.getTextMessageWithFormat("command.commandspy.success", mp.getMessageWithFormat(to ? "standard.enabled" : "standard.disabled")));
    return CommandResult.success();
}
Also used : MessageProvider(io.github.nucleuspowered.nucleus.internal.messages.MessageProvider) CommandSpyUserDataModule(io.github.nucleuspowered.nucleus.modules.commandspy.datamodules.CommandSpyUserDataModule) ModularUserService(io.github.nucleuspowered.nucleus.dataservices.modular.ModularUserService)

Aggregations

ModularUserService (io.github.nucleuspowered.nucleus.dataservices.modular.ModularUserService)1 MessageProvider (io.github.nucleuspowered.nucleus.internal.messages.MessageProvider)1 CommandSpyUserDataModule (io.github.nucleuspowered.nucleus.modules.commandspy.datamodules.CommandSpyUserDataModule)1