Advertisement
Treyzania

Untitled

Feb 15th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. package com.bapcraft.got.player;
  2.  
  3. import java.io.File;
  4. import java.util.UUID;
  5.  
  6. import com.bapcraft.got.BapGot;
  7. import com.google.gson.annotations.Expose;
  8.  
  9. public class GotPlayer {
  10.  
  11. @Expose public UUID uuid;
  12.  
  13. /** If you're there when it starts. */
  14. @Expose public int gamesPlayed;
  15. /** If you die too many times or lose outright. */
  16. @Expose public int gamesLost;
  17. /** If you get to the throne and complete the objectives. */
  18. @Expose public int gamesWon;
  19. /** If you win it because someone else in your family gets to the throne. */
  20. @Expose public int gamesWonWithFamily;
  21. /** In-game currency, persists between rounds. */
  22. @Expose public long gold;
  23.  
  24. public GotPlayer(UUID uuid) {
  25. this.uuid = uuid;
  26. }
  27.  
  28. public GotPlayer() {
  29. // For Gson.
  30. }
  31.  
  32. public int getGamesWonOverall() {
  33. return this.gamesWon + this.gamesWonWithFamily;
  34. }
  35.  
  36. public int getGamesCompleted() {
  37. return this.gamesWon + this.gamesWonWithFamily + this.gamesLost;
  38. }
  39.  
  40. public void flush() {
  41. PlayerIO.savePlayerData_deferred(this);
  42. }
  43.  
  44. public File getDataFile() {
  45. return getDataFile(this.uuid);
  46. }
  47.  
  48. public static File getDataFile(UUID uuid) {
  49. return new File(new File(BapGot.INSTANCE.getDataFolder(), "playerdata"), "player-data_" + uuid.toString() + ".json");
  50. }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement