mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-28 13:15:23 +01:00
Fixed NPE when checking username (#153)
This commit is contained in:
parent
189187fd25
commit
80964978bc
@ -79,7 +79,7 @@ public GDPermissionUser getOrCreateUser(UUID uuid) {
|
||||
}
|
||||
|
||||
public GDPermissionUser getOrCreateUser(String username) {
|
||||
if (username == null) {
|
||||
if (username == null || username.length() > 16) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public GDPermissionUser getOrCreateUser(UUID uuid) {
|
||||
}
|
||||
|
||||
public GDPermissionUser getOrCreateUser(String username) {
|
||||
if (username == null) {
|
||||
if (username == null || username.length() > 16) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.griefdefender.GriefDefenderPlugin;
|
||||
import com.griefdefender.api.GriefDefender;
|
||||
import com.griefdefender.api.claim.ClaimTypes;
|
||||
import com.griefdefender.api.permission.flag.Flag;
|
||||
import com.griefdefender.api.permission.flag.Flags;
|
||||
@ -168,7 +169,7 @@ public User createUserFromCache(UUID uuid) {
|
||||
|
||||
public User createUserFromCache(String username) {
|
||||
final UUID uuid = SpongeUsernameCache.getLastKnownUUID(username);
|
||||
if (username != null) {
|
||||
if (uuid != null) {
|
||||
return Sponge.getGame().getServiceManager().provide(UserStorageService.class).get().get(GameProfile.of(uuid, username)).orElse(null);
|
||||
}
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user