mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-09-06 04:08:03 +02:00
Improved amphibious stuff, added pumpkin scuba.
This commit is contained in:
parent
cc6ac93b7a
commit
5b5349fc34
@ -19,6 +19,7 @@
|
||||
#
|
||||
|
||||
summary-on-start: on
|
||||
pumpkin-scuba: off
|
||||
|
||||
protection:
|
||||
item-durability: on
|
||||
|
@ -60,6 +60,7 @@ public class WorldConfiguration {
|
||||
public boolean classicWater;
|
||||
public boolean simulateSponge;
|
||||
public int spongeRadius;
|
||||
public boolean pumpkinScuba;
|
||||
public boolean redstoneSponges;
|
||||
public boolean noPhysicsGravel;
|
||||
public boolean noPhysicsSand;
|
||||
@ -133,6 +134,8 @@ private void loadConfiguration() {
|
||||
simulateSponge = config.getBoolean("simulation.sponge.enable", true);
|
||||
spongeRadius = Math.max(1, config.getInt("simulation.sponge.radius", 3)) - 1;
|
||||
redstoneSponges = config.getBoolean("simulation.sponge.redstone", false);
|
||||
|
||||
pumpkinScuba = config.getBoolean("pumpkin-scuba", false);
|
||||
|
||||
noPhysicsGravel = config.getBoolean("physics.no-physics-gravel", false);
|
||||
noPhysicsSand = config.getBoolean("physics.no-physics-sand", false);
|
||||
|
@ -26,6 +26,7 @@
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.Creeper;
|
||||
@ -226,6 +227,15 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
}
|
||||
|
||||
if (type == DamageCause.DROWNING && cfg.hasAmphibiousMode(player)) {
|
||||
player.setRemainingAir(player.getMaximumAir());
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == DamageCause.DROWNING && wcfg.pumpkinScuba
|
||||
&& (player.getInventory().getHelmet().getType() == Material.PUMPKIN
|
||||
|| player.getInventory().getHelmet().getType() == Material.JACK_O_LANTERN)) {
|
||||
player.setRemainingAir(player.getMaximumAir());
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -242,6 +252,7 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
}
|
||||
|
||||
if (wcfg.disableDrowningDamage && type == DamageCause.DROWNING) {
|
||||
player.setRemainingAir(player.getMaximumAir());
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user