1919public final class BlueBorder extends JavaPlugin {
2020 private static final String MARKER_SET_ID = "worldborder" ;
2121 private static final String LABEL = "World border" ;
22+ private static final String DEFAULT_COLOR = "FF0000" ;
23+ private Color color ;
2224
2325 @ Override
2426 public void onEnable () {
27+ getConfig ().options ().copyDefaults (true );
28+ saveConfig ();
29+ reloadOptions ();
2530 BlueMapAPI .onEnable (this ::addWorldBorders );
2631 BlueMapAPI .onDisable (this ::removeWorldBorders );
2732 }
2833
2934 @ Override
3035 public boolean onCommand (CommandSender sender , Command command , String label , String [] args ) {
36+ reloadOptions ();
3137 BlueMapAPI .getInstance ().ifPresent (this ::removeWorldBorders );
3238 BlueMapAPI .getInstance ().ifPresent (this ::addWorldBorders );
3339 return true ;
@@ -38,6 +44,11 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
3844 return Collections .emptyList ();
3945 }
4046
47+ private void reloadOptions () {
48+ reloadConfig ();
49+ color = new Color (Integer .parseInt (getConfig ().getString ("color" , DEFAULT_COLOR ).toLowerCase (), 16 ), 1f );
50+ }
51+
4152 private void addWorldBorders (BlueMapAPI blueMapAPI ) {
4253 for (final World world : getServer ().getWorlds ()) {
4354 final MarkerSet markerSet = MarkerSet .builder ().label (LABEL ).build ();
@@ -51,7 +62,7 @@ private void addWorldBorders(BlueMapAPI blueMapAPI) {
5162 final ShapeMarker marker = ShapeMarker .builder ()
5263 .label (LABEL )
5364 .shape (border , world .getSeaLevel ())
54- .lineColor (new Color ( 0xFF0000 , 1f ) )
65+ .lineColor (color )
5566 .fillColor (new Color (0 ))
5667 .lineWidth (3 )
5768 .depthTestEnabled (false )
0 commit comments