java - Set world border to 400 blocks -


i set world border 400 blocks when server starts, players can't go out of map far.

how can achieve this? can't find way myself.

to world, use bukkit.getworld(worldname). so, world "world" (the default world), use:

world world = bukkit.getworld("world"); 

then, worldborder of world, can use getworldborder():

worldborder border = world.getworldborder(); 

then, can modify world have side length of 400 blocks using:

border.setsize(400.0); 

and set center location @ x = 0 , z = 0 using

border.setcenter(0.0, 0.0); 

so, code in onenable() method in main class (the 1 extends javaplugin) this:

world world = bukkit.getworld("world");  worldborder border = world.getworldborder(); border.setsize(400.0); border.setcenter(0.0, 0.0); 

if border 400 blocks in every direction, should set size 800.0 instead of 400.0.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -