2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-23 04:28:01 +00:00

Correctly mark the UUID/name methods as NonNull

This commit is contained in:
Tux 2014-05-28 02:06:17 -04:00
parent dea8073b11
commit bb71dd674f
2 changed files with 5 additions and 4 deletions

View File

@ -210,7 +210,7 @@ public class RedisBungeeAPI {
* @return the name for the UUID
* @since 0.3
*/
public final String getNameFromUuid(UUID uuid) {
public final String getNameFromUuid(@NonNull UUID uuid) {
return plugin.getUuidTranslator().getNameFromUuid(uuid);
}
@ -222,7 +222,7 @@ public class RedisBungeeAPI {
* @return the UUID for the name
* @since 0.3
*/
public final UUID getUuidFromName(String name) {
public final UUID getUuidFromName(@NonNull String name) {
return plugin.getUuidTranslator().getTranslatedUuid(name);
}
}

View File

@ -11,6 +11,7 @@ import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.Maps;
import com.imaginarycode.minecraft.redisbungee.RedisBungee;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import net.md_5.bungee.api.ProxyServer;
import redis.clients.jedis.Jedis;
@ -28,7 +29,7 @@ public class UUIDTranslator {
public static final Pattern UUID_PATTERN = Pattern.compile("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}");
public static final Pattern MOJANGIAN_UUID_PATTERN = Pattern.compile("[a-fA-F0-9]{32}");
public UUID getTranslatedUuid(String player) {
public UUID getTranslatedUuid(@NonNull String player) {
if (ProxyServer.getInstance().getPlayer(player) != null)
return ProxyServer.getInstance().getPlayer(player).getUniqueId();
@ -81,7 +82,7 @@ public class UUIDTranslator {
}
}
public String getNameFromUuid(UUID player) {
public String getNameFromUuid(@NonNull UUID player) {
if (ProxyServer.getInstance().getPlayer(player) != null)
return ProxyServer.getInstance().getPlayer(player).getName();