Disguise as different player

Discussion in 'Plugin Help/Development/Requests' started by CheesyFreezy, May 13, 2015.

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

    CheesyFreezy

    Heey heey developers,

    I'm about to start with my second minigame, in this minigame there's 1 hunter and the other players are normal players. The hunter needs to kill all the other players without being killed. The hunter can use a menu to disguise as the other players to not be seen. I've been browsing through the forums and google, i've also tried using packets, but i just can't figure this out.
    How do i make a plugin where players can disguise as another player?
     
  2. Offline

    dlange

    @CheesyFreezy This is a very complicated thing to try implementing... You could try LibsDisguisesAPI or another working API/lib.
    If you really want I do this yourself at least show us what you have tried so far!
     
  3. Offline

    CheesyFreezy

    @dlange

    I returned all the variables and they'll returned something. Except for the EntityHuman (I have no idea how that works).

    Code:
    Code:
    if(command.equalsIgnoreCase("disguise")) {
                if(sender instanceof Player) {
                    Player player = (Player) sender;
                   
                    if(player.hasPermission("arcticmc.admin") || player.isOp()) {
                        if(args.length == 0) {
                            player.sendMessage(Plugin.prefix + ChatColor.YELLOW + "/disguise [Name]" + ChatColor.GRAY + "- Disguise as a player");
                        } else if(args.length == 1) {
                            String name = args[0];
                           
                            player.sendMessage(Plugin.prefix + ChatColor.GRAY + "You've been disguised as " + ChatColor.YELLOW + name + ChatColor.GRAY + "!");
                           
                            GameProfile profile = new GameProfile(UUID.randomUUID(), name);
                            WorldServer world = (WorldServer) ((CraftPlayer)player).getHandle().getWorld();
                            EntityHuman human = new EntityHuman(world, profile) {
                                public boolean v() {
                                    return false;
                                }
                            };
                           
                            Bukkit.broadcastMessage("profile: " + profile);
                            Bukkit.broadcastMessage("world: " + world);
                            Bukkit.broadcastMessage("human: " + human);
                           
                            for(Player players : Bukkit.getOnlinePlayers()) {
                                if(players != player) {
                                    PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(((CraftPlayer) player).getHandle().getId());
                                    PacketPlayOutNamedEntitySpawn spawn = new PacketPlayOutNamedEntitySpawn(human);
                                   
                                    ((CraftPlayer) players).getHandle().playerConnection.sendPacket(destroy);
                                    ((CraftPlayer) players).getHandle().playerConnection.sendPacket(spawn);
                                }
                            }
                        }
                    }
                }
            }
     
  4. @CheesyFreezy Does the hunter just take the player's skin, or their name too?
     
  5. Offline

    CheesyFreezy

    Both
     
  6. @CheesyFreezy Then you don't need anything so complex - simply changing their name will result in their skin changing, unless you handle it otherwise.
     
  7. Offline

    CheesyFreezy

    That doesn't work, it doesn't change anything

    Code:
    Code:
    if(command.equalsIgnoreCase("disguise")) {
                if(sender instanceof Player) {
                    Player player = (Player) sender;
                   
                    if(player.hasPermission("arcticmc.admin") || player.isOp()) {
                        if(args.length == 0) {
                            player.sendMessage(Plugin.prefix + ChatColor.YELLOW + "/disguise [Name]" + ChatColor.GRAY + "- Disguise as a player");
                        } else if(args.length == 1) {
                            String name = args[0];
                           
                            player.sendMessage(Plugin.prefix + ChatColor.GRAY + "You've been disguised as " + ChatColor.YELLOW + name + ChatColor.GRAY + "!");
                           
                            player.setCustomName(name);
                            player.setCustomNameVisible(true);
                        }
                    }
                }
            }
     
  8. @CheesyFreezy That method doesn't work for players - you'll want to change their actual name tag. I recommend hooking into TagAPI.
     
  9. Offline

    CheesyFreezy

    Is there also a way to not use an API? I don't like API's that much.....
     
  10. Offline

    CheesyFreezy

    You know what i mean :/
     
  11. @CheesyFreezy No I really don't. What's the actual problem with using something like TagAPI? Yes, it's an external API. Yes, you could replicate it by doing it yourself. However, doing so would kind of go against the reason TagAPI was created - so that plugins who also wanted to edit nametags were less likely to conflict with each other.
     
  12. Offline

    CheesyFreezy

    1: Outdated
    2: Does this change your skin?
     
  13. @CheesyFreezy Outdated how? It's up to date to the latest 1.7 build, I believe.
     
  14. Offline

    CheesyFreezy

    I'm using craftbukkit 1.8 and i don't want to use other versions....
     
  15. @CheesyFreezy Well sorry, I don't use unofficial Bukkit builds so I wouldn't know how to support you.
     
  16. @CheesyFreezy
    Problem with MC 1.8 is that now if you want to spawn a fake player and you want it to be seen by other players, they're name has to be in the tab list. MC 1.8 has made it pretty hard to create fake players, but I did manager to create player holograms in it that are fully functional, I could create a custom 1.8 disguise plugin (I already made that a while ago for a private project) and make it public on bukkitdev
     
  17. Offline

    CheesyFreezy

    Is it possible to get that manager of yours as fast as possible? I need it :p
     
  18. CheesyFreezy likes this.
  19. Offline

    CheesyFreezy

    Thank you! :D
     
Thread Status:
Not open for further replies.

Share This Page