Advertisement
Guest User

TokenPlayer.java

a guest
Aug 29th, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. package us.legioncraft.tokens;
  2.  
  3. import java.util.UUID;
  4.  
  5. import org.bukkit.Bukkit;
  6.  
  7. /**
  8.  *
  9.  * @author TheMindWreck
  10.  * @version 1.0
  11.  *
  12.  */
  13.  
  14. public class TokenPlayer {
  15.     private UUID player;
  16.     private TokensAPI plugin;
  17.      
  18.     /**
  19.      * Constructor that allows you to access their token info. Create the object to use the methods.
  20.      * @param player    the UUID of the player
  21.      *
  22.      */
  23.     public TokenPlayer(UUID player){
  24.         this.player = player;
  25.     }
  26.    
  27.     /**
  28.      * Gives class ability to use the getConfig() method and like methods
  29.      * @param plugin - Class variable
  30.      */
  31.     public TokenPlayer(TokensAPI plugin){
  32.         this.plugin = plugin;
  33.     }
  34.     /**
  35.      * Gets the tokens that the player has.
  36.      *
  37.      * @return the number of tokens the player has
  38.      */
  39.     public int getTokens(){
  40.         Bukkit.getServer().broadcastMessage(player.toString());
  41.         return plugin.getCustomConfig(player).getInt("tokens");
  42.     }
  43.    
  44.     /**
  45.      * Sets the player's tokens to a certain amount
  46.      *
  47.      * @param tokens the number of tokens to set the players tokens to.
  48.      */
  49.    
  50.     public void setTokens(int tokens){
  51.         plugin.getCustomConfig(player).set("tokens", tokens);
  52.         plugin.saveCustomConfig(player);
  53.     }
  54.    
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement