Merge branch 'develop' of https://github.com/BentoBoxWorld/Level into develop

This commit is contained in:
BONNe1704 2019-01-02 15:02:47 +02:00
commit c2778960b3

View File

@ -7,12 +7,12 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import world.bentobox.level.Level;
import world.bentobox.level.calculators.CalcIslandLevel;
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandCreatedEvent;
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandResettedEvent;
import world.bentobox.bentobox.api.events.team.TeamEvent.TeamJoinEvent;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.level.Level;
import world.bentobox.level.calculators.CalcIslandLevel;
/**
* Listens for new islands and sets the level to zero automatically
@ -35,17 +35,11 @@ public class NewIslandListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onNewIsland(IslandCreatedEvent e) {
cil.putIfAbsent(e.getIsland(), new CalcIslandLevel(addon, e.getIsland(), () -> zeroLevel(e.getIsland())));
// Set deaths to zero just in case
addon.getPlayers().setDeaths(e.getIsland().getWorld(), e.getOwner(), 0);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onNewIsland(IslandResettedEvent e) {
cil.putIfAbsent(e.getIsland(), new CalcIslandLevel(addon, e.getIsland(), () -> zeroLevel(e.getIsland())));
// Reset deaths
if (addon.getSettings().isIslandResetDeathReset()) {
addon.getPlayers().setDeaths(e.getIsland().getWorld(), e.getOwner(), 0);
}
}