Removed acid-related events.

This commit is contained in:
tastybento 2018-07-28 13:39:18 -07:00
parent c2deb6bcd5
commit da04246a50
8 changed files with 52 additions and 156 deletions

View File

@ -1,58 +0,0 @@
package us.tastybento.bskyblock.api.events.acid;
import org.bukkit.entity.Entity;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.database.objects.Island;
/**
* Fired when an entity (items excluded) receives damage from acid
* @author Poslovitch
* @since 1.0
*/
public class EntityDamageByAcidEvent extends IslandBaseEvent {
private final Entity entity;
private double damage;
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 Entity who is receiving Acid
* @return the damaged Entity
*/
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() {
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) {
this.damage = damage;
}
/**
* Gets the cause of the acid damage
* @return the cause of the acid damage
*/
public Acid getCause() {
return cause;
}
}

View File

@ -1,28 +0,0 @@
package us.tastybento.bskyblock.api.events.acid;
import org.bukkit.entity.Item;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.database.objects.Island;
/**
* Fired when an item (on the ground) gets destroyed by acid
* @author Poslovitch
* @since 1.0
*/
public class ItemDestroyByAcidEvent extends IslandBaseEvent {
private final Item item;
public ItemDestroyByAcidEvent(Island island, Item item) {
super(island);
this.item = item;
}
/**
* Gets the item which is getting destroyed by Acid
* @return the destroyed item
*/
public Item getItem() {
return item;
}
}

View File

@ -1,40 +0,0 @@
package us.tastybento.bskyblock.api.events.acid;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.database.objects.Island;
/**
* Fired when an ItemStack (water bottle or bucket) is filled with acid
* @author Poslovitch
* @since 1.0
*/
public class ItemFillWithAcidEvent extends IslandBaseEvent {
private final Player player;
private final ItemStack item;
// TODO: dispenser?
public ItemFillWithAcidEvent(Island island, Player player, ItemStack item) {
super(island);
this.player = player;
this.item = item;
}
/**
* Gets the player who triggered the event
* @return the player who triggered the event
*/
public Player getPlayer() {
return player;
}
/**
* Gets the item that will be acid-ified
* @return the item that will be acid-ified
*/
public ItemStack getItem() {
return item;
}
}

View File

@ -1,28 +0,0 @@
package us.tastybento.bskyblock.api.events.acid;
import org.bukkit.entity.Player;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.database.objects.Island;
/**
* Fired when a player drinks acid and... DIES
* @author Poslovitch
* @since 1.0
*/
public class PlayerDrinkAcidEvent extends IslandBaseEvent {
private final Player player;
public PlayerDrinkAcidEvent(Island island, Player player) {
super(island);
this.player = player;
}
/**
* Gets the player which is getting killed by its stupid thirsty
* @return the killed player
*/
public Player getPlayer() {
return player;
}
}

View File

@ -16,6 +16,10 @@ import us.tastybento.bskyblock.database.objects.Island;
*/
public class IslandEvent {
/**
* Reason for the event
*
*/
public enum Reason {
CREATE,
CREATED,
@ -34,66 +38,110 @@ public class IslandEvent {
return new IslandEventBuilder();
}
/**
* Fired when an island is going to be created. May be canceled.
*
*/
public static class IslandCreateEvent extends IslandBaseEvent {
private IslandCreateEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is created.
*
*/
public static class IslandCreatedEvent extends IslandBaseEvent {
private IslandCreatedEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is going to be deleted. May be canceled.
*
*/
public static class IslandDeleteEvent extends IslandBaseEvent {
private IslandDeleteEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is deleted.
*
*/
public static class IslandDeletedEvent extends IslandBaseEvent {
private IslandDeletedEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an a player enters an island
*
*/
public static class IslandEnterEvent extends IslandBaseEvent {
private IslandEnterEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when a player exits and island
*
*/
public static class IslandExitEvent extends IslandBaseEvent {
private IslandExitEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is locked
*
*/
public static class IslandLockEvent extends IslandBaseEvent {
private IslandLockEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is unlocked
*
*/
public static class IslandUnlockEvent extends IslandBaseEvent {
private IslandUnlockEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is going to be reset. May be canceled.
*
*/
public static class IslandResetEvent extends IslandBaseEvent {
private IslandResetEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired after an island is reset
*
*/
public static class IslandResettedEvent extends IslandBaseEvent {
private IslandResettedEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when something happens to the island not covered by other events
*
*/
public static class IslandGeneralEvent extends IslandBaseEvent {
private IslandGeneralEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor

View File

@ -68,6 +68,7 @@ public class PanelItem {
public void setName(String name) {
this.name = name;
meta.setDisplayName(name);
meta.setLocalizedName(name); //Localized name cannot be overridden by the player using an anvils
icon.setItemMeta(meta);
}
@ -122,6 +123,6 @@ public class PanelItem {
meta.addItemFlags(ItemFlag.HIDE_DESTROYS);
meta.addItemFlags(ItemFlag.HIDE_PLACED_ON);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
icon.setItemMeta(meta);
icon.setItemMeta(meta);
}
}

View File

@ -81,7 +81,7 @@ public class PVPListener extends AbstractFlagListener {
Projectile p = (Projectile) damager;
if (p.getShooter() instanceof Player) {
// Allow self damage
if (p.getShooter().equals(hurtEntity)) {
if (hurtEntity.equals(p.getShooter())) {
return;
}
User user = User.getInstance((Player)p.getShooter());

View File

@ -324,6 +324,7 @@ public class IslandsManager {
/**
* Returns a set of island member UUID's for the island of playerUUID
* This includes the owner of the island. If there is no island, this set will be empty.
*
* @param world - world to check
* @param playerUUID - the player's UUID