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.
Best Answer
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:
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:
Usage
To display the diameter of the worldborder square (edge to edge):
To display the distance from the midpoint of an edge of the WB square to the centre of the square:
Expected Result of Samples
or
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
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.
Add a scoreboard objective named
constants
to the scoreboard.Set fake player
2
's score of objectiveconstants
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
Run
/worldborder get
and store it in fake playerwb
's score of objectiveborder
.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.Divide fake player
wb
's score of objectiveborder
by fake player2
's score of objectiveconstants
. 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 objectiveborder
is now the radius.Tell all players
wb
's score of objectiveborder
.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.