mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
delhome/delwarp all rewrite; add events for bulk-deletes, close #265
This commit is contained in:
1 parent
2402f12536
commit
834fdbfc0e
17 files changed
+379
-51
No files matched your search
@@ -152,6 +152,20 @@ public class SavedPositionManager {
|
||||
});
|
||||
}
|
||||
|
||||
public CompletableFuture<Integer> deleteAllHomes(@NotNull User user) {
|
||||
return CompletableFuture.supplyAsync(() -> eventDispatcher.dispatchDeleteAllHomesEvent(user).join().isCancelled())
|
||||
.thenApply(cancelled -> database.deleteAllHomes(user)
|
||||
.thenApply(result -> {
|
||||
cache.homes.remove(user.uuid);
|
||||
cache.privateHomeLists.remove(user.username);
|
||||
cache.publicHomeLists.clear();
|
||||
if (mapHook != null) {
|
||||
mapHook.clearHomes(user);
|
||||
}
|
||||
return result;
|
||||
}).join());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to update an existing home with new metadata
|
||||
*
|
||||
@@ -320,6 +334,18 @@ public class SavedPositionManager {
|
||||
});
|
||||
}
|
||||
|
||||
public CompletableFuture<Integer> deleteAllWarps() {
|
||||
return CompletableFuture.supplyAsync(() -> eventDispatcher.dispatchDeleteAllWarpsEvent().join().isCancelled())
|
||||
.thenApply(cancelled -> database.deleteAllWarps()
|
||||
.thenApply(result -> {
|
||||
cache.warps.clear();
|
||||
if (mapHook != null) {
|
||||
mapHook.clearWarps();
|
||||
}
|
||||
return result;
|
||||
}).join());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to update an existing warp with new metadata
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user