Interface PollModule

All Superinterfaces:
org.incendo.cloud.execution.CommandExecutionHandler<FPlayer>, ModuleCommand, ModuleLocalization, ModuleSimple

public interface PollModule extends ModuleCommand
The /poll command, which runs a vote in chat.
  • Method Details

    • executeVote

      void executeVote(FPlayer fPlayer, org.incendo.cloud.context.CommandContext<FPlayer> commandContext)
      Runs the voting form of the command.
      Parameters:
      fPlayer - the voter
      commandContext - the parsed arguments
    • config

      Command.Poll config()
      Description copied from interface: ModuleCommand
      The config section for this command, which also holds its aliases.
      Specified by:
      config in interface ModuleCommand
      Specified by:
      config in interface ModuleSimple
      Returns:
      the command settings
    • permission

      Description copied from interface: ModuleSimple
      The permission that gates this module.
      Specified by:
      permission in interface ModuleSimple
      Returns:
      the permission
    • localization

      Localization.Command.Poll localization(FPlayer fPlayer)
      Description copied from interface: ModuleLocalization
      The localization section for a player, picked from their chosen language.
      Specified by:
      localization in interface ModuleLocalization
      Parameters:
      fPlayer - the player the text is for
      Returns:
      the localization settings
    • createPoll

      void createPoll(FPlayer fPlayer, String title, boolean multipleValue, long endTimeValue, long repeatTimeValue, List<String> answers)
      Starts a poll and announces it.
      Parameters:
      fPlayer - who started it
      title - the question
      multipleValue - whether a voter may pick several answers
      endTimeValue - how long voting stays open, in milliseconds
      repeatTimeValue - how often the poll is re-announced, in milliseconds
      answers - the options to vote on
    • saveAndUpdateLast

      void saveAndUpdateLast(Poll poll)
      Stores a poll and makes it the one an unqualified vote applies to.
      Parameters:
      poll - the poll
    • vote

      void vote(FEntity fPlayer, int id, int numberVote, UUID metadataUUID)
      Records a vote and announces the new tally.
      Parameters:
      fPlayer - the voter
      id - the poll id
      numberVote - the chosen option
      metadataUUID - the shared message id
    • resolveVote

      String resolveVote(FPlayer fPlayer, int voteType, int answerID, int pollID, int count)
      The wording confirming a vote.
      Parameters:
      fPlayer - the reader
      voteType - whether the vote was cast, changed or withdrawn
      answerID - the chosen option
      pollID - the poll id
      count - the votes that option now has
      Returns:
      the confirmation text
    • resolvePollFormat

      String resolvePollFormat(FPlayer fPlayer, Poll poll, PollModule.Status status)
      The rendered poll, laid out for the stage it has reached.
      Parameters:
      fPlayer - the reader
      poll - the poll
      status - the stage
      Returns:
      the rendered poll
    • resolveAnswerTags

      net.kyori.adventure.text.minimessage.tag.resolver.TagResolver[] resolveAnswerTags(FEntity sender, FPlayer fReceiver, Poll poll)
      The answers of a poll, each as its own tag
      Parameters:
      sender - who created the poll
      fReceiver - the reader
      poll - the poll
      Returns:
      one resolver per answer