Package eu.soupmc

Class GameAPI

java.lang.Object
eu.soupmc.GameAPI

public class GameAPI extends Object
Main class of the Game API, used for basic cloudnet stuff + XP, Coins and Nick requests
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Sub class to create a game profile of a certain player to have all methods at one location
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static GameAPI
    The instance of this class
    Class<? extends org.bukkit.plugin.java.JavaPlugin>
    The main class of the plugin using this API
  • Constructor Summary

    Constructors
    Constructor
    Description
    GameAPI(Class<? extends org.bukkit.plugin.java.JavaPlugin> passedPlugin)
    Constructor to get the plugin class
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static void
    addCoins(org.bukkit.entity.Player player, int coins)
    Add a specific amount of coins to a player
    protected static void
    addXp(org.bukkit.entity.Player player, int xp)
    Add a specific amount of xp points to a player
    protected static int
    getCoins(org.bukkit.entity.Player p)
    Get the coins from a player
    static GameAPI
    Returns the Game API instance
    int
    Get max players of a server using the cloudnet API
    protected static String
    getNick(org.bukkit.entity.Player p)
    Get the nick status from a player
    protected static int
    getXp(org.bukkit.entity.Player p)
    Get the XP from a player
    protected String
    request(String type, String key, UUID uuid, String amount)
    Method for a basic POST request to the WebClient API
    void
    Set the ingame status of the server using the cloudnet API
    void
    setMaxPlayers(int maxPlayers)
    Set max players of a server using the cloudnet API
    protected static void
    setNick(org.bukkit.entity.Player p, boolean value)
    Set the nick status of a player

    Methods inherited from class java.lang.Object

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

    • plugin

      public Class<? extends org.bukkit.plugin.java.JavaPlugin> plugin
      The main class of the plugin using this API
    • instance

      public static GameAPI instance
      The instance of this class
  • Constructor Details

    • GameAPI

      public GameAPI(Class<? extends org.bukkit.plugin.java.JavaPlugin> passedPlugin)
      Constructor to get the plugin class
      Parameters:
      passedPlugin - The plugin extending JavaPlugin
  • Method Details

    • setIngameStatus

      public void setIngameStatus()
      Set the ingame status of the server using the cloudnet API
    • setMaxPlayers

      public void setMaxPlayers(int maxPlayers)
      Set max players of a server using the cloudnet API
      Parameters:
      maxPlayers - The maximum of players who can join the server
    • getMaxPlayers

      public int getMaxPlayers()
      Get max players of a server using the cloudnet API
      Returns:
      The max players value of the current server
    • addXp

      protected static void addXp(org.bukkit.entity.Player player, int xp)
      Add a specific amount of xp points to a player
      Parameters:
      player - The player the Xp should be added to
      xp - The amount of xp the player should receive
    • getXp

      protected static int getXp(org.bukkit.entity.Player p)
      Get the XP from a player
      Parameters:
      p - The player of the xp
      Returns:
      The players xp
    • addCoins

      protected static void addCoins(org.bukkit.entity.Player player, int coins)
      Add a specific amount of coins to a player
      Parameters:
      player - The player the coins should be added to
      coins - The amount of coins the player should receive
    • getCoins

      protected static int getCoins(org.bukkit.entity.Player p)
      Get the coins from a player
      Parameters:
      p - The player of the coins รค
      Returns:
      The players coins
    • getNick

      protected static String getNick(org.bukkit.entity.Player p)
      Get the nick status from a player
      Parameters:
      p - The player of the nick status
      Returns:
      The String value of the nick status of the player
    • setNick

      protected static void setNick(org.bukkit.entity.Player p, boolean value)
      Set the nick status of a player
      Parameters:
      p - The player which nick should be set
      value - The boolean value the nick of the player should have
    • request

      protected String request(String type, String key, UUID uuid, String amount)
      Method for a basic POST request to the WebClient API
      Parameters:
      type - Specifies the type of the request, in this case either 'read' or 'write'
      key - Specifies the key of the request, e.g. getCoins
      uuid - The uuid of the player in the database
      amount - Optional, if not required, '', sets the amount of a write request, e.g. for addCoins: 20
      Returns:
      A json string containing the http response
    • getInstance

      public static GameAPI getInstance()
      Returns the Game API instance
      Returns:
      GameAPI instance