mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-05 02:09:50 +01:00
Removed OfflinePlayer implementation from PlayerProfile
This commit is contained in:
parent
1f84cd556b
commit
76aac83cc9
@ -14,10 +14,6 @@ import com.djrapitops.plan.system.info.server.ServerInfo;
|
|||||||
import com.djrapitops.plan.utilities.MiscUtils;
|
import com.djrapitops.plan.utilities.MiscUtils;
|
||||||
import com.djrapitops.plan.utilities.comparators.ActionComparator;
|
import com.djrapitops.plan.utilities.comparators.ActionComparator;
|
||||||
import com.djrapitops.plan.utilities.comparators.GeoInfoComparator;
|
import com.djrapitops.plan.utilities.comparators.GeoInfoComparator;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -31,7 +27,7 @@ import java.util.stream.Stream;
|
|||||||
*
|
*
|
||||||
* @author Rsl1122
|
* @author Rsl1122
|
||||||
*/
|
*/
|
||||||
public class PlayerProfile implements OfflinePlayer {
|
public class PlayerProfile {
|
||||||
|
|
||||||
// Identification
|
// Identification
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
@ -172,10 +168,6 @@ public class PlayerProfile implements OfflinePlayer {
|
|||||||
return getLastSeen(getAllSessions());
|
return getLastSeen(getAllSessions());
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLastSeen(UUID serverUUID) {
|
|
||||||
return getLastSeen(getSessions(serverUUID).stream());
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getLastSeen(Stream<Session> s) {
|
public long getLastSeen(Stream<Session> s) {
|
||||||
OptionalLong max = s.mapToLong(session -> Math.max(session.getSessionStart(), session.getSessionEnd())).max();
|
OptionalLong max = s.mapToLong(session -> Math.max(session.getSessionStart(), session.getSessionEnd())).max();
|
||||||
if (max.isPresent()) {
|
if (max.isPresent()) {
|
||||||
@ -387,7 +379,6 @@ public class PlayerProfile implements OfflinePlayer {
|
|||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -435,72 +426,14 @@ public class PlayerProfile implements OfflinePlayer {
|
|||||||
|
|
||||||
// OfflinePlayer methods for possible PluginData analysis
|
// OfflinePlayer methods for possible PluginData analysis
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOnline() {
|
|
||||||
Player p = getPlayer();
|
|
||||||
return p != null && p.isOnline();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getUniqueId() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isBanned() {
|
public boolean isBanned() {
|
||||||
return bannedOnServers.size() != 0;
|
return bannedOnServers.size() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isWhitelisted() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWhitelisted(boolean b) {
|
|
||||||
/* Do nothing */
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Player getPlayer() {
|
|
||||||
return Bukkit.getPlayer(uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getFirstPlayed() {
|
|
||||||
return registered;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getLastPlayed() {
|
|
||||||
return getLastSeen(ServerInfo.getServerUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPlayedBefore() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location getBedSpawnLocation() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> serialize() {
|
|
||||||
return new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOp() {
|
public boolean isOp() {
|
||||||
return oppedOnServers.contains(ServerInfo.getServerUUID());
|
return oppedOnServers.contains(ServerInfo.getServerUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setOp(boolean b) {
|
|
||||||
/* Do nothing */
|
|
||||||
}
|
|
||||||
|
|
||||||
public void calculateWorldTimesPerServer() {
|
public void calculateWorldTimesPerServer() {
|
||||||
if (worldTimesMap.containsKey(ServerInfo.getServerUUID())) {
|
if (worldTimesMap.containsKey(ServerInfo.getServerUUID())) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user