mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 11:37:05 +01:00
Add new reward event
This commit is contained in:
parent
462db92cb8
commit
fc86c5e999
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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.Reward;
|
||||
import de.erethon.dungeonsxl.api.player.GlobalPlayer;
|
||||
import java.util.List;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Fired when a player gets his {@link Reward}s after finishing a game.
|
||||
* <p>
|
||||
* @see GlobalPlayer#setRewardItems(java.util.List)
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public class GlobalPlayerRewardPayOutEvent extends GlobalPlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private final List<Reward> rewards;
|
||||
|
||||
public GlobalPlayerRewardPayOutEvent(GlobalPlayer globalPlayer, List<Reward> rewards) {
|
||||
super(globalPlayer);
|
||||
this.rewards = rewards;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of the rewards the player will get.
|
||||
*
|
||||
* @return a list of the rewards the player will get
|
||||
*/
|
||||
public List<Reward> getRewards() {
|
||||
return rewards;
|
||||
}
|
||||
|
||||
@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.game;
|
||||
|
||||
import de.erethon.dungeonsxl.event.dplayer.DPlayerEvent;
|
||||
import de.erethon.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;
|
||||
}
|
||||
|
||||
}
|
@ -1,104 +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.game;
|
||||
|
||||
import de.erethon.dungeonsxl.api.Reward;
|
||||
import de.erethon.dungeonsxl.player.DGamePlayer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* @author Daniel Saukel
|
||||
*/
|
||||
public class DGamePlayerRewardEvent extends DGamePlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private List<Reward> rewards = new ArrayList<>();
|
||||
private List<Player> excludedPlayers = new ArrayList<>();
|
||||
|
||||
public DGamePlayerRewardEvent(DGamePlayer dPlayer) {
|
||||
super(dPlayer);
|
||||
this.rewards = dPlayer.getGroup().getRewards();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rewards
|
||||
*/
|
||||
public List<Reward> getRewards() {
|
||||
return rewards;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reward the reward to add
|
||||
*/
|
||||
public void addRewards(Reward reward) {
|
||||
rewards.add(reward);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reward the reward to remove
|
||||
*/
|
||||
public void removeRewards(Reward reward) {
|
||||
rewards.remove(reward);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the excludedPlayers
|
||||
*/
|
||||
public List<Player> getExcludedPlayers() {
|
||||
return excludedPlayers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player the player to add
|
||||
*/
|
||||
public void addExcludedPlayer(Player player) {
|
||||
excludedPlayers.add(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player the player to remove
|
||||
*/
|
||||
public void removeExcludedPlayer(Player player) {
|
||||
excludedPlayers.remove(player);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user