plugin cannot be resolved?

Discussion in 'Plugin Development' started by Aggressor, Jun 15, 2014.

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

    Aggressor

    Hi, I have created a constructor and stuff for my instance called plugin, for some reason, it cannot be resolved when I try to use it in another class. Here is my Main class:

    Code:java
    1. package me.aggressor.lastmanstanding;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.List;
    5.  
    6. import org.bukkit.plugin.java.JavaPlugin;
    7.  
    8. public class Main extends JavaPlugin {
    9.  
    10. public final Main plugin;
    11.  
    12. public Main(Main plugin) {
    13. this.plugin = plugin;
    14. }
    15.  
    16. public final List<String> players = new ArrayList<String>();
    17.  
    18. public final List<String> getPlayers() {
    19. return this.players;
    20. }
    21.  
    22. @Override
    23. public void onEnable() {
    24. }
    25.  
    26. @Override
    27. public void onDisable() {
    28. }
    29. }
     
  2. Offline

    cheddar262

    Aggressor
    How are you passing it into another class?
    Also, if this is an issue with when you try to load it up on a server, could you please post your plugin.yml?
     
  3. Offline

    Konkz

    Make an instance of your plugin in onEnable().
    Also, if you are not using onDisable{} then why have a method for it?
     
  4. Konkz Because empty methods look pretty :)
    Aggressor Not sure how you were going to pass it an instance of itself through the constructor, or why you thought that wouldn't cause problems
     
Thread Status:
Not open for further replies.

Share This Page