So I have a SignManager class : Code:java package me.ati.signsplus; import java.lang.reflect.Array; public class SignManager { private String signType; private String signPermission; private String signIdentifier; //E.G. [HEAL] top line of sign private Array[] lines = new Array[2]; /* Getters and Setters */ public String getSign1() { return signType; } public void setSign(String sign) { this.signType = sign; } public String getPermission() { return signPermission; } public void setPermission(String permission) { this.signPermission = permission; } public String getIdentifier() { return signIdentifier; } public void setIdentifier(String identifier) { this.signIdentifier = identifier; } public Array[] getLines() { return lines; } public void setLines(Array[] lines) { this.lines = lines; } public SignManager(String signType, String identifier, String permission) { this.signType = signType; this.signPermission = permission; this.signIdentifier = identifier; }} And a Heal Class: Code:java package me.ati.signsplus.signs; import me.ati.signsplus.SignManager; public class Heal { public SignManager heal = new SignManager("Heal", "#heal", "signsplus.use.heal"); // heal.getIdentifier(); this doesn't work } I cant access the get methods for the Heal sign in the Heal class. I've looked on Google an YouTube and cant find a solution. Thanks in advance.
The methods can only be used in other methods or when initializing a variable. Code:java public class Heal { public SignManager heal = new SignManager("Heal", "#heal", "signsplus.use.heal"); String myString = heal.getIdentifier(); public void myMethod() { heal.getIdentifier(); }}
@felizfritz How would I use the setters then, is there a way to do it without the method? mythbusterma I am trying to learn Java by using the Bukkit API to make it more enjoyable. I have tried to find a solution to this with Google and YouTube but had no luck. Also bear in mind I don't have a good source to learn Java since I cant buy books on the language.
Ati_444 Perhaps using the Java Trail is a good idea: http://docs.oracle.com/javase/tutorial/java/ We strongly recommend against using Bukkit to learn Java, as it will only cause you grief. Using Bukkit is something you should do only after you feel comfortable with the language.
Ati_444 The library was made for a reason. It won't be enjoyable to learn java and a 3rd party at the same time once you figure out you weren't able to learn anything. Java is a separate entity from its API and to use an API you need to learn how to use the language it was written in first.