mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-12 19:30:48 +01:00
updated tnt fix, updated respawn teleport
This commit is contained in:
parent
881846d301
commit
d042b785ed
@ -261,7 +261,8 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WorldGuardConfiguration cfg = plugin.getWgConfiguration();
|
WorldGuardConfiguration cfg = plugin.getWgConfiguration();
|
||||||
WorldGuardWorldConfiguration wcfg = cfg.getWorldConfig(event.getLocation().getWorld().getName());
|
Location l = event.getLocation();
|
||||||
|
WorldGuardWorldConfiguration wcfg = cfg.getWorldConfig(l.getWorld().getName());
|
||||||
|
|
||||||
if (event.getEntity() instanceof LivingEntity) {
|
if (event.getEntity() instanceof LivingEntity) {
|
||||||
|
|
||||||
@ -277,8 +278,8 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wcfg.useRegions) {
|
if (wcfg.useRegions) {
|
||||||
Vector pt = toVector(event.getEntity().getLocation());
|
Vector pt = toVector(l);
|
||||||
RegionManager mgr = plugin.getGlobalRegionManager().getRegionManager(event.getLocation().getWorld().getName());
|
RegionManager mgr = plugin.getGlobalRegionManager().getRegionManager(wcfg.getWorldName());
|
||||||
|
|
||||||
if (!mgr.getApplicableRegions(pt)
|
if (!mgr.getApplicableRegions(pt)
|
||||||
.allowsFlag(AreaFlags.FLAG_CREEPER_EXPLOSION)) {
|
.allowsFlag(AreaFlags.FLAG_CREEPER_EXPLOSION)) {
|
||||||
@ -293,8 +294,8 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wcfg.useRegions && event.getEntity() != null) {
|
if (wcfg.useRegions && event.getEntity() != null) {
|
||||||
Vector pt = toVector(event.getEntity().getLocation());
|
Vector pt = toVector(l);
|
||||||
RegionManager mgr = plugin.getGlobalRegionManager().getRegionManager(event.getLocation().getWorld().getName());
|
RegionManager mgr = plugin.getGlobalRegionManager().getRegionManager(wcfg.getWorldName());
|
||||||
|
|
||||||
if (!mgr.getApplicableRegions(pt)
|
if (!mgr.getApplicableRegions(pt)
|
||||||
.allowsFlag(AreaFlags.FLAG_TNT)) {
|
.allowsFlag(AreaFlags.FLAG_TNT)) {
|
||||||
|
@ -266,17 +266,17 @@ public void onPlayerRespawn(PlayerRespawnEvent event) {
|
|||||||
BukkitPlayer localPlayer = BukkitPlayer.wrapPlayer(cfg, player);
|
BukkitPlayer localPlayer = BukkitPlayer.wrapPlayer(cfg, player);
|
||||||
if (spawnconfig.equals("owner")) {
|
if (spawnconfig.equals("owner")) {
|
||||||
if (regions.isOwner(localPlayer)) {
|
if (regions.isOwner(localPlayer)) {
|
||||||
player.teleportTo(spawn);
|
event.setRespawnLocation(spawn);
|
||||||
}
|
}
|
||||||
} else if (spawnconfig.equals("member")) {
|
} else if (spawnconfig.equals("member")) {
|
||||||
if (regions.isMember(localPlayer)) {
|
if (regions.isMember(localPlayer)) {
|
||||||
player.teleportTo(spawn);
|
event.setRespawnLocation(spawn);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.teleportTo(spawn);
|
event.setRespawnLocation(spawn);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.teleportTo(spawn);
|
event.setRespawnLocation(spawn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user