Help with getConfig

Discussion in 'Plugin Development' started by Drizzy, Nov 26, 2014.

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

    Drizzy

    How do I set it up so the config can recognise the sound? This doesn't work and is my code, what do I need to do?

    Code:java
    1. i.getLocation().getWorld().playSound(getConfig().getString("Sound");


    The 'playSound' says it's not applicable for arguments.

    I don't really know much about Java fully, I've just looked here and there and know simple stuff so do little things but never configuration. It's weird, I know I know but pls help :p
     
  2. @DrizzySound.valueOf(getConfig().getString("Sound"));
     
  3. Offline

    Skionz

    Drizzy The constructor takes a Location, Sound, float, and another float for the volume and pitch. Not just a Sound.
     
    bwfcwalshy likes this.
  4. Offline

    17xDillz1997

    Could make a string then: i.getLocation().getWorld().playSound(i.getLocation(), Sound.valueOf(String), (Floats)
     
  5. Offline

    Drizzy

    17xDillz1997 Skionz bwfcwalshy
    Also, how do I reload config. I did this but the reload doesn't work. No errors, but the settings don't actually reset:
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
    2. if(cmd.getName().equalsIgnoreCase("LReload")) {
    3. reloadConfig();
    4. sender.sendMessage(Prefix + "Configuration reloaded");
    5. return true;
    6. }
    7. return false;
    8. }
     
  6. Offline

    Monkey_Swag

    Drizzy add the saveConfig(); method after the reloadConfig();
     
    17xDillz1997 likes this.
  7. Offline

    Drizzy

    Didn't work. Is it because I have saveConfig(); on enable?
     
  8. Offline

    JordyPwner

    Put on enable: saveDefaultConfig()
     
  9. Offline

    Drizzy

    Didn't work either. I replaced saveConfig(); with that, correct?
     
  10. Offline

    Monkey_Swag

    Drizzy pots your full code
     
Thread Status:
Not open for further replies.

Share This Page