Solved Passing string to listener?

Discussion in 'Plugin Development' started by Barinade, Dec 3, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Barinade

    I have my main class and my lister, on my main class I have
    public final String s = "string";

    How can I read this on my listener class?
     
  2. Offline

    KeybordPiano459

    In your listener - String s = {MAINCLASS}.s
    Also, change public final to public static final.
     
  3. Offline

    Sehales

    Uuuhm, I think you should learn Java first before writing bukkit plugins...
    But it would be:

    Code:
    MyPlugin mp = new MyPlugin; //MyPlugin is your class which extends "JavaPlugin"
    String listenerStrin = mp.s;
    
     
  4. Offline

    Barinade

    Thanks, it was static I was missing, dunno why it didn't tell me to change the modifier...

    No.
     
  5. Offline

    Sehales

    Barinade for this question it is a possible answer.....
     
  6. Offline

    Barinade

    Creating a new instance of the main class?
     
Thread Status:
Not open for further replies.

Share This Page