Creating fake users on client server list

Discussion in 'Plugin Development' started by martijnpold, Jul 30, 2015.

Thread Status:
Not open for further replies.
  1. Hello,

    is there any way to make fake players on the minecraft client's server list so it would show for example 5/10 while noone is online? I want to make it and add it to a custom plugin im making so i need to write/add the code myself.

    Is there any way of doing this
     
  2. Offline

    Ruptur

    @martijnpold
    You cant do this with bukkit but i believe you can do it with Spigot's BungeeCoord
     
  3. There are already plugins that do this, i believe they use ProtocolLib but i dont know how to use that and most websites i looked for on google gave errors when i used it
     
  4. Offline

    xTrollxDudex

  5. Offline

    Ruptur

  6. How exactly do i use that? its missing a lot of stuff and im getting errors. For instance it does not know
    PlayerInteractManager

    I found this online but i cannot get it working, it does not give me errors but it doesnt work either:
    Code:
    protocolManager.addPacketListener(new PacketAdapter(this, ConnectionSide.SERVER_SIDE, ListenerPriority.HIGHEST, GamePhase.LOGIN, Packets.Server.KICK_DISCONNECT) {
                @Override
                public void onPacketSending(PacketEvent event) {
                    try {
                        final StructureModifier<String> stringModifier = event.getPacket().getSpecificModifier(String.class);
                        final String replyString = stringModifier.read(0);
                        int offset = 0;
                        String splitter = String.valueOf(ChatColor.COLOR_CHAR); // 1.3 and earlier
                        if (replyString.startsWith(splitter)) { // 1.4 and onward
                            splitter = "\u0000";
                            offset = 3;
                        }
                        final String[] split = replyString.split(splitter);
                        if (split.length == (3 + offset)) {
                            int online;
                            try {
                                online = Integer.parseInt(split[1 + offset]);
                            } catch (final NumberFormatException e) {
                                return;
                            }
                            online = 10;
                            final StringBuilder builder = new StringBuilder();
                            for (int x = 0; x < split.length; x++) {
                                if (builder.length() > 0) {
                                    builder.append(splitter);
                                }
                                if (x == (1 + offset)) {
                                    builder.append(online);
                                    continue;
                                }
                                builder.append(split[x]);
                            }
                            stringModifier.write(0, builder.toString());
                        }
                    } catch (final FieldAccessException e) {
                    }
                }
            });
    Bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
Thread Status:
Not open for further replies.

Share This Page