Search in sources :

Example 6 with NoteData

use of io.github.nucleuspowered.nucleus.modules.note.data.NoteData in project Nucleus by NucleusPowered.

the class ClearNotesCommand method executeCommand.

@Override
public CommandResult executeCommand(CommandSource src, CommandContext args) throws Exception {
    User user = args.<User>getOne(playerKey).get();
    List<NoteData> notes = handler.getNotesInternal(user);
    if (notes.isEmpty()) {
        src.sendMessage(plugin.getMessageProvider().getTextMessageWithFormat("command.checknotes.none", user.getName()));
        return CommandResult.success();
    }
    if (handler.clearNotes(user)) {
        src.sendMessage(plugin.getMessageProvider().getTextMessageWithFormat("command.clearnotes.success", user.getName()));
        return CommandResult.success();
    }
    src.sendMessage(plugin.getMessageProvider().getTextMessageWithFormat("command.clearnotes.failure", user.getName()));
    return CommandResult.empty();
}
Also used : User(org.spongepowered.api.entity.living.player.User) NoteData(io.github.nucleuspowered.nucleus.modules.note.data.NoteData)

Aggregations

NoteData (io.github.nucleuspowered.nucleus.modules.note.data.NoteData)6 User (org.spongepowered.api.entity.living.player.User)6 UserStorageService (org.spongepowered.api.service.user.UserStorageService)3 Util (io.github.nucleuspowered.nucleus.Util)2 RunAsync (io.github.nucleuspowered.nucleus.internal.annotations.RunAsync)2 NoModifiers (io.github.nucleuspowered.nucleus.internal.annotations.command.NoModifiers)2 Permissions (io.github.nucleuspowered.nucleus.internal.annotations.command.Permissions)2 RegisterCommand (io.github.nucleuspowered.nucleus.internal.annotations.command.RegisterCommand)2 AbstractCommand (io.github.nucleuspowered.nucleus.internal.command.AbstractCommand)2 SuggestedLevel (io.github.nucleuspowered.nucleus.internal.permissions.SuggestedLevel)2 NoteHandler (io.github.nucleuspowered.nucleus.modules.note.handlers.NoteHandler)2 ZoneId (java.time.ZoneId)2 DateTimeFormatter (java.time.format.DateTimeFormatter)2 Comparator (java.util.Comparator)2 List (java.util.List)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 Sponge (org.spongepowered.api.Sponge)2 CommandResult (org.spongepowered.api.command.CommandResult)2 CommandSource (org.spongepowered.api.command.CommandSource)2