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.
[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.
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?
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.