allow getting AdaptedPlayer via UUID
This commit is contained in:
+8
-4
@@ -16,10 +16,7 @@ import us.ajg0702.queue.commands.commands.PlayerSender;
|
||||
import us.ajg0702.queue.platforms.bungeecord.players.BungeePlayer;
|
||||
import us.ajg0702.queue.platforms.bungeecord.server.BungeeServer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.*;
|
||||
|
||||
public class BungeeMethods implements PlatformMethods {
|
||||
|
||||
@@ -87,6 +84,13 @@ public class BungeeMethods implements PlatformMethods {
|
||||
return new BungeePlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdaptedPlayer getPlayer(UUID uuid) {
|
||||
ProxiedPlayer player = proxyServer.getPlayer(uuid);
|
||||
if(player == null) return null;
|
||||
return new BungeePlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getServerNames() {
|
||||
return new ArrayList<>(proxyServer.getServers().keySet());
|
||||
|
||||
+10
-5
@@ -19,10 +19,7 @@ import us.ajg0702.queue.commands.commands.PlayerSender;
|
||||
import us.ajg0702.queue.platforms.velocity.players.VelocityPlayer;
|
||||
import us.ajg0702.queue.platforms.velocity.server.VelocityServer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings("OptionalIsPresent")
|
||||
public class VelocityMethods implements PlatformMethods {
|
||||
@@ -96,7 +93,15 @@ public class VelocityMethods implements PlatformMethods {
|
||||
public AdaptedPlayer getPlayer(String name) {
|
||||
Optional<Player> player = proxyServer.getPlayer(name);
|
||||
if(!player.isPresent()) {
|
||||
System.out.println("Player "+name+" not found");
|
||||
return null;
|
||||
}
|
||||
return new VelocityPlayer(player.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdaptedPlayer getPlayer(UUID uuid) {
|
||||
Optional<Player> player = proxyServer.getPlayer(uuid);
|
||||
if(!player.isPresent()) {
|
||||
return null;
|
||||
}
|
||||
return new VelocityPlayer(player.get());
|
||||
|
||||
Reference in New Issue
Block a user