Hello
I've recently been trying to fix my ship pack to work in a minimal sense (simply having it not crash and work in corvus mode) but have hit a brick wall.
When I don't have the import for
or
, I receive the error in the title for the type Method.
When I do have the import, I have the same error only for SectorGeneratorPlugin.
Now I know what you're thinking - easy, something else is wrong with the code which is causing the error. But as far as I can see this isn't the case.
• I have tried commenting out everything around the Method class to eliminate other possible causes.
• setupForCorvus is fine and proven code: when I entirely comment out the current generate() method and rename setupForCorvus to generate, all is fine (as long as you don't have Nexerelin of course).
• I wondered if this was caused by me not having Nexerelin, but then I remembered this is supposed to stop it from crashing, not prevent it from compiling in the first place. Even then the try-catch should stop a horrible runtime death.
My suspicion is I am missing another import for the exceptions.
Here is my code at the moment:
package data.scripts.world;
import java.awt.Color;
import java.util.List;
import java.lang.Method; //This causes the problem, as does import java.lang;
import java.util.ArrayList;
import java.util.Arrays;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.FactionAPI;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.RepLevel;
import com.fs.starfarer.api.campaign.CampaignFleetAPI;
import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.FleetAssignment;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.SectorGeneratorPlugin;
import com.fs.starfarer.api.campaign.StarSystemAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.campaign.econ.MarketAPI;
import com.fs.starfarer.api.fleet.FleetMemberType;
import com.fs.starfarer.api.impl.campaign.ids.Conditions;
import com.fs.starfarer.api.impl.campaign.ids.Submarkets;
import com.fs.starfarer.api.impl.campaign.submarkets.StoragePlugin;
import com.fs.starfarer.api.impl.campaign.shared.SharedData;
import com.fs.starfarer.api.impl.campaign.ids.Factions;
import data.scripts.world.corvus.Corvus;
@SuppressWarnings("unchecked")
public class ShipPackSectorGen implements SectorGeneratorPlugin
//public class ShipPackSectorGen extends SectorGen
{
public void generate(SectorAPI sector)
{
//try
//{
Class<?> def = Global.getSettings().getScriptClassLoader().loadClass("exerelin.campaign.SectorManager");
Method method;
//try
//{
// method = def.getMethod("getCorvusMode");
// Object result = method.invoke(def);
// if ((boolean)result == true)
// {
// setupForCorvus(sector);
// }
//}
//catch (NoSuchMethodException ex) { }
//catch (SecurityException ex) { }
//catch (IllegalAccessException ex) { }
//catch (IllegalArgumentException ex) { }
//catch (InvocationTargetException ex) { }
//}
//catch (ClassNotFoundException ex)
//{
// setupForCorvus(sector);
//}
}
public void setupForCorvus(SectorAPI sector)
{
...
Do a bunch of stuff
...
}
...
Any help with this is much appreciated, this has been driving me nuts for a few days now and I understand it's probably something incredibly simple that I'm missing, so sorry if I'm being dumb.