I have a bunch of subclasses extending a Skill Type,
public abstract class Skill {
// current level
private static int fishLevel = 1;
private static boolean isFishing = false;
private static int miningLevel = 1;
private static boolean isMining = false;
private static int attackLevel = 1;
private static int defLevel = 1;
private static int strLevel = 1;
private static int teleLevel = 1;
public Skill(String name) {
}
/**
* @return the fishLevel
*/
public static int getFishLevel() {
return fishLevel;
}
/**
* @param fishLevel
* the fishLevel to set
*/
public static void levelUpFishing() {
fishLevel++;
}
/**
* @return the isFishing
*/
public static boolean isFishing() {
return isFishing;
}
/**
* @param isFishing
* the isFishing to set
*/
public static void setIsFishing(boolean isFishing) {
Skill.isFishing = isFishing;
}}
I want to use Inheritance so i dont have to keep typing the same stuff again and again, like i have been doing :
/**
* Uses the static methods
*
* @author Erick
*
*/
public class Fishing extends Skill {
public Fishing() {
}
public static void levelUp() {
levelUpFishing();
}
public static String getId() {
return "Fishing";
}
}
I know I could use the static methods in the Skill Class, but i also need to set Icons and other things, that inheritance would help out with tremendously, is there a way to do this, I don’t want to make instances of each skill.