Added boss spawn failure debug messages

This commit is contained in:
Esophose 2019-05-19 01:50:54 -06:00
parent 32181ed01a
commit af5a46e06a
2 changed files with 33 additions and 14 deletions

View File

@ -26,7 +26,7 @@ import java.util.List;
*/
public class BossHookManager implements IReloadable {
@Getter private boolean askyblockEnabled, factionsEnabled, stackmobEnabled, worldguardEnabld;
@Getter private boolean askyblockEnabled, factionsEnabled, stackmobEnabled, worldguardEnabled;
@Getter private List<String> worldGuardSpawnRegions, worldguardBlockedRegions;
@Getter private boolean askyblockOwnIsland, factionWarzone;
@ -51,7 +51,7 @@ public class BossHookManager implements IReloadable {
this.askyblockEnabled = askyblock.getBoolean("enabled", false);
this.factionsEnabled = factions.getBoolean("enabled", false);
this.stackmobEnabled = stackMob.getBoolean("enabled", false);
this.worldguardEnabld = worldGuard.getBoolean("enabled", true);
this.worldguardEnabled = worldGuard.getBoolean("enabled", true);
this.worldGuardSpawnRegions = worldGuard.getStringList("spawnRegions");
this.worldguardBlockedRegions = worldGuard.getStringList("blockedRegions");
@ -71,7 +71,7 @@ public class BossHookManager implements IReloadable {
}
private void setupWorldGuard() {
if(!isWorldguardEnabld()) return;
if(!isWorldguardEnabled()) return;
this.worldGuardHelper = new WorldGuardHelper();
}

View File

@ -1,5 +1,6 @@
package com.songoda.epicbosses.managers;
import com.songoda.epicbosses.utils.ServerUtils;
import lombok.Getter;
import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.utils.IReloadable;
@ -43,37 +44,49 @@ public class BossLocationManager implements IReloadable {
Location l = new Location(location.getWorld(), x, y, z);
Block block = l.getBlock();
if(block.getType().isSolid()) return false;
if(block.getType().isSolid()) {
ServerUtils.get().logDebug("Unable to spawn boss due to needing a 5x3x5 area to spawn");
return false;
}
}
}
}
if(isUseBlockedWorlds()) {
if(getBlockedWorlds().contains(location.getWorld().getName())) return false;
if(getBlockedWorlds().contains(location.getWorld().getName())) {
ServerUtils.get().logDebug("Unable to spawn boss due to world being in blocked worlds list");
return false;
}
}
boolean isInBlockedRegion = false;
if(this.bossHookManager.isWorldguardEnabld() && this.bossHookManager.getWorldGuardHelper() != null) {
if(this.bossHookManager.isWorldguardEnabled() && this.bossHookManager.getWorldGuardHelper() != null) {
List<String> currentRegions = this.bossHookManager.getWorldGuardHelper().getRegionNames(location);
boolean blocked = false;
if(currentRegions != null) {
for(String s : this.bossHookManager.getWorldguardBlockedRegions()) {
if(currentRegions.contains(s)) {
isInBlockedRegion = true;
blocked = true;
break;
}
}
}
if(isInBlockedRegion) return false;
if(blocked) {
ServerUtils.get().logDebug("Unable to spawn boss due to worldguard region being in blocked list");
return false;
}
}
}
if(this.bossHookManager.isFactionsEnabled() && this.bossHookManager.getFactionHelper() != null) {
if(!this.bossHookManager.getFactionHelper().isInWarzone(location)) return false;
if(!this.bossHookManager.getFactionHelper().isInWarzone(location)) {
ServerUtils.get().logDebug("Unable to spawn boss due to being outside a factions warzone");
return false;
}
}
if(this.bossHookManager.isWorldguardEnabld() && this.bossHookManager.getWorldGuardHelper() != null) {
if(this.bossHookManager.isWorldguardEnabled() && this.bossHookManager.getWorldGuardHelper() != null) {
List<String> currentRegions = this.bossHookManager.getWorldGuardHelper().getRegionNames(location);
boolean allowed = false;
@ -85,13 +98,19 @@ public class BossLocationManager implements IReloadable {
}
}
if(!allowed) return false;
if(!allowed) {
ServerUtils.get().logDebug("Unable to spawn boss due to worldguard region not being in the spawnable regions list");
return false;
}
}
}
if(this.bossHookManager.isAskyblockEnabled() && this.bossHookManager.getASkyblockHelper() != null) {
if(this.bossHookManager.isAskyblockOwnIsland()) {
return this.bossHookManager.getASkyblockHelper().isOnOwnIsland(player);
boolean canSpawn = this.bossHookManager.getASkyblockHelper().isOnOwnIsland(player);
if (!canSpawn)
ServerUtils.get().logDebug("Unable to spawn boss due to not being on own ASkyblock island");
return canSpawn;
}
}