Disguise

Discussion in 'Plugin Development' started by locutus, Jul 23, 2011.

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

    locutus

    I realize this might be a bit difficult, but I'm looking for a way to represent a player as a different player, or as a mob, depending on who is looking. I'm looking for suggestions about how to do it.

    One of the reasons is to get rid of the name above thier head, which is visible through walls. If I can show a player with a generic player mob, they can't be detected
     
  2. Offline

    Sacaldur

    I don't now, how to do this, but if you're crouching your name is invisible through blocks
    for what do you need invisible player names?

    an other way is to change the friendly name (I don't know if it works)
     
  3. Offline

    locutus

    In my experience crouching only darkens the name, rather than rendering it invisible. You can still see it.
    I'd also like to be able to impersonate other players.

    As for why I don't want players to be seen....
    I run a pretty intense PvP server, and it's considered the normal course of play to destroy someone's base, fill it with magma, and run off with all their things in a specially designed flying chest airship. All this assuming that they are online and you can get past their traps and forcefields and can put up with the damage that comes with breaking blocks in enemy territory. We've had a few "griefers" ragequit after getting trapped in a player made obsidian oubliette. One of the factions has quite a few more melee bonuses than the others(its balanced in other ways) and thier base is huge enough to sneak around IF you can't be seen through the walls. it's an obsidian base, so even darkened grey names show up easily against the dark stone.

    The other thing is that I would like to give a certain faction the power to impersonate others, for a price. That price will be absurdly high, but if it can be met, it can be used to start wars between other factions. There are plenty of plugins that do this in chat, but I want to be able to wear the other's name, and be seen in thier skin.

    What I'm really looking for is a suggestion for way to alter the per-client representation of the world. I know this is done with the invisibility plugins. I'm an energetic h4xx0r, and I have not problem completely researching and implementing any ideas I'm given, but I am unfamiliar with Java and Bukkit, so I'd like someone more experienced than me to show me where to start looking.
     
  4. Offline

    Bone008

    I recommend you to first get a bit more familar with Jana, bukkit and what packets are (you also need craftbukkit for that one). Without a good foundation, you won't be able to make such a complex plugin.
    Then take a look at the source of a plugin that makes someone effectively invisible. I don't know how to do so myself, I can imagine it being quite a hassle (only sending a Destroy Entity packet (0x1D) won't be enough; new players, chunk unloads/reloads etc.).
    With that knowledge, you just have to redo that, but instead of only sending 0x1D-packets to make the player disappear, you also send a Mob Spawn packet (0x18), ideally with the same EntityID as the player actually has, so you won't have to deal with updating it.

    Packet reference: http://mc.kev009.com/Protocol
     
    locutus likes this.
  5. Offline

    locutus

    Thank you! +1 likes! As a network engineer, I'm quite familiar with TCP/IP and the OSI model, so what you are saying makes sense. I am also a fair programmer in c++.
    I have to craft a pair of packets to let the client know that I am now someone else, without changing my EntityID. Then, if I understand you correctly, the server will update my position/actions normally, based on my EntityID, without any further intervention from my plugin.
    Finally, when I get set on fire or hit with a decloaking tool, I have to send another Destroy Entity/MobSpawn packet set to set everything straight.
    The relevant packets must also be sent on login of either player. Hmm. That could lead to being able to see through the disguise for a split second.

    how do chunk unloads/loads interact with entities? I guess when the server would normally send a chunk to the client, all the entities int hat chunk are sent as well. Perhaps there is a way to interrupt a particular packet, to avoid that splitsecond reveal.

    I gather that bukkit doesn't have support for this, but the implementation, craftbukkit, does?
     
  6. Offline

    Bone008

    Basically, I don't know every point of time when you have to send your packets. That's why you should look at some working plugins and see how they accomplish that (with disappearing).

    In a normal situation, the client knows a player as a NamedEntity with its name above its head. To get rid of the name, make the entity disappear (0x1D) and make it spawn again. But this time, not as a NamedEntity (0x14) but as a "Mob" (0x18).

    And I assume that the packets which the client reveices from the server also apply to an Entity that is not named.
    If they don't ... well then you're plan would be a HUGE hassle.
     
  7. Offline

    Adondriel

    You could ask the maker of VanishNOPickup on how they literally make you invisible.
     
  8. Offline

    locutus

    I hope they do as well. I guess I can test it out empirically. It would be cool to wander around as a generic player or even a skeleton, but even if I have to restrict myself to sending net.minecraft.server.Packet20NamedEntitySpawn and not net.minecraft.server.Packet24MobSpawn I will still feel like I won.

    Now that you've pointed me in the right direction, the SpyerAdmin source makes more sense. Now that I'm looking for it, I see the destroy entity packets and the create named entity packets. That plugin does not seem to handle momentary visibility, which make sense. I don't see myself being inclined to rewriting craftbukkit to abort the relevant packets. Also, that is beyond the scope of what a plugin should do. I'll just tell my sithlords to be careful around portals and logins and whatever else.
     
  9. Offline

    Supersam654

    I believe that an anti x-raying plugin changes packets as they are sent to the client. In order to get this to work, the dev had to modify one of Minecraft's class files. So just a heads up if you are still going to try releasing your plugin, you will probably need to explain to people how to edit the server minecraft.jar (same as installing a client side mod, just use the server jar file).
     
  10. Offline

    Bone008

    @Supersam654 The only AntiXRay-plugin that I know doesn't alter the packets that are sent. It actually changes the ores in the world to stone and only changes them back if they are discovered.
    You might be talking about another one, though.

    @locutus Good luck with your try. You got me curious if this can work like that :D. Please post if you got any results.
     
  11. Offline

    Supersam654

    @Bone008 I forget the exact name, but there are atleast 3 anti x-ray plugins that I know of, and all of them attack the situation from completely different angles.
     
  12. Offline

    locutus

    I'd be interested in seeing the source for that. I don't use the ore replacement one because it is too processor intensive, and does not do chests, which are what I really care about. pstones used to do chests by replacing them ingame, but I think that kept eating people's [diamond], so that was removed. If I could conceal only chests by sending false packets, that would remove the danger of item deletion. That might be a separate plugin, but it will use alot of the same code to detect when they are in range and spoofpackets need to be sent.



    I'm pretty sure I don't have to change what packets are being sent. I just have to send extra ones. I think that requires linking against craftbukkit, but not actually modifying the server beyond the scope of a plugin. That said, a cleverly written client could detect this and show the player the truth. Then I WOULD have to use a modified class file :( I don't think it will come to that unless my disguise/antixray catch on in a big way. Thanks for helping clarify the idea for me though.
     
  13. Offline

    locutus

    I'm having trouble understanding how packets work in minecraft. I've gotten to the point where I can delete and replace an entity from the client's perspective, but I need help to rewrite the packet I'm sending out. I can seem to figure out the interface. currently, I can get a good packet with
    Code:
    new Packet20NamedEntitySpawn(spy.getHandle())
    I just can't figure out how to modify it. I know what to do with the data once I get it, but I can't figure out how to get it out or put it back again. I appreciate your help.
     
  14. Offline

    Bone008

    Yeah, if a packet only takes an object as a constructor and takes its data from it, changing it becomes pretty annoying.

    The members of Packet20NamedEntitySpawn, as they are deobfuscated from MCP are the following:
    Code:
        public int entityId;
        public String name;
        public int xPosition;
        public int yPosition;
        public int zPosition;
        public byte rotation;
        public byte pitch;
        public int currentItem;
    With craftbukkit you unfortunately have to deal with the obfuscated names (a,b,c,d,...). You can only guess and try which one are the correct ones. The fortunate thing is that the members in packets are usually public, so you have free access to them.

    In this example, if you'd like to alter the name, it's packet.b because it's the only string there. But well, you'll probably figure it out.
     
    locutus likes this.
  15. Offline

    ddubois89

  16. Offline

    locutus

Thread Status:
Not open for further replies.

Share This Page