Mismatched Type

Discussion in 'Plugin Development' started by tappestry, Mar 11, 2016.

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

    tappestry

    Hey all,

    I am updating a plugin that changed from from 1.8 - 1.9
    Very very new to all this, but I am getting a mismatched type error, I tried changing the type throughout the code but I get more errors, here is a snippet, if anyone would like to give me any advice, it would be awesome! If not, I appreciate you reading :D

    Code:
       if (this.titleConfig.contains(Title.Type.PREFIX.getKey()))
         {
         Set titles = this.titleConfig.getConfigurationSection(Title.Type.PREFIX.getKey()).getKeys(false);
         for (String name : titles) {
             Title title = loadTitle(Title.Type.PREFIX, name);
            if (title != null) this.prefixes.put(name, title);
         }
    of course the error is that String name is not right and trquires an Object...Did something change to objects over the update? If so how I can I fix this, maybe a import?
     
  2. Offline

    Corndogoz

    which line is the error on?
     
  3. Offline

    HoeMC

    Try Set<String> instead of Set.
     
    tappestry likes this.
  4. Offline

    Zombie_Striker

    @tappestry
    The reason you are getting this error is because you did not specify the parameters of the set. Try doing as @HoeMC suggested and that will fix your problem.
     
    tappestry likes this.
  5. Offline

    tappestry

    Thank you that solved the problem!

    I ran into this again on LINE 26, but this solution doesn't work here, what do you think? I tried Map, and Entry for the set but still bugs out pretty bad. I'm thinking that maybe I shouldnt b using a Map, maybe an Array?

    Code:
      private Map<String, Bag> bags = new HashMap();
    
      public Bag getBagById(String id) {
        return (Bag)this.bags.get(id);
      }
    
      public void addItem(String id, Bag bagItem) {
        this.bags.put(id, bagItem);
      }
    
      public Set<String> getBagIdList() {
        return this.bags.keySet();
      }
    
      public void clearItems() {
        this.bags.clear();
      }
    
      public List<Bag> getRandomBags(LivingEntity deadEntity)
      {
        List randomList = new ArrayList();
    
        Set bagEntrySet = this.bags.entrySet();
    
        for (Map.Entry entry : bagEntrySet) {
          Bag bag = (Bag)entry.getValue();
    
    
    Set<Entry<String.Bag>> bagEntrySet ? I've tried a few differernt set up with the Map<> parameters but still getting the same errors.
     
    Last edited: Mar 12, 2016
Thread Status:
Not open for further replies.

Share This Page