Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by SIndybad, Jul 7, 2015.
Is there any way to differentiate servers(e.g. server UUID)?
You could try getting the ip?
EDIT: There's another method called getServerID, not exactly sure what that returns but you could try it. You can even get the server name if you want.
I tried getServerID() and it returns unnamed(you can change it in server.properties). If you don't have a static ip, wouldn't it change, though?
nvm, I will just create a UUID in a file
wait, that wouldn't be good as people could just copy their UUID and put it on another server... any ideas?
Depends on what you are going to be using this for. If you need something to uniquely identify servers in a "relative" safe environment then you can use UUIDs. You can generate random ones using
The UUID v4 is a 122 random bit UUID, meaning there should be 5,31e+36 (2^122) possibilities. This means in practice that if you generate random UUIDs you will never get two that are the same (since the chance of that happening is so low).
This is spoofable though, so if that is a problem (that someone got access to the UUID, which should be stored in some file, and spoof the server) then you could try using a combination of the iport.
You could also use a session system, like either get a UUID from some central or generate one each time the server starts up. This would not be good if you need consistency for each server over a longer period of time but would on the other hand prevent spoofing as long as the connection is secure and you don't have programs/plugins which got access to read the real time memory of the server (and get the UUID).
UUID would be good, but if you want something related to the process id, server id, and time. Take a look at MongoDB's ObjectID.