mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-18 07:07:40 +01:00
Events
This commit is contained in:
parent
3d74c4a427
commit
59a6397536
@ -0,0 +1,23 @@
|
||||
package us.tastybento.bskyblock.api.events;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Fired when BSkyBlock is ready to play and all files are loaded
|
||||
*
|
||||
* @author tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class BSkyBlockReadyEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package us.tastybento.bskyblock.api.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Poslovitch
|
||||
* @version 1.0
|
||||
*/
|
||||
public class IslandEvent extends Event implements Cancellable{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private final Island island;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
*/
|
||||
public IslandEvent(Island island){
|
||||
this.island = island;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the island involved in this event
|
||||
*/
|
||||
public Island getIsland(){
|
||||
return this.island;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
@ -1,79 +1,58 @@
|
||||
package us.tastybento.bskyblock.api.events.acid;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when an entity (player and items excluded) receives damage from acid
|
||||
* Fired when an entity (items excluded) receives damage from acid
|
||||
* @author Poslovitch
|
||||
* @since 4.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public class EntityDamageByAcidEvent extends Event implements Cancellable{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private Island island;
|
||||
private Entity entity;
|
||||
public class EntityDamageByAcidEvent extends IslandEvent {
|
||||
private final Entity entity;
|
||||
private double damage;
|
||||
|
||||
public EntityDamageByAcidEvent(Island island, Entity entity, double damage) {
|
||||
this.island = island;
|
||||
|
||||
public enum Acid { RAIN, WATER };
|
||||
private final Acid cause;
|
||||
|
||||
public EntityDamageByAcidEvent(Island island, Entity entity, double damage, Acid cause) {
|
||||
super(island);
|
||||
this.entity = entity;
|
||||
this.damage = damage;
|
||||
this.cause = cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the island where stands the damaged Entity
|
||||
* @return the island where stands the damaged Entity
|
||||
*/
|
||||
public Island getIsland(){
|
||||
return island;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the Entity who is receiving Acid
|
||||
* @return the damaged Entity
|
||||
*/
|
||||
public Entity getEntity(){
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the amount of damage that is applied to the Entity
|
||||
* @return the amount of damage caused by the acid
|
||||
*/
|
||||
public double getDamage(){
|
||||
public double getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the amount of damage that will be applied to the entity
|
||||
* @param damage - the amount of damage caused by the acid
|
||||
*/
|
||||
public void setDamage(double damage){
|
||||
public void setDamage(double damage) {
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
/**
|
||||
* Gets the cause of the acid damage
|
||||
* @return the cause of the acid damage
|
||||
*/
|
||||
public Acid getCause() {
|
||||
return cause;
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +1,28 @@
|
||||
package us.tastybento.bskyblock.api.events.acid;
|
||||
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when an item (on the ground) gets destroyed by acid
|
||||
* @author Poslovitch
|
||||
* @since 4.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public class ItemDestroyByAcidEvent extends Event implements Cancellable{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private Island island;
|
||||
private Item item;
|
||||
|
||||
public class ItemDestroyByAcidEvent extends IslandEvent {
|
||||
private final Item item;
|
||||
|
||||
public ItemDestroyByAcidEvent(Island island, Item item) {
|
||||
this.island = island;
|
||||
super(island);
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the island where stands the destroyed item
|
||||
* @return the island where stands the destroyed item
|
||||
*/
|
||||
public Island getIsland(){
|
||||
return island;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the item which is getting destroyed by Acid
|
||||
* @return the destroyed item
|
||||
*/
|
||||
public Item getItem(){
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
|
@ -1,72 +1,40 @@
|
||||
package us.tastybento.bskyblock.api.events.acid;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when an ItemStack (water bottle or bucket) is filled with acid
|
||||
* @author Poslovitch
|
||||
* @since 4.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public class ItemFillWithAcidEvent extends Event implements Cancellable{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private Island island;
|
||||
private Player player;
|
||||
private ItemStack item;
|
||||
|
||||
public class ItemFillWithAcidEvent extends IslandEvent {
|
||||
private final Player player;
|
||||
private final ItemStack item;
|
||||
|
||||
// TODO: dispenser?
|
||||
public ItemFillWithAcidEvent(Island island, Player player, ItemStack item) {
|
||||
this.island = island;
|
||||
super(island);
|
||||
this.player = player;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the island where the event happened
|
||||
* @return the island where the event happened
|
||||
*/
|
||||
public Island getIsland(){
|
||||
return island;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the player who triggered the event
|
||||
* @return the player who triggered the event
|
||||
*/
|
||||
public Player getPlayer(){
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the item that will be acid-ified
|
||||
* @return the item that will be acid-ified
|
||||
*/
|
||||
public ItemStack getItem(){
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
|
@ -1,91 +0,0 @@
|
||||
package us.tastybento.bskyblock.api.events.acid;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when a player receives damage from acid
|
||||
* @author Poslovitch
|
||||
* @since 4.0
|
||||
*/
|
||||
public class PlayerDamageByAcidEvent extends Event implements Cancellable{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private Island island;
|
||||
private Player player;
|
||||
private double damage;
|
||||
|
||||
public enum Acid { RAIN, WATER };
|
||||
private Acid cause;
|
||||
|
||||
public PlayerDamageByAcidEvent(Island island, Player player, double damage, Acid cause) {
|
||||
this.island = island;
|
||||
this.player = player;
|
||||
this.damage = damage;
|
||||
this.cause = cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the island where stands the damaged Player
|
||||
* @return the island where stands the damaged Player
|
||||
*/
|
||||
public Island getIsland(){
|
||||
return island;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Player who is receiving Acid
|
||||
* @return the damaged Player
|
||||
*/
|
||||
public Player getPlayer(){
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of damage that is applied to the Player
|
||||
* @return the amount of damage caused by the acid
|
||||
*/
|
||||
public double getDamage(){
|
||||
return damage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the amount of damage that will be applied to the Player
|
||||
* @param damage - the amount of damage caused by the acid
|
||||
*/
|
||||
public void setDamage(double damage){
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cause of the acid damage
|
||||
* @return the cause of the acid damage
|
||||
*/
|
||||
public Acid getCause(){
|
||||
return cause;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
@ -1,61 +1,28 @@
|
||||
package us.tastybento.bskyblock.api.events.acid;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when a player drinks acid and... DIES
|
||||
* @author Poslovitch
|
||||
* @since 4.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public class PlayerDrinkAcidEvent extends Event implements Cancellable{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private Island island;
|
||||
private Player player;
|
||||
|
||||
public class PlayerDrinkAcidEvent extends IslandEvent {
|
||||
private final Player player;
|
||||
|
||||
public PlayerDrinkAcidEvent(Island island, Player player) {
|
||||
this.island = island;
|
||||
super(island);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the island where stands the killed player
|
||||
* @return the island where stands the killed player
|
||||
*/
|
||||
public Island getIsland(){
|
||||
return island;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the player which is getting killed by its stupid thirsty
|
||||
* @return the killed player
|
||||
*/
|
||||
public Player getPlayer(){
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
package us.tastybento.bskyblock.api.events.island;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when the owner of an island changes
|
||||
*
|
||||
* @author Poslovitch
|
||||
* @version 1.0
|
||||
*/
|
||||
public class IslandChangeOwnerEvent extends IslandEvent {
|
||||
private final UUID oldOwner, newOwner;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
* @param oldOwner
|
||||
* @param newOwner
|
||||
*/
|
||||
public IslandChangeOwnerEvent(Island island, UUID oldOwner, UUID newOwner) {
|
||||
super(island);
|
||||
this.oldOwner = oldOwner;
|
||||
this.newOwner = newOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the old owner
|
||||
*/
|
||||
public UUID getOldOwner() {
|
||||
return oldOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the new owner
|
||||
*/
|
||||
public UUID getNewOwner() {
|
||||
return newOwner;
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package us.tastybento.bskyblock.api.events.island;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when a player starts a new island
|
||||
*
|
||||
* @author tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class IslandCreateEvent extends IslandEvent {
|
||||
private final Player player;
|
||||
//private final Schematic schematic;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
* @param player
|
||||
* @param schematic
|
||||
*/
|
||||
public IslandCreateEvent(Island island, Player player/*, Schematic schematic*/) {
|
||||
super(island);
|
||||
this.player = player;
|
||||
//this.schematic = schematic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
// /** TODO: schematics
|
||||
// * @return the schematicName
|
||||
// */
|
||||
// public Schematic getSchematicName() {
|
||||
// return schematic;
|
||||
// }
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package us.tastybento.bskyblock.api.events.island;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired before an island is deleted.
|
||||
*
|
||||
* @author tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class IslandDeleteEvent extends IslandEvent {
|
||||
|
||||
/**
|
||||
* @param island
|
||||
*/
|
||||
public IslandDeleteEvent(Island island) {
|
||||
super(island);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package us.tastybento.bskyblock.api.events.island;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when a player enters an island's area
|
||||
*
|
||||
* @author tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class IslandEnterEvent extends IslandEvent {
|
||||
private final UUID player;
|
||||
private final Location location;
|
||||
|
||||
/**
|
||||
* Called to create the event
|
||||
* @param island - island the player is entering
|
||||
* @param player
|
||||
* @param location - Location of where the player entered the island or tried to enter
|
||||
*/
|
||||
public IslandEnterEvent(Island island, UUID player, Location location) {
|
||||
super(island);
|
||||
this.player = player;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player
|
||||
*/
|
||||
public UUID getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of where the player entered the island or tried to enter
|
||||
* @return the location
|
||||
*/
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package us.tastybento.bskyblock.api.events.island;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when a player exits an island's protected area
|
||||
*
|
||||
* @author tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class IslandExitEvent extends IslandEvent {
|
||||
private final UUID player;
|
||||
private final Location location;
|
||||
|
||||
/**
|
||||
* @param island that the player is leaving
|
||||
* @param player
|
||||
* @param location - Location of where the player exited the island's protected area
|
||||
*/
|
||||
public IslandExitEvent(Island island, UUID player, Location location) {
|
||||
super(island);
|
||||
this.player = player;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player
|
||||
*/
|
||||
public UUID getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of where the player exited the island's protected area
|
||||
* @return the location
|
||||
*/
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package us.tastybento.bskyblock.api.events.island;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when a player joins an existing island.
|
||||
*
|
||||
* @author tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class IslandJoinEvent extends IslandEvent {
|
||||
private final UUID player;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
* @param player
|
||||
*/
|
||||
public IslandJoinEvent(Island island, UUID player) {
|
||||
super(island);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player
|
||||
*/
|
||||
public UUID getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method suggested by Exloki.
|
||||
* Equals to <code>getIsland().getOwner();</code>
|
||||
* @return the owner of the joined island
|
||||
*/
|
||||
public UUID getNewIslandOwner() {
|
||||
return getIsland().getOwner();
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package us.tastybento.bskyblock.api.events.island;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when a player leaves an existing island.
|
||||
*
|
||||
* @author tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class IslandLeaveEvent extends IslandEvent {
|
||||
private final UUID player;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
* @param player
|
||||
*/
|
||||
public IslandLeaveEvent(Island island, UUID player) {
|
||||
super(island);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player
|
||||
*/
|
||||
public UUID getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method suggested by Exloki.
|
||||
* Equals to <code>getIsland().getOwner();</code>
|
||||
* @return the owner of the left island
|
||||
*/
|
||||
public UUID getOldIslandOwner() {
|
||||
return getIsland().getOwner();
|
||||
}
|
||||
}
|
@ -1,53 +1,31 @@
|
||||
package us.tastybento.bskyblock.api.events.island;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* This event is fired when an island is going to be locked.
|
||||
* <p>
|
||||
* Cancelling this event will result in keeping the island unlocked.
|
||||
*
|
||||
* @author Poslovitch
|
||||
* @since 4.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public class IslandLockEvent extends Event implements Cancellable{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Island island;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
*/
|
||||
public IslandLockEvent(Island island){
|
||||
this.island = island;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the locked island
|
||||
*/
|
||||
public Island getIsland(){
|
||||
return this.island;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
public class IslandLockEvent extends IslandEvent {
|
||||
private final CommandSender locker;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
* @param locker
|
||||
*/
|
||||
public IslandLockEvent(Island island, CommandSender locker) {
|
||||
super(island);
|
||||
this.locker = locker;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
public CommandSender getLocker() {
|
||||
return locker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package us.tastybento.bskyblock.api.events.island;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* This event is fired when a player resets an island
|
||||
*
|
||||
* @author tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class IslandResetEvent extends IslandEvent {
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
* @param player
|
||||
*/
|
||||
public IslandResetEvent(Island island, Player player) {
|
||||
super(island);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
}
|
@ -1,53 +1,31 @@
|
||||
package us.tastybento.bskyblock.api.events.island;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* This event is fired when an island is going to be unlocked.
|
||||
* <p>
|
||||
* Cancelling this event will result in keeping the island locked.
|
||||
*
|
||||
* @author Poslovitch
|
||||
* @since 4.0
|
||||
* @since 1.0
|
||||
*/
|
||||
public class IslandUnlockEvent extends Event implements Cancellable{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Island island;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
*/
|
||||
public IslandUnlockEvent(Island island){
|
||||
this.island = island;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the locked island
|
||||
*/
|
||||
public Island getIsland(){
|
||||
return this.island;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
public class IslandUnlockEvent extends IslandEvent {
|
||||
private final CommandSender unlocker;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
* @param unlocker
|
||||
*/
|
||||
public IslandUnlockEvent(Island island, CommandSender unlocker) {
|
||||
super(island);
|
||||
this.unlocker = unlocker;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
public CommandSender getUnlocker(){
|
||||
return unlocker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package us.tastybento.bskyblock.api.events.island;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.database.objects.Island.SettingsFlag;
|
||||
|
||||
/**
|
||||
* This event is fired when a player changes a setting on his island
|
||||
* <p>
|
||||
* Canceling this event will result in canceling the change.
|
||||
*
|
||||
* @author Poslovitch
|
||||
* @since 1.0
|
||||
*/
|
||||
public class SettingChangeEvent extends IslandEvent {
|
||||
private final UUID player;
|
||||
private final SettingsFlag editedSetting;
|
||||
private final boolean setTo;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
* @param player
|
||||
* @param editedSetting
|
||||
* @param setTo
|
||||
*/
|
||||
public SettingChangeEvent(Island island, UUID player, SettingsFlag editedSetting, boolean setTo) {
|
||||
super(island);
|
||||
this.player = player;
|
||||
this.editedSetting = editedSetting;
|
||||
this.setTo = setTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player
|
||||
*/
|
||||
public UUID getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the edited setting
|
||||
*/
|
||||
public SettingsFlag getSetting() {
|
||||
return this.editedSetting;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return enabled/disabled
|
||||
*/
|
||||
public boolean getSetTo() {
|
||||
return this.setTo;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package us.tastybento.bskyblock.api.events.purge;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* This event is fired before an island is going to be purged.
|
||||
* Canceling this event will prevent the plugin to remove the island.
|
||||
*
|
||||
* @author Poslovitch
|
||||
* @since 1.0
|
||||
*/
|
||||
public class PurgeDeleteIslandEvent extends IslandEvent {
|
||||
|
||||
/**
|
||||
* Called to create the event
|
||||
* @param island - island that will be removed
|
||||
*/
|
||||
public PurgeDeleteIslandEvent(Island island) {
|
||||
super(island);
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package us.tastybento.bskyblock.api.events.purge;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event is fired when islands to remove have been chosen and before starting to remove them.
|
||||
* You can remove or add islands to remove.
|
||||
* Canceling this event will cancel the purge
|
||||
*
|
||||
* @author Poslovitch
|
||||
* @since 1.0
|
||||
*/
|
||||
public class PurgeStartEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private final UUID user;
|
||||
private List<UUID> islandsList;
|
||||
|
||||
/**
|
||||
* Called to create the event
|
||||
* @param user - the UUID of the player who launched the purge, may be null if purge is launched using the console.
|
||||
* @param islandsList - the list of islands to remove, based on their leader's UUID
|
||||
*/
|
||||
public PurgeStartEvent(UUID user, List<UUID> islandsList) {
|
||||
this.user = user;
|
||||
this.islandsList = islandsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the user who launched the purge, may be null if purge is launched using the console.
|
||||
*/
|
||||
public UUID getUser( ){
|
||||
return this.user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of islands to remove, based on their leader's UUID
|
||||
*/
|
||||
public List<UUID> getIslandsList() {
|
||||
return this.islandsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to directly add an island owner's UUID to the list
|
||||
* @param - the owner's UUID from the island to remove
|
||||
*/
|
||||
public void add(UUID islandOwner) {
|
||||
if(!this.islandsList.contains(islandOwner)) islandsList.add(islandOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to directly remove an island owner's UUID to the list
|
||||
* @param - the owner's UUID from the island to remove
|
||||
*/
|
||||
public void remove(UUID islandOwner) {
|
||||
if(this.islandsList.contains(islandOwner)) islandsList.remove(islandOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the island list
|
||||
* @param - a new island owners' UUIDs list
|
||||
*/
|
||||
public void setIslandsList(List<UUID> islandsList) {
|
||||
this.islandsList = islandsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package us.tastybento.bskyblock.api.events.team;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when a player joins an island team as a coop member
|
||||
*
|
||||
* @author tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class CoopJoinEvent extends IslandEvent {
|
||||
private final UUID player, inviter;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
* @param player
|
||||
* @param inviter
|
||||
*/
|
||||
public CoopJoinEvent(Island island, UUID player, UUID inviter) {
|
||||
super(island);
|
||||
this.player = player;
|
||||
this.inviter = inviter;
|
||||
}
|
||||
|
||||
/**
|
||||
* The UUID of the player who were coop'd
|
||||
* @return the coop'd
|
||||
*/
|
||||
public UUID getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* The UUID of the player who invited the player to join the island
|
||||
* @return the inviter
|
||||
*/
|
||||
public UUID getInviter() {
|
||||
return inviter;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package us.tastybento.bskyblock.api.events.team;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Fired when a player leaves an island coop
|
||||
*
|
||||
* @author tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class CoopLeaveEvent extends IslandEvent {
|
||||
private final UUID player, expeller;
|
||||
|
||||
/**
|
||||
* Note that not all coop leaving events can be cancelled because they could be due to bigger events than
|
||||
* coop, e.g., an island being reset.
|
||||
* @param island
|
||||
* @param player
|
||||
* @param expeller
|
||||
*/
|
||||
public CoopLeaveEvent(Island island, UUID player, UUID expeller) {
|
||||
super(island);
|
||||
this.player = player;
|
||||
this.expeller = expeller;
|
||||
}
|
||||
|
||||
/**
|
||||
* The UUID of the player who left
|
||||
* @return the player who left the coop
|
||||
*/
|
||||
public UUID getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the expelling player
|
||||
*/
|
||||
public UUID getExpeller() {
|
||||
return expeller;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package us.tastybento.bskyblock.api.events.team;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Fired when a player accepts an invite to join a team.
|
||||
*
|
||||
* @author Poslovitch
|
||||
* @since 1.0
|
||||
*/
|
||||
public class PlayerAcceptInviteEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
* @param player
|
||||
*/
|
||||
public PlayerAcceptInviteEvent(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of ASkyBlock.
|
||||
* <p>
|
||||
* ASkyBlock 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.
|
||||
* <p>
|
||||
* ASkyBlock 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.
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ASkyBlock. If not, see <http://www.gnu.org/licenses/>.
|
||||
*******************************************************************************/
|
||||
|
||||
package us.tastybento.bskyblock.api.events.team;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Fired when a player rejects an invite to join a team.
|
||||
*
|
||||
* @author Poslovitch
|
||||
* @since 1.0
|
||||
*/
|
||||
public class PlayerRejectInviteEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
* @param player
|
||||
*/
|
||||
public PlayerRejectInviteEvent(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package us.tastybento.bskyblock.api.events.team;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* This event is fired when a player talks in TeamChat
|
||||
*
|
||||
* @author Poslovitch
|
||||
* @since 1.0
|
||||
*/
|
||||
public class TeamChatEvent extends IslandEvent {
|
||||
private final UUID player;
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* @param island
|
||||
* @param player
|
||||
* @param message
|
||||
*/
|
||||
public TeamChatEvent(Island island, UUID player, String message) {
|
||||
super(island);
|
||||
this.player = player;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player who talked
|
||||
*/
|
||||
public UUID getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message that the player is attempting to send.
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message that the player will send.
|
||||
* @param the message to send
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user