mirror of
https://github.com/BentoBoxWorld/AcidIsland.git
synced 2024-11-22 10:36:07 +01:00
Adds config setting for potion effects for acid and rain
https://github.com/BentoBoxWorld/AcidIsland/issues/83
This commit is contained in:
parent
000b9947f9
commit
bb58480eb5
2
pom.xml
2
pom.xml
@ -65,7 +65,7 @@
|
||||
<!-- Do not change unless you want different name for local builds. -->
|
||||
<build.number>-LOCAL</build.number>
|
||||
<!-- This allows to change between versions. -->
|
||||
<build.version>1.11.1</build.version>
|
||||
<build.version>1.11.2</build.version>
|
||||
</properties>
|
||||
|
||||
<!-- Profiles will allow to automatically change build version. -->
|
||||
|
@ -95,6 +95,9 @@ public class AISettings implements WorldSettings {
|
||||
@ConfigEntry(path = "acid.damage.effects")
|
||||
@Adapter(PotionEffectListAdapter.class)
|
||||
private List<PotionEffectType> acidEffects = new ArrayList<>();
|
||||
@ConfigComment("Acid effect duration in seconds")
|
||||
@ConfigEntry(path = "acid.damage.acid-effect-duration", since = "1.11.2")
|
||||
private int acidEffectDuation = 30;
|
||||
|
||||
@ConfigComment("Potion effects from going into acid rain and snow.")
|
||||
@ConfigComment("You can list multiple effects.")
|
||||
@ -110,6 +113,10 @@ public class AISettings implements WorldSettings {
|
||||
@Adapter(PotionEffectListAdapter.class)
|
||||
private List<PotionEffectType> acidRainEffects = new ArrayList<>();
|
||||
|
||||
@ConfigComment("Rain effect duration in seconds")
|
||||
@ConfigEntry(path = "acid.damage.rain-effect-duration", since = "1.11.2")
|
||||
private int rainEffectDuation = 10;
|
||||
|
||||
@ConfigComment("If player wears a helmet then they will not suffer from acid rain")
|
||||
@ConfigEntry(path = "acid.damage.protection.helmet")
|
||||
private boolean helmetProtection;
|
||||
@ -1571,4 +1578,28 @@ public class AISettings implements WorldSettings {
|
||||
public void setAcidRainEffects(List<PotionEffectType> acidRainEffects) {
|
||||
this.acidRainEffects = acidRainEffects;
|
||||
}
|
||||
/**
|
||||
* @return the rainEffectDuation
|
||||
*/
|
||||
public int getRainEffectDuation() {
|
||||
return rainEffectDuation;
|
||||
}
|
||||
/**
|
||||
* @param rainEffectDuation the rainEffectDuation to set
|
||||
*/
|
||||
public void setRainEffectDuation(int rainEffectDuation) {
|
||||
this.rainEffectDuation = rainEffectDuation;
|
||||
}
|
||||
/**
|
||||
* @return the acidEffectDuation
|
||||
*/
|
||||
public int getAcidEffectDuation() {
|
||||
return acidEffectDuation;
|
||||
}
|
||||
/**
|
||||
* @param acidEffectDuation the acidEffectDuation to set
|
||||
*/
|
||||
public void setAcidEffectDuation(int acidEffectDuation) {
|
||||
this.acidEffectDuation = acidEffectDuation;
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,8 @@ public class AcidEffect implements Listener {
|
||||
PotionEffectType.HUNGER,
|
||||
PotionEffectType.SLOW,
|
||||
PotionEffectType.SLOW_DIGGING,
|
||||
PotionEffectType.WEAKNESS);
|
||||
PotionEffectType.WEAKNESS,
|
||||
PotionEffectType.POISON);
|
||||
private static final List<PotionEffectType> IMMUNE_EFFECTS = Arrays.asList(
|
||||
PotionEffectType.WATER_BREATHING,
|
||||
PotionEffectType.CONDUIT_POWER);
|
||||
@ -119,8 +120,7 @@ public class AcidEffect implements Listener {
|
||||
AcidRainEvent event = new AcidRainEvent(player, totalDamage, protection, addon.getSettings().getAcidRainEffects());
|
||||
addon.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
event.getPotionEffects().stream().filter(EFFECTS::contains).forEach(t -> player.addPotionEffect(new PotionEffect(t, 600, 1)));
|
||||
event.getPotionEffects().stream().filter(e -> e.equals(PotionEffectType.POISON)).forEach(t -> player.addPotionEffect(new PotionEffect(t, 200, 1)));
|
||||
event.getPotionEffects().stream().filter(EFFECTS::contains).forEach(t -> player.addPotionEffect(new PotionEffect(t, addon.getSettings().getRainEffectDuation() * 20, 1)));
|
||||
// Apply damage if there is any
|
||||
if (event.getRainDamage() > 0D) {
|
||||
player.damage(event.getRainDamage());
|
||||
@ -158,8 +158,7 @@ public class AcidEffect implements Listener {
|
||||
AcidEvent acidEvent = new AcidEvent(player, totalDamage, protection, addon.getSettings().getAcidEffects());
|
||||
addon.getServer().getPluginManager().callEvent(acidEvent);
|
||||
if (!acidEvent.isCancelled()) {
|
||||
acidEvent.getPotionEffects().stream().filter(EFFECTS::contains).forEach(t -> player.addPotionEffect(new PotionEffect(t, 600, 1)));
|
||||
acidEvent.getPotionEffects().stream().filter(e -> e.equals(PotionEffectType.POISON)).forEach(t -> player.addPotionEffect(new PotionEffect(t, 200, 1)));
|
||||
acidEvent.getPotionEffects().stream().filter(EFFECTS::contains).forEach(t -> player.addPotionEffect(new PotionEffect(t, addon.getSettings().getAcidEffectDuation() * 20, 1)));
|
||||
// Apply damage if there is any
|
||||
if (acidEvent.getTotalDamage() > 0D) {
|
||||
player.damage(acidEvent.getTotalDamage());
|
||||
|
@ -39,6 +39,8 @@ acid:
|
||||
effects:
|
||||
- CONFUSION
|
||||
- BLINDNESS
|
||||
# Acid effect duration in seconds
|
||||
acid-effect-duation: 30
|
||||
# Potion effects from going into acid rain and snow.
|
||||
# You can list multiple effects.
|
||||
# Available effects are:
|
||||
@ -51,6 +53,8 @@ acid:
|
||||
# WEAKNESS
|
||||
# Added since 1.9.1.
|
||||
rain-effects: []
|
||||
# Rain effect duration in seconds
|
||||
rain-effect-duation: 10
|
||||
protection:
|
||||
# If player wears a helmet then they will not suffer from acid rain
|
||||
helmet: false
|
||||
|
Loading…
Reference in New Issue
Block a user