-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Challenges reset when island is reset.
- Loading branch information
1 parent
97bec0f
commit 5f7581f
Showing
7 changed files
with
135 additions
and
84 deletions.
There are no files selected for viewing
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
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
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
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
33 changes: 33 additions & 0 deletions
33
src/main/java/bentobox/addon/challenges/listeners/ResetListener.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,33 @@ | ||
/** | ||
* | ||
*/ | ||
package bentobox.addon.challenges.listeners; | ||
|
||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.EventPriority; | ||
import org.bukkit.event.Listener; | ||
|
||
import bentobox.addon.challenges.ChallengesAddon; | ||
import world.bentobox.bentobox.api.events.island.IslandEvent; | ||
import world.bentobox.bentobox.api.events.island.IslandEvent.Reason; | ||
|
||
/** | ||
* Resets challenges when the island is reset | ||
* @author tastybento | ||
* | ||
*/ | ||
public class ResetListener implements Listener { | ||
|
||
private ChallengesAddon addon; | ||
|
||
public ResetListener(ChallengesAddon addon) { | ||
this.addon = addon; | ||
} | ||
|
||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) | ||
public void onIslandReset(IslandEvent e) { | ||
if (e.getReason().equals(Reason.CREATED) || (addon.getConfig().getBoolean("resetchallenges") && e.getReason().equals(Reason.RESETTED))) { | ||
addon.getChallengesManager().resetAllChallenges(e.getOwner(), e.getLocation().getWorld()); | ||
} | ||
} | ||
} |
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
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