mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-25 03:55:22 +01:00
Call events properly
This commit is contained in:
parent
5699cc142b
commit
5a3a77cabf
@ -120,6 +120,7 @@ public class GroupCommand extends BRCommand {
|
|||||||
|
|
||||||
DGroup dGroup = new DGroup(args[2], player);
|
DGroup dGroup = new DGroup(args[2], player);
|
||||||
DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND);
|
DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
dGroup.delete();
|
dGroup.delete();
|
||||||
@ -133,6 +134,7 @@ public class GroupCommand extends BRCommand {
|
|||||||
public void disbandGroup(DGroup dGroup) {
|
public void disbandGroup(DGroup dGroup) {
|
||||||
if (dGroup != null) {
|
if (dGroup != null) {
|
||||||
DGroupDisbandEvent event = new DGroupDisbandEvent(dGroup, player, DGroupDisbandEvent.Cause.COMMAND);
|
DGroupDisbandEvent event = new DGroupDisbandEvent(dGroup, player, DGroupDisbandEvent.Cause.COMMAND);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
dGroup.delete();
|
dGroup.delete();
|
||||||
@ -212,6 +214,7 @@ public class GroupCommand extends BRCommand {
|
|||||||
Player toKick = plugin.getServer().getPlayer(args[2]);
|
Player toKick = plugin.getServer().getPlayer(args[2]);
|
||||||
if (toKick != null) {
|
if (toKick != null) {
|
||||||
DPlayerKickEvent event = new DPlayerKickEvent(DGamePlayer.getByPlayer(toKick.getPlayer()), DPlayerKickEvent.Cause.COMMAND);
|
DPlayerKickEvent event = new DPlayerKickEvent(DGamePlayer.getByPlayer(toKick.getPlayer()), DPlayerKickEvent.Cause.COMMAND);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (dGroup.getPlayers().contains(toKick)) {
|
if (dGroup.getPlayers().contains(toKick)) {
|
||||||
|
@ -61,7 +61,9 @@ public class LeaveCommand extends BRCommand {
|
|||||||
DGroup dGroup = DGroup.getByPlayer(player);
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
|
|
||||||
DPlayerEscapeEvent dPlayerEscapeEvent = new DPlayerEscapeEvent(dPlayer);
|
DPlayerEscapeEvent dPlayerEscapeEvent = new DPlayerEscapeEvent(dPlayer);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(dPlayerEscapeEvent);
|
||||||
DPlayerLeaveDGroupEvent dPlayerLeaveDGroupEvent = new DPlayerLeaveDGroupEvent(dPlayer, dGroup);
|
DPlayerLeaveDGroupEvent dPlayerLeaveDGroupEvent = new DPlayerLeaveDGroupEvent(dPlayer, dGroup);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(dPlayerLeaveDGroupEvent);
|
||||||
|
|
||||||
if (dPlayerEscapeEvent.isCancelled() || dPlayerLeaveDGroupEvent.isCancelled()) {
|
if (dPlayerEscapeEvent.isCancelled() || dPlayerLeaveDGroupEvent.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -143,6 +143,7 @@ public class PlayCommand extends BRCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND);
|
DGroupCreateEvent event = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.COMMAND);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
plugin.getDGroups().remove(dGroup);
|
plugin.getDGroups().remove(dGroup);
|
||||||
|
@ -96,6 +96,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DPlayerDeathEvent dPlayerDeathEvent = new DPlayerDeathEvent(dPlayer, event, 1);
|
DPlayerDeathEvent dPlayerDeathEvent = new DPlayerDeathEvent(dPlayer, event, 1);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(dPlayerDeathEvent);
|
||||||
|
|
||||||
if (dPlayerDeathEvent.isCancelled()) {
|
if (dPlayerDeathEvent.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -128,6 +129,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
if (dPlayer.getLives() == 0 && dPlayer.isReady()) {
|
if (dPlayer.getLives() == 0 && dPlayer.isReady()) {
|
||||||
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer, DPlayerKickEvent.Cause.DEATH);
|
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer, DPlayerKickEvent.Cause.DEATH);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(dPlayerKickEvent);
|
||||||
|
|
||||||
if (!dPlayerKickEvent.isCancelled()) {
|
if (!dPlayerKickEvent.isCancelled()) {
|
||||||
MessageUtil.broadcastMessage(DMessages.PLAYER_DEATH_KICK.getMessage(player.getName()));
|
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);
|
DGroup dGroup = new DGroup(player, plugin.getMainConfig().getTutorialDungeon(), false);
|
||||||
|
|
||||||
DGroupCreateEvent createEvent = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.GROUP_SIGN);
|
DGroupCreateEvent createEvent = new DGroupCreateEvent(dGroup, player, DGroupCreateEvent.Cause.GROUP_SIGN);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(createEvent);
|
||||||
|
|
||||||
if (createEvent.isCancelled()) {
|
if (createEvent.isCancelled()) {
|
||||||
dGroup = null;
|
dGroup = null;
|
||||||
|
@ -23,6 +23,7 @@ import io.github.dre2n.dungeonsxl.trigger.WaveTrigger;
|
|||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
@ -71,6 +72,7 @@ public class DMob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DMobDeathEvent dMobDeathEvent = new DMobDeathEvent(this, event);
|
DMobDeathEvent dMobDeathEvent = new DMobDeathEvent(this, event);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(dMobDeathEvent);
|
||||||
|
|
||||||
if (dMobDeathEvent.isCancelled()) {
|
if (dMobDeathEvent.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -698,6 +698,7 @@ public class DGamePlayer extends DGlobalPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DGroupFinishFloorEvent event = new DGroupFinishFloorEvent(dGroup, dGroup.getGameWorld(), newFloor);
|
DGroupFinishFloorEvent event = new DGroupFinishFloorEvent(dGroup, dGroup.getGameWorld(), newFloor);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -756,6 +757,7 @@ public class DGamePlayer extends DGlobalPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DPlayerFinishEvent dPlayerFinishEvent = new DPlayerFinishEvent(this, first, hasToWait);
|
DPlayerFinishEvent dPlayerFinishEvent = new DPlayerFinishEvent(this, first, hasToWait);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(dPlayerFinishEvent);
|
||||||
|
|
||||||
if (dPlayerFinishEvent.isCancelled()) {
|
if (dPlayerFinishEvent.isCancelled()) {
|
||||||
finished = false;
|
finished = false;
|
||||||
@ -767,6 +769,7 @@ public class DGamePlayer extends DGlobalPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DGroupFinishDungeonEvent dGroupFinishDungeonEvent = new DGroupFinishDungeonEvent(dGroup);
|
DGroupFinishDungeonEvent dGroupFinishDungeonEvent = new DGroupFinishDungeonEvent(dGroup);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(dGroupFinishDungeonEvent);
|
||||||
|
|
||||||
if (dGroupFinishDungeonEvent.isCancelled()) {
|
if (dGroupFinishDungeonEvent.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -928,6 +931,7 @@ public class DGamePlayer extends DGlobalPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DPlayerUpdateEvent event = new DPlayerUpdateEvent(this, locationValid, teleportWolf, respawnInventory, offline, kick, triggerAllInDistance);
|
DPlayerUpdateEvent event = new DPlayerUpdateEvent(this, locationValid, teleportWolf, respawnInventory, offline, kick, triggerAllInDistance);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -947,6 +951,7 @@ public class DGamePlayer extends DGlobalPlayer {
|
|||||||
|
|
||||||
if (kick) {
|
if (kick) {
|
||||||
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(this, DPlayerKickEvent.Cause.OFFLINE);
|
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(this, DPlayerKickEvent.Cause.OFFLINE);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(dPlayerKickEvent);
|
||||||
|
|
||||||
if (!dPlayerKickEvent.isCancelled()) {
|
if (!dPlayerKickEvent.isCancelled()) {
|
||||||
leave();
|
leave();
|
||||||
|
@ -164,6 +164,7 @@ public class DGroup {
|
|||||||
// Check group
|
// Check group
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
DGroupDisbandEvent event = new DGroupDisbandEvent(this, player, DGroupDisbandEvent.Cause.GROUP_IS_EMPTY);
|
DGroupDisbandEvent event = new DGroupDisbandEvent(this, player, DGroupDisbandEvent.Cause.GROUP_IS_EMPTY);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
delete();
|
delete();
|
||||||
@ -385,6 +386,7 @@ public class DGroup {
|
|||||||
*/
|
*/
|
||||||
public void addReward(Reward reward) {
|
public void addReward(Reward reward) {
|
||||||
RewardAdditionEvent event = new RewardAdditionEvent(reward, this);
|
RewardAdditionEvent event = new RewardAdditionEvent(reward, this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -466,6 +468,7 @@ public class DGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DGroupStartFloorEvent event = new DGroupStartFloorEvent(this, gameWorld);
|
DGroupStartFloorEvent event = new DGroupStartFloorEvent(this, gameWorld);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -502,6 +505,7 @@ public class DGroup {
|
|||||||
if (config != null) {
|
if (config != null) {
|
||||||
for (Requirement requirement : config.getRequirements()) {
|
for (Requirement requirement : config.getRequirements()) {
|
||||||
RequirementDemandEvent requirementDemandEvent = new RequirementDemandEvent(requirement, player);
|
RequirementDemandEvent requirementDemandEvent = new RequirementDemandEvent(requirement, player);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (requirementDemandEvent.isCancelled()) {
|
if (requirementDemandEvent.isCancelled()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -21,6 +21,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|||||||
import io.github.dre2n.dungeonsxl.event.requirement.RequirementRegistrationEvent;
|
import io.github.dre2n.dungeonsxl.event.requirement.RequirementRegistrationEvent;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,6 +46,7 @@ public abstract class Requirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RequirementRegistrationEvent event = new RequirementRegistrationEvent(requirement);
|
RequirementRegistrationEvent event = new RequirementRegistrationEvent(requirement);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -21,6 +21,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|||||||
import io.github.dre2n.dungeonsxl.event.reward.RewardRegistrationEvent;
|
import io.github.dre2n.dungeonsxl.event.reward.RewardRegistrationEvent;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,6 +46,7 @@ public abstract class Reward {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RewardRegistrationEvent event = new RewardRegistrationEvent(reward);
|
RewardRegistrationEvent event = new RewardRegistrationEvent(reward);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -190,6 +190,7 @@ public abstract class DSign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DSignRegistrationEvent event = new DSignRegistrationEvent(sign, gameWorld, dSign);
|
DSignRegistrationEvent event = new DSignRegistrationEvent(sign, gameWorld, dSign);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -65,6 +65,7 @@ public class LeaveSign extends DSign {
|
|||||||
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
|
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
|
||||||
if (dPlayer != null) {
|
if (dPlayer != null) {
|
||||||
DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer);
|
DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return false;
|
return false;
|
||||||
@ -80,6 +81,7 @@ public class LeaveSign extends DSign {
|
|||||||
public void onTrigger() {
|
public void onTrigger() {
|
||||||
for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
|
for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
|
||||||
DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer);
|
DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -23,6 +23,7 @@ import io.github.dre2n.dungeonsxl.config.DMessages;
|
|||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
@ -66,6 +67,7 @@ public class TimeIsRunningTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer, DPlayerKickEvent.Cause.TIME_EXPIRED);
|
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer, DPlayerKickEvent.Cause.TIME_EXPIRED);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(dPlayerKickEvent);
|
||||||
|
|
||||||
if (!dPlayerKickEvent.isCancelled()) {
|
if (!dPlayerKickEvent.isCancelled()) {
|
||||||
MessageUtil.broadcastMessage(DMessages.PLAYER_TIME_KICK.getMessage(player.getName()));
|
MessageUtil.broadcastMessage(DMessages.PLAYER_TIME_KICK.getMessage(player.getName()));
|
||||||
|
@ -49,6 +49,7 @@ public class DistanceTrigger extends Trigger {
|
|||||||
|
|
||||||
public void onTrigger(Player player) {
|
public void onTrigger(Player player) {
|
||||||
TriggerActionEvent event = new TriggerActionEvent(this);
|
TriggerActionEvent event = new TriggerActionEvent(this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -43,6 +43,7 @@ public class InteractTrigger extends Trigger {
|
|||||||
|
|
||||||
public void onTrigger(Player player) {
|
public void onTrigger(Player player) {
|
||||||
TriggerActionEvent event = new TriggerActionEvent(this);
|
TriggerActionEvent event = new TriggerActionEvent(this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -39,6 +39,7 @@ public class MobTrigger extends Trigger {
|
|||||||
|
|
||||||
public void onTrigger() {
|
public void onTrigger() {
|
||||||
TriggerActionEvent event = new TriggerActionEvent(this);
|
TriggerActionEvent event = new TriggerActionEvent(this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -95,6 +95,7 @@ public class ProgressTrigger extends Trigger {
|
|||||||
/* Actions */
|
/* Actions */
|
||||||
public void onTrigger() {
|
public void onTrigger() {
|
||||||
TriggerActionEvent event = new TriggerActionEvent(this);
|
TriggerActionEvent event = new TriggerActionEvent(this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -43,6 +43,7 @@ public class RedstoneTrigger extends Trigger {
|
|||||||
|
|
||||||
public void onTrigger() {
|
public void onTrigger() {
|
||||||
TriggerActionEvent event = new TriggerActionEvent(this);
|
TriggerActionEvent event = new TriggerActionEvent(this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -39,6 +39,7 @@ public class SignTrigger extends Trigger {
|
|||||||
|
|
||||||
public void onTrigger(boolean enable) {
|
public void onTrigger(boolean enable) {
|
||||||
TriggerActionEvent event = new TriggerActionEvent(this);
|
TriggerActionEvent event = new TriggerActionEvent(this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -188,6 +188,7 @@ public abstract class Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TriggerRegistrationEvent event = new TriggerRegistrationEvent(trigger);
|
TriggerRegistrationEvent event = new TriggerRegistrationEvent(trigger);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -46,6 +46,7 @@ public class UseItemTrigger extends Trigger {
|
|||||||
|
|
||||||
public void onTrigger(Player player) {
|
public void onTrigger(Player player) {
|
||||||
TriggerActionEvent event = new TriggerActionEvent(this);
|
TriggerActionEvent event = new TriggerActionEvent(this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -56,6 +56,7 @@ public class WaveTrigger extends Trigger {
|
|||||||
|
|
||||||
public void onTrigger() {
|
public void onTrigger() {
|
||||||
TriggerActionEvent event = new TriggerActionEvent(this);
|
TriggerActionEvent event = new TriggerActionEvent(this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -208,6 +208,7 @@ public class EditWorld {
|
|||||||
creator.generateStructures(false);
|
creator.generateStructures(false);
|
||||||
|
|
||||||
EditWorldGenerateEvent event = new EditWorldGenerateEvent(this);
|
EditWorldGenerateEvent event = new EditWorldGenerateEvent(this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -218,6 +219,7 @@ public class EditWorld {
|
|||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
EditWorldSaveEvent event = new EditWorldSaveEvent(this);
|
EditWorldSaveEvent event = new EditWorldSaveEvent(this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -256,6 +258,7 @@ public class EditWorld {
|
|||||||
|
|
||||||
public void delete() {
|
public void delete() {
|
||||||
EditWorldUnloadEvent event = new EditWorldUnloadEvent(this, true);
|
EditWorldUnloadEvent event = new EditWorldUnloadEvent(this, true);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -276,6 +279,7 @@ public class EditWorld {
|
|||||||
|
|
||||||
public void deleteNoSave() {
|
public void deleteNoSave() {
|
||||||
EditWorldUnloadEvent event = new EditWorldUnloadEvent(this, false);
|
EditWorldUnloadEvent event = new EditWorldUnloadEvent(this, false);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -329,6 +333,7 @@ public class EditWorld {
|
|||||||
|
|
||||||
public static EditWorld load(String name) {
|
public static EditWorld load(String name) {
|
||||||
EditWorldLoadEvent event = new EditWorldLoadEvent(name);
|
EditWorldLoadEvent event = new EditWorldLoadEvent(name);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -398,6 +398,7 @@ public class GameWorld {
|
|||||||
|
|
||||||
public void startGame() {
|
public void startGame() {
|
||||||
GameWorldStartGameEvent event = new GameWorldStartGameEvent(this, getGame());
|
GameWorldStartGameEvent event = new GameWorldStartGameEvent(this, getGame());
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -434,6 +435,7 @@ public class GameWorld {
|
|||||||
|
|
||||||
public void delete() {
|
public void delete() {
|
||||||
GameWorldUnloadEvent event = new GameWorldUnloadEvent(this);
|
GameWorldUnloadEvent event = new GameWorldUnloadEvent(this);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -471,6 +473,7 @@ public class GameWorld {
|
|||||||
/* Statics */
|
/* Statics */
|
||||||
public static GameWorld load(String name) {
|
public static GameWorld load(String name) {
|
||||||
GameWorldLoadEvent event = new GameWorldLoadEvent(name);
|
GameWorldLoadEvent event = new GameWorldLoadEvent(name);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return null;
|
return null;
|
||||||
@ -632,6 +635,8 @@ public class GameWorld {
|
|||||||
|
|
||||||
for (Requirement requirement : worldConfig.getRequirements()) {
|
for (Requirement requirement : worldConfig.getRequirements()) {
|
||||||
RequirementCheckEvent event = new RequirementCheckEvent(requirement, player);
|
RequirementCheckEvent event = new RequirementCheckEvent(requirement, player);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user