From 6f40766d757db73cc4a12ab6ec72fd0d2bbc80dc Mon Sep 17 00:00:00 2001 From: 4drian3d Date: Wed, 30 Mar 2022 18:04:53 -0500 Subject: [PATCH] API improvements --- .../authmevelocity/proxy/AuthmeVelocityAPI.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthmeVelocityAPI.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthmeVelocityAPI.java index efb3182..3df16a2 100644 --- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthmeVelocityAPI.java +++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthmeVelocityAPI.java @@ -1,7 +1,5 @@ package com.glyart.authmevelocity.proxy; -import java.util.Optional; -import java.util.UUID; import java.util.function.Predicate; import com.glyart.authmevelocity.proxy.config.AuthMeConfig; @@ -27,8 +25,7 @@ public final class AuthmeVelocityAPI { * @return if the player is logged in or not */ public boolean isLogged(@NotNull Player player){ - final UUID playerUUID = player.getUniqueId(); - return plugin.loggedPlayers.contains(playerUUID); + return plugin.loggedPlayers.contains(player.getUniqueId()); } /** @@ -37,8 +34,7 @@ public final class AuthmeVelocityAPI { * @return if the player was succesfully added */ public boolean addPlayer(@NotNull Player player){ - final UUID playerUUID = player.getUniqueId(); - return plugin.loggedPlayers.add(playerUUID); + return plugin.loggedPlayers.add(player.getUniqueId()); } /** @@ -47,8 +43,7 @@ public final class AuthmeVelocityAPI { * @return if the player was succesfully removed */ public boolean removePlayer(@NotNull Player player){ - final UUID playerUUID = player.getUniqueId(); - return plugin.loggedPlayers.remove(playerUUID); + return plugin.loggedPlayers.remove(player.getUniqueId()); } /** @@ -65,8 +60,7 @@ public final class AuthmeVelocityAPI { * @return if the player is on a login server */ public boolean isInAuthServer(@NotNull Player player){ - Optional connection = player.getCurrentServer(); - return connection.isPresent() && isAuthServer(connection.get()); + return player.getCurrentServer().map(this::isAuthServer).orElse(false); } /**