mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-24 08:12:23 +01:00
Add some feedback in the method for island deletion.
This commit is contained in:
parent
c712e7e95f
commit
821fd77354
@ -105,13 +105,18 @@ public class AdminDeleteCommand extends ConfirmableCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void deleteIsland(User user, Island oldIsland) {
|
||||
private boolean deleteIsland(User user, Island oldIsland) {
|
||||
// Fire island preclear event
|
||||
IslandEvent.builder().involvedPlayer(user.getUniqueId()).reason(Reason.PRECLEAR).island(oldIsland)
|
||||
.oldIsland(oldIsland).location(oldIsland.getCenter()).build();
|
||||
if (getIslands().deleteIsland(oldIsland, true, targetUUID)) {
|
||||
user.sendMessage("commands.admin.delete.deleted-island", TextVariables.XYZ,
|
||||
Util.xyz(oldIsland.getCenter().toVector()));
|
||||
getIslands().deleteIsland(oldIsland, true, targetUUID);
|
||||
return true;
|
||||
}
|
||||
user.sendMessage("commands.admin.delete.canceled", TextVariables.XYZ,
|
||||
Util.xyz(oldIsland.getCenter().toVector()));
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
@ -273,13 +273,14 @@ public class IslandsManager {
|
||||
* @param island island to delete, not null
|
||||
* @param removeBlocks whether the island blocks should be removed or not
|
||||
* @param involvedPlayer - player related to the island deletion, if any
|
||||
* @return true if island deleted, false if canceled
|
||||
*/
|
||||
public void deleteIsland(@NonNull Island island, boolean removeBlocks, @Nullable UUID involvedPlayer) {
|
||||
public boolean deleteIsland(@NonNull Island island, boolean removeBlocks, @Nullable UUID involvedPlayer) {
|
||||
// Fire event
|
||||
IslandBaseEvent event = IslandEvent.builder().island(island).involvedPlayer(involvedPlayer)
|
||||
.reason(Reason.DELETE).build();
|
||||
if (event.getNewEvent().map(IslandBaseEvent::isCancelled).orElse(event.isCancelled())) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
// Set the owner of the island to no one.
|
||||
island.setOwner(null);
|
||||
@ -303,6 +304,7 @@ public class IslandsManager {
|
||||
// Delete the island from the database
|
||||
handler.deleteObject(island);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private Gson getGson() {
|
||||
|
@ -459,6 +459,7 @@ commands:
|
||||
cannot-delete-owner: '&c All island members have to be kicked from the island
|
||||
before deleting it.'
|
||||
deleted-island: '&a Island at &e [xyz] &a has been successfully deleted.'
|
||||
canceled: '&c Island deletion was cancelled via API at [xyz].'
|
||||
deletehomes:
|
||||
parameters: <player>
|
||||
description: deletes all named homes from an island
|
||||
|
Loading…
Reference in New Issue
Block a user