Closed JeromeWolff closed 4 years ago
You can do that, yes. However, it provides a nicer structure just like partitioning variables of the same type. To point number 2: You can accidentally produce bugs with it, but it is not a must. However, any experienced developer will tell you that this application is much clearer and more beautiful. Writing code quickly is one thing, good and beautiful code is another.
I don't really agree with the code style changes, the lambda change and the "try-with-resources" is good tho. If you could change that I'd accept the pull request.
Okay maybe that's a good point, I will change that in a later recode of this project. Still, the brackets and the declarations are still a problem for me
As I have already said, the braces will not produce errors from future developers.
I prefer not using the braces in such cases, it looks nicer - it's personal preference. Same thing with the declaration
Does it look better now?
That's more like it. But why did you remove the private modifiers in the enums?
No matter which modifier a constructor of an enum has, it can only be called within the class. Therefore you always take package-private.
Yeah I know that, but I want to have a modifier in front of a constructor - personal preference
Why do you use so many unnecessary things?
The code is very inefficient, there are memory leaks, performance problems and it is mostly hardcoded. And why do you have something like that in your code:
if (configurations.containsKey(section.getFolder() + "/" + section.getName())) {
System.out.println(Main.getConsolePrefix() + "PAUL NEIN");
Bukkit.getServer().shutdown();
}
It's a joke - a contributor once made a mistake which cost me hours of fixing, so I made this. And if you think that this code is performing badly, why don't you prove that to me instead of just dropping random statements
And there are many things in this code that I don't like anymore (like a bad structure, final etc). But until I didn't recode it, I won't change things in order to keep things simple and similar.
You use multiple nested loops, which are executed synchronously. The same is true for MySQL: there you use statements instead of prepared statements, which are faster and more secure against SQL injections. Also MySQL is never executed asynchronously. With a high probability you have several entries in the table from one player.
I didn't knew I don't use prepared statements, I thought I would. Still, this won't make any noticeable difference in performance, but I will change that. And the main game loop for example has to be synchronized - Bukkit doesn't like handling the players asynchronously and even that doesn't cost any performance.
When you execute something synchronously, you wait for it to finish before moving on to another task. When you execute something asynchronously, you can move on to another task before it finishes.
Improve updater by adding "try-with-resources", missing braces and lambda expressions. I also removed unnecessary assignments.