4

I would like to know if it is possible to have my auto message plugin display current world border size. It will shrink from a diameter of 20000 to 213 at a rate of 34 meters per hour. So occasionally players should get a message like: Warning! The world border is shrinking! Worldborder is currently 18354 meters from spawn. And the number would be in the next message eg. 18320 and gradually getting smaller.

Does anyone know if this even possible? I don't know if auto message plugin can deliver other placeholders than its own.

I am using an automessage by ELCHILEN096 dev.bukkit.org/projects/automessage If you know any better up to date plugin like this one, or that supports papi and can put any placeholder in the message, if happy to hear one.

EDIT: I have come to a partial solution on this issue. My current solution is to have automessage tell a message that runs a command "/worldborder get" by the player when clicked the text. also added a permission minecraft.command.worldborder.get to let them run the command.

I am still looking for a placeholder type of result without the player having to click the text to get the information.

8
  • There are several AutoMessage plugins out there. Can yours make use of commands? Or if you don't know, please post a link to your plugin.
    – dly
    Jun 7 '19 at 17:00
  • Mine uses JSON as a language and player can interact with it. Like, run a command after clicking the text.
    – Roopekoo
    Jun 7 '19 at 20:25
  • 1
    I'm not too familiar with that one and can't test it right now, but you could probably make a clickable Text and run /execute @s worldborder get or if you really need a custom message you'll probably need a scoreboard value.
    – dly
    Jun 7 '19 at 20:42
  • Does it need to be the plugin that does it? You can just use /execute store result score #border border run worldborder get in Vanilla (after creating the "border" scoreboard) and then display that using e.g. /tellraw, /title or whatever. Jun 7 '19 at 22:07
  • @dly I have made this somewhat working thanks to user dly for the command suggestion. Now there is a text warning about shrinking worldborder. When it is clicked player runs unknowingly a command "/worldborder get" and with a permission minecraft.command.worldborder.get they can run the command.
    – Roopekoo
    Jun 7 '19 at 23:09
4

This answer works on 1.13+. It does not use a plugin, and is much simpler, and better for your use.

Setup

Run the following command one time:

/scoreboard objectives add border

Additionally, if you are planning to display the radius of the WB square (midpoint of edge to centre) instead of the diameter (length of edge), you must also run the following commands one time each in order:

/scoreboard objectives add constants
/scoreboard players set 2 constants 2

Usage

To display the diameter of the worldborder square (edge to edge):

/execute store result score wb border run worldborder get
/tellraw @a [{"text":"Warning!","color":"red","bold":true}, {"text":" The world border is shrinking. Currently "}, {"score":{"name":"wb","objective":"wb"}}, {"text":" wide."}]

To display the distance from the midpoint of an edge of the WB square to the centre of the square:

/execute store result score wb border run worldborder get
/scoreboard players operation wb border /= 2 constants
/tellraw @a [{"text":"Warning!","color":"red","bold":true}, {"text":" The world border is shrinking. Currently at radius of "}, {"score":{"name":"wb","objective":"border"}}, {"text":"."}]

Expected Result of Samples

Warning! The worldborder is shrinking. Currently XXXXX blocks wide.

or

Warning! The worldborder is shrinking. Currently at radius of XXXXX.

Both results are displayed in RED.

How it Works

Learn how your Minecraft commands work in this section so you can apply them to other uses! If you only plan on this one use of the commands, feel free to skip this section.

Setup Commands

/scoreboard objectives add border

Add a scoreboard objective named border to the scoreboard.

The first command adds a scoreboard objective to the scoreboard. This acts as the area for the variable where the worldborder diameter is stored.

/scoreboard objectives add constants
/scoreboard players set 2 constants 2

Add a scoreboard objective named constants to the scoreboard.
Set fake player 2's score of objective constants to 2.

These commands add another objective to the scoreboard. These are more variables that are always set to a constant number. You'll need this to calculate the radius, because math operations can only be performed on existing variables, not constant numbers.

Usage Commands

/execute store result score wb border run worldborder get

Run /worldborder get and store it in fake player wb's score of objective border.

Place the worldborder diameter in the scoreboard space we reserved for it earlier. This lets us access it from the JSON text in the tellraw command later.

/scoreboard players operation wb border /= 2 constants

Divide fake player wb's score of objective border by fake player 2's score of objective constants. Overwrite the score where we got the dividend from with the result of the division.

This command will divide the diameter by 2 to give us the radius. The diameter will be overwritten by the result of this division, meaning fake player wb's score of objective border is now the radius.

/tellraw @a [{"score":{"name":"wb","objective":"border"}}]

Tell all players wb's score of objective border.

This command will print the world border diameter or radius (depending on which commands you executed before) as a message to all players. Add more components to this to change the formatting of the text, or add text before and after.

-3

Using the scoreboard command is a popular way to do this, however you will need to create a data pack or command block creation in order to store to and read from it, as well as the plugin won't be able to access these values, unless you directly modify it yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.