mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-28 05:25:20 +01:00
Merge branch 'master' of https://github.com/wizjany/worldguard
This commit is contained in:
commit
af25c15286
@ -18,6 +18,7 @@
|
|||||||
# Remember to check the compatibility spreadsheet for WorldGuard to see
|
# Remember to check the compatibility spreadsheet for WorldGuard to see
|
||||||
# if any features are currently broken in your version of Bukkit.
|
# if any features are currently broken in your version of Bukkit.
|
||||||
#
|
#
|
||||||
|
suppress-tick-sync-warnings: false
|
||||||
|
|
||||||
# For permissions, see http://wiki.sk89q.com/wiki/WorldGuard/Permissions/Bukkit
|
# For permissions, see http://wiki.sk89q.com/wiki/WorldGuard/Permissions/Bukkit
|
||||||
permissions:
|
permissions:
|
||||||
|
@ -68,6 +68,8 @@ player-damage:
|
|||||||
disable-suffocation-damage: off
|
disable-suffocation-damage: off
|
||||||
disable-contact-damage: off
|
disable-contact-damage: off
|
||||||
teleport-on-suffocation: off
|
teleport-on-suffocation: off
|
||||||
|
disable-void-damage: off
|
||||||
|
teleport-on-void-falling: off
|
||||||
|
|
||||||
regions:
|
regions:
|
||||||
enable: on
|
enable: on
|
||||||
|
@ -89,6 +89,8 @@ public class WorldConfiguration {
|
|||||||
public boolean disableDrowningDamage;
|
public boolean disableDrowningDamage;
|
||||||
public boolean disableSuffocationDamage;
|
public boolean disableSuffocationDamage;
|
||||||
public boolean teleportOnSuffocation;
|
public boolean teleportOnSuffocation;
|
||||||
|
public boolean disableVoidDamage;
|
||||||
|
public boolean teleportOnVoid;
|
||||||
public boolean useRegions;
|
public boolean useRegions;
|
||||||
public boolean highFreqFlags;
|
public boolean highFreqFlags;
|
||||||
public int regionWand = 287;
|
public int regionWand = 287;
|
||||||
@ -175,6 +177,8 @@ private void loadConfiguration() {
|
|||||||
disableSuffocationDamage = config.getBoolean("player-damage.disable-suffocation-damage", false);
|
disableSuffocationDamage = config.getBoolean("player-damage.disable-suffocation-damage", false);
|
||||||
disableContactDamage = config.getBoolean("player-damage.disable-contact-damage", false);
|
disableContactDamage = config.getBoolean("player-damage.disable-contact-damage", false);
|
||||||
teleportOnSuffocation = config.getBoolean("player-damage.teleport-on-suffocation", false);
|
teleportOnSuffocation = config.getBoolean("player-damage.teleport-on-suffocation", false);
|
||||||
|
disableVoidDamage = config.getBoolean("player-damage.disable-void-damage", false);
|
||||||
|
teleportOnVoid = config.getBoolean("player-damage.teleport-on-void-falling", false);
|
||||||
|
|
||||||
signChestProtection = config.getBoolean("chest-protection.enable", false);
|
signChestProtection = config.getBoolean("chest-protection.enable", false);
|
||||||
|
|
||||||
|
@ -18,17 +18,16 @@
|
|||||||
*/
|
*/
|
||||||
package com.sk89q.worldguard.bukkit;
|
package com.sk89q.worldguard.bukkit;
|
||||||
|
|
||||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.event.Event.Priority;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
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.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.CreatureType;
|
import org.bukkit.entity.CreatureType;
|
||||||
import org.bukkit.entity.Creeper;
|
import org.bukkit.entity.Creeper;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
@ -38,10 +37,16 @@
|
|||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.entity.Wolf;
|
||||||
import org.bukkit.event.entity.*;
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.blocks.BlockType;
|
import com.sk89q.worldedit.blocks.BlockType;
|
||||||
|
|
||||||
import static com.sk89q.worldguard.bukkit.BukkitUtil.*;
|
import static com.sk89q.worldguard.bukkit.BukkitUtil.*;
|
||||||
|
|
||||||
|
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||||
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
|
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||||
|
|
||||||
public class WorldGuardEntityListener extends EntityListener {
|
public class WorldGuardEntityListener extends EntityListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,11 +78,16 @@ public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
|||||||
Entity defender = event.getEntity();
|
Entity defender = event.getEntity();
|
||||||
DamageCause type = event.getCause();
|
DamageCause type = event.getCause();
|
||||||
|
|
||||||
if (defender instanceof Player) {
|
|
||||||
Player player = (Player) defender;
|
|
||||||
|
|
||||||
ConfigurationManager cfg = plugin.getGlobalConfiguration();
|
ConfigurationManager cfg = plugin.getGlobalConfiguration();
|
||||||
WorldConfiguration wcfg = cfg.get(player.getWorld());
|
WorldConfiguration wcfg = cfg.get(defender.getWorld());
|
||||||
|
|
||||||
|
if (defender instanceof Wolf) {
|
||||||
|
if (wcfg.antiWolfDumbness && !(type == DamageCause.VOID)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (defender instanceof Player) {
|
||||||
|
Player player = (Player) defender;
|
||||||
|
|
||||||
if (cfg.hasGodMode(player)) {
|
if (cfg.hasGodMode(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -94,6 +104,17 @@ public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wcfg.teleportOnVoid && type == DamageCause.VOID) {
|
||||||
|
findFreePosition(player);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wcfg.disableVoidDamage && type == DamageCause.VOID) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,13 +422,17 @@ public void findFreePosition(Player player) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (free == 2) {
|
if (free == 2) {
|
||||||
if (y - 1 != origY) {
|
if (y - 1 != origY || y == 1) {
|
||||||
loc.setX(x + 0.5);
|
loc.setX(x + 0.5);
|
||||||
loc.setY(y);
|
loc.setY(y);
|
||||||
loc.setZ(z + 0.5);
|
loc.setZ(z + 0.5);
|
||||||
|
if (y <= 2 && world.getBlockAt(x,0,z).getType() == Material.AIR) {
|
||||||
|
world.getBlockAt(x,0,z).setTypeId(20);
|
||||||
|
loc.setY(2);
|
||||||
|
}
|
||||||
|
player.setFallDistance(0F);
|
||||||
player.teleport(loc);
|
player.teleport(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user