2017-06-29 21:18:53 +02:00
|
|
|
/*
|
|
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
|
|
* To change this template file, choose Tools | Templates
|
|
|
|
* and open the template in the editor.
|
|
|
|
*/
|
|
|
|
package com.djrapitops.pluginbridge.plan;
|
|
|
|
|
|
|
|
import main.java.com.djrapitops.plan.data.UserData;
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.OfflinePlayer;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2017-08-17 10:23:14 +02:00
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
2017-06-29 21:18:53 +02:00
|
|
|
/**
|
|
|
|
* @author Rsl1122
|
|
|
|
*/
|
|
|
|
public class FakeOfflinePlayer implements OfflinePlayer {
|
|
|
|
|
|
|
|
private final UserData data;
|
|
|
|
|
|
|
|
public FakeOfflinePlayer(UserData data) {
|
|
|
|
this.data = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isOnline() {
|
|
|
|
return data.isOnline();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getName() {
|
2017-07-09 13:25:36 +02:00
|
|
|
String name = data.getName();
|
|
|
|
if (name == null) {
|
|
|
|
name = "null";
|
|
|
|
}
|
|
|
|
return name;
|
2017-06-29 21:18:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public UUID getUniqueId() {
|
|
|
|
return data.getUuid();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isBanned() {
|
|
|
|
return data.isBanned();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isWhitelisted() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setWhitelisted(boolean bln) {
|
2017-08-17 17:03:45 +02:00
|
|
|
/* Not used */
|
2017-06-29 21:18:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Player getPlayer() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getFirstPlayed() {
|
|
|
|
return data.getRegistered();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getLastPlayed() {
|
|
|
|
return data.getLastPlayed();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasPlayedBefore() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Location getBedSpawnLocation() {
|
|
|
|
return new Location(null, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isOp() {
|
|
|
|
return data.isOp();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setOp(boolean bln) {
|
2017-08-17 17:03:45 +02:00
|
|
|
/* Not used */
|
2017-06-29 21:18:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> serialize() {
|
|
|
|
return new HashMap<>();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|