v4.5: Bulk delete, regex customization, QoL & API work (#486)

* Improve validator error specificity, fix #481

* Add more sanity-checking to cluster IDs, close #482

* Add bulk/player-delete command, close #484, close #257

* Fix checkstyle formatting in tests

* Add missing strings to other locale files

* Use morepaperlib for runtime command registration on spigot

* api: make creation methods return a future, close #473

* Add name/description restriction regex customization

* docs: Update config file with new regex options

* bump version number to 4.5

* fix typo, correct command confirmation logic

* Make confirmation locales more clear

* Fix confirmation checking logic
This commit is contained in:
William authored and GitHub committed 2023-08-28 16:31:48 +01:00
1 parent e2c9a52911
commit 6bfd69f232
38 files changed
+1161 -692

No files matched your search

@@ -26,6 +26,7 @@ import net.william278.huskhomes.HuskHomes;
import net.william278.huskhomes.position.Position;
import net.william278.huskhomes.user.User;
import net.william278.huskhomes.util.BukkitAdapter;
import net.william278.huskhomes.util.ValidationException;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -98,28 +99,29 @@ public class EssentialsXImporter extends Importer {
@NotNull
private String normalizeName(@NotNull String name) {
if (plugin.getValidator().isValidName(name)) {
try {
plugin.getValidator().validateName(name);
return name;
} catch (ValidationException e) {
// Remove spaces
name = name.replaceAll(" ", "_");
// Remove unicode characters
if (plugin.getSettings().doRestrictNames()) {
name = name.replaceAll("[^A-Za-z0-9_-]", "");
}
// Ensure the name is not blank
if (name.isBlank()) {
name = "imported-" + UUID.randomUUID().toString().substring(0, 5);
}
// Ensure name is not too long
if (name.length() > 16) {
name = name.substring(0, 16);
}
return name;
}
// Remove spaces
name = name.replaceAll(" ", "_");
// Remove unicode characters
if (!plugin.getSettings().doAllowUnicodeNames()) {
name = name.replaceAll("[^A-Za-z0-9_-]", "");
}
// Ensure the name is not blank
if (name.isBlank()) {
name = "imported-" + UUID.randomUUID().toString().substring(0, 5);
}
// Ensure name is not too long
if (name.length() > 16) {
name = name.substring(0, 16);
}
return name;
}
@Override