mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-19 07:38:12 +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) {
|
||||
Vector pt = toVector(eventLoc);
|
||||
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);
|
||||
|
||||
if (!set.allows(DefaultFlag.MOB_SPAWNING)) {
|
||||
@ -635,8 +637,8 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
return;
|
||||
}
|
||||
|
||||
Set<CreatureType> blockTypes = set.getFlag(DefaultFlag.DENY_SPAWN);
|
||||
if (blockTypes != null && blockTypes.contains(creaType)) {
|
||||
Set<CreatureType> creatureTypes = set.getFlag(DefaultFlag.DENY_SPAWN);
|
||||
if (creatureTypes != null && creatureTypes.contains(creaType)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -150,9 +150,14 @@ public RegionManager load(World world) {
|
||||
|
||||
return manager;
|
||||
} catch (FileNotFoundException e) {
|
||||
logger.warning("WorldGuard: Region file for world \""
|
||||
+ name + "\" missing or inaccessible.");
|
||||
} catch (IOException e) {
|
||||
logger.warning("WorldGuard: Failed to load regions from file "
|
||||
+ file.getAbsolutePath() + " : " + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.warning("WorldGuard: Error loading regions for world \""
|
||||
+ name + "\":" + e.getMessage());
|
||||
}
|
||||
|
||||
// @TODO: THIS CREATES PROBLEMS!!
|
||||
|
Loading…
Reference in New Issue
Block a user