Solved Type mismatch: cannot convert from element type Object to SerializedLocation

Discussion in 'Plugin Development' started by Maulss, May 16, 2013.

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

    Maulss

    Hey guys, I got a problem. I'm currently focusing on a plugin for my server and Eclipse gives me the error on line 47 (spawns), line 52 (itemSpawns) and line 57 (items) in my main class:

    http://pastebin.com/mDCCcVTy

    It gives me a "Type mismatch: cannot convert from element type Object to SerializedLocation" error.

    Here's my SerializedLocation class:

    http://pastebin.com/7RaWh62s

    This is an unfinished project I had for a long time, I decided to finish it.
    Any suggestions? Thanks!
     
  2. Offline

    felixfritz

    As you initalize the lists (I think it's in line 30 - 32), you have to specify, what kind of objects the list will hold.
    PHP:
    //List "spawns" will have SerializedLocations
    List<SerializedLocationspawns = new ArrayList<SerializedLocation>();
     
    //List "itemSpawns" as well
    List<SerializedLocationitemSpawns = new ArrayList<SerializedLocation>();
     
    //List "items" will have ItemStacks
    List<ItemStackitems = ((Arena)e.getValue()).getItemToSpawn();
    I hope, this will help you out.
     
    Maulss likes this.
  3. Offline

    Maulss

    Thanks, all fixed. :)
     
    felixfritz likes this.
  4. Offline

    microgeek

    This is not your code. This my my old(few months old) code I sold to somebody, who sold it to about 15 other people. Don't take credit for other's work, even if you don't know who the orignal creator is.
     
  5. Offline

    Maulss

    Messaged.
     
Thread Status:
Not open for further replies.

Share This Page