help..

Discussion in 'Spigot Plugin Development' started by Vrsd12, Apr 22, 2017.

  1. Someone could give me an example of a code that
    When you open a menu you can disable or enable some of the config.yml
    Or simply to activate and deactivate
     
  2. What do you mean by disabling/enabling? It's not like a listener or a command you can turn on and off, there are entries which you can read or ignore.
     
  3. You can find a plugin that does that and decompile it.

    Otherwise Im sure there is one on GitHub that does this. That is what GitHub is for, you don't really have to ask here
     
    • Agree Agree x 1
    • Friendly Friendly x 1
  4. So you'd like kind of a config manager in a GUI.

    For one, I see no reason why anybody would want this. It is better, more convenient, and faster to just go into the config file. But I understand it if they want for example someone who doesn't have access to the config to be able to edit it; but then again, I would think commands would suffice.

    Anyhow, you have to be creative and come up with your own system. For booleans it's as simple as it can get. When the item is clicked, and set the value of the corresponding key to the opposite value of what it was before. (if it's true, set it to false, and vice versa). Kind of like a toggling system. If it is a string, integer, long, etc, I would take use of the chat. For example, put them in a mode where they can write the value in the chat (listen to PlayerChatEvent and get the value/String, but cancel it so it doesn't get out in the chat). You can use any method such as Integer.parseInt(the string) and just set that as the new ket.

    Save, and you are good to go.