Referencing public void not working

Discussion in 'Plugin Development' started by FletchTech90, Jun 19, 2014.

?

What's your favorite IDE?

  1. Eclipse

    1 vote(s)
    100.0%
  2. NetBeans

    0 vote(s)
    0.0%
  3. Other

    0 vote(s)
    0.0%
Thread Status:
Not open for further replies.
  1. Offline

    FletchTech90

    Let's say I have 2 classes, Main and Game. (I actually have more, but these two are the ones involved.)

    In Game, I have a
    public void join(Player player, GameArena arena){
    //Business that happens on join
    }

    and I need to reference it in Main so I can use this on the command /th join.

    I try and use Game.join(player, arena), but the autocomplete for Game. shows 2 things:
    • class
    • this
    This is really a roadblock for my big plugin, can someone please help me?

    Thanks in advance.
     
  2. Offline

    RawCode

    poll is flame bait \ holywar fuel

    you shoud read something about static keyword and oop in general
     
  3. Offline

    1Rogue

    vim master race

    You're attempting to use a static reference to a method that requires an instance. You need to create an object first:

    Code:java
    1. Game g = new Game();
    2. g.join(/*...*/);
     
    FletchTech90 likes this.
  4. Offline

    FletchTech90

    Oops. Too late now!
    That made no sense. "oop"?

    Alright. Thanks. I will remember these things from O Bukkity Forums!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  5. Offline

    1Rogue

Thread Status:
Not open for further replies.

Share This Page