Retrive player type "sq"?

Discussion in 'Plugin Development' started by Froshin, May 19, 2013.

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

    Froshin

    Hi. I am running a server that also uses the forge API and a mod that is designed for the Forge API.

    I was wondering if there's a way for bukkit to retrive a "sq" type player instead of just a Player type player, or am I forced to use the forge api for this?

    I need this because a method in the mod does not recognize the bukkit Player.

    Thanks!
     
  2. Offline

    Steffion

    Froshin What is sq!? If its something with forge, go to their site instead.
     
  3. Offline

    Froshin

    Steffion
    As far as I am concerned, it's the default minecraft obfuscated player class.
    But I am very new to this.

    Oh, and haha, I love how you used both an exclamation aswell as a questionmark.
     
  4. Offline

    Minnymin3

    CraftPlayer?
     
  5. Offline

    LazyLemons

    I think you mean EntityPlayer?
     
  6. Offline

    Jake0oo0

  7. Offline

    Froshin

    LazyLemons
    Am I completely wrong here or is EntityPlayer the non-obfuscated forge version of Sq?

    @MinnyMin
    "CraftPlayer cannot be resolved to a type"; does this exist in the bukkit library?

    Jake0oo0

    Can you evaluate on that?


    Thanks in advance!

    Bump.

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

    agaricus

    You're probably looking for the internal Minecraft player handle – if you have the org.bukkit.entity.Player wrapper, you can get this by downcasting to CraftPlayer then calling getHandle(), something like this:
    Code:
    ((CraftPlayer) player).getHandle()
    
    On vanilla CraftBukkit https://github.com/Bukkit/CraftBukk...kkit/craftbukkit/entity/CraftPlayer.java#L703, this returns an net.minecraft.server.EntityPlayer.

    net.minecraft.server.EntityPlayer is a subclass of net.minecraft.server.EntityHuman, but with additional functionality, so you can use EntityPlayer anywhere you can use EntityHuman.

    The "sq" class is actually from Mojang – it is what they call net.minecraft.server.EntityHuman, in their obfuscated code (as of 1.5.2). Bukkit deobfuscates it to EntityHuman, for readability purposes. But it is exactly the same class, just with a different name.

    You may also see the net.minecraft.entity.player.EntityPlayerMP and net.minecraft.entity.player.EntityPlayer classes. These are the names given by the Minecraft Coder Pack (MCP), which is a toolkit used for modding Minecraft, and is used by most mods. CraftBukkit however uses mc-dev mappings instead of MCP, so it has different namings.

    This can get confusing at times; if you need to translate between the various names I have this repository: https://github.com/agaricusb/MinecraftRemapping. To summarize the classes you're looking for:

    net.minecraft.server.EntityHuman = sq = net.minecraft.player.EntityPlayer
    net.minecraft.server.EntityPlayer = jc = net.minecraft.player.EntityPlayerMP
     
    Froshin likes this.
  9. Offline

    Froshin

    agaricus

    Thank you!!

    I gotta hit the hay now, but I will get back to this tomorrow.
     
  10. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Not a Bukkit question
     
Thread Status:
Not open for further replies.

Share This Page