-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This class listens for level calculation, and will update "unlocked" biomes for the player.
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 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
59 changes: 59 additions & 0 deletions
59
src/main/java/world/bentobox/biomes/listeners/IslandLevelListener.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,59 @@ | ||
// | ||
// Created by BONNe | ||
// Copyright - 2022 | ||
// | ||
|
||
|
||
package world.bentobox.biomes.listeners; | ||
|
||
|
||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.EventPriority; | ||
import org.bukkit.event.Listener; | ||
|
||
import world.bentobox.bentobox.api.user.User; | ||
import world.bentobox.biomes.BiomesAddon; | ||
import world.bentobox.level.events.IslandLevelCalculatedEvent; | ||
|
||
|
||
/** | ||
* The type Level listener. | ||
*/ | ||
public class IslandLevelListener implements Listener | ||
{ | ||
/** | ||
* Instantiates a new Level listener. | ||
* | ||
* @param addon the addon | ||
*/ | ||
public IslandLevelListener(BiomesAddon addon) | ||
{ | ||
this.addon = addon; | ||
} | ||
|
||
|
||
/** | ||
* On level up. | ||
* | ||
* @param event the event | ||
*/ | ||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) | ||
public void onLevelCalculated(IslandLevelCalculatedEvent event) | ||
{ | ||
// Process event in Addon Manager. | ||
this.addon.getAddonManager().checkBiomesUnlockStatus( | ||
event.getIsland(), | ||
User.getInstance(event.getTargetPlayer()), | ||
event.getLevel()); | ||
} | ||
|
||
|
||
// --------------------------------------------------------------------- | ||
// Section: Variables | ||
// --------------------------------------------------------------------- | ||
|
||
/** | ||
* Instance of addon for event. | ||
*/ | ||
private final BiomesAddon addon; | ||
} |