Solved Mapping Values not allowed here?

Discussion in 'Plugin Development' started by blok601, Nov 8, 2015.

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

    blok601

    Hello. As you can see from the title, I am getting the error: Mapping Values not allowed here.

    Here my config
    Code:
    blok601: 1
      deaths: 0
     
  2. Offline

    DoggyCode™

    That's not how mapping works. You would have to do something like this:
    Code:
    block601:
      value: 1
      deaths: 0
    If you really need that 1.
     
  3. Offline

    blok601

    So I would need two sub-sections?

    @DoggyCode™
     
  4. Offline

    Zombie_Striker

    @blok601
    It would be nice to actually see the error. It would be nice to see the code that is causing the error.
     
  5. Offline

    blok601

    Code:
        @EventHandler
        public void onPlayerJoinEvent(PlayerJoinEvent event){
            Player p = event.getPlayer();
            if(!(p.hasPlayedBefore())){
                plugin.getConfig().set(p.getName(), 0);
                plugin.getConfig().set(p.getName() + ".deaths", 0);
                plugin.saveConfig();
            }
        }
    @Zombie_Striker
     
  6. Offline

    Zombie_Striker

    plugin.getConfig().set(p.getName(), 0);
    plugin.getConfig().set(p.getName() + ".deaths", 0);

    This actually should be
    plugin.getConfig().set(p.getName()+".score/points/values", 0);
    plugin.getConfig().set(p.getName() + ".deaths", 0);
     
  7. Offline

    blok601

    Sorry, I am kinda new to this...

    What did you do to the first line:
    plugin.getConfig().set(p.getName()+".score/points/values", 0);

    @mrCookieSlime help please

    EDIT: Fixed, thanks.
     
    Last edited: Nov 8, 2015
  8. Offline

    Zombie_Striker

    @blok601
    What i did there was add an extra value. you could not treat a path as both "key" and a "subpath".

    Choose the name you want (do you want it to be called points or score?) and try it out.
     
  9. Offline

    blok601

    Sorry, I completely misunderstood the whole concept. Thanks. I didn't realize that when you did the slashes you just didn't know what the value was called.

    Thanks!
     
  10. Offline

    mcdorli

    Don't tagh people who isn't ib the thread
     
Thread Status:
Not open for further replies.

Share This Page