How to do this?

Discussion in 'Plugin Development' started by Sarcry, Sep 3, 2016.

Thread Status:
Not open for further replies.
  1. @Sarcry
    Show us where this "PlayerFrozen" constructor is called.
  2. Offline


    it's in the main class ( Punish )
    public ArrayList<Player> frozen = new ArrayList<Player>();
    This is why I use plugin.frozen.(etc)
    public PlayerFrozenListener(Punish plugin) {
            this.plugin = plugin;
  3. @Sarcry
    Yes, but where do you call the constructor (where you do "new PlayerFrozenListener(plugin)")?
  4. Offline


    You mean this?
    PluginManager pm = Bukkit.getPluginManager();
    pm.registerEvents(new PlayerFrozenListener(this),this);
  5. @Sarcry
    Wait my bad. I though "PlayerFrozen" was a constructor.. but it's a method. Alright, show us where you call the "PlayerFrozen" method of the "PlayerFrozenListener" class.
  6. Offline


    I think I've forgotten that. By the way, how do I call a method from that class if it's not static?
  7. @Sarcry
    Instantiate the class into an object and call the method on the object.
  8. Offline


    Sorry to interrupt, just wanted to mention that this is the reason why code conventions exist. Here:

    @Sarcry try reading up a bit on Object Oriented Programming and Java itself. Not (ab)using static is just a good practice
Thread Status:
Not open for further replies.

Share This Page