Worldborder coordinates into scoreboard objective

How can I have the worldborder coordinates into some scoreboard objectives? If it's not possible in vanilla it's not a problem to use a plugin.
Best Answer
The solution is quite similar to this answer I gave a while ago, but of course with some slight changes.
First things first, you need a 20Hz fill clock. How to make one isn't exactly within the scope of this question.
Next, you'll need a scoreboard objective to hold the current world border size:
/scoreboard objectives add BorderQuery dummy
You'll also need an empty player that will keep track of day time:
/scoreboard players set #BorderPlayer BorderQuery 0
The first command block to be triggered by the fill clock should query the border size from the game:
worldborder get
We need to redirect the result of command block to the scoreboard objective we set up earlier. Turn off the fill clock, stand directly on the command block, and enter this command:
/stats block ~ ~-1 ~ set QueryResult #BorderPlayer BorderQuery
The fake #BorderPlayer
now stores the world border size in his BorderQuery
objective. From there, you can test the objective, and with some more work, perform an operation on it.
If you need to do operations with the objective, it may be better to set the objective for @a
(instead of just #BorderPlayer
) in the stats
command. Additionally, everyone will need the objective active.
Pictures about "Worldborder coordinates into scoreboard objective"



How do you add a scoreboard to an objective?
Scoreboard CommandHow do you teleport to a scoreboard in Minecraft?
Setting Up A World BorderMinecraft 1.12 - Getting the Coordinates of an Entity into Scoreboard Objectives
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Engin Akyurt, Anna Tarazevich, Pixabay, Pixabay