Skip to content

Commit

Permalink
Update to BentoBox 1.15.4 API
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Jan 2, 2021
1 parent 2a31fc9 commit 8ad527b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<powermock.version>2.0.2</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.15.2-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.14.0</bentobox.version>
<level.version>1.6.0</level.version>
<bentobox.version>1.15.4</bentobox.version>
<level.version>2.5.0</level.version>
<vault.version>1.7</vault.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;

import world.bentobox.bentobox.api.events.island.IslandEvent;
import world.bentobox.bentobox.api.events.island.IslandEvent.Reason;
import world.bentobox.bentobox.api.events.island.IslandCreatedEvent;
import world.bentobox.bentobox.api.events.island.IslandRegisteredEvent;
import world.bentobox.bentobox.api.events.island.IslandResettedEvent;
import world.bentobox.challenges.ChallengesAddon;

/**
Expand All @@ -24,15 +25,39 @@ public ResetListener(ChallengesAddon addon) {
this.addon = addon;
}

@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onIslandReset(IslandEvent e) {
if (addon.getChallengesSettings().isResetChallenges())
{
if (e.getReason().equals(IslandEvent.Reason.CREATED) ||
e.getReason().equals(IslandEvent.Reason.RESETTED) ||
e.getReason().equals(IslandEvent.Reason.REGISTERED)) {
addon.getChallengesManager().resetAllChallenges(e.getOwner(), e.getLocation().getWorld(), e.getOwner());
}
}

/**
* This method handles Island Created event.
*
* @param e Event that must be handled.
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onIslandCreated(IslandCreatedEvent e)
{
addon.getChallengesManager().resetAllChallenges(e.getOwner(), e.getLocation().getWorld(), e.getOwner());
}


/**
* This method handles Island Resetted event.
*
* @param e Event that must be handled.
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onIslandCreated(IslandResettedEvent e)
{
addon.getChallengesManager().resetAllChallenges(e.getOwner(), e.getLocation().getWorld(), e.getOwner());
}


/**
* This method handles Island Registered event.
*
* @param e Event that must be handled.
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onIslandCreated(IslandRegisteredEvent e)
{
addon.getChallengesManager().resetAllChallenges(e.getOwner(), e.getLocation().getWorld(), e.getOwner());
}
}

0 comments on commit 8ad527b

Please sign in to comment.