Jump to content

Recommended Posts

Posted

Hi,

I'm trying to get the names of my teammates on Hypixel. 

Although for some reason on Hypixel getTeam doesn't work. It just results in random numbers

Minecraft.getMinecraft().thePlayer.getTeam() 

 

 The only way I've been able to tell which team the player is in is by the tab list. They're separated into different colors, like this.

Screenshot_1.png.ff2937abcbf514d76bc57338063bd2e7.png

 

Is there a way I can use the colors to find who's on my team?

Posted (edited)

You can check the color style of the player’s name via PlayerEntity#getDisplayName (might be off; can’t remember the exact spelling).

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted (edited)
3 hours ago, DavidM said:

You can check the color style of the player’s name via PlayerEntity#getDisplayName (might be off; can’t remember the exact spelling).

Thanks. That worked in a test where I printed it. 

I do have one more question. How would I compare that to the rest of the players in the game? I made a Collection with NetworkPlayerInfo where I'm able to find the names and turn them into a string. Am I able to turn the display names into a string? Because instead of just the returning the name (like getName does), the displayname gives a "B" for the team letter that im trying to find. I haven't had any luck with it. Every time I try the chat just shows up blank. Any suggestions?

@SubscribeEvent
    public void matchJoin(ClientChatReceivedEvent event) {
        if (event.message.getUnformattedText().contains("test")) {
            Collection<NetworkPlayerInfo> players = Minecraft.getMinecraft().getNetHandler().getPlayerInfoMap();
               for (final NetworkPlayerInfo networkplayerinfo : players) {
            	  //turning displayname into a string  

 

Edited by iimyst
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.