generated from BONNePlayground/.github
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement data removing after island deletion.
- Loading branch information
Showing
2 changed files
with
62 additions
and
15 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
src/main/java/world/bentobox/visit/listeners/IslandEventsListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// Created by BONNe | ||
// Copyright - 2020 | ||
// | ||
|
||
|
||
package world.bentobox.visit.listeners; | ||
|
||
|
||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.EventPriority; | ||
import org.bukkit.event.Listener; | ||
|
||
import world.bentobox.bentobox.api.events.island.IslandDeleteEvent; | ||
import world.bentobox.visit.VisitAddon; | ||
|
||
|
||
/** | ||
* This listener deletes island data after it is removed. | ||
*/ | ||
public class IslandEventsListener implements Listener | ||
{ | ||
/** | ||
* @param addon - addon | ||
*/ | ||
public IslandEventsListener(VisitAddon addon) | ||
{ | ||
this.addon = addon; | ||
} | ||
|
||
|
||
/** | ||
* This method handles island deletion. On island deletion it should remove generator data too. | ||
* | ||
* @param event IslandDeletedEvent instance. | ||
*/ | ||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) | ||
public void onIslandDelete(IslandDeleteEvent event) | ||
{ | ||
this.addon.getAddonManager().removeData(event.getIsland()); | ||
} | ||
|
||
|
||
/** | ||
* stores addon instance | ||
*/ | ||
private final VisitAddon addon; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters