// Path: src/main/java/com/mcbans/domain/models/client/Ban.java
// public class Ban implements Serializable {
//     private long id;
//     private String reason;
//     private Player admin;
//     private Player player;
//     private double reputation;
//     private String type;
//     private Long duration;
//     private Server server;
//     private Date date;
// 
//     public Ban() {
//     }
// 
//     public Ban(String type, String reason, double reputation, Player admin) {
//         this.reason = reason;
//         this.reputation = reputation;
//         this.type = type;
//         this.admin = admin;
//     }
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public String getReason() {
//         return reason;
//     }
// 
//     public void setReason(String reason) {
//         this.reason = reason;
//     }
// 
//     public double getReputation() {
//         return reputation;
//     }
// 
//     public void setReputation(double reputation) {
//         this.reputation = reputation;
//     }
// 
//     public String getType() {
//         return type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     public Long getDuration() {
//         return duration;
//     }
// 
//     public void setDuration(Long duration) {
//         this.duration = duration;
//     }
// 
//     public Server getServer() {
//         return server;
//     }
// 
//     public void setServer(Server server) {
//         this.server = server;
//     }
// 
//     public Date getDate() {
//         return date;
//     }
// 
//     public void setDate(Date date) {
//         this.date = date;
//     }
// 
//     public Player getAdmin() {
//         return admin;
//     }
// 
//     public void setAdmin(Player admin) {
//         this.admin = admin;
//     }
// 
//     public Player getPlayer() {
//         return player;
//     }
// 
//     public void setPlayer(Player player) {
//         this.player = player;
//     }
// }
// 
// Path: src/main/java/com/mcbans/domain/models/client/Player.java
// public class Player implements Serializable {
//   String name;
//   long playerId;
//   String uuid;
// 
//   public Player() {
//   }
// 
//   public Player(long playerId, String name, String uuid) {
//     this.name = name;
//     this.playerId = playerId;
//     this.uuid = uuid;
//   }
// 
//   public Player(String name) {
//     this.name = name;
//   }
// 
//   public String getName() {
//     return name;
//   }
// 
//   public void setName(String name) {
//     this.name = name;
//   }
// 
//   public long getPlayerId() {
//     return playerId;
//   }
// 
//   public void setPlayerId(long playerId) {
//     this.playerId = playerId;
//   }
// 
//   public String getUuid() {
//     return uuid;
//   }
// 
//   public void setUuid(String uuid) {
//     this.uuid = uuid;
//   }
// }


import com.mcbans.domain.models.client.Ban;
import com.mcbans.domain.models.client.Player;
import com.mcbans.utils.*;
import java.io.IOException;
import java.util.List;
package com.mcbans.client;



public class PlayerLookupClient extends Client {
  public PlayerLookupClient(Client c) {
    super(c);
  }

  public PlayerLookupClient(String apiKey) throws IOException, BadApiKeyException, TooLargeException {
    super(apiKey);
  }
  public static PlayerLookupClient cast(Client client) {
    return new PlayerLookupClient(client);
  }

  public interface DataReceived{
    void received(Player player, List<Ban> bans, Double rep);
    void error(String message);
  }

  public void lookupPlayer(String playerName, DataReceived dataReceived) throws IOException, ClassNotFoundException, TooLargeException {
    if(playerName==null || playerName.length()>16 || playerName.length()<3){
      dataReceived.error("Not valid player name.");
      return;
    }
    sendCommand(ServerMCBansCommands.PlayerLookup);
    WriteToOutputStream.writeString(this.getOutputStream(), playerName);
    Command c = getCommand(getInputStream());
    switch(c.getCommand()){
      case 124:
        dataReceived.error(ReadFromInputStream.readString(getInputStream(), 255));
        break;
      case 70:
        int length = Long.valueOf(ReadFromInputStream.readLong(getInputStream())).intValue();
        Player player = ObjectSerializer.deserialize(ReadFromInputStream.readByteData(getInputStream(), length));
// Path: src/main/java/com/mcbans/domain/models/client/Ban.java
// public class Ban implements Serializable {
//     private long id;
//     private String reason;
//     private Player admin;
//     private Player player;
//     private double reputation;
//     private String type;
//     private Long duration;
//     private Server server;
//     private Date date;
// 
//     public Ban() {
//     }
// 
//     public Ban(String type, String reason, double reputation, Player admin) {
//         this.reason = reason;
//         this.reputation = reputation;
//         this.type = type;
//         this.admin = admin;
//     }
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public String getReason() {
//         return reason;
//     }
// 
//     public void setReason(String reason) {
//         this.reason = reason;
//     }
// 
//     public double getReputation() {
//         return reputation;
//     }
// 
//     public void setReputation(double reputation) {
//         this.reputation = reputation;
//     }
// 
//     public String getType() {
//         return type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     public Long getDuration() {
//         return duration;
//     }
// 
//     public void setDuration(Long duration) {
//         this.duration = duration;
//     }
// 
//     public Server getServer() {
//         return server;
//     }
// 
//     public void setServer(Server server) {
//         this.server = server;
//     }
// 
//     public Date getDate() {
//         return date;
//     }
// 
//     public void setDate(Date date) {
//         this.date = date;
//     }
// 
//     public Player getAdmin() {
//         return admin;
//     }
// 
//     public void setAdmin(Player admin) {
//         this.admin = admin;
//     }
// 
//     public Player getPlayer() {
//         return player;
//     }
// 
//     public void setPlayer(Player player) {
//         this.player = player;
//     }
// }
// 
// Path: src/main/java/com/mcbans/domain/models/client/Player.java
// public class Player implements Serializable {
//   String name;
//   long playerId;
//   String uuid;
// 
//   public Player() {
//   }
// 
//   public Player(long playerId, String name, String uuid) {
//     this.name = name;
//     this.playerId = playerId;
//     this.uuid = uuid;
//   }
// 
//   public Player(String name) {
//     this.name = name;
//   }
// 
//   public String getName() {
//     return name;
//   }
// 
//   public void setName(String name) {
//     this.name = name;
//   }
// 
//   public long getPlayerId() {
//     return playerId;
//   }
// 
//   public void setPlayerId(long playerId) {
//     this.playerId = playerId;
//   }
// 
//   public String getUuid() {
//     return uuid;
//   }
// 
//   public void setUuid(String uuid) {
//     this.uuid = uuid;
//   }
// }


// Path: src/main/java/com/mcbans/client/PlayerLookupClient.java
import com.mcbans.domain.models.client.Ban;
import com.mcbans.domain.models.client.Player;
import com.mcbans.utils.*;
import java.io.IOException;
import java.util.List;

package com.mcbans.client;



public class PlayerLookupClient extends Client {
  public PlayerLookupClient(Client c) {
    super(c);
  }

  public PlayerLookupClient(String apiKey) throws IOException, BadApiKeyException, TooLargeException {
    super(apiKey);
  }
  public static PlayerLookupClient cast(Client client) {
    return new PlayerLookupClient(client);
  }

  public interface DataReceived{
    void received(Player player, List<Ban> bans, Double rep);
    void error(String message);
  }

  public void lookupPlayer(String playerName, DataReceived dataReceived) throws IOException, ClassNotFoundException, TooLargeException {
    if(playerName==null || playerName.length()>16 || playerName.length()<3){
      dataReceived.error("Not valid player name.");
      return;
    }
    sendCommand(ServerMCBansCommands.PlayerLookup);
    WriteToOutputStream.writeString(this.getOutputStream(), playerName);
    Command c = getCommand(getInputStream());
    switch(c.getCommand()){
      case 124:
        dataReceived.error(ReadFromInputStream.readString(getInputStream(), 255));
        break;
      case 70:
        int length = Long.valueOf(ReadFromInputStream.readLong(getInputStream())).intValue();
        Player player = ObjectSerializer.deserialize(ReadFromInputStream.readByteData(getInputStream(), length));
        List<Ban> bans = null;