mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-09 00:54:44 +02:00
Implement some more generic types to make the player objects easier to work with and also create wrapper objects for fake players (NPCs). Potentially fixes PS-27
This commit is contained in:
@ -63,12 +63,11 @@ import static com.sk89q.worldedit.world.gamemode.GameModes.CREATIVE;
|
||||
import static com.sk89q.worldedit.world.gamemode.GameModes.SPECTATOR;
|
||||
import static com.sk89q.worldedit.world.gamemode.GameModes.SURVIVAL;
|
||||
|
||||
public class BukkitPlayer extends PlotPlayer {
|
||||
public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
|
||||
private static boolean CHECK_EFFECTIVE = true;
|
||||
public final Player player;
|
||||
private boolean offline;
|
||||
private UUID uuid;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
@ -78,20 +77,29 @@ public class BukkitPlayer extends PlotPlayer {
|
||||
* @param player Bukkit player instance
|
||||
*/
|
||||
public BukkitPlayer(@NotNull final Player player) {
|
||||
this.player = player;
|
||||
super.populatePersistentMetaMap();
|
||||
this(player, false);
|
||||
}
|
||||
|
||||
public BukkitPlayer(@NotNull final Player player, final boolean offline) {
|
||||
this(player, offline, true);
|
||||
}
|
||||
|
||||
public BukkitPlayer(@NotNull final Player player, final boolean offline, final boolean realPlayer) {
|
||||
this.player = player;
|
||||
this.offline = offline;
|
||||
super.populatePersistentMetaMap();
|
||||
if (realPlayer) {
|
||||
super.populatePersistentMetaMap();
|
||||
}
|
||||
}
|
||||
|
||||
@Override public Actor toActor() {
|
||||
return BukkitAdapter.adapt(player);
|
||||
}
|
||||
|
||||
@Override public Player getPlatformPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@NotNull @Override public Location getLocation() {
|
||||
final Location location = super.getLocation();
|
||||
return location == null ? BukkitUtil.getLocation(this.player) : location;
|
||||
|
Reference in New Issue
Block a user