Hello, Im wondering how you could use scoreboards and multiple classes for example be able to access this in one class publicstaticvoid test(){ ScoreboardManager sbManager = Bukkit.getScoreboardManager(); Scoreboard sBoard = sbManager.getNewScoreboard(); final Team red = sBoard.registerNewTeam("red"); final Team blue = sBoard.registerNewTeam("blue"); int reds = red.getSize(); int blues = blue.getSize(); int Bothteams = red.getSize() + blue.getSize(); int bothteams = reds + blues; and access those ints and teams in another.
If it's static, just use: Code: classname.methodname(); If it's not static, use: Code: classname name = new classname(); name.methodname();
Avoid static variables if you don't have a specific and good reason to use it. Automatically making anything static will quickly lead you down the path to unmaintainable code. That being said, you can create them as public instance variables, and then pass class 1 to your other class, and have the other class access them that way. You can also use getter and setter methods which are arguably the most failsafe way to share data. This is still highly dependent on what the classes are supposed to do. Usually, a class should handle its own as much as it can and share as little with other classes as possible, otherwise you end up with global variables which are almost always a bad idea. What are the functions of the multiple classes? If we knew why you're sharing data between them we could give you much better guidance in building a good object structure.
Considering the code he presented didn't show much knowledge of the subject, I figured I might as well put as much effort into the answer as he most likely put into his question.
My suggestion is to watch tutorials on youtube on java, learn the syntax, learn how to "code" in a sense.
Yes, I recommend watching 'TheBCBroz'; I've heard that they're much loved and respected by the Bukkit community.
Wizehh Actually, you're incorrect, many experience developers recommended NOT to watch TheBCBroz as they teach outdated methods.
You mispelled PogoStick29 and mazentheamazin the reason I and i think others don't watch them is because the obvious bad conventions and two he is always lazy and trying to rush videos
I have heard the same thing, but I've never watched any of their videos. Don't judge unless you can confirm . I'd hate it if people insulted my videos unless they told me what I did wrong so I could improve them.
He doesn't show what the plugin does or explain any of it because he's always in a damn rush, also he doesn't upload frequently he started a year before you and your only like 10 vids away.