mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Simplify CommandBase's onCommand
Added some TODOs to do Replaced "dynamic" regex with cached Patterns
This commit is contained in:
30 files changed
+122
-106
No files matched your search
@@ -15,6 +15,7 @@ import me.william278.huskhomes2.integrations.VaultIntegration;
|
||||
import me.william278.huskhomes2.teleport.points.Home;
|
||||
import me.william278.huskhomes2.teleport.points.TeleportationPoint;
|
||||
import me.william278.huskhomes2.teleport.points.Warp;
|
||||
import me.william278.huskhomes2.utils.RegexUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@@ -179,7 +180,7 @@ public class SettingHandler {
|
||||
conditionsNotMetReason = "error_set_warp_invalid_length";
|
||||
return;
|
||||
}
|
||||
if (!warpName.matches("[A-Za-z0-9_\\-]+")) {
|
||||
if (!RegexUtil.NAME_PATTERN.matcher(warpName).matches()) {
|
||||
conditionsNotMetReason = "error_set_warp_invalid_characters";
|
||||
return;
|
||||
}
|
||||
@@ -215,7 +216,7 @@ public class SettingHandler {
|
||||
conditionsNotMetReason = "error_set_home_invalid_length";
|
||||
return;
|
||||
}
|
||||
if (!homeName.matches("[A-Za-z0-9_\\-]+")) {
|
||||
if (!RegexUtil.NAME_PATTERN.matcher(homeName).matches()) {
|
||||
conditionsNotMetReason = "error_set_home_invalid_characters";
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user