#Send the name of the player who used the item in chat

4 messages · Page 1 of 1 (latest)

eternal geyser
#

I need a script that expands world border after using item and tells in chat the name of a player that used it. I did the first part about border, but idk how to send name of player

ItemEvents.rightClicked('kubejs:border_star', event => {
  event.item.count--
  event.server.runCommand('worldborder add 5')
  event.server.runCommand('tellraw @a "§bГраница мира расширенна!§r"')
})
acoustic burrowBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

regal marsh
# eternal geyser I need a script that expands world border after using item and tells in chat the...

you can get player name by event.player.displayName or event.player.name
you can also use server.tell to replace server.runCommand("tellraw")
And there's built-in Text class which makes creating chat component a lot easier

ItemEvents.rightClicked('kubejs:border_star', event => {
    const {item, server, player} = event
    item.shrink(1)
    server.runCommand('worldborder add 5')
    server.tell("§bГраница мира расширенна!§r")
    server.tell(
        Text.of("...")
        .append(Text.green(player.name))
        .append(Text.of("..."))
    )
})
eternal geyser