Solved ArrayLists

Discussion in 'Plugin Development' started by TomTheDeveloper, Mar 26, 2013.

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

    TomTheDeveloper

    Hey, i have a problem.

    I have in my Main class this:
    Code:java
    1. ArrayList<String> Ready = new ArrayList<String>();

    and my mainclass extends JavaPlugin.

    But now i need this ArrayList in another class called VillageMap, but villagemap already extends BukkitRunnable, so how can i get the same ArrayList back in that class?
     
  2. Offline

    xmarinusx

    TomTheDeveloper
    In VillageMap you can do Mainclass.Ready
    Or in VillageMap you can do this:
    Code:java
    1.  
    2. //VillageMap
    3. public mainclass plugin;
    4.  
    5. //Constructor
    6. public VillageMap(mainclass instance){
    7. plugin = instance;
    8. }
    9.  
    10. //mainclass
    11. public VillageMap villageMap
    12. public ArrayList<String> Ready = new ArrayList<String>();
    13.  
    14. onEnable(){
    15. villageMap = new VillageMap(this);
    16. }

    Now inside VillageMap you can do plugin.Ready
     
    TomTheDeveloper likes this.
  3. Offline

    TomTheDeveloper

Thread Status:
Not open for further replies.

Share This Page