mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-09-18 19:11:09 +02:00
#102: Restructured events
This commit is contained in:
parent
0da5d76742
commit
a3590fff1e
@ -20,8 +20,8 @@ import io.github.dre2n.commons.command.BRCommand;
|
||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEscapeEvent;
|
||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerLeaveDGroupEvent;
|
||||
import io.github.dre2n.dungeonsxl.event.dplayer.instance.edit.DEditPlayerEscapeEvent;
|
||||
import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
||||
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||
@ -67,7 +67,7 @@ public class LeaveCommand extends BRCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
DPlayerEscapeEvent dPlayerEscapeEvent = new DPlayerEscapeEvent(dPlayer);
|
||||
DEditPlayerEscapeEvent dPlayerEscapeEvent = new DEditPlayerEscapeEvent((DEditPlayer) dPlayer);
|
||||
plugin.getServer().getPluginManager().callEvent(dPlayerEscapeEvent);
|
||||
DPlayerLeaveDGroupEvent dPlayerLeaveDGroupEvent = new DPlayerLeaveDGroupEvent(dPlayer, dGroup);
|
||||
plugin.getServer().getPluginManager().callEvent(dPlayerLeaveDGroupEvent);
|
||||
|
@ -31,6 +31,7 @@ public class DGroupDisbandEvent extends DGroupEvent implements Cancellable {
|
||||
COMMAND,
|
||||
DUNGEON_FINISHED,
|
||||
GROUP_IS_EMPTY,
|
||||
LOST,
|
||||
CUSTOM
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2016 Frank Baumann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package io.github.dre2n.dungeonsxl.event.dgroup;
|
||||
|
||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public class DGroupScoreEvent extends DGroupEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private Player scorer;
|
||||
private DGroup loserGroup;
|
||||
|
||||
public DGroupScoreEvent(DGroup dGroup, Player scorer, DGroup loserGroup) {
|
||||
super(dGroup);
|
||||
this.scorer = scorer;
|
||||
this.loserGroup = loserGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the creator
|
||||
*/
|
||||
public Player getScorer() {
|
||||
return scorer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scorer
|
||||
* the scoerer to set
|
||||
*/
|
||||
public void setCreator(Player scorer) {
|
||||
this.scorer = scorer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the group that lost a score to the scorers
|
||||
*/
|
||||
public DGroup getLoserGroup() {
|
||||
return loserGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loserGroup
|
||||
* the group that lost a score to the scorers to set
|
||||
*/
|
||||
public void setLoserGroup(DGroup loserGroup) {
|
||||
this.loserGroup = loserGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2016 Frank Baumann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer.instance;
|
||||
|
||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEvent;
|
||||
import io.github.dre2n.dungeonsxl.player.DInstancePlayer;
|
||||
|
||||
/**
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public abstract class DInstancePlayerEvent extends DPlayerEvent {
|
||||
|
||||
public DInstancePlayerEvent(DInstancePlayer dPlayer) {
|
||||
super(dPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DInstancePlayer getDPlayer() {
|
||||
return (DInstancePlayer) dPlayer;
|
||||
}
|
||||
|
||||
public void setDPlayer(DInstancePlayer dPlayer) {
|
||||
this.dPlayer = dPlayer;
|
||||
}
|
||||
|
||||
}
|
@ -14,8 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer;
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer.instance;
|
||||
|
||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEvent;
|
||||
import io.github.dre2n.dungeonsxl.player.DInstancePlayer;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -23,7 +24,7 @@ import org.bukkit.event.HandlerList;
|
||||
/**
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public class DPlayerUpdateEvent extends DPlayerEvent implements Cancellable {
|
||||
public class DInstancePlayerUpdateEvent extends DPlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
@ -35,7 +36,7 @@ public class DPlayerUpdateEvent extends DPlayerEvent implements Cancellable {
|
||||
private boolean kick;
|
||||
private boolean triggerAllInDistance;
|
||||
|
||||
public DPlayerUpdateEvent(DInstancePlayer dPlayer, boolean locationValid, boolean teleportWolf, boolean respawnInventory, boolean offline, boolean kick, boolean triggerAllInDistance) {
|
||||
public DInstancePlayerUpdateEvent(DInstancePlayer dPlayer, boolean locationValid, boolean teleportWolf, boolean respawnInventory, boolean offline, boolean kick, boolean triggerAllInDistance) {
|
||||
super(dPlayer);
|
||||
this.locationValid = locationValid;
|
||||
this.teleportWolf = teleportWolf;
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2016 Frank Baumann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer.instance.edit;
|
||||
|
||||
import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public class DEditPlayerEscapeEvent extends DEditPlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
public DEditPlayerEscapeEvent(DEditPlayer dPlayer) {
|
||||
super(dPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2016 Frank Baumann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer.instance.edit;
|
||||
|
||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEvent;
|
||||
import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
||||
|
||||
/**
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public abstract class DEditPlayerEvent extends DPlayerEvent {
|
||||
|
||||
public DEditPlayerEvent(DEditPlayer dPlayer) {
|
||||
super(dPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DEditPlayer getDPlayer() {
|
||||
return (DEditPlayer) dPlayer;
|
||||
}
|
||||
|
||||
public void setDPlayer(DEditPlayer dPlayer) {
|
||||
this.dPlayer = dPlayer;
|
||||
}
|
||||
|
||||
}
|
@ -14,8 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer;
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer.instance.game;
|
||||
|
||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEvent;
|
||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -24,7 +25,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
/**
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public class DPlayerDeathEvent extends DPlayerEvent implements Cancellable {
|
||||
public class DGamePlayerDeathEvent extends DPlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
@ -32,7 +33,7 @@ public class DPlayerDeathEvent extends DPlayerEvent implements Cancellable {
|
||||
private PlayerDeathEvent bukkitEvent;
|
||||
private int lostLives;
|
||||
|
||||
public DPlayerDeathEvent(DGamePlayer dPlayer, PlayerDeathEvent bukkitEvent, int lostLives) {
|
||||
public DGamePlayerDeathEvent(DGamePlayer dPlayer, PlayerDeathEvent bukkitEvent, int lostLives) {
|
||||
super(dPlayer);
|
||||
this.bukkitEvent = bukkitEvent;
|
||||
this.lostLives = lostLives;
|
@ -14,21 +14,21 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer;
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer.instance.game;
|
||||
|
||||
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public class DPlayerEscapeEvent extends DPlayerEvent implements Cancellable {
|
||||
public class DGamePlayerEscapeEvent extends DGamePlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
public DPlayerEscapeEvent(DGlobalPlayer dPlayer) {
|
||||
public DGamePlayerEscapeEvent(DGamePlayer dPlayer) {
|
||||
super(dPlayer);
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2016 Frank Baumann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer.instance.game;
|
||||
|
||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEvent;
|
||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||
|
||||
/**
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public abstract class DGamePlayerEvent extends DPlayerEvent {
|
||||
|
||||
public DGamePlayerEvent(DGamePlayer dPlayer) {
|
||||
super(dPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DGamePlayer getDPlayer() {
|
||||
return (DGamePlayer) dPlayer;
|
||||
}
|
||||
|
||||
public void setDPlayer(DGamePlayer dPlayer) {
|
||||
this.dPlayer = dPlayer;
|
||||
}
|
||||
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer;
|
||||
package io.github.dre2n.dungeonsxl.event.dplayer.instance.game;
|
||||
|
||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||
import org.bukkit.event.Cancellable;
|
||||
@ -23,7 +23,7 @@ import org.bukkit.event.HandlerList;
|
||||
/**
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public class DPlayerFinishEvent extends DPlayerEvent implements Cancellable {
|
||||
public class DGamePlayerFinishEvent extends DGamePlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
@ -31,7 +31,7 @@ public class DPlayerFinishEvent extends DPlayerEvent implements Cancellable {
|
||||
private boolean first;
|
||||
private boolean hasToWait;
|
||||
|
||||
public DPlayerFinishEvent(DGamePlayer dPlayer, boolean first, boolean hasToWait) {
|
||||
public DGamePlayerFinishEvent(DGamePlayer dPlayer, boolean first, boolean hasToWait) {
|
||||
super(dPlayer);
|
||||
this.first = first;
|
||||
this.hasToWait = hasToWait;
|
Loading…
Reference in New Issue
Block a user