Code criticism and advice

Status
This thread has been locked.

Kuzni

If you signed up after 2016 don't diss me thx
Supreme
Feedback score
12
Posts
1,688
Reactions
950
Resources
0
Hey I've made this to open source,

Please take a look at the code and judge it on anything non-personal preference related.
Also pls ignore the other shit in the rep I would sort it out but I've gotta leave for something, soz x

Database stuff was done by my mate but you can still give critisism, he'll see it.

https://github.com/Kuzni/StaffEssentials-1.0-SNAPSHOT

Thanks
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Ambrosia

Premium
Feedback score
22
Posts
2,340
Reactions
1,384
Resources
0
Use Gradle as your dependency management.

Maybe have different methods like "registerCommands" or "registerListeners" in your main class to handle commands/listeners, up to you though. Also, you should look into DI (dependency injection) or here or a million other sites.

Also, I don't think you should be using static variables in your StaffUtil class for checking if they're in vanish/staff mode (also use a Set instead of a List, and follow the Liskov Substitution Principle). Also for things like saying "flight enabled" or "flight disabled" you could use ternary operators. And for actually toggling flight you could use inverse booleans. It may just be me, but I prefer to use abstraction/annotations for handling commands. Too me, most of the Util classes are using static for things they shouldn't be.[DOUBLEPOST=1545245191][/DOUBLEPOST]if i linked anything that was wrong, please reply to me and tell me
 
Last edited:

Deleted User

Deactivated
Feedback score
18
Posts
218
Reactions
344
Resources
0
It is clear you need to look into different design patterns, especially OOP; as addressed by Ambrosia. Please, please, please run all your database queries and executions OFF the main thread, and cache your results where possible.

Whenever a player moves, interacts, places a block, etc, multiple database queries are being made: shown in this class of which none are being cached or off the main thread. I really hope this plugin isn't being used on a live server as it could lead to significant performance issues.

Also, FilterListener will deny any use of a capital L, including if it's in the middle of a sentence.
 
Last edited:

sores

MineBOI
Premium
Feedback score
5
Posts
305
Reactions
210
Resources
0
You could store your String List for the Filtered words in your config or separate file instead of hard coding them, then just pull from the file.
 

YoloSanta

Bot & Plugin Developer
Supreme
Feedback score
18
Posts
884
Reactions
374
Resources
0
Learn to use lombok and stop using static
 

Kuzni

If you signed up after 2016 don't diss me thx
Supreme
Feedback score
12
Posts
1,688
Reactions
950
Resources
0
Thanks for the advice guys, I'll work on everything I can and show all the db stuff to the guy who did it.
 

YoloSanta

Bot & Plugin Developer
Supreme
Feedback score
18
Posts
884
Reactions
374
Resources
0
Or just learn to use simple getters and setters. Lombok isn't just for getters and setters lol
ooh a skripter!! Anyways i never even mentioned getters and setters all i said was learn to use Lombok since you can use it for more than getters and setters.
 
Status
This thread has been locked.
Top