mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Added an invalid world name check.
This commit is contained in:
parent
cc9c1f63d8
commit
76dc60194d
@ -16,8 +16,8 @@ import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import lombok.*;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@ -288,6 +288,11 @@ import java.util.Map.Entry;
|
||||
MainUtil.sendMessage(player, "&cYou need to choose a world name!");
|
||||
return false;
|
||||
}
|
||||
if (!d(args[0])) {
|
||||
MainUtil.sendMessage(player,
|
||||
"Non [a-z0-9_.-] character in the world name: " + args[0]);
|
||||
return false;
|
||||
}
|
||||
if (WorldUtil.IMP.isWorld(args[0])) {
|
||||
if (PlotSquared.get().hasPlotArea(args[0])) {
|
||||
MainUtil.sendMessage(player, "&cThat world name is already taken!");
|
||||
@ -317,6 +322,11 @@ import java.util.Map.Entry;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean d(String s) {
|
||||
return s.chars().allMatch((i) -> {
|
||||
return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46;
|
||||
});
|
||||
}
|
||||
private static final class StepPickGenerator extends SetupStep {
|
||||
|
||||
@Getter private String generator;
|
||||
|
Loading…
Reference in New Issue
Block a user