Minecraft / Java read data from config?

En
- in Plugins
6

I want to program a plugin for the game "Minecraft".

Now I want, if the player "ABC" makes the command "/ cmd CBA", that then an ID is generated (eg "AHC71") and saved in the config as follows:

CBA:

ID: AHC71

If an ID is generated which already exists in the config, a new one should be generated and set to the player in the config.

How exactly can I do that?

PS: The ID should contain letters & numbers, but should max. 9 characters long.

vo

Question about individual steps that you can't handle.

En

Ok… So how exactly can I save this data in the config as I wrote it above?

Get the rest I think.

vo

Most likely, the API you use for the plugin has interfaces for it.

jo

This could be achieved with a YAML configuration file. Programmatically, a HashMap made of an integer and string would be a good choice. The lengths and doubling of the IDs you could solve with simple if queries.

En

I managed that now. However, I somehow do not get it to read out the IDs of the players and send.

So I have it now in the "id.yml" saved:

NAME: 18384

Now I would like to query with a command whether the ID of args [0] exists in the id.yml. Can you help me with that?

jo

Take a look at this spigot documentation page: https://hub.spigotmc.org/...ation.html