Package com.github.mafelp.Builders
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 tomessage
.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 loggerThe logger, which is used to log information to the console. -
presentBuilders
private static final java.util.Map<org.javacord.api.entity.user.User,PresentBuilder> presentBuildersThe map which saves the current state and all the presentBuilds for Users. -
state
The state of the current builder. -
present
private final com.google.gson.JsonObject presentThe present which will be configured. -
channel
private org.javacord.api.entity.channel.PrivateChannel channelThe channel, to which the messages were sent. -
server
private final org.javacord.api.entity.server.Server serverThe server on which the presents should be created. -
sender
private final org.javacord.api.entity.user.User senderThe user who created the present. -
receiver
private final org.javacord.api.entity.user.User receiverThe user who shall receive and can unpack the present. -
message
private org.javacord.api.entity.message.Message messageThe first message sent by this bot in order to initiate the wizard. -
presentBuilderReactionListener
The Listener, which listens to tomessage
.
-
-
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
- 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
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.
-