Package eu.soupmc
Class GameAPI
java.lang.Object
eu.soupmc.GameAPI
Main class of the Game API, used for basic cloudnet stuff + XP, Coins and Nick requests
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSub class to create a game profile of a certain player to have all methods at one location -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddCoins(org.bukkit.entity.Player player, int coins) Add a specific amount of coins to a playerprotected static voidaddXp(org.bukkit.entity.Player player, int xp) Add a specific amount of xp points to a playerprotected static intgetCoins(org.bukkit.entity.Player p) Get the coins from a playerstatic GameAPIReturns the Game API instanceintGet max players of a server using the cloudnet APIprotected static StringgetNick(org.bukkit.entity.Player p) Get the nick status from a playerprotected static intgetXp(org.bukkit.entity.Player p) Get the XP from a playerprotected StringMethod for a basic POST request to the WebClient APIvoidSet the ingame status of the server using the cloudnet APIvoidsetMaxPlayers(int maxPlayers) Set max players of a server using the cloudnet APIprotected static voidsetNick(org.bukkit.entity.Player p, boolean value) Set the nick status of a player
-
Field Details
-
plugin
The main class of the plugin using this API -
instance
The instance of this class
-
-
Constructor Details
-
GameAPI
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 toxp- 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 tocoins- 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
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 setvalue- The boolean value the nick of the player should have
-
request
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. getCoinsuuid- The uuid of the player in the databaseamount- 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
Returns the Game API instance- Returns:
- GameAPI instance
-