[DEV] save in database
Hi, If I want to store all the players' data in a database, how can I make it possible for them to get this data without a direct connection to the db in the mod? (to avoid security problems)
14 Replies
Thanks for asking your question!
Once you have finished, please close your thread.
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
command to close
/close
!close
!solved
Requested by pastrik#0
By player data, do u mean the player dat files?
When I say database, I mean db like MySQL
not what I’m asking
What do u mean by “player data”
You should create an api and database server
For database server you can use xamp mysql (phpMyAdmin)
What data are you trying to store?
Class
stats
really not a lot of context here. what do you mean by 'mod'?
Is this a server-side plugin? Well, a direct DB connection is how a lot of other plugins do it. Make an API middleware if you really care.
Server-side mod? No idea, probably not the right place to ask.
Anything client-side? Forget it. Highly not advised. API is the only option, and you better not be trusting the client much.
Wouldn't it be better to use a mod instead of a plugin for 100% stability?
it depends on your goal (which you haven't really elaborated on). "Stability" isn't really part of the equation when debating a mod or plugin. Intent is what drives your platform decision.
Developing a mod puts you on Forge, Fabric, or some other modding platform. Developing a plugin squarely places you in the Bukkit lineage (Spigot, Paper, Purpur, etc).
The problem is that Mohist, which lets you create a ModxPlugin server, is currently not stable, so creating a mod as a plugin seems better to me. Note that a client-side mod is imperative for gui.
if you're developing anything around the idea of hybrid servers, stop imo. They're never going to be stable. No one wants to support them, period. They might operate, but you're gonna find out real fast why people look down on hybrids.
You haven't said a word of "I want a client-side unique interface" or "I want custom blocks" or anything, so this didn't really explain much.
plus, many plugins integrate "custom" interfaces (sort of) via resource packs. If you really need code to run on the client, then you need to develop a client and server mod. If you can get away with something server-sided, which is probably more advantageous to you anyway, you should.
either way, on the server side, whether it's a mod or plugin, establishing direct connections to a DB via some database driver is completely fine. It's how most plugins do it. I haven't really seen a mod leverage a (non-flatfile) DB before, but I really can't imagine it's much different.
!solved
post closed!
The post/thread has been closed!
Requested by pastrik#0