50 lines
1.5 KiB
Java
Raw Normal View History

package com.plotsquared.bukkit.uuid;
2014-12-16 15:58:54 +11:00
2015-07-31 00:25:16 +10:00
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
2015-07-27 19:50:04 +02:00
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
2015-07-27 19:50:04 +02:00
import com.plotsquared.bukkit.object.BukkitOfflinePlayer;
import com.plotsquared.bukkit.object.BukkitPlayer;
2014-12-16 15:58:54 +11:00
2015-09-13 14:04:31 +10:00
public class DefaultUUIDWrapper extends UUIDWrapper {
2014-12-16 15:58:54 +11:00
@Override
2015-09-13 14:04:31 +10:00
public UUID getUUID(final PlotPlayer player) {
2015-02-21 23:52:50 +11:00
return ((BukkitPlayer) player).player.getUniqueId();
2014-12-16 15:58:54 +11:00
}
2015-09-13 14:04:31 +10:00
2014-12-16 15:58:54 +11:00
@Override
2015-09-13 14:04:31 +10:00
public UUID getUUID(final OfflinePlotPlayer player) {
2015-02-21 23:52:50 +11:00
return player.getUUID();
2014-12-16 15:58:54 +11:00
}
2015-09-13 14:04:31 +10:00
2014-12-16 15:58:54 +11:00
@Override
2015-09-13 14:04:31 +10:00
public OfflinePlotPlayer getOfflinePlayer(final UUID uuid) {
2015-02-21 23:52:50 +11:00
return new BukkitOfflinePlayer(Bukkit.getOfflinePlayer(uuid));
2014-12-16 15:58:54 +11:00
}
2015-09-13 14:04:31 +10:00
@Override
2015-09-13 14:04:31 +10:00
public UUID getUUID(final String name) {
return Bukkit.getOfflinePlayer(name).getUniqueId();
}
2015-09-13 14:04:31 +10:00
2015-02-26 22:13:17 +11:00
@Override
2015-09-13 14:04:31 +10:00
public OfflinePlotPlayer[] getOfflinePlayers() {
2015-09-11 20:09:22 +10:00
final OfflinePlayer[] ops = Bukkit.getOfflinePlayers();
final BukkitOfflinePlayer[] toReturn = new BukkitOfflinePlayer[ops.length];
2015-09-13 14:04:31 +10:00
for (int i = 0; i < ops.length; i++) {
2015-02-26 22:13:17 +11:00
toReturn[i] = new BukkitOfflinePlayer(ops[i]);
}
return toReturn;
}
2016-02-11 05:59:51 +11:00
@Override
public OfflinePlotPlayer getOfflinePlayer(String name) {
return new BukkitOfflinePlayer(Bukkit.getOfflinePlayer(name));
}
2014-12-16 15:58:54 +11:00
}