Advertisement
Guest User

Untitled

a guest
Aug 21st, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. public class LocalPlayer
  2. {
  3.     private final UUID uuid;
  4.     private final String nickname;
  5.     private boolean god;
  6.     private boolean costam;
  7.     private int points;
  8.  
  9.     public LocalPlayer(UUID uuid, String nickname, boolean god, boolean costam, int points)
  10.     {
  11.         this.uuid = uuid;
  12.         // to samo dla reszty
  13.     }
  14.    
  15.     public UUID getUUID() // to samo dla reszty + dla boolean np zamiast getGod robisz isGod lub hasGod
  16.     {
  17.         return uuid;
  18.     }
  19.  
  20.     public void setGod(boolean god) //to samo dla reszty
  21.     {
  22.         this.god = god;
  23.     }
  24.  
  25. // + możesz dodawać takie wygodne metody:
  26.    public void addPoints(int points)
  27.    {
  28.         this.points += points;
  29.    }
  30. + metoda equals i hashcode sprawdzająca tylko UUID bo każdy ma inne, ale to wystraczy wygenerować w eclipse/intellij czy co tam masz, każdy program ma metode do ich generowania.
  31. Tak samo jak ma metody do generowanie tych "getterów" i "setterów"
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement