mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-24 18:19:03 +01:00
Better handle empty group / player names due to bad region data.
Fixes WORLDGUARD-3182.
This commit is contained in:
parent
dac09c64c8
commit
41f520845a
@ -27,7 +27,6 @@
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
@ -63,9 +62,10 @@ public GroupDomain(String[] groups) {
|
||||
*/
|
||||
public void addGroup(String name) {
|
||||
checkNotNull(name);
|
||||
checkArgument(!name.trim().isEmpty(), "Can't add empty group name");
|
||||
setDirty(true);
|
||||
groups.add(name.trim().toLowerCase());
|
||||
if (!name.trim().isEmpty()) {
|
||||
setDirty(true);
|
||||
groups.add(name.trim().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,6 @@
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
@ -65,12 +64,13 @@ public PlayerDomain(String[] names) {
|
||||
*/
|
||||
public void addPlayer(String name) {
|
||||
checkNotNull(name);
|
||||
checkArgument(!name.trim().isEmpty(), "Can't add empty player name");
|
||||
setDirty(true);
|
||||
names.add(name.trim().toLowerCase());
|
||||
// Trim because some names contain spaces (previously valid Minecraft
|
||||
// names) and we cannot store these correctly in the SQL storage
|
||||
// implementations
|
||||
if (!name.trim().isEmpty()) {
|
||||
setDirty(true);
|
||||
names.add(name.trim().toLowerCase());
|
||||
// Trim because some names contain spaces (previously valid Minecraft
|
||||
// names) and we cannot store these correctly in the SQL storage
|
||||
// implementations
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user