mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 14:38:53 +00:00
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:
1 parent
e2c9a52911
commit
6bfd69f232
38 files changed
+1161
-692
No files matched your search
@@ -113,6 +113,13 @@ public class BlueMapHook extends MapHook {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearHomes(@NotNull String worldName) {
|
||||
if (publicHomesMarkerSets != null) {
|
||||
publicHomesMarkerSets.get(worldName).getMarkers().clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWarp(@NotNull Warp warp) {
|
||||
if (!isValidPosition(warp)) {
|
||||
@@ -143,6 +150,13 @@ public class BlueMapHook extends MapHook {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearWarps(@NotNull String worldName) {
|
||||
if (warpsMarkerSets != null) {
|
||||
warpsMarkerSets.get(worldName).getMarkers().clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getIcon(@NotNull String iconName) {
|
||||
return BlueMapAPI.getInstance().map(api -> {
|
||||
|
||||
@@ -112,6 +112,13 @@ public class DynmapHook extends MapHook {
|
||||
.forEach(Marker::deleteMarker)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearHomes(@NotNull String worldName) {
|
||||
plugin.runSync(() -> getPublicHomesMarkerSet().ifPresent(markerSet -> markerSet.getMarkers().stream()
|
||||
.filter(marker -> marker.getWorld().equals(worldName))
|
||||
.forEach(Marker::deleteMarker)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWarp(@NotNull Warp warp) {
|
||||
if (!isValidPosition(warp)) {
|
||||
@@ -150,6 +157,13 @@ public class DynmapHook extends MapHook {
|
||||
.forEach(Marker::deleteMarker)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearWarps(@NotNull String worldName) {
|
||||
plugin.runSync(() -> getWarpsMarkerSet().ifPresent(markerSet -> markerSet.getMarkers().stream()
|
||||
.filter(marker -> marker.getWorld().equals(worldName))
|
||||
.forEach(Marker::deleteMarker)));
|
||||
}
|
||||
|
||||
private Optional<DynmapCommonAPI> getDynmap() {
|
||||
return Optional.ofNullable(dynmapApi);
|
||||
}
|
||||
|
||||
@@ -80,6 +80,13 @@ public abstract class MapHook extends Hook {
|
||||
*/
|
||||
public abstract void clearHomes(@NotNull User user);
|
||||
|
||||
/**
|
||||
* Clears homes on a world from the map.
|
||||
*
|
||||
* @param worldName the world to clear homes from
|
||||
*/
|
||||
public abstract void clearHomes(@NotNull String worldName);
|
||||
|
||||
/**
|
||||
* Update a warp, adding it to the map if it exists, or updating it on the map if it doesn't.
|
||||
*
|
||||
@@ -99,6 +106,13 @@ public abstract class MapHook extends Hook {
|
||||
*/
|
||||
public abstract void clearWarps();
|
||||
|
||||
/**
|
||||
* Clears all warps from a world from the map.
|
||||
*
|
||||
* @param worldName the world to clear warps from
|
||||
*/
|
||||
public abstract void clearWarps(@NotNull String worldName);
|
||||
|
||||
/**
|
||||
* Returns if the position is valid to be set on this server.
|
||||
*
|
||||
|
||||
@@ -85,6 +85,11 @@ public class Pl3xMapHook extends MapHook implements EventListener {
|
||||
publicHomes.removeIf(home -> home.getOwner().equals(user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearHomes(@NotNull String worldName) {
|
||||
publicHomes.removeIf(home -> home.getWorld().getName().equals(worldName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWarp(@NotNull Warp warp) {
|
||||
warps.remove(warp);
|
||||
@@ -103,6 +108,11 @@ public class Pl3xMapHook extends MapHook implements EventListener {
|
||||
warps.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearWarps(@NotNull String worldName) {
|
||||
warps.removeIf(warp -> warp.getWorld().getName().equals(worldName));
|
||||
}
|
||||
|
||||
private void registerIcon(@NotNull String key, @NotNull String iconFileName) {
|
||||
try (InputStream iconStream = plugin.getResource(iconFileName)) {
|
||||
if (iconStream == null) {
|
||||
|
||||
Reference in new issue
Block a user