Solved Some trouble in the config quick fix plz help

Discussion in 'Plugin Development' started by dbaum102, May 21, 2016.

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

    dbaum102

    Config:
    Code:
    items:
      test:
        inGameName: '&3MyName'
        lore1: '&2Lore Line One'
        command1: /kill
        permissionNode: custom.node
        healthpts: 3
    Code:
    Code:
    List<String> temp = (List<String>) this.getConfig().getConfigurationSection("items");
    Error:
    Code:
    cannot be cast to java.util.List
            at dbaum.special.items.main.onCommand(main.java:41)
    Looking for alternate code to loop through the different items such as all the "sub classes" of items. Not returning an something like lore1: .... but returning the titles of the sections holding those items in this instance test would be index 0.
     
  2. Offline

    Jakeeeee

    ConfigurationSection cannot be casted to a List, but can be a set.

    EDIT: Also why would you need it to be a list? When you could use the #get feature from the ConfigurationSection?
     
  3. Offline

    dbaum102

    I am trying to loop through all of the items... are you saying put <ConfigurationSection> int the list <>?
    @Jakeeeee

    Nvm im dumb what would i put in <> for it to work... I want the headings of the items
    Btw it says Class cast exception above it in the error
     
  4. Offline

    Zombie_Striker

    @dbaum102
    Try putting "Object" inside of the <>, and try using THIS as a guide for testing what each object actually is equal to.
     
  5. Offline

    dbaum102

    fixed using different way
     
Thread Status:
Not open for further replies.

Share This Page