mirror of
https://github.com/BentoBoxWorld/AcidIsland.git
synced 2024-11-26 12:46:14 +01:00
Enables snow to cause acid damage. Both falling and snow on the ground.
https://github.com/BentoBoxWorld/AcidIsland/issues/44
This commit is contained in:
parent
51c087fc7a
commit
97998edd19
@ -73,6 +73,10 @@ public class AISettings implements WorldSettings {
|
||||
@ConfigEntry(path = "acid.damage.rain")
|
||||
private int acidRainDamage = 1;
|
||||
|
||||
@ConfigComment("Damage from acid snow")
|
||||
@ConfigEntry(path = "acid.damage.snow")
|
||||
private boolean acidDamageSnow;
|
||||
|
||||
@ConfigComment("Delay before acid or acid rain starts burning")
|
||||
@ConfigComment("This can give time for conduit power to kick in")
|
||||
@ConfigEntry(path = "acid.damage.delay")
|
||||
@ -1285,6 +1289,17 @@ public class AISettings implements WorldSettings {
|
||||
public void setWorldName(String worldName) {
|
||||
this.worldName = worldName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the acidDamageSnow
|
||||
*/
|
||||
public boolean isAcidDamageSnow() {
|
||||
return acidDamageSnow;
|
||||
}
|
||||
/**
|
||||
* @param acidDamageSnow the acidDamageSnow to set
|
||||
*/
|
||||
public void setAcidDamageSnow(boolean acidDamageSnow) {
|
||||
this.acidDamageSnow = acidDamageSnow;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class AcidEffect implements Listener {
|
||||
} else if (!wetPlayers.containsKey(player)) {
|
||||
// Start hurting them
|
||||
// Add to the list
|
||||
wetPlayers.put(player, + addon.getSettings().getAcidDamageDelay() * 1000);
|
||||
wetPlayers.put(player, System.currentTimeMillis() + addon.getSettings().getAcidDamageDelay() * 1000);
|
||||
// This runnable continuously hurts the player even if
|
||||
// they are not
|
||||
// moving but are in acid rain.
|
||||
@ -172,7 +172,7 @@ public class AcidEffect implements Listener {
|
||||
private boolean isSafeFromRain(Player player) {
|
||||
if (addon.getSettings().isHelmetProtection() && (player.getInventory().getHelmet() != null
|
||||
&& player.getInventory().getHelmet().getType().name().contains("HELMET"))
|
||||
|| player.getLocation().getBlock().getTemperature() < 0.1 // snow falls
|
||||
|| (!addon.getSettings().isAcidDamageSnow() && player.getLocation().getBlock().getTemperature() < 0.1) // snow falls
|
||||
|| player.getLocation().getBlock().getHumidity() == 0 // dry
|
||||
|| (player.getActivePotionEffects().stream().map(PotionEffect::getType).anyMatch(IMMUNE_EFFECTS::contains))) {
|
||||
return true;
|
||||
@ -192,14 +192,15 @@ public class AcidEffect implements Listener {
|
||||
* @return true if player is safe
|
||||
*/
|
||||
private boolean isSafeFromAcid(Player player) {
|
||||
// In liquid
|
||||
// Not in liquid or on snow
|
||||
if (!player.getLocation().getBlock().getType().equals(Material.WATER)
|
||||
&& (!player.getLocation().getBlock().getType().equals(Material.SNOW) || !addon.getSettings().isAcidDamageSnow())
|
||||
&& !player.getLocation().getBlock().getRelative(BlockFace.UP).getType().equals(Material.WATER)) {
|
||||
return true;
|
||||
}
|
||||
// Check if player is in a boat
|
||||
// Check if player is on a boat
|
||||
if (player.getVehicle() != null && player.getVehicle().getType().equals(EntityType.BOAT)) {
|
||||
// I'M ON A BOAT! I'M ON A BOAT! A %^&&* BOAT! SNL Sketch.
|
||||
// I'M ON A BOAT! I'M ON A BOAT! A %^&&* BOAT! SNL Sketch. https://youtu.be/avaSdC0QOUM.
|
||||
return true;
|
||||
}
|
||||
// Check if full armor protects
|
||||
|
Loading…
Reference in New Issue
Block a user