CraftPlayer cannot be resolved to a type

Discussion in 'Plugin Development' started by Zacky1, Dec 17, 2012.

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

    Zacky1

    What's wrong with this bit of code?:


    Code:
    for(Player p : Bukkit.getServer().getOnlinePlayers()) {
            ((CraftPlayer)p).getHandle().netServerHandler.sendPacket(new Packet250CustomPayload(Packet, (url+16).getBytes()));
            }
    This says that "CraftPlayer cannot be resolved to a type"
    How the heck do i fix this?
     
  2. Offline

    Tirelessly

    You reference craftbukkit.
     
  3. Offline

    Zacky1

    So how do I fix it?
     
  4. Offline

    zack6849

    you know how you added the bukkit jar to your eclipse project?
    Do the same but with a craftbukkit jar
     
  5. Offline

    Zacky1

    I added craftbukkit.jar
    and not Bukkit.jar...

    My plugin is running with only Craftbukkit

    Added both, no change :O

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  6. Offline

    4am

    Latest dev builds remove references to CraftBukkit objects. Not sure if they are renamed - actually came here to find this out.
     
  7. Offline

    Zacky1

    Argh, perfect. -.- Jeez

    Found the solution...
    You need to "force import" it sine Eclipse will not suggest it for some reason... ;3
    import org.bukkit.craftbukkit.entity.CraftPlayer;

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  8. Offline

    Tirelessly

    Surprisingly enough just because you need to do it the way it was meant to be done, that's still called importing, not "force importing"
     
  9. Offline

    Zacky1

    Well... you know what I mean XD

    Ill change it just for you: "Manually import it"
     
  10. Offline

    feff890

    Still isn't working. Tried manually importing it but... Nup.
    Edit: For all people with this problem you must import the latest version.
    import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
     
    PDKnight likes this.
  11. Well, as you all should know, with bukkit is some shit going on. Somebody of the development team left and he/she had a licence for the code he/she wrote. now this code is removed and this person wrote a !LOT! that's why you can't download 1.7.10 and why some 1.7.9 versions arent working. I've a backup of the last 1.7.9 version which is runnable. You need to add the jarfile, which you use to run your server, as a library to your project in eclipse. then you can access craftplayer and all that other stuff. no "manual imports" anymore xD

    I hope i helped you :)
     
  12. Offline

    thomasb454


    necropost much
     
  13. thomasb454 oww yea sorry, i only took a look at the timestamp of feff890's post :O i overlooked that this post is older than a year, wuupsy. but this is what happens if people like Zacky1 doesn't set thier thread so solved
     
  14. Shmobi No, it's what happens when people like feff890 find almost 2 year old posts - even solved posts aren't safe from being necro'd :)
     
  15. AdamQpzm this fits for feff890 but i wouldn't even have taken a look at the thread if it would've been marked as solved (sorry if i fucked up the time in this sentence so hard but im german xD me does not do knowing any much better :O :D)
     
    AdamQpzm likes this.
Thread Status:
Not open for further replies.

Share This Page