Class PresentManager

java.lang.Object
com.github.mafelp.Manager.PresentManager

public class PresentManager
extends java.lang.Object
The class that handles tasks that have something to do with Presents.
  • Field Summary

    Fields
    Modifier and Type Field Description
    private static org.apache.logging.log4j.Logger logger
    The logging instance to log statements to the console and the log file.
    private static java.util.Map<org.javacord.api.entity.server.Server,​com.google.gson.JsonArray> presentsMap
    The Map of presents for a specific server.
  • Constructor Summary

    Constructors
    Constructor Description
    PresentManager()  
  • Method Summary

    Modifier and Type Method Description
    static void addPresent​(org.javacord.api.entity.server.Server server, com.google.gson.JsonObject present)
    The method to a add a present to a server.
    static org.javacord.api.entity.message.embed.EmbedBuilder buildPresent​(com.google.gson.JsonObject present)
    A function which creates an embed out of a JSON Present.
    static java.util.List<com.google.gson.JsonObject> getPresents​(org.javacord.api.entity.server.Server server, org.javacord.api.entity.user.User user)
    The getter for all presents, that can be unpacked by a user.
    static java.io.File getPresentsFile​(org.javacord.api.entity.server.Server server)
    Gets a presents file for a specific server.
    static void loadPresents()
    Loads all the presents from all the servers in.
    static void savePresents()
    A method that saves all Presents from all servers.
    static void savePresents​(org.javacord.api.entity.server.Server server)
    Saves the presents from a server to its corresponding file.

    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 logging instance to log statements to the console and the log file.
    • presentsMap

      private static final java.util.Map<org.javacord.api.entity.server.Server,​com.google.gson.JsonArray> presentsMap
      The Map of presents for a specific server.
  • Constructor Details

    • PresentManager

      public PresentManager()
  • Method Details

    • getPresentsFile

      public static java.io.File getPresentsFile​(org.javacord.api.entity.server.Server server)
      Gets a presents file for a specific server.
      Parameters:
      server - The server to get the presents file of.
      Returns:
      The presents file.
    • addPresent

      public static void addPresent​(org.javacord.api.entity.server.Server server, com.google.gson.JsonObject present)
      The method to a add a present to a server.
      Parameters:
      server - The server to add the present to.
      present - The present you want to add.
    • getPresents

      public static java.util.List<com.google.gson.JsonObject> getPresents​(org.javacord.api.entity.server.Server server, org.javacord.api.entity.user.User user)
      The getter for all presents, that can be unpacked by a user.
      Parameters:
      server - The server you want to get all the presents of.
      user - The user of whom you want to get the presents.
      Returns:
      The list of presents the user has.
    • buildPresent

      public static org.javacord.api.entity.message.embed.EmbedBuilder buildPresent​(com.google.gson.JsonObject present)
      A function which creates an embed out of a JSON Present.
      Parameters:
      present - The JSON Object to build the present from.
      Returns:
      The embed which is ready to send.
    • savePresents

      public static void savePresents​(org.javacord.api.entity.server.Server server)
      Saves the presents from a server to its corresponding file.
      Parameters:
      server - The server to save the presents of.
    • savePresents

      public static void savePresents()
      A method that saves all Presents from all servers.
    • loadPresents

      public static void loadPresents()
      Loads all the presents from all the servers in.