Skip to content

Add label to config #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/main/java/org/popcraft/blueborder/BlueBorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@

public final class BlueBorder extends JavaPlugin {
private static final String MARKER_SET_ID = "worldborder";
private static final String LABEL = "World border";
private static final String DEFAULT_LABEL = "World border";
private static final String DEFAULT_COLOR = "FF0000";
private Color color;
private String label;

@Override
public void onEnable() {
Expand All @@ -47,11 +48,12 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
private void reloadOptions() {
reloadConfig();
color = new Color(Integer.parseInt(getConfig().getString("color", DEFAULT_COLOR).toLowerCase(), 16), 1f);
label = getConfig().getString("label", DEFAULT_LABEL);
}

private void addWorldBorders(BlueMapAPI blueMapAPI) {
for (final World world : getServer().getWorlds()) {
final MarkerSet markerSet = MarkerSet.builder().label(LABEL).build();
final MarkerSet markerSet = MarkerSet.builder().label(label).build();
final WorldBorder worldBorder = world.getWorldBorder();
final double centerX = worldBorder.getCenter().getX();
final double centerZ = worldBorder.getCenter().getZ();
Expand All @@ -60,7 +62,7 @@ private void addWorldBorders(BlueMapAPI blueMapAPI) {
final Vector2d pos2 = new Vector2d(centerX + radius, centerZ + radius);
final Shape border = Shape.createRect(pos1, pos2);
final ShapeMarker marker = ShapeMarker.builder()
.label(LABEL)
.label(label)
.shape(border, world.getSeaLevel())
.lineColor(color)
.fillColor(new Color(0))
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
label: World border
color: FF0000