Jump to content

addTabCompletionOptions Crash on Tab Press (1.8.9)


syns

Recommended Posts

I'm having a crash issue with Tab Completion on Online Players with a command. This is what was implemented, followed by a separate file named OnlinePlayers.java

@Override

public List<String> addTabCompletionOptions(final ICommandSender sender, final String[] args, final BlockPos pos) {

return (args.length >= 1) ? getListOfStringsMatchingLastWord(args, OnlinePlayers.getListOfPlayerUsernames()) : null;

}

OnlinePlayers.java:

package me.syns.slashping;

import net.minecraft.client.network.*;
import java.util.*;

public class OnlinePlayers
{
    public static String[] getListOfPlayerUsernames() {
        final String[] users = null;
        final Collection<NetworkPlayerInfo> players = Ping.mc.getNetHandler().getPlayerInfoMap();
        final List<String> list = new ArrayList<>();
        for (final NetworkPlayerInfo info : players) {
            list.add(info.getGameProfile().getName());
        }
        return list.toArray(new String[0]);
    }
}

ย 

If you need anymore information, let me know. I've attempted various other methods and keep looking around as to why it's crashing. This is a mod being developed for 1.8.9, and soon to be ported to 1.12.2 (after I get some help regarding the Tab Completion)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.