mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-11-24 02:55:38 +01:00
Fix for level setting with different sized islands.
https://github.com/BentoBoxWorld/BentoBox/issues/709
This commit is contained in:
parent
2ea430554f
commit
671e17398e
@ -39,6 +39,8 @@ public class IslandTeamListeners implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onNewIsland(IslandCreatedEvent e) {
|
||||
// Clear the island setting
|
||||
addon.setInitialIslandLevel(e.getIsland(), 0L);
|
||||
if (e.getIsland().getOwner() != null && e.getIsland().getWorld() != null) {
|
||||
cil.putIfAbsent(e.getIsland(), new CalcIslandLevel(addon, e.getIsland(), () -> zeroLevel(e.getIsland())));
|
||||
}
|
||||
@ -46,6 +48,8 @@ public class IslandTeamListeners implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onNewIsland(IslandResettedEvent e) {
|
||||
// Clear the island setting
|
||||
addon.setInitialIslandLevel(e.getIsland(), 0L);
|
||||
if (e.getIsland().getOwner() != null && e.getIsland().getWorld() != null) {
|
||||
cil.putIfAbsent(e.getIsland(), new CalcIslandLevel(addon, e.getIsland(), () -> zeroLevel(e.getIsland())));
|
||||
}
|
||||
@ -95,7 +99,8 @@ public class IslandTeamListeners implements Listener {
|
||||
|
||||
private void zeroLevel(Island island) {
|
||||
if (cil.containsKey(island)) {
|
||||
addon.setInitialIslandLevel(island, cil.get(island).getResult().getLevel());
|
||||
long level = cil.get(island).getResult().getLevel();
|
||||
addon.setInitialIslandLevel(island, level);
|
||||
cil.remove(island);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user