PlotSquared/src/main/java/com/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java

45 lines
1.3 KiB
Java
Raw Normal View History

package com.plotsquared.bukkit.uuid;
2014-12-16 05:58:54 +01:00
2015-07-30 16:25:16 +02: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 05:58:54 +01:00
2015-09-13 06:04:31 +02:00
public class DefaultUUIDWrapper extends UUIDWrapper {
2014-12-16 05:58:54 +01:00
@Override
2015-09-13 06:04:31 +02:00
public UUID getUUID(final PlotPlayer player) {
2015-02-21 13:52:50 +01:00
return ((BukkitPlayer) player).player.getUniqueId();
2014-12-16 05:58:54 +01:00
}
2015-09-13 06:04:31 +02:00
2014-12-16 05:58:54 +01:00
@Override
2015-09-13 06:04:31 +02:00
public UUID getUUID(final OfflinePlotPlayer player) {
2015-02-21 13:52:50 +01:00
return player.getUUID();
2014-12-16 05:58:54 +01:00
}
2015-09-13 06:04:31 +02:00
2014-12-16 05:58:54 +01:00
@Override
2015-09-13 06:04:31 +02:00
public OfflinePlotPlayer getOfflinePlayer(final UUID uuid) {
2015-02-21 13:52:50 +01:00
return new BukkitOfflinePlayer(Bukkit.getOfflinePlayer(uuid));
2014-12-16 05:58:54 +01:00
}
2015-09-13 06:04:31 +02:00
@Override
2015-09-13 06:04:31 +02:00
public UUID getUUID(final String name) {
return Bukkit.getOfflinePlayer(name).getUniqueId();
}
2015-09-13 06:04:31 +02:00
2015-02-26 12:13:17 +01:00
@Override
2015-09-13 06:04:31 +02:00
public OfflinePlotPlayer[] getOfflinePlayers() {
2015-09-11 12:09:22 +02:00
final OfflinePlayer[] ops = Bukkit.getOfflinePlayers();
final BukkitOfflinePlayer[] toReturn = new BukkitOfflinePlayer[ops.length];
2015-09-13 06:04:31 +02:00
for (int i = 0; i < ops.length; i++) {
2015-02-26 12:13:17 +01:00
toReturn[i] = new BukkitOfflinePlayer(ops[i]);
}
return toReturn;
}
2014-12-16 05:58:54 +01:00
}