Skip to content

Commit 852c9e6

Browse files
committed
Add config for color
1 parent 4ab6774 commit 852c9e6

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group = "org.popcraft"
6-
version = "1.1.0"
6+
version = "1.1.1"
77

88
java {
99
toolchain {

src/main/java/org/popcraft/blueborder/BlueBorder.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,21 @@
1919
public 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)

src/main/resources/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
color: FF0000

0 commit comments

Comments
 (0)