mirror of
https://github.com/BentoBoxWorld/AcidIsland.git
synced 2024-11-29 22:24:02 +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")
|
@ConfigEntry(path = "acid.damage.rain")
|
||||||
private int acidRainDamage = 1;
|
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("Delay before acid or acid rain starts burning")
|
||||||
@ConfigComment("This can give time for conduit power to kick in")
|
@ConfigComment("This can give time for conduit power to kick in")
|
||||||
@ConfigEntry(path = "acid.damage.delay")
|
@ConfigEntry(path = "acid.damage.delay")
|
||||||
@ -1285,6 +1289,17 @@ public class AISettings implements WorldSettings {
|
|||||||
public void setWorldName(String worldName) {
|
public void setWorldName(String worldName) {
|
||||||
this.worldName = 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)) {
|
} else if (!wetPlayers.containsKey(player)) {
|
||||||
// Start hurting them
|
// Start hurting them
|
||||||
// Add to the list
|
// 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
|
// This runnable continuously hurts the player even if
|
||||||
// they are not
|
// they are not
|
||||||
// moving but are in acid rain.
|
// moving but are in acid rain.
|
||||||
@ -172,7 +172,7 @@ public class AcidEffect implements Listener {
|
|||||||
private boolean isSafeFromRain(Player player) {
|
private boolean isSafeFromRain(Player player) {
|
||||||
if (addon.getSettings().isHelmetProtection() && (player.getInventory().getHelmet() != null
|
if (addon.getSettings().isHelmetProtection() && (player.getInventory().getHelmet() != null
|
||||||
&& player.getInventory().getHelmet().getType().name().contains("HELMET"))
|
&& 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.getLocation().getBlock().getHumidity() == 0 // dry
|
||||||
|| (player.getActivePotionEffects().stream().map(PotionEffect::getType).anyMatch(IMMUNE_EFFECTS::contains))) {
|
|| (player.getActivePotionEffects().stream().map(PotionEffect::getType).anyMatch(IMMUNE_EFFECTS::contains))) {
|
||||||
return true;
|
return true;
|
||||||
@ -192,14 +192,15 @@ public class AcidEffect implements Listener {
|
|||||||
* @return true if player is safe
|
* @return true if player is safe
|
||||||
*/
|
*/
|
||||||
private boolean isSafeFromAcid(Player player) {
|
private boolean isSafeFromAcid(Player player) {
|
||||||
// In liquid
|
// Not in liquid or on snow
|
||||||
if (!player.getLocation().getBlock().getType().equals(Material.WATER)
|
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)) {
|
&& !player.getLocation().getBlock().getRelative(BlockFace.UP).getType().equals(Material.WATER)) {
|
||||||
return true;
|
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)) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
// Check if full armor protects
|
// Check if full armor protects
|
||||||
|
Loading…
Reference in New Issue
Block a user