mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2025-01-08 00:38:22 +01:00
No longer fire the AddonEvent, only fire BentoBoxEvent
This may affect plugins that listen for the event.
This commit is contained in:
parent
920f3675f7
commit
bfed6c75eb
@ -25,8 +25,6 @@ import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import world.bentobox.bentobox.api.events.addon.AddonBaseEvent;
|
||||
import world.bentobox.bentobox.api.events.addon.AddonEvent;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
@ -200,23 +198,12 @@ public class LevelsManager {
|
||||
IslandLevelCalculatedEvent ilce = new IslandLevelCalculatedEvent(targetPlayer, island, results);
|
||||
Bukkit.getPluginManager().callEvent(ilce);
|
||||
if (ilce.isCancelled()) return true;
|
||||
// This exposes these values to plugins via the event
|
||||
Map<String, Object> keyValues = new HashMap<>();
|
||||
keyValues.put("eventName", "IslandLevelCalculatedEvent");
|
||||
keyValues.put("targetPlayer", targetPlayer);
|
||||
keyValues.put("islandUUID", island.getUniqueId());
|
||||
keyValues.put("level", results.getLevel());
|
||||
keyValues.put("pointsToNextLevel", results.getPointsToNextLevel());
|
||||
keyValues.put("deathHandicap", results.getDeathHandicap());
|
||||
keyValues.put("initialLevel", results.getInitialLevel());
|
||||
keyValues.put("isCancelled", false);
|
||||
AddonBaseEvent e = new AddonEvent().builder().addon(addon).keyValues(keyValues).build();
|
||||
// Set the values if they were altered
|
||||
results.setLevel((Long)e.getKeyValues().getOrDefault("level", results.getLevel()));
|
||||
results.setInitialLevel((Long)e.getKeyValues().getOrDefault("initialLevel", results.getInitialLevel()));
|
||||
results.setDeathHandicap((int)e.getKeyValues().getOrDefault("deathHandicap", results.getDeathHandicap()));
|
||||
results.setPointsToNextLevel((Long)e.getKeyValues().getOrDefault("pointsToNextLevel", results.getPointsToNextLevel()));
|
||||
return ((Boolean)e.getKeyValues().getOrDefault("isCancelled", false));
|
||||
results.setLevel((Long)ilce.getKeyValues().getOrDefault("level", results.getLevel()));
|
||||
results.setInitialLevel((Long)ilce.getKeyValues().getOrDefault("initialLevel", results.getInitialLevel()));
|
||||
results.setDeathHandicap((int)ilce.getKeyValues().getOrDefault("deathHandicap", results.getDeathHandicap()));
|
||||
results.setPointsToNextLevel((Long)ilce.getKeyValues().getOrDefault("pointsToNextLevel", results.getPointsToNextLevel()));
|
||||
return ((Boolean)ilce.getKeyValues().getOrDefault("isCancelled", false));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user