mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-12 11:21:34 +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();
|
||||
WorldGuardWorldConfiguration wcfg = cfg.getWorldConfig(event.getLocation().getWorld().getName());
|
||||
Location l = event.getLocation();
|
||||
WorldGuardWorldConfiguration wcfg = cfg.getWorldConfig(l.getWorld().getName());
|
||||
|
||||
if (event.getEntity() instanceof LivingEntity) {
|
||||
|
||||
@ -277,8 +278,8 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
||||
}
|
||||
|
||||
if (wcfg.useRegions) {
|
||||
Vector pt = toVector(event.getEntity().getLocation());
|
||||
RegionManager mgr = plugin.getGlobalRegionManager().getRegionManager(event.getLocation().getWorld().getName());
|
||||
Vector pt = toVector(l);
|
||||
RegionManager mgr = plugin.getGlobalRegionManager().getRegionManager(wcfg.getWorldName());
|
||||
|
||||
if (!mgr.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_CREEPER_EXPLOSION)) {
|
||||
@ -293,8 +294,8 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
||||
}
|
||||
|
||||
if (wcfg.useRegions && event.getEntity() != null) {
|
||||
Vector pt = toVector(event.getEntity().getLocation());
|
||||
RegionManager mgr = plugin.getGlobalRegionManager().getRegionManager(event.getLocation().getWorld().getName());
|
||||
Vector pt = toVector(l);
|
||||
RegionManager mgr = plugin.getGlobalRegionManager().getRegionManager(wcfg.getWorldName());
|
||||
|
||||
if (!mgr.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_TNT)) {
|
||||
|
@ -266,17 +266,17 @@ public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
BukkitPlayer localPlayer = BukkitPlayer.wrapPlayer(cfg, player);
|
||||
if (spawnconfig.equals("owner")) {
|
||||
if (regions.isOwner(localPlayer)) {
|
||||
player.teleportTo(spawn);
|
||||
event.setRespawnLocation(spawn);
|
||||
}
|
||||
} else if (spawnconfig.equals("member")) {
|
||||
if (regions.isMember(localPlayer)) {
|
||||
player.teleportTo(spawn);
|
||||
event.setRespawnLocation(spawn);
|
||||
}
|
||||
} else {
|
||||
player.teleportTo(spawn);
|
||||
event.setRespawnLocation(spawn);
|
||||
}
|
||||
} else {
|
||||
player.teleportTo(spawn);
|
||||
event.setRespawnLocation(spawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user