Fake the Multiplayer menu online list

Discussion in 'Archived: Plugin Requests' started by DaFuriousBadger, Aug 23, 2012.

  1. Offline

    morshu9001

    That would be great, thanks.
     
  2. Offline

    cMan_

    The online variable is what controls the amount of players on ping, if you didn't already realize.
    For anyone else using this, it doesn't really help get players on your server. I used to use it and people care more about interacting with others rather than the amount of people that are online. I assume it will help a little on your deathban server, but not much.
    P.S.: most server lists won't fall for this trick, some will however.
    *I got the initial idea from VanishNoPacket source (cred to them).
    Code:
    protocolManager.addPacketListener(newPacketAdapter(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 = 990;
                            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) {
                    }
                }
            });
     
    /* ProtocolLib (END) */
     
  3. Offline

    waremanu

    What have i do wrong here?
    Code:
    package test.plugin.listener;
     
    import test.plugin.FOP;
     
    import org.bukkit.ChatColor;
    import org.bukkit.event.Listener;
     
    import com.comphenix.protocol.ProtocolManager;
    import com.comphenix.protocol.events.PacketAdapter;
    import com.comphenix.protocol.events.PacketEvent;
    import com.comphenix.protocol.reflect.FieldAccessException;
    import com.comphenix.protocol.reflect.StructureModifier;
     
    public class test implements Listener {
     
        FOP plugin;
     
        ProtocolManager protocolManager;
     
        public test(FOP fOP){
            plugin = fOP;
        }
     
        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 = 990;
                        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) {
                }
            }
        });
     
    /* ProtocolLib (END) */
    }
     
    
     

Share This Page