PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.92k stars 904 forks source link

No colours in `bot.tablist` #1714

Closed GoogleSites closed 3 years ago

GoogleSites commented 3 years ago

Versions

Detailed description of a problem

A clear and concise description of what the problem is, with as much context as possible. What are you building? What problem are you trying to solve?

I'm trying to get the list of players in the tab (with coloured names) that are located in Hypixel BedWars in order to get a list of all teams (each team has a different colour for their names).

What did you try yet?

I've tried bot.tablist (it's empty), and player.displayName, but neither show the colours that I want.

Did you try any method from the API? None of them do what I'm looking for.

Did you try any example? Any error from those?

Your current code

import mineflayer from 'mineflayer';

const bot = mineflayer.createBot({
    username: 'Bot',
    version: '1.8.9',
    host: 'localhost',
    port: 57573
});

bot.once('login', () => {
    setInterval(console.log, 5000, bot.tablist);
});

Expected behavior

A clear and concise description of what you expected to happen.

bot.tablist should include a list of players in the tablist, along with the correct colours (anywhere at all works, it doesn't need to be nicely formatted).

Additional context

Add any other context about the problem here.

I have a yellow name that I set using scoreboard commands: /scoreboard teams add MyTeam Yellow /scoreboard teams join MyTeam

ghost commented 3 years ago
  • [ ] The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 3.2.0
  • server: Vanilla 1.8.9
  • node: 14.4.0

Detailed description of a problem

A clear and concise description of what the problem is, with as much context as possible. What are you building? What problem are you trying to solve?

I'm trying to get the list of players in the tab (with coloured names) that are located in Hypixel BedWars in order to get a list of all teams (each team has a different colour for their names).

What did you try yet?

I've tried bot.tablist (it's empty), and player.displayName, but neither show the colours that I want.

Did you try any method from the API? None of them do what I'm looking for.

Did you try any example? Any error from those?

Your current code

import mineflayer from 'mineflayer';

const bot = mineflayer.createBot({
  username: 'Bot',
  version: '1.8.9',
  host: 'localhost',
  port: 57573
});

bot.once('login', () => {
  setInterval(console.log, 5000, bot.tablist);
});

Expected behavior

A clear and concise description of what you expected to happen.

