From 5a3a77cabf8f23bb7081aeb1791a3f254d08c361 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Fri, 6 May 2016 15:28:19 +0200 Subject: [PATCH] Call events properly --- .../io/github/dre2n/dungeonsxl/command/GroupCommand.java | 3 +++ .../io/github/dre2n/dungeonsxl/command/LeaveCommand.java | 2 ++ .../java/io/github/dre2n/dungeonsxl/command/PlayCommand.java | 1 + .../io/github/dre2n/dungeonsxl/listener/PlayerListener.java | 3 +++ src/main/java/io/github/dre2n/dungeonsxl/mob/DMob.java | 2 ++ .../java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java | 5 +++++ src/main/java/io/github/dre2n/dungeonsxl/player/DGroup.java | 4 ++++ .../io/github/dre2n/dungeonsxl/requirement/Requirement.java | 2 ++ src/main/java/io/github/dre2n/dungeonsxl/reward/Reward.java | 2 ++ src/main/java/io/github/dre2n/dungeonsxl/sign/DSign.java | 1 + src/main/java/io/github/dre2n/dungeonsxl/sign/LeaveSign.java | 2 ++ .../io/github/dre2n/dungeonsxl/task/TimeIsRunningTask.java | 2 ++ .../io/github/dre2n/dungeonsxl/trigger/DistanceTrigger.java | 1 + .../io/github/dre2n/dungeonsxl/trigger/InteractTrigger.java | 1 + .../java/io/github/dre2n/dungeonsxl/trigger/MobTrigger.java | 1 + .../io/github/dre2n/dungeonsxl/trigger/ProgressTrigger.java | 1 + .../io/github/dre2n/dungeonsxl/trigger/RedstoneTrigger.java | 1 + .../java/io/github/dre2n/dungeonsxl/trigger/SignTrigger.java | 1 + .../java/io/github/dre2n/dungeonsxl/trigger/Trigger.java | 1 + .../io/github/dre2n/dungeonsxl/trigger/UseItemTrigger.java | 1 + .../java/io/github/dre2n/dungeonsxl/trigger/WaveTrigger.java | 1 + .../java/io/github/dre2n/dungeonsxl/world/EditWorld.java | 5 +++++ .../java/io/github/dre2n/dungeonsxl/world/GameWorld.java | 5 +++++ 23 files changed, 48 insertions(+) diff --git a/src/main/java/io/github/dre2n/dungeonsxl/command/GroupCommand.java b/src/main/java/io/github/dre2n/dungeonsxl/command/GroupCommand.java index 29debb39..105ba18a 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/command/GroupCommand.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/command/GroupCommand.java @@ -120,6 +120,7 @@ public class GroupCommand extends BRCommand { DGroup dGroup = new DGroup(args[2], player); DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { dGroup.delete(); @@ -133,6 +134,7 @@ public class GroupCommand extends BRCommand { public void disbandGroup(DGroup dGroup) { if (dGroup != null) { DGroupDisbandEvent event = new DGroupDisbandEvent(dGroup, player, DGroupDisbandEvent.Cause.COMMAND); + plugin.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { dGroup.delete(); @@ -212,6 +214,7 @@ public class GroupCommand extends BRCommand { Player toKick = plugin.getServer().getPlayer(args[2]); if (toKick != null) { DPlayerKickEvent event = new DPlayerKickEvent(DGamePlayer.getByPlayer(toKick.getPlayer()), DPlayerKickEvent.Cause.COMMAND); + plugin.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { if (dGroup.getPlayers().contains(toKick)) { diff --git a/src/main/java/io/github/dre2n/dungeonsxl/command/LeaveCommand.java b/src/main/java/io/github/dre2n/dungeonsxl/command/LeaveCommand.java index e9adfc12..8d68d150 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/command/LeaveCommand.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/command/LeaveCommand.java @@ -61,7 +61,9 @@ public class LeaveCommand extends BRCommand { DGroup dGroup = DGroup.getByPlayer(player); DPlayerEscapeEvent dPlayerEscapeEvent = new DPlayerEscapeEvent(dPlayer); + plugin.getServer().getPluginManager().callEvent(dPlayerEscapeEvent); DPlayerLeaveDGroupEvent dPlayerLeaveDGroupEvent = new DPlayerLeaveDGroupEvent(dPlayer, dGroup); + plugin.getServer().getPluginManager().callEvent(dPlayerLeaveDGroupEvent); if (dPlayerEscapeEvent.isCancelled() || dPlayerLeaveDGroupEvent.isCancelled()) { return; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/command/PlayCommand.java b/src/main/java/io/github/dre2n/dungeonsxl/command/PlayCommand.java index a1648ca2..f362bfea 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/command/PlayCommand.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/command/PlayCommand.java @@ -143,6 +143,7 @@ public class PlayCommand extends BRCommand { } DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { plugin.getDGroups().remove(dGroup); diff --git a/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java b/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java index 0973373d..841f3e54 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java @@ -96,6 +96,7 @@ public class PlayerListener implements Listener { } DPlayerDeathEvent dPlayerDeathEvent = new DPlayerDeathEvent(dPlayer, event, 1); + plugin.getServer().getPluginManager().callEvent(dPlayerDeathEvent); if (dPlayerDeathEvent.isCancelled()) { return; @@ -128,6 +129,7 @@ public class PlayerListener implements Listener { if (dPlayer.getLives() == 0 && dPlayer.isReady()) { DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer, DPlayerKickEvent.Cause.DEATH); + plugin.getServer().getPluginManager().callEvent(dPlayerKickEvent); if (!dPlayerKickEvent.isCancelled()) { MessageUtil.broadcastMessage(DMessages.PLAYER_DEATH_KICK.getMessage(player.getName())); @@ -533,6 +535,7 @@ public class PlayerListener implements Listener { DGroup dGroup = new DGroup(player, plugin.getMainConfig().getTutorialDungeon(), false); DGroupCreateEvent createEvent = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.GROUP_SIGN); + plugin.getServer().getPluginManager().callEvent(createEvent); if (createEvent.isCancelled()) { dGroup = null; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/mob/DMob.java b/src/main/java/io/github/dre2n/dungeonsxl/mob/DMob.java index 5afaeb17..839bd226 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/mob/DMob.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/mob/DMob.java @@ -23,6 +23,7 @@ import io.github.dre2n.dungeonsxl.trigger.WaveTrigger; import io.github.dre2n.dungeonsxl.world.GameWorld; import java.util.Random; import java.util.Set; +import org.bukkit.Bukkit; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.event.entity.EntityDeathEvent; @@ -71,6 +72,7 @@ public class DMob { } DMobDeathEvent dMobDeathEvent = new DMobDeathEvent(this, event); + Bukkit.getServer().getPluginManager().callEvent(dMobDeathEvent); if (dMobDeathEvent.isCancelled()) { return; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java b/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java index 79fa1bc8..8d3c8e68 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java @@ -698,6 +698,7 @@ public class DGamePlayer extends DGlobalPlayer { } DGroupFinishFloorEvent event = new DGroupFinishFloorEvent(dGroup, dGroup.getGameWorld(), newFloor); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; @@ -756,6 +757,7 @@ public class DGamePlayer extends DGlobalPlayer { } DPlayerFinishEvent dPlayerFinishEvent = new DPlayerFinishEvent(this, first, hasToWait); + plugin.getServer().getPluginManager().callEvent(dPlayerFinishEvent); if (dPlayerFinishEvent.isCancelled()) { finished = false; @@ -767,6 +769,7 @@ public class DGamePlayer extends DGlobalPlayer { } DGroupFinishDungeonEvent dGroupFinishDungeonEvent = new DGroupFinishDungeonEvent(dGroup); + plugin.getServer().getPluginManager().callEvent(dGroupFinishDungeonEvent); if (dGroupFinishDungeonEvent.isCancelled()) { return; @@ -928,6 +931,7 @@ public class DGamePlayer extends DGlobalPlayer { } DPlayerUpdateEvent event = new DPlayerUpdateEvent(this, locationValid, teleportWolf, respawnInventory, offline, kick, triggerAllInDistance); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; @@ -947,6 +951,7 @@ public class DGamePlayer extends DGlobalPlayer { if (kick) { DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(this, DPlayerKickEvent.Cause.OFFLINE); + plugin.getServer().getPluginManager().callEvent(dPlayerKickEvent); if (!dPlayerKickEvent.isCancelled()) { leave(); diff --git a/src/main/java/io/github/dre2n/dungeonsxl/player/DGroup.java b/src/main/java/io/github/dre2n/dungeonsxl/player/DGroup.java index 4d044f76..c93194f0 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/player/DGroup.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/player/DGroup.java @@ -164,6 +164,7 @@ public class DGroup { // Check group if (isEmpty()) { DGroupDisbandEvent event = new DGroupDisbandEvent(this, player, DGroupDisbandEvent.Cause.GROUP_IS_EMPTY); + plugin.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { delete(); @@ -385,6 +386,7 @@ public class DGroup { */ public void addReward(Reward reward) { RewardAdditionEvent event = new RewardAdditionEvent(reward, this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; @@ -466,6 +468,7 @@ public class DGroup { } DGroupStartFloorEvent event = new DGroupStartFloorEvent(this, gameWorld); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; @@ -502,6 +505,7 @@ public class DGroup { if (config != null) { for (Requirement requirement : config.getRequirements()) { RequirementDemandEvent requirementDemandEvent = new RequirementDemandEvent(requirement, player); + plugin.getServer().getPluginManager().callEvent(event); if (requirementDemandEvent.isCancelled()) { continue; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/requirement/Requirement.java b/src/main/java/io/github/dre2n/dungeonsxl/requirement/Requirement.java index 593161c4..340f29d7 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/requirement/Requirement.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/requirement/Requirement.java @@ -21,6 +21,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.event.requirement.RequirementRegistrationEvent; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; /** @@ -45,6 +46,7 @@ public abstract class Requirement { } RequirementRegistrationEvent event = new RequirementRegistrationEvent(requirement); + Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return null; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/reward/Reward.java b/src/main/java/io/github/dre2n/dungeonsxl/reward/Reward.java index 2f1a8dd1..3e785ebd 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/reward/Reward.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/reward/Reward.java @@ -21,6 +21,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.event.reward.RewardRegistrationEvent; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; /** @@ -45,6 +46,7 @@ public abstract class Reward { } RewardRegistrationEvent event = new RewardRegistrationEvent(reward); + Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return null; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/DSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/DSign.java index 86234823..8cf440ec 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/DSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/DSign.java @@ -190,6 +190,7 @@ public abstract class DSign { } DSignRegistrationEvent event = new DSignRegistrationEvent(sign, gameWorld, dSign); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return null; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/LeaveSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/LeaveSign.java index 429002b9..078c3a90 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/LeaveSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/LeaveSign.java @@ -65,6 +65,7 @@ public class LeaveSign extends DSign { DGamePlayer dPlayer = DGamePlayer.getByPlayer(player); if (dPlayer != null) { DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return false; @@ -80,6 +81,7 @@ public class LeaveSign extends DSign { public void onTrigger() { for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) { DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/task/TimeIsRunningTask.java b/src/main/java/io/github/dre2n/dungeonsxl/task/TimeIsRunningTask.java index 44c80412..0a849063 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/task/TimeIsRunningTask.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/task/TimeIsRunningTask.java @@ -23,6 +23,7 @@ import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent; import io.github.dre2n.dungeonsxl.player.DGamePlayer; import io.github.dre2n.dungeonsxl.player.DGroup; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; @@ -66,6 +67,7 @@ public class TimeIsRunningTask extends BukkitRunnable { } DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer, DPlayerKickEvent.Cause.TIME_EXPIRED); + Bukkit.getServer().getPluginManager().callEvent(dPlayerKickEvent); if (!dPlayerKickEvent.isCancelled()) { MessageUtil.broadcastMessage(DMessages.PLAYER_TIME_KICK.getMessage(player.getName())); diff --git a/src/main/java/io/github/dre2n/dungeonsxl/trigger/DistanceTrigger.java b/src/main/java/io/github/dre2n/dungeonsxl/trigger/DistanceTrigger.java index a9199494..ebe32df3 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/trigger/DistanceTrigger.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/trigger/DistanceTrigger.java @@ -49,6 +49,7 @@ public class DistanceTrigger extends Trigger { public void onTrigger(Player player) { TriggerActionEvent event = new TriggerActionEvent(this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/trigger/InteractTrigger.java b/src/main/java/io/github/dre2n/dungeonsxl/trigger/InteractTrigger.java index d271cf9e..852d3126 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/trigger/InteractTrigger.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/trigger/InteractTrigger.java @@ -43,6 +43,7 @@ public class InteractTrigger extends Trigger { public void onTrigger(Player player) { TriggerActionEvent event = new TriggerActionEvent(this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/trigger/MobTrigger.java b/src/main/java/io/github/dre2n/dungeonsxl/trigger/MobTrigger.java index 4f42c09a..dc879dc0 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/trigger/MobTrigger.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/trigger/MobTrigger.java @@ -39,6 +39,7 @@ public class MobTrigger extends Trigger { public void onTrigger() { TriggerActionEvent event = new TriggerActionEvent(this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/trigger/ProgressTrigger.java b/src/main/java/io/github/dre2n/dungeonsxl/trigger/ProgressTrigger.java index bfc0947b..0c149de6 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/trigger/ProgressTrigger.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/trigger/ProgressTrigger.java @@ -95,6 +95,7 @@ public class ProgressTrigger extends Trigger { /* Actions */ public void onTrigger() { TriggerActionEvent event = new TriggerActionEvent(this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/trigger/RedstoneTrigger.java b/src/main/java/io/github/dre2n/dungeonsxl/trigger/RedstoneTrigger.java index a2f3b954..e02de200 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/trigger/RedstoneTrigger.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/trigger/RedstoneTrigger.java @@ -43,6 +43,7 @@ public class RedstoneTrigger extends Trigger { public void onTrigger() { TriggerActionEvent event = new TriggerActionEvent(this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/trigger/SignTrigger.java b/src/main/java/io/github/dre2n/dungeonsxl/trigger/SignTrigger.java index 46953065..f44eabf2 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/trigger/SignTrigger.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/trigger/SignTrigger.java @@ -39,6 +39,7 @@ public class SignTrigger extends Trigger { public void onTrigger(boolean enable) { TriggerActionEvent event = new TriggerActionEvent(this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/trigger/Trigger.java b/src/main/java/io/github/dre2n/dungeonsxl/trigger/Trigger.java index f9004218..70a2ee6a 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/trigger/Trigger.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/trigger/Trigger.java @@ -188,6 +188,7 @@ public abstract class Trigger { } TriggerRegistrationEvent event = new TriggerRegistrationEvent(trigger); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return null; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/trigger/UseItemTrigger.java b/src/main/java/io/github/dre2n/dungeonsxl/trigger/UseItemTrigger.java index 4dfa0522..9fb8e056 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/trigger/UseItemTrigger.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/trigger/UseItemTrigger.java @@ -46,6 +46,7 @@ public class UseItemTrigger extends Trigger { public void onTrigger(Player player) { TriggerActionEvent event = new TriggerActionEvent(this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/trigger/WaveTrigger.java b/src/main/java/io/github/dre2n/dungeonsxl/trigger/WaveTrigger.java index 82e0b6aa..068ebcf4 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/trigger/WaveTrigger.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/trigger/WaveTrigger.java @@ -56,6 +56,7 @@ public class WaveTrigger extends Trigger { public void onTrigger() { TriggerActionEvent event = new TriggerActionEvent(this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/world/EditWorld.java b/src/main/java/io/github/dre2n/dungeonsxl/world/EditWorld.java index 39cd9b88..66a10a31 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/world/EditWorld.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/world/EditWorld.java @@ -208,6 +208,7 @@ public class EditWorld { creator.generateStructures(false); EditWorldGenerateEvent event = new EditWorldGenerateEvent(this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; @@ -218,6 +219,7 @@ public class EditWorld { public void save() { EditWorldSaveEvent event = new EditWorldSaveEvent(this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; @@ -256,6 +258,7 @@ public class EditWorld { public void delete() { EditWorldUnloadEvent event = new EditWorldUnloadEvent(this, true); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; @@ -276,6 +279,7 @@ public class EditWorld { public void deleteNoSave() { EditWorldUnloadEvent event = new EditWorldUnloadEvent(this, false); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; @@ -329,6 +333,7 @@ public class EditWorld { public static EditWorld load(String name) { EditWorldLoadEvent event = new EditWorldLoadEvent(name); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return null; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/world/GameWorld.java b/src/main/java/io/github/dre2n/dungeonsxl/world/GameWorld.java index cb126e9b..f8a96cf4 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/world/GameWorld.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/world/GameWorld.java @@ -398,6 +398,7 @@ public class GameWorld { public void startGame() { GameWorldStartGameEvent event = new GameWorldStartGameEvent(this, getGame()); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; @@ -434,6 +435,7 @@ public class GameWorld { public void delete() { GameWorldUnloadEvent event = new GameWorldUnloadEvent(this); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; @@ -471,6 +473,7 @@ public class GameWorld { /* Statics */ public static GameWorld load(String name) { GameWorldLoadEvent event = new GameWorldLoadEvent(name); + plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return null; @@ -632,6 +635,8 @@ public class GameWorld { for (Requirement requirement : worldConfig.getRequirements()) { RequirementCheckEvent event = new RequirementCheckEvent(requirement, player); + plugin.getServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { continue; }