Location

Discussion in 'Plugin Development' started by ewrs, Aug 17, 2018.

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

    ewrs

    Hey. I have a problem and I can not solve it. When I try to add coordinates of the player to PUBLIC LOCATION LOBBY, I get an ostish.

    Code:


    Location loc = p.getLocation();
    Main.lobby.add(loc);
    p.sendMessage("Success");
    }catch(Exception e) {
    e.printStackTrace();
    p.sendMessage("Error");
    }

    Error:

    https://pastebin.com/zYQFSmC8

    Sorry for my english, he's not the best.
     
    Last edited: Aug 17, 2018
  2. Offline

    Zombie_Striker

    [01:23:33] [Server thread/WARN]: at en.ewrs728.tntrun.TNTRun.onCommand(TNTRun.java:43)
    What is line 43 of TNT run?

    Don't abuse the static modifier. When it comes to plugins, you should never have to use them. If you need to access a field from the main class, pass the main class's instance to the other class using constructors.
     
  3. Offline

    ewrs

    something I do not really understand you ...
     
  4. Offline

    KarimAKL

    You have a class with the name "TNTRun", what does line 43 in that class say?
     
  5. Offline

    user_91277742

    avoid as much as possible , create methods statics like "public static etc" . To remove that, just create constructor to acces to the instance in other class. That means @Zombie_Striker right?
     
    MrGeneralQ likes this.
  6. Offline

    ewrs

    is TNTRun.lobby.add(loc);

    I do not understand you. If it is private, I can not use it. Static needs a lobby to change everywhere

    TNTRun.get().lobby.setX(loc.getX());
    I removed static, but it did not issue it. The entire issue is given by this line, and I can not figure out how to replace it ;(

    https://pastebin.com/Wx6i0Kuz

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited: Aug 18, 2018
  7. Offline

    ewrs

    Help please
     
Thread Status:
Not open for further replies.

Share This Page