Facebook
From StefTheDev, 5 Years ago, written in Java.
Embed
Download Paste or View Raw
Hits: 226
  1. public class Encapsulation {
  2.  
  3.     private UUID uuid;
  4.     private int level, xp;
  5.  
  6.     //Constructor which puts all the data into the variables.
  7.     public Encapsulation(UUID uuid, int level, int xp) {
  8.         this.uuid = uuid;
  9.         this.level = level;
  10.         this.xp = xp;
  11.     }
  12.  
  13.     //Simply get data.
  14.     public int getLevel() {
  15.         return level;
  16.     }
  17.  
  18.     public UUID getUuid() {
  19.         return uuid;
  20.     }
  21.  
  22.     public int getXp() {
  23.         return xp;
  24.     }
  25.  
  26.     //Simply set data.
  27.     public void setUuid(UUID uuid) {
  28.         this.uuid = uuid;
  29.     }
  30.  
  31.     public void setLevel(int level) {
  32.         this.level = level;
  33.     }
  34.  
  35.     public void setXp(int xp) {
  36.         this.xp = xp;
  37.     }
  38.  
  39.     //We will use this for serialization
  40.     @Override
  41.     public String toString() {
  42.         return uuid.toString() + ":" + level + ":" + xp;
  43.     }
  44. }