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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteIsland(User user, Island oldIsland) {
|
private boolean deleteIsland(User user, Island oldIsland) {
|
||||||
// Fire island preclear event
|
// Fire island preclear event
|
||||||
IslandEvent.builder().involvedPlayer(user.getUniqueId()).reason(Reason.PRECLEAR).island(oldIsland)
|
IslandEvent.builder().involvedPlayer(user.getUniqueId()).reason(Reason.PRECLEAR).island(oldIsland)
|
||||||
.oldIsland(oldIsland).location(oldIsland.getCenter()).build();
|
.oldIsland(oldIsland).location(oldIsland.getCenter()).build();
|
||||||
user.sendMessage("commands.admin.delete.deleted-island", TextVariables.XYZ,
|
if (getIslands().deleteIsland(oldIsland, true, targetUUID)) {
|
||||||
|
user.sendMessage("commands.admin.delete.deleted-island", TextVariables.XYZ,
|
||||||
|
Util.xyz(oldIsland.getCenter().toVector()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
user.sendMessage("commands.admin.delete.canceled", TextVariables.XYZ,
|
||||||
Util.xyz(oldIsland.getCenter().toVector()));
|
Util.xyz(oldIsland.getCenter().toVector()));
|
||||||
getIslands().deleteIsland(oldIsland, true, targetUUID);
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,13 +273,14 @@ public class IslandsManager {
|
|||||||
* @param island island to delete, not null
|
* @param island island to delete, not null
|
||||||
* @param removeBlocks whether the island blocks should be removed or not
|
* @param removeBlocks whether the island blocks should be removed or not
|
||||||
* @param involvedPlayer - player related to the island deletion, if any
|
* @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
|
// Fire event
|
||||||
IslandBaseEvent event = IslandEvent.builder().island(island).involvedPlayer(involvedPlayer)
|
IslandBaseEvent event = IslandEvent.builder().island(island).involvedPlayer(involvedPlayer)
|
||||||
.reason(Reason.DELETE).build();
|
.reason(Reason.DELETE).build();
|
||||||
if (event.getNewEvent().map(IslandBaseEvent::isCancelled).orElse(event.isCancelled())) {
|
if (event.getNewEvent().map(IslandBaseEvent::isCancelled).orElse(event.isCancelled())) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
// Set the owner of the island to no one.
|
// Set the owner of the island to no one.
|
||||||
island.setOwner(null);
|
island.setOwner(null);
|
||||||
@ -303,6 +304,7 @@ public class IslandsManager {
|
|||||||
// Delete the island from the database
|
// Delete the island from the database
|
||||||
handler.deleteObject(island);
|
handler.deleteObject(island);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Gson getGson() {
|
private Gson getGson() {
|
||||||
|
@ -459,6 +459,7 @@ commands:
|
|||||||
cannot-delete-owner: '&c All island members have to be kicked from the island
|
cannot-delete-owner: '&c All island members have to be kicked from the island
|
||||||
before deleting it.'
|
before deleting it.'
|
||||||
deleted-island: '&a Island at &e [xyz] &a has been successfully deleted.'
|
deleted-island: '&a Island at &e [xyz] &a has been successfully deleted.'
|
||||||
|
canceled: '&c Island deletion was cancelled via API at [xyz].'
|
||||||
deletehomes:
|
deletehomes:
|
||||||
parameters: <player>
|
parameters: <player>
|
||||||
description: deletes all named homes from an island
|
description: deletes all named homes from an island
|
||||||
|
Loading…
Reference in New Issue
Block a user