How to reload plugin?

Discussion in 'Plugin Development' started by AcpSoldier, Aug 19, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    AcpSoldier

    So I made this HubLauncher plugin, and I want it so I can change the launch power by using a command. The command sets the number in the config, and it works. But the launcher still uses the old number UNLESS I type /reload on my server, then it uses the one I typed in the command earlier.

    So my idea was to reload the plugin every time I use the power command. But I have no clue how. Any help is appreciated!
     
  2. Offline

    bennie3211

    save it to a variable inside your plugin and to your config. Or read after changing the value in the config the config again.
     
  3. Offline

    AcpSoldier

    Ummm. I have no clue what you are saying. Explain please?
     
  4. Offline

    br456

    AcpSoldier
    Reload your config like this:
    Code:java
    1. FileConfiguration config = YamlConfiguration.loadConfiguration(new File(p.getDataFolder(), "config.yml"));

    config is the configuration object, and the File object created is the path to your file
     
  5. Offline

    fireblast709

    AcpSoldier after you set something in the config, the value you are using in the launcher needs to be updated. Create a setter in the launcher class that you invoke when you set the number in the command, to update the value.
     
  6. Offline

    AcpSoldier

    How would I do this in code?
     
  7. Offline

    bennie3211

    First of all, start with learning the basics of Java. No one is going to spoonfeed you :)
     
  8. Offline

    fireblast709

    AcpSoldier post the command and launcher code so know how your code is structured
     
  9. Offline

    RenditionsRule

    Well what I would do is after setting the variable in the config, I would run "reloadConfig()" as a function. This is what I use for my plugins.
     
Thread Status:
Not open for further replies.

Share This Page