mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 11:37:05 +01:00
Add new EditPlayer events
This commit is contained in:
parent
a4a5874f39
commit
1cf83aaca6
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2014-2020 Daniel Saukel
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser 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 GNULesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.erethon.dungeonsxl.api.event.player;
|
||||
|
||||
import de.erethon.dungeonsxl.api.player.EditPlayer;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Fired when a player starts editing a dungeon map.
|
||||
*
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public class EditPlayerEditEvent extends EditPlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private boolean newlyLoaded;
|
||||
|
||||
public EditPlayerEditEvent(EditPlayer editPlayer, boolean newlyLoaded) {
|
||||
super(editPlayer);
|
||||
this.newlyLoaded = newlyLoaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the edit world was not instantiated before the player edited it and false if it was.
|
||||
*
|
||||
* @return true if the edit world was not instantiated before the player edited it and false if it was
|
||||
*/
|
||||
public boolean isNewlyLoaded() {
|
||||
return newlyLoaded;
|
||||
}
|
||||
|
||||
@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,39 @@
|
||||
/*
|
||||
* Copyright (C) 2014-2020 Daniel Saukel
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser 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 GNULesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.erethon.dungeonsxl.api.event.player;
|
||||
|
||||
import de.erethon.dungeonsxl.api.player.EditPlayer;
|
||||
|
||||
/**
|
||||
* Superclass for events involving {@link EditPlayer}s.
|
||||
*
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public abstract class EditPlayerEvent extends GlobalPlayerEvent {
|
||||
|
||||
protected EditPlayerEvent(EditPlayer editPlayer) {
|
||||
super(editPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the EditPlayer involved in this event
|
||||
*
|
||||
* @return the EditPlayer involved in this event
|
||||
*/
|
||||
public EditPlayer getEditPlayer() {
|
||||
return (EditPlayer) globalPlayer;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2014-2020 Daniel Saukel
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser 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 GNULesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.erethon.dungeonsxl.api.event.player;
|
||||
|
||||
import de.erethon.dungeonsxl.api.player.EditPlayer;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Fired when a player stops editing a dungeon map.
|
||||
*
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public class EditPlayerLeaveEvent extends EditPlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private boolean escape;
|
||||
private boolean unloadIfEmpty;
|
||||
|
||||
public EditPlayerLeaveEvent(EditPlayer editPlayer, boolean escape, boolean unloadIfEmpty) {
|
||||
super(editPlayer);
|
||||
this.escape = escape;
|
||||
this.unloadIfEmpty = unloadIfEmpty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if the edit world is saved, true if not.
|
||||
*
|
||||
* @return false if the edit world is saved, true if not
|
||||
*/
|
||||
public boolean isEscape() {
|
||||
return escape;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the instance shall be unloaded when it is empty after the player left.
|
||||
*
|
||||
* @return if the instance shall be unloaded when it is empty after the player left
|
||||
*/
|
||||
public boolean getUnloadIfEmpty() {
|
||||
return unloadIfEmpty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if the instance shall be unloaded when it is empty after the player left.
|
||||
*
|
||||
* @param unloadIfEmpty if the instance shall be unloaded when it is empty after the player left
|
||||
*/
|
||||
public void setUnloadIfEmpty(boolean unloadIfEmpty) {
|
||||
this.unloadIfEmpty = unloadIfEmpty;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2020 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 de.erethon.dungeonsxl.event.dplayer.instance.edit;
|
||||
|
||||
import de.erethon.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;
|
||||
}
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2020 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 de.erethon.dungeonsxl.event.dplayer.instance.edit;
|
||||
|
||||
import de.erethon.dungeonsxl.event.dplayer.DPlayerEvent;
|
||||
import de.erethon.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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user