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