//TODO refactor me and make me pretty
public static boolean isInterdicted(SegmentController ship, Vector3i position) {
        //TODO add interdiction check for target sector
        JumpAddOn warpdrive;
        if(ship instanceof ManagedSegmentController<?>) {
            warpdrive =((Ship)ship).getManagerContainer().getJumpAddOn();
        } else {
            return false;
        }
        //use vanilla check method - check one sector in each direction for jumpaddons that interdict this one.
        assert warpdrive.isOnServer();
        GameServerState gameServerState;
        Sector sector;
        boolean retVal = false;
        Vector3i neighbourSectorPos = new Vector3i();
        //debug jumpdrive level
        if(ship.hasActiveReactors()){
        //    DebugFile.log ("warpdrive of "+ ship.getName() + " has level: " + ((ManagedSegmentController<?>)ship).getManagerContainer().getPowerInterface().getActiveReactor().getLevel());
        }
        try {
            sector = GameServer.getUniverse().getSector(position);
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
        if (sector == null) {
            return false;
        }
        int checkRange = 3; //range to check for inhibitors [sectors]
        int shipReactorLvl = 0;
        try {
            shipReactorLvl = ((ManagedSegmentController<?>)ship).getManagerContainer().getPowerInterface().getActiveReactor().getLevel();
        } catch (Exception e) {
            e.printStackTrace();
            DebugFile.log("managercontainer null: " + (((ManagedSegmentController<?>)ship).getManagerContainer() == null));
            DebugFile.log("powerinterface null: " + (((ManagedSegmentController<?>)ship).getManagerContainer().getPowerInterface() == null));
            DebugFile.log("activereactor null: " + (((ManagedSegmentController<?>)ship).getManagerContainer().getPowerInterface().getActiveReactor() == null));
            return true;
        }
        int inhibitorStrength = 0;
        int catchesLvl = 0;
        double inhRange = 0;
        Vector3i currentSec = ship.getSector(new Vector3i()); //TODO refactor me and make me pretty
        for (int x = -checkRange; x <= checkRange; ++x) {
            for (int y = -checkRange; y <= checkRange; ++y) {
                for (int z = -checkRange; z <= checkRange; ++z) {
                    neighbourSectorPos.set(sector.pos.x + z, sector.pos.y + y, sector.pos.z + x);
                    Sector neighbourSector;
                    if ((neighbourSector = GameServerState.instance.getUniverse().getSectorWithoutLoading(neighbourSectorPos)) == null) {
                        continue; //sector is not loaded
                    }
                    //get inhibitor level //returns [0..9]
                    inhibitorStrength = neighbourSector.getRemoteSector().getConfigManager().apply(StatusEffectType.WARP_INTERDICTION_STRENGTH, 1); //TODO change apply value to 300K?
                    catchesLvl = inhibitorStrength * 60; //will catch anything up to
                    //max inhRange of inhibitor
                    inhRange = Math.max(0, neighbourSector.getRemoteSector().getConfigManager().apply(StatusEffectType.WARP_INTERDICTION_DISTANCE,  1));
                    int dx = Math.abs(currentSec.x - neighbourSectorPos.x);
                    int dy = Math.abs(currentSec.y - neighbourSectorPos.y);
                    int dz = Math.abs(currentSec.z - neighbourSectorPos.z);
                    double distance = Math.pow(dx * dx + dy * dy + dz * dz,0.5);
                    //TODO change config entry of inhibition power consumption
                    if (inhibitorStrength <= 1 || (distance > inhRange)) {
                        continue;
                    }
                    //DebugFile.log("inhibitor has strength: " + inhibitorStrength + " catches rkt level: " + catchesLvl + " power cons: " + inhibitorStrength * 60000 + " range: " + inhRange + " vs: " + distance);
                    if (catchesLvl >= shipReactorLvl) {
                        warpdrive.getSegmentController().sendControllingPlayersServerMessage(new Object[]{" inhibitor detected in " + neighbourSectorPos.toString()}, 3);
                        retVal = true;
                        break;
                    }
                }
            }
        }
        return retVal;
    }
int catchesLvl = 0;
double inhRange = 0;
Vector3i currentSec = ship.getSector(new Vector3i()); //TODO refactor me and make me pretty
for (int x = -checkRange; x <= checkRange; ++x) {
for (int y = -checkRange; y <= checkRange; ++y) {
} catch (Exception e) {
e.printStackTrace();
DebugFile.log("managercontainer null: " + (((ManagedSegmentController<?>)ship).getManagerContainer() == null));
DebugFile.log("powerinterface null: " + (((ManagedSegmentController<?>)ship).getManagerContainer().getPowerInterface() == null));
DebugFile.log("activereactor null: " + (((ManagedSegmentController<?>)ship).getManagerContainer().getPowerInterface().getActiveReactor() == null));
return true;
}
int inhibitorStrength = 0;
int catchesLvl = 0;
double inhRange = 0;
Vector3i currentSec = ship.getSector(new Vector3i()); //TODO refactor me and make me pretty
for (int x = -checkRange; x <= checkRange; ++x) {
for (int y = -checkRange; y <= checkRange; ++y) {
for (int z = -checkRange; z <= checkRange; ++z) {
neighbourSectorPos.set(sector.pos.x + z, sector.pos.y + y, sector.pos.z + x);
Sector neighbourSector;
if ((neighbourSector = GameServerState.instance.getUniverse().getSectorWithoutLoading(neighbourSectorPos)) == null) {
continue; //sector is not loaded
}
//get inhibitor level //returns [0..9]
inhibitorStrength = neighbourSector.getRemoteSector().getConfigManager().apply(StatusEffectType.WARP_INTERDICTION_STRENGTH, 1); //TODO change apply value to 300K?
e.printStackTrace();
return false;
}
if (sector == null) {
return false;
}
int checkRange = 3; //range to check for inhibitors [sectors]
int shipReactorLvl = 0;
try {
shipReactorLvl = ((ManagedSegmentController<?>)ship).getManagerContainer().getPowerInterface().getActiveReactor().getLevel();
} catch (Exception e) {
e.printStackTrace();
DebugFile.log("managercontainer null: " + (((ManagedSegmentController<?>)ship).getManagerContainer() == null));
DebugFile.log("powerinterface null: " + (((ManagedSegmentController<?>)ship).getManagerContainer().getPowerInterface() == null));
DebugFile.log("activereactor null: " + (((ManagedSegmentController<?>)ship).getManagerContainer().getPowerInterface().getActiveReactor() == null));
return true;
}
int inhibitorStrength = 0;
int catchesLvl = 0;
double inhRange = 0;
Vector3i currentSec = ship.getSector(new Vector3i()); //TODO refactor me and make me pretty
for (int x = -checkRange; x <= checkRange; ++x) {
for (int y = -checkRange; y <= checkRange; ++y) {
for (int z = -checkRange; z <= checkRange; ++z) {
neighbourSectorPos.set(sector.pos.x + z, sector.pos.y + y, sector.pos.z + x);
Sector neighbourSector;
if ((neighbourSector = GameServerState.instance.getUniverse().getSectorWithoutLoading(neighbourSectorPos)) == null) {
continue; //sector is not loaded
}
//get inhibitor level //returns [0..9]
inhibitorStrength = neighbourSector.getRemoteSector().getConfigManager().apply(StatusEffectType.WARP_INTERDICTION_STRENGTH, 1); //TODO change apply value to 300K?
catchesLvl = inhibitorStrength * 60; //will catch anything up to
//max inhRange of inhibitor
inhRange = Math.max(0, neighbourSector.getRemoteSector().getConfigManager().apply(StatusEffectType.WARP_INTERDICTION_DISTANCE, 1));
int dx = Math.abs(currentSec.x - neighbourSectorPos.x);
int dy = Math.abs(currentSec.y - neighbourSectorPos.y);
int dz = Math.abs(currentSec.z - neighbourSectorPos.z);
double distance = Math.pow(dx * dx + dy * dy + dz * dz,0.5);
//TODO change config entry of inhibition power consumption
if (inhibitorStrength <= 1 || (distance > inhRange)) {
continue;