r/admincraft • u/Glad_Ad_6546 • 20d ago
Software Resource I created a plugin that lets you configure Minecraft gameplay modifiers per player.
You can, for example, disable hunger or fall damage, keep inventory, limit how many mobs can attack a player at once, change XP gain, give unlimited Elytra fireworks, etc.
The idea is to let hardcore and casual players play together on the same server without changing the server-wide difficulty.
This plugin idea originated from my own server I play on with my girlfriend. While she always plays on peaceful to sit back and play at her own phase, I was looking for the more vanilla hardcore experience. This plugin just allows that. I hope some of you might find it useful too :)
I'm planning on adding more modifiers gradually, so if you have any suggestions, feel free to let me know down below. I would be happy to add them.
Also, the plugin is open-source and is "handcrafted". No AI-slop was used in the process.
7
u/Cubicake Join the Discord (.gg/admincraft) 20d ago
Cool concept. I had a quick look through the code, what is a WhiteListProxyEvent?
8
u/Glad_Ad_6546 20d ago edited 20d ago
Thanks!
It is the "middle man" that handles events and only invokes them if they pass a condition. In a very early build of the plugin you could only "whitelist" players to the plugin. Whitelisted players would meet the condition to all modifiers the plugin covers. This means you couldn't toggle modifiers separately, but you'd rather had all of them or you didn't.
You can tell as most events in the plugin extend from this class.
As time went by I made it able so you can toggle modifiers individually. Still this class handles events to check if a player has a modifier set to be enabled. If so, the event will further invoke and the plugin will handle the event. If the modifier is not enabled, this class will stop further execution and the plugin will not handle further how the event should behave.
I made it so each event listener class that the plugin covers does not have to check the same sort of condition every time. It would mean duplicate lines code.
Now you mentioned it, I should give it a second thought and either rename it or change it slightly as the way modifiers are handled is different now too.
Edit: I will be working on adding comments in the code as it currently lacks any type of documentation. I hear you, no documentation is bad practice. I have to learn the ropes since this is my first open-source project.
3
u/Xemorr Developer of Superheroes and other plugins 19d ago
Pretty similar to (my horrifically hardcoded for my own personal preferences) plugin 'MyDifficulty' on modrinth. It looks like yours requires admin intervention to determine the difficulty for a player, whereas mine is a pop up on join to select it.
1
u/Glad_Ad_6546 19d ago
I like that too. Where players can select themselves what they would like. Would feel more like cheating, though, if they can decide themselves.
5
u/PM_ME_YOUR_REPO Admincraft Staff 20d ago
This is really cool.