Consolidated Acid events using an abscract event
This commit is contained in:
parent
388d386ef8
commit
91ff142254
2
pom.xml
2
pom.xml
|
@ -284,7 +284,7 @@
|
|||
<show>public</show>
|
||||
<failOnError>false</failOnError>
|
||||
<additionalJOption>-Xdoclint:none</additionalJOption>
|
||||
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
|
||||
<!-- <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable> -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
|
|
@ -161,7 +161,7 @@ public class AcidIsland extends GameModeAddon {
|
|||
|
||||
@Override
|
||||
public WorldSettings getWorldSettings() {
|
||||
return settings;
|
||||
return getSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
package world.bentobox.acidisland.events;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
/**
|
||||
* This event is fired when a player is going to be burned by acid or acid rain
|
||||
*
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractAcidEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player player;
|
||||
private final double protection;
|
||||
/**
|
||||
* @since 1.9.1
|
||||
*/
|
||||
private List<PotionEffectType> potionEffects;
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param rainDamage
|
||||
* @param protection
|
||||
*/
|
||||
public AbstractAcidEvent(Player player, double protection, List<PotionEffectType> potionEffects) {
|
||||
this.player = player;
|
||||
this.protection = protection;
|
||||
this.potionEffects = potionEffects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player being damaged by acid rain
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player the player to set
|
||||
*/
|
||||
public void setPlayer(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount the damage was reduced for this player due to armor, etc.
|
||||
* @return the protection
|
||||
*/
|
||||
public double getProtection() {
|
||||
return protection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the potion effects that will be applied to the player.
|
||||
* @return list of potion effect types
|
||||
* @since 1.9.1
|
||||
*/
|
||||
public List<PotionEffectType> getPotionEffects() {
|
||||
return potionEffects;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param potionEffects the potionEffects to set
|
||||
* @since 1.9.1
|
||||
*/
|
||||
public void setPotionEffects(List<PotionEffectType> potionEffects) {
|
||||
this.potionEffects = potionEffects;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
|
@ -3,9 +3,6 @@ package world.bentobox.acidisland.events;
|
|||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
/**
|
||||
|
@ -14,13 +11,9 @@ import org.bukkit.potion.PotionEffectType;
|
|||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class AcidEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public class AcidEvent extends AbstractAcidEvent {
|
||||
|
||||
private Player player;
|
||||
private double totalDamage;
|
||||
private final double protection;
|
||||
private List<PotionEffectType> potionEffects;
|
||||
|
||||
/**
|
||||
* @param player - player
|
||||
|
@ -29,26 +22,8 @@ public class AcidEvent extends Event implements Cancellable {
|
|||
* @param potionEffects - potion effects given to the player
|
||||
*/
|
||||
public AcidEvent(Player player, double totalDamage, double protection, List<PotionEffectType> potionEffects) {
|
||||
this.player = player;
|
||||
super(player, protection, potionEffects);
|
||||
this.totalDamage = totalDamage;
|
||||
this.protection = protection;
|
||||
this.potionEffects = potionEffects;
|
||||
}
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* @return the player being damaged by acid rain
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player the player to set
|
||||
*/
|
||||
public void setPlayer(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,14 +34,6 @@ public class AcidEvent extends Event implements Cancellable {
|
|||
return totalDamage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount the damage was reduced for this player due to armor, etc.
|
||||
* @return the protection
|
||||
*/
|
||||
public double getProtection() {
|
||||
return protection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param totalDamage to set
|
||||
*/
|
||||
|
@ -74,36 +41,4 @@ public class AcidEvent extends Event implements Cancellable {
|
|||
this.totalDamage = totalDamage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the potionEffects
|
||||
*/
|
||||
public List<PotionEffectType> getPotionEffects() {
|
||||
return potionEffects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param potionEffects the potionEffects to set
|
||||
*/
|
||||
public void setPotionEffects(List<PotionEffectType> potionEffects) {
|
||||
this.potionEffects = potionEffects;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,6 @@ package world.bentobox.acidisland.events;
|
|||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
/**
|
||||
|
@ -14,44 +11,18 @@ import org.bukkit.potion.PotionEffectType;
|
|||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class AcidRainEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player player;
|
||||
public class AcidRainEvent extends AbstractAcidEvent {
|
||||
private double rainDamage;
|
||||
private final double protection;
|
||||
/**
|
||||
* @since 1.9.1
|
||||
*/
|
||||
private List<PotionEffectType> potionEffects;
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param rainDamage
|
||||
* @param protection
|
||||
* @param player - player
|
||||
* @param rainDamage - rain damage caused
|
||||
* @param protection - protection reducer to damage
|
||||
* @param potionEffects - potion effects to apply if acid rain affects player
|
||||
*/
|
||||
public AcidRainEvent(Player player, double rainDamage, double protection, List<PotionEffectType> potionEffects) {
|
||||
this.player = player;
|
||||
super(player, protection, potionEffects);
|
||||
this.rainDamage = rainDamage;
|
||||
this.protection = protection;
|
||||
this.potionEffects = potionEffects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the player being damaged by acid rain
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player the player to set
|
||||
*/
|
||||
public void setPlayer(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,14 +33,6 @@ public class AcidRainEvent extends Event implements Cancellable {
|
|||
return rainDamage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount the damage was reduced for this player due to armor, etc.
|
||||
* @return the protection
|
||||
*/
|
||||
public double getProtection() {
|
||||
return protection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rainDamage the rainDamage to set
|
||||
*/
|
||||
|
@ -77,40 +40,4 @@ public class AcidRainEvent extends Event implements Cancellable {
|
|||
this.rainDamage = rainDamage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the potion effects that will be applied to the player.
|
||||
* @return list of potion effect types
|
||||
* @since 1.9.1
|
||||
*/
|
||||
public List<PotionEffectType> getPotionEffects() {
|
||||
return potionEffects;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param potionEffects the potionEffects to set
|
||||
* @since 1.9.1
|
||||
*/
|
||||
public void setPotionEffects(List<PotionEffectType> potionEffects) {
|
||||
this.potionEffects = potionEffects;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue