Fake player count plugin

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

Thread Status:
Not open for further replies.
  1. Plugin category: Informational

    Suggested name: PlayerListing

    Game version: 1.7.10

    What I want: I would like a plugin where the player count is always on 9/10 and all clients will then see that number in their multiplayer tab.

    When I'd like it by: Today or tomorrow
     
    Last edited: Jul 31, 2015
  2. Offline

    SayHi2uTube

  3. I need a plugin thats JUST that, nothing more. Thats why i requested it, ofc i know that there are plugins that add stuff but i need just this.
     
  4. Online

    timtower Administrator Administrator Moderator

    @martijnpold Ignoring functionality is easier than creating a new plugin for something that 20 plugins do though.
     
  5. Offline

    SayHi2uTube

    Like tim said, just ignore or don't use it. You never know, you may need it in the future.
     
  6. I have reasons why i want only this. It shouldnt be that hard?
     
  7. @martijnpold They all do it like you want. I encourage you to just use those till you learn or until someone does do this request.
     
    timtower likes this.
  8. Alright, can you at least take a look at this code then? see if you see anything wrong with it?

    Code (open)

    public void onLoad() {
    ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
    protocolManager.addPacketListener(new PacketAdapter(this, ConnectionSide.SERVER_SIDE, ListenerPriority.HIGHEST, GamePhase.LOGIN, Packets.Server.KICK_DISCONNECT) {
    @Overridepublic 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 earlierif (replyString.startsWith(splitter)) { // 1.4 and onwardsplitter = "\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) {
    }
    }
    });
     
  9. Offline

    Chiller

    @martijnpold Why are you trying to re-invent the wheel?
    Just use one of the above plugins instead of wasting time trying to find someone who will do it for you...

    @martijnpold After two minutes of research you get this very simple piece of code that you can put into your project!

    Code:
    ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(pluginInstance, new PacketType[] { PacketType.Status.Server.OUT_SERVER_INFO })
    {
        public void onPacketSending(PacketEvent event)
        {
            WrappedServerPing ping = (WrappedServerPing) event.getPacket().getServerPings().read(0);
           
            ping.setPlayersOnline(onlinePlayers);
        }
    });
    
    EDIT by Timtower: merged posts
     
    Last edited by a moderator: Jul 31, 2015
Thread Status:
Not open for further replies.

Share This Page