Solved Config Help

Discussion in 'Spigot Plugin Development' started by YoloSanta, May 27, 2018.

Thread Status:
Not open for further replies.
  1. Im trying to get the blocks a player breaks, but it's not adding 1 to the block. I need some help.
  2. 1. Use a single instance of your config file. Define it outside of the event.
    2. You're not reaching your config the right way, unless you have a getConfig() method defined in your main class to reach the proper config (which doesn't appear to be the case, considering the config only exists inside the event).
    3. When you set the oldAmount int, if the block is not set under the player's UUID, you'll receive an NPE. Use something like this instead of line 28:
    Code (Text):
    if (manage.getInt("BlocksBroken." + p.getName() + "." + e.getBlock().getType) != null) {
    int oldAmount = manage.getInt("BlocksBroken." + p.getName() + "." + e.getBlock().getType) + 1;
    4. If the player's name changes, their data will be inaccessible or replaced until changed manually in the config.
Thread Status:
Not open for further replies.