From bfed6c75ebfe36f70c7296786820e1ed0789f72b Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 13 Sep 2020 11:21:58 -0700 Subject: [PATCH] No longer fire the AddonEvent, only fire BentoBoxEvent This may affect plugins that listen for the event. --- .../world/bentobox/level/LevelsManager.java | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/main/java/world/bentobox/level/LevelsManager.java b/src/main/java/world/bentobox/level/LevelsManager.java index 2f74b85..6e62f8e 100644 --- a/src/main/java/world/bentobox/level/LevelsManager.java +++ b/src/main/java/world/bentobox/level/LevelsManager.java @@ -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 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)); } /**