Risiko94

Player.java

Oct 19th, 2021
566
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package DataTypes;
  2.  
  3. public class Player {
  4.     final byte id;
  5.     final String clan;
  6.     final String name;
  7.     final String hash;
  8.     final String ip;
  9.  
  10.     public byte getId() {
  11.         return this.id;
  12.     }
  13.     public String getClan() {
  14.         return this.clan;
  15.     }
  16.     public String getName() {
  17.         return this.name;
  18.     }
  19.  
  20.     public String getHash() {
  21.         return this.hash;
  22.     }
  23.  
  24.     public String getIp() {
  25.         return this.ip;
  26.     }
  27.     public String getClanAndName() {
  28.         return (this.getClan() + " " + this.getName());
  29.     }
  30.  
  31.  
  32.  
  33.     public Player (byte id, String clantag, String name, String hash, String ip) {
  34.         this.id = id;
  35.         this.clan = (clantag.length() <= 1) ? "" : clantag;
  36.         this.name = (name.length() <= 1) ? "ERROR NO NAME" : name;
  37.         this.hash = (hash.length() <= 1) ? "NO HASH" : hash;
  38.         this.ip = (ip.length() <= 1) ? "NO IP" : ip;
  39.     }
  40.    
  41.     public Player () {
  42.         this.id = 0;
  43.         this.clan = "ERROR";
  44.         this.name = "ERROR";
  45.         this.hash = "ERROR";
  46.         this.ip =  "ERROR";
  47.     }
  48.  
  49.     public String vomit(){
  50.         return ("ID: " + String.format("%#04x", getId()) +
  51.                 "\tClan: " + getClan() +
  52.                 "\tPlayername: " + getName() +
  53.                 "\t\tHash: " + getHash() +
  54.                 " \tIP: " + getIp());
  55.     }  
  56.     public String toString() {
  57.         return(getClanAndName() + " \t(Hash: " + getHash() + " IP: " + getIp() + ")");
  58.     }
  59.  
  60.  
  61. }
RAW Paste Data