mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-19 15:48:10 +01:00
Ignore NPE onCreatureSpawn and attempt to get more information about it instead.
This commit is contained in:
parent
602b1d8a27
commit
eacce487ed
@ -628,6 +628,8 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
|
|||||||
if (wcfg.useRegions) {
|
if (wcfg.useRegions) {
|
||||||
Vector pt = toVector(eventLoc);
|
Vector pt = toVector(eventLoc);
|
||||||
RegionManager mgr = plugin.getGlobalRegionManager().get(eventLoc.getWorld());
|
RegionManager mgr = plugin.getGlobalRegionManager().get(eventLoc.getWorld());
|
||||||
|
// @TODO get victims' stacktraces and find out why it's null anyway
|
||||||
|
if (mgr == null) return;
|
||||||
ApplicableRegionSet set = mgr.getApplicableRegions(pt);
|
ApplicableRegionSet set = mgr.getApplicableRegions(pt);
|
||||||
|
|
||||||
if (!set.allows(DefaultFlag.MOB_SPAWNING)) {
|
if (!set.allows(DefaultFlag.MOB_SPAWNING)) {
|
||||||
@ -635,8 +637,8 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<CreatureType> blockTypes = set.getFlag(DefaultFlag.DENY_SPAWN);
|
Set<CreatureType> creatureTypes = set.getFlag(DefaultFlag.DENY_SPAWN);
|
||||||
if (blockTypes != null && blockTypes.contains(creaType)) {
|
if (creatureTypes != null && creatureTypes.contains(creaType)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -150,9 +150,14 @@ public RegionManager load(World world) {
|
|||||||
|
|
||||||
return manager;
|
return manager;
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
logger.warning("WorldGuard: Region file for world \""
|
||||||
|
+ name + "\" missing or inaccessible.");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warning("WorldGuard: Failed to load regions from file "
|
logger.warning("WorldGuard: Failed to load regions from file "
|
||||||
+ file.getAbsolutePath() + " : " + e.getMessage());
|
+ file.getAbsolutePath() + " : " + e.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warning("WorldGuard: Error loading regions for world \""
|
||||||
|
+ name + "\":" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: THIS CREATES PROBLEMS!!
|
// @TODO: THIS CREATES PROBLEMS!!
|
||||||
|
Loading…
Reference in New Issue
Block a user