OnJoin (PlayerJoinEvent e) in the main class more efficient or in separate class in the package (Minecraft Java)?

Ba
12

And 2nd question: Is it necessary to "pm.registerEvents (this, this);" to write in the mainclass, if onJoin is also in the main class?

Ja

You also have to register the event if you have the event in the main class, because at the beginning not the whole main class will be executed, but only the onEnable ()

Ba

Okeyy, why have onJoin1,2,3 been executed without error so far?

Ja

I do not have your code. If you can send me possibly by link on https://hastebin.com/...stebin.com? Then I could help you better

Ba

Dat would be 383 lines of code😆

Ba

OK wait

Ja

383 lines of code is not much. You can skim over that

Ba

Once I copied out the registers and the onJoin4 blblablub's stuff.

PluginManager Register:

Dat onJoin4 () Thing:

Aso, does that work so that I just make p.setMaxHealth and p.setFoodLevel while joining? Because i would like to indicate that you only have 5 instead of 10 hearts / FoodLevel xD

Ja

Why do you want to give someone 5.5 hearts and why do you want to put someone half hungry? And if I should help you, I would need the whole code. I do not want to make fun of your (obviously very bad) code here, because I understand what it's like to start programming. And the code if possible on hastebin.com

Ba

OK wait. But woe, you use it for your own purposes. But I do not believe it. Because it's just a lot of the little xD

Ba

Code of the main class: https://hastebin.com/...wozey.java

Ja

Public void onJoin4 (PlayerJoinEvent e) {
Player p = e.getPlayer ();

if (PermissionsEx.getUser (p) .inGroup ("Owner") | PermissionsEx.getUser (p) .inGroup ("Member")) {
p.setMaxHealth (10); // EXAMPLE LEVEL'S
p.setFoodLevel (10);

} else {
if (p.isOp ()) {
p.setMaxHealth (11);
p.setFoodLevel (11);
} else {
p.setMaxHealth (1);
p.setFoodLevel (1);
}
}
}

I do not understand this part about vomiting. You wrote the following:

If someone in the Pex group is owner or member then he gets 5 hearts and 5 hunger bars. If he is not in one of these groups, then you ask if the player has OP. If the player has OP, then he gets 5.5 Hearts and 5.5 Hunger Bars. But if he has no surgery, then he gets half a heart and half a hunger bar.

But why? You have to know: 10 hearts in the game = 20 in Java. Reason: A HALF heart = 1. 20 half hearts = 20.

The same with food.

Ba

I know xD

10 are 5 hearts / hunger bars

and 11 are 5.5

and 1 should be just half a🤷🏻♂️
To understand the background is unimportant at first. Maybe it will be changed