CraftPlayer

Discussion in 'Plugin Development' started by brian109, Apr 19, 2014.

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

    brian109

    Hi,

    I have a problem where when I imported org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer then it says it cant find this class and I'm wondering is there an alternative for this.

    Much is appreciated,
    Brian Mak
     
  2. Offline

    Gater12

    brian109
    Did you include craftbukkit along with bukkit?
     
    brian109 likes this.
  3. Offline

    brian109

    Could you make that more clear. I added Bukkit and CraftBukkit as a reference.
     
  4. Offline

    Gater12

    brian109
    Did you try removing that import and try to import it again?
     
  5. Offline

    Nateb1121

    You shouldn't use CraftPlayer directly like that, your plugin will break When ever bukkit updates...
     
  6. Offline

    brian109

    Gater12 Yes I did, numerous times already.

    I'm trying to use
    Code:java
    1. ((CraftPlayer) player).getHandle().ping
    to get the ping, but the import for CraftPlayer is for v1_7_R1

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

    Garris0n

    Well is that the CB version you're using?
     
  8. Offline

    brian109

    Garris0n
    That is not the version I'm using, but is there an alternative piece of code for this?
     
  9. Offline

    Nateb1121


    That's the issue with code like that, for the version you're using you'll need to know its numbers. Do /version and you should be able to figure out the numbers. You should see something like 1.7.X- R<number>.
     
  10. Offline

    brian109

    Nateb1121

    I know that, but I can't use other R[numbers] here because there is no such class.

    Im using R3

    But, when I replace R1 with R3, it says no class found.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  11. Offline

    Heirteir

    brian109
    You need to get Craftbukkit version 1.7.2 R3 from the development download page and import that build path instead of your current build path that's why the class is not appearing.
     
  12. Offline

    brian109

    Heirteir

    It still says that the import can't be resolved. I've added both 1.7.8 dev build and 1.7.2 R0.3 build into my build path, but still the same error.
     
  13. Offline

    Heirteir

    brian109
    You don't import both builds you just import 1 build and make sure that your server has the same build as your importing in your plugin
     
  14. Offline

    brian109

    Oh wait I posted that by mistake. I meant I tried both of them separately. But, it didn't work
     
Thread Status:
Not open for further replies.

Share This Page