Class PresentBuilder

java.lang.Object
com.github.mafelp.Builders.PresentBuilder

public class PresentBuilder
extends java.lang.Object
The class that handles the building of a present in a private chat.
  • Field Summary

    Fields
    Modifier and Type Field Description
    private org.javacord.api.entity.channel.PrivateChannel channel
    The channel, to which the messages were sent.
    private static org.apache.logging.log4j.Logger logger
    The logger, which is used to log information to the console.
    private org.javacord.api.entity.message.Message message
    The first message sent by this bot in order to initiate the wizard.
    private com.google.gson.JsonObject present
    The present which will be configured.
    private PresentBuilderReactionListener presentBuilderReactionListener
    The Listener, which listens to to message.
    private static java.util.Map<org.javacord.api.entity.user.User,​PresentBuilder> presentBuilders
    The map which saves the current state and all the presentBuilds for Users.
    private org.javacord.api.entity.user.User receiver
    The user who shall receive and can unpack the present.
    private org.javacord.api.entity.user.User sender
    The user who created the present.
    private org.javacord.api.entity.server.Server server
    The server on which the presents should be created.
    private PresentBuilderState state
    The state of the current builder.
  • Constructor Summary

    Constructors
    Constructor Description
    PresentBuilder​(org.javacord.api.entity.user.User sender, org.javacord.api.entity.user.User receiver, org.javacord.api.entity.server.Server server, org.javacord.api.entity.message.Message originalMessage)  
  • Method Summary

    Modifier and Type Method Description
    com.google.gson.JsonObject getPresent()  
    static PresentBuilder getPresentBuilder​(@NotNull org.javacord.api.entity.user.User user)  
    PresentBuilder nextStep​(java.lang.String content)
    The method that handles the actual execution of the present builder.
    void sendPreview()
    This method sends a preview to the configured private channel.
    PresentBuilder setState​(PresentBuilderState builderState)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      private static final org.apache.logging.log4j.Logger logger
      The logger, which is used to log information to the console.
    • presentBuilders

      private static final java.util.Map<org.javacord.api.entity.user.User,​PresentBuilder> presentBuilders
      The map which saves the current state and all the presentBuilds for Users.
    • state

      private PresentBuilderState state
      The state of the current builder.
    • present

      private final com.google.gson.JsonObject present
      The present which will be configured.
    • channel

      private org.javacord.api.entity.channel.PrivateChannel channel
      The channel, to which the messages were sent.
    • server

      private final org.javacord.api.entity.server.Server server
      The server on which the presents should be created.
    • sender

      private final org.javacord.api.entity.user.User sender
      The user who created the present.
    • receiver

      private final org.javacord.api.entity.user.User receiver
      The user who shall receive and can unpack the present.
    • message

      private org.javacord.api.entity.message.Message message
      The first message sent by this bot in order to initiate the wizard.
    • presentBuilderReactionListener

      private final PresentBuilderReactionListener presentBuilderReactionListener
      The Listener, which listens to to message.
  • Constructor Details

    • PresentBuilder

      public PresentBuilder​(org.javacord.api.entity.user.User sender, org.javacord.api.entity.user.User receiver, org.javacord.api.entity.server.Server server, org.javacord.api.entity.message.Message originalMessage)
      Parameters:
      sender - The user who has triggered this event and will create a present.
      receiver - The first argument, which defines the user, who shall receive and be able to unpack the present.
      server - The server on which the present shall be unpacked.
      originalMessage - The original message, sent on the server.
  • Method Details

    • getPresentBuilder

      public static PresentBuilder getPresentBuilder​(@NotNull @NotNull org.javacord.api.entity.user.User user)
      Parameters:
      user - The user whose present builder will be returned.
      Returns:
      The present builder from the User.
    • getPresent

      public com.google.gson.JsonObject getPresent()
      Returns:
      Getter for the JSONObject, which is the present.
    • setState

      public PresentBuilder setState​(PresentBuilderState builderState)
      Parameters:
      builderState - The current state in the enum that represents the current state of the present builder.
      Returns:
      The new state of the present builder.
    • sendPreview

      public void sendPreview()
      This method sends a preview to the configured private channel.
    • nextStep

      public PresentBuilder nextStep​(java.lang.String content)
      The method that handles the actual execution of the present builder.
      Parameters:
      content - The content of the message.
      Returns:
      The current instance of the present builder to allow the chaining of methods.