mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-03 18:53:43 +01:00 
			
		
		
		
	Added an invalid world name check.
This commit is contained in:
		@@ -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.StringMan;
 | 
				
			||||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
 | 
					import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
 | 
				
			||||||
import lombok.*;
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.jetbrains.annotations.Nullable;
 | 
					import org.jetbrains.annotations.Nullable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.*;
 | 
					import java.util.*;
 | 
				
			||||||
import java.util.Map.Entry;
 | 
					import java.util.Map.Entry;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -288,6 +288,11 @@ import java.util.Map.Entry;
 | 
				
			|||||||
                    MainUtil.sendMessage(player, "&cYou need to choose a world name!");
 | 
					                    MainUtil.sendMessage(player, "&cYou need to choose a world name!");
 | 
				
			||||||
                    return false;
 | 
					                    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 (WorldUtil.IMP.isWorld(args[0])) {
 | 
				
			||||||
                    if (PlotSquared.get().hasPlotArea(args[0])) {
 | 
					                    if (PlotSquared.get().hasPlotArea(args[0])) {
 | 
				
			||||||
                        MainUtil.sendMessage(player, "&cThat world name is already taken!");
 | 
					                        MainUtil.sendMessage(player, "&cThat world name is already taken!");
 | 
				
			||||||
@@ -317,6 +322,11 @@ import java.util.Map.Entry;
 | 
				
			|||||||
        return false;
 | 
					        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 {
 | 
					    private static final class StepPickGenerator extends SetupStep {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @Getter private String generator;
 | 
					        @Getter private String generator;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user