bot.tablist should include a list of players in the tablist, along with the correct colours (anywhere at all works, it doesn't need to be nicely formatted).

Additional context

Add any other context about the problem here.

I have a yellow name that I set using scoreboard commands: /scoreboard teams add MyTeam Yellow /scoreboard teams join MyTeam

You only look at the list of players, to get the tab you need:

 bot._client.on('player_info', (packet) => {
   console.log(packet)
 }

More details: https://wiki.vg/Protocol#Player_Info

GoogleSites commented 3 years ago
  • [ ] The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 3.2.0
  • server: Vanilla 1.8.9
  • node: 14.4.0

Detailed description of a problem

A clear and concise description of what the problem is, with as much context as possible. What are you building? What problem are you trying to solve? I'm trying to get the list of players in the tab (with coloured names) that are located in Hypixel BedWars in order to get a list of all teams (each team has a different colour for their names).

What did you try yet?

I've tried bot.tablist (it's empty), and player.displayName, but neither show the colours that I want. Did you try any method from the API? None of them do what I'm looking for. Did you try any example? Any error from those?

Your current code

import mineflayer from 'mineflayer';

const bot = mineflayer.createBot({
    username: 'Bot',
    version: '1.8.9',
    host: 'localhost',
    port: 57573
});

bot.once('login', () => {
    setInterval(console.log, 5000, bot.tablist);
});

Expected behavior

A clear and concise description of what you expected to happen. bot.tablist should include a list of players in the tablist, along with the correct colours (anywhere at all works, it doesn't need to be nicely formatted).

Additional context

Add any other context about the problem here. I have a yellow name that I set using scoreboard commands: /scoreboard teams add MyTeam Yellow /scoreboard teams join MyTeam

You only look at the list of players, to get the tab you need:

 bot._client.on('player_info', (packet) => {
   console.log(packet)
 }

More details: https://wiki.vg/Protocol#Player_Info

That doesn't contain the player's name colour (or the content in the tab) either.


{
  action: 0,
  data: [
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: 'Bot',
      properties: [],
      gamemode: 0,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 0,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: 'GoogleSites',
      properties: [Array],
      gamemode: 1,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 0,
  data: [
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: 'Bot',
      properties: [],
      gamemode: 0,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 1,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    }
  ]
}```
ghost commented 3 years ago
  • [ ] The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 3.2.0
  • server: Vanilla 1.8.9
  • node: 14.4.0

Detailed description of a problem

A clear and concise description of what the problem is, with as much context as possible. What are you building? What problem are you trying to solve? I'm trying to get the list of players in the tab (with coloured names) that are located in Hypixel BedWars in order to get a list of all teams (each team has a different colour for their names).

What did you try yet?

I've tried bot.tablist (it's empty), and player.displayName, but neither show the colours that I want. Did you try any method from the API? None of them do what I'm looking for. Did you try any example? Any error from those?

Your current code

import mineflayer from 'mineflayer';

const bot = mineflayer.createBot({
  username: 'Bot',
  version: '1.8.9',
  host: 'localhost',
  port: 57573
});

bot.once('login', () => {
  setInterval(console.log, 5000, bot.tablist);
});

Expected behavior

A clear and concise description of what you expected to happen. bot.tablist should include a list of players in the tablist, along with the correct colours (anywhere at all works, it doesn't need to be nicely formatted).

Additional context

Add any other context about the problem here. I have a yellow name that I set using scoreboard commands: /scoreboard teams add MyTeam Yellow /scoreboard teams join MyTeam

You only look at the list of players, to get the tab you need:

 bot._client.on('player_info', (packet) => {
   console.log(packet)
 }

More details: https://wiki.vg/Protocol#Player_Info

That doesn't contain the player's name colour (or the content in the tab) either.


{
  action: 0,
  data: [
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: 'Bot',
      properties: [],
      gamemode: 0,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 0,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: 'GoogleSites',
      properties: [Array],
      gamemode: 1,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 0,
  data: [
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: 'Bot',
      properties: [],
      gamemode: 0,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 1,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    }
  ]
}```

hmm, it seems to be stored displayName

u9g commented 3 years ago
  • [ ] The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 3.2.0
  • server: Vanilla 1.8.9
  • node: 14.4.0

Detailed description of a problem

A clear and concise description of what the problem is, with as much context as possible. What are you building? What problem are you trying to solve? I'm trying to get the list of players in the tab (with coloured names) that are located in Hypixel BedWars in order to get a list of all teams (each team has a different colour for their names).

What did you try yet?

I've tried bot.tablist (it's empty), and player.displayName, but neither show the colours that I want. Did you try any method from the API? None of them do what I'm looking for. Did you try any example? Any error from those?

Your current code

import mineflayer from 'mineflayer';

const bot = mineflayer.createBot({
  username: 'Bot',
  version: '1.8.9',
  host: 'localhost',
  port: 57573
});

bot.once('login', () => {
  setInterval(console.log, 5000, bot.tablist);
});

Expected behavior

A clear and concise description of what you expected to happen. bot.tablist should include a list of players in the tablist, along with the correct colours (anywhere at all works, it doesn't need to be nicely formatted).

Additional context

Add any other context about the problem here. I have a yellow name that I set using scoreboard commands: /scoreboard teams add MyTeam Yellow /scoreboard teams join MyTeam

You only look at the list of players, to get the tab you need:

 bot._client.on('player_info', (packet) => {
   console.log(packet)
 }

More details: https://wiki.vg/Protocol#Player_Info

That doesn't contain the player's name colour (or the content in the tab) either.

{
  action: 0,
  data: [
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: 'Bot',
      properties: [],
      gamemode: 0,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 0,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: 'GoogleSites',
      properties: [Array],
      gamemode: 1,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 0,
  data: [
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: 'Bot',
      properties: [],
      gamemode: 0,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 1,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    }
  ]
}```

maybe check bot.players for their colored name?

GoogleSites commented 3 years ago
  • [ ] The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 3.2.0
  • server: Vanilla 1.8.9
  • node: 14.4.0

Detailed description of a problem

A clear and concise description of what the problem is, with as much context as possible. What are you building? What problem are you trying to solve? I'm trying to get the list of players in the tab (with coloured names) that are located in Hypixel BedWars in order to get a list of all teams (each team has a different colour for their names).

What did you try yet?

I've tried bot.tablist (it's empty), and player.displayName, but neither show the colours that I want. Did you try any method from the API? None of them do what I'm looking for. Did you try any example? Any error from those?

Your current code

import mineflayer from 'mineflayer';

const bot = mineflayer.createBot({
    username: 'Bot',
    version: '1.8.9',
    host: 'localhost',
    port: 57573
});

bot.once('login', () => {
    setInterval(console.log, 5000, bot.tablist);
});

Expected behavior

A clear and concise description of what you expected to happen. bot.tablist should include a list of players in the tablist, along with the correct colours (anywhere at all works, it doesn't need to be nicely formatted).

Additional context

Add any other context about the problem here. I have a yellow name that I set using scoreboard commands: /scoreboard teams add MyTeam Yellow /scoreboard teams join MyTeam

You only look at the list of players, to get the tab you need:

 bot._client.on('player_info', (packet) => {
   console.log(packet)
 }

More details: https://wiki.vg/Protocol#Player_Info

That doesn't contain the player's name colour (or the content in the tab) either.

{
  action: 0,
  data: [
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: 'Bot',
      properties: [],
      gamemode: 0,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 0,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: 'GoogleSites',
      properties: [Array],
      gamemode: 1,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 0,
  data: [
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: 'Bot',
      properties: [],
      gamemode: 0,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 1,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    }
  ]
}
{
  action: 2,
  data: [
    {
      UUID: '2320b86e-ea7c-4d7c-a756-30ae86281d78',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    },
    {
      UUID: 'bb19ef2f-2f95-39a8-8bad-bda3ed373847',
      name: undefined,
      properties: undefined,
      gamemode: undefined,
      ping: 0,
      displayName: undefined
    }
  ]
}```

maybe check bot.players for their colored name?

bot.players doesn't have it either

rom1504 commented 3 years ago

Now done