I currently have two constructors in one of my classes, one going to my main class, and the other to another class that has most of the methods that I use. The reason I don't use static methods for my second class that I have a constructor, is that I don't want the code to be used by any other source, just mine. Here are the two constructors:
PrisonProfessionalMain plugin;
public PPCommandAdminMenu(PrisonProfessionalMain instance)
{
plugin = instance;
}
QuickMethods qm;
public PPCommandAdminMenu(QuickMethods instance)
{
qm = instance;
}
Then I am calling a method from the QuickMethods class here:
qm.getConfigString(plugin, "prefix")
Apparently, whatever method I call from this class it returns null. I do not think it is what I put inside of the method, but here is the method from the other class:
public String getConfigString(PrisonProfessionalMain instance, String configvar)
{
return colorize(instance.getConfig().getString(configvar));
}
I don't see a problem here, but I am wondering if I should use a static way instead. I want to try and stay away from static methods for the reason I stated above.
REMEMBER: Calling any other method from this class results in it returning null. I know this because in console it has a stack trace that reads it null. It says this on the line that is calling any method from this class.
I tried removing the Strings and instances from inside the method:
public String getConfigString()
{
return System.out.println("test");
}
This still however, resulted in another null pointer, pointing at the line that I called the method on.
My question is: How would I have the QuickMethods class stop returning null upon calling methods/strings from it.