Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.bukkit.configuration.file.FileConfiguration;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -53,6 +52,10 @@ public synchronized Color defaultOutlineColor() {
return new Color("#" + rgb);
}

public synchronized int defaultOutlineWidth() {
return config.getInt("defaultOutlineWidth", 2);
}

public synchronized String markerSetName() {
return config.getString("markerSetName", "Undefined (Check BlueBridge addon config)");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ private void addToMarkerSet(MarkerSet ms, RegionSnapshot rs, Shape shape, Vector
.label(StringEscapeUtils.escapeHtml4(rs.getShortName()))
.detail(rs.getHtmlDisplay())
.lineColor(rs.getBorderColor())
.lineWidth(rs.getOutlineWidth())
.fillColor(rs.getColor())
.depthTestEnabled(rs.getDepthCheck())
.build();
Expand All @@ -116,6 +117,7 @@ private void addToMarkerSet(MarkerSet ms, RegionSnapshot rs, Shape shape, Vector
.label(StringEscapeUtils.escapeHtml4(rs.getShortName()))
.detail(rs.getHtmlDisplay())
.lineColor(rs.getBorderColor())
.lineWidth(rs.getOutlineWidth())
.fillColor(rs.getColor())
.depthTestEnabled(rs.getDepthCheck())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class RegionSnapshot {
private List<Vector2d> points;
private Color color = new Color(0, 0, 0);
private Color borderColor = new Color(0, 0, 0);
private int outlineWidth = 2;
private double minDistance;
private double maxDistance;

Expand Down Expand Up @@ -81,6 +82,10 @@ public Color getBorderColor() {
return borderColor;
}

public int getOutlineWidth() {
return outlineWidth;
}

public double getMinDistance() {
return minDistance;
}
Expand Down Expand Up @@ -126,6 +131,10 @@ public void setBorderColor(Color borderColor) {
this.borderColor = borderColor;
}

public void setOutlineWidth(int outlineWidth) {
this.outlineWidth = outlineWidth;
}

public void setMinDistance(double minDistance) {
this.minDistance = minDistance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ private void prefillDefaults() {
region.setDepthCheck(cfg.defaultDepthCheck());
region.setColor(cfg.defaultColor());
region.setBorderColor(cfg.defaultOutlineColor());
region.setOutlineWidth(cfg.defaultOutlineWidth());
region.setMinDistance(cfg.minDistance());
region.setMaxDistance(cfg.maxDistance());

Expand Down Expand Up @@ -75,6 +76,11 @@ public RegionSnapshotBuilder setBorderColor(Color color) {
return this;
}

public RegionSnapshotBuilder setOutlineWidth(int outlineWidth) {
region.setOutlineWidth(outlineWidth);
return this;
}

public RegionSnapshotBuilder setMinDistance(double minDistance) {
region.setMinDistance(minDistance);
return this;
Expand Down
2 changes: 2 additions & 0 deletions BlueBridgeCore/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ maxDistance: -1
defaultColor: "0087ff96"
defaultOutlineColor: "0060ff"

defaultOutlineWidth: 2

# Uncomment this section to exclude BlueMap maps from rendering regions.
# You can also add this list to the addon configs to block only their regions from appearing on a map. The two lists (addon specific and BlueBridgeCore) will be merged.
# excludedMaps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class WorldGuardIntegration {
public static StateFlag EXTRUDE_FLAG;
public static StringFlag COLOR_FLAG;
public static StringFlag OUTLINE_FLAG;
public static IntegerFlag OUTLINE_WIDTH_FLAG;
public static StringFlag DISPLAY_FLAG;
public static DoubleFlag MAX_DISTANCE_FLAG;
public static DoubleFlag MIN_DISTANCE_FLAG;
Expand All @@ -55,15 +56,17 @@ public boolean init() {
StateFlag extrudeFlag = new StateFlag("bluemap-extrude", false);
StringFlag colorFlag = new StringFlag("bluemap-color", Integer.toHexString(BlueBridgeUtils.colorToInt(BlueBridgeWGConfig.getInstance().defaultColor())));
StringFlag outlineFlag = new StringFlag("bluemap-color-outline", Integer.toHexString(BlueBridgeUtils.colorToInt(BlueBridgeWGConfig.getInstance().defaultOutlineColor())).substring(2));
IntegerFlag outlineWidthFlag = new IntegerFlag("bluemap-outline-width");
StringFlag displayFlag = new StringFlag("bluemap-display");
DoubleFlag maxDistanceFlag = new DoubleFlag("bluemap-max-distance");
DoubleFlag minDistanceFlag = new DoubleFlag("bluemap-min-distance");
flags.registerAll(Arrays.asList(new Flag[]{renderFlag, depthCheckFlag, heightFlag, extrudeFlag, colorFlag, outlineFlag, displayFlag, maxDistanceFlag, minDistanceFlag}));
flags.registerAll(Arrays.asList(new Flag[]{renderFlag, depthCheckFlag, heightFlag, extrudeFlag, colorFlag, outlineFlag, outlineWidthFlag, displayFlag, maxDistanceFlag, minDistanceFlag}));
RENDER_FLAG = renderFlag;
HEIGHT_FLAG = heightFlag;
EXTRUDE_FLAG = extrudeFlag;
COLOR_FLAG = colorFlag;
OUTLINE_FLAG = outlineFlag;
OUTLINE_WIDTH_FLAG = outlineWidthFlag;
DISPLAY_FLAG = displayFlag;
DEPTH_CHECK_FLAG = depthCheckFlag;
MAX_DISTANCE_FLAG = maxDistanceFlag;
Expand All @@ -88,7 +91,7 @@ public List<RegionSnapshot> getAllRegions(UUID worldUUID) {

if (bukkitWorld == null) {
BlueBridgeWG.getInstance().getLogger().warning("World " + worldUUID.toString() + " not found! Please check your Bluemap config for invalid worlds!");
return new ArrayList<RegionSnapshot>();
return new ArrayList<>();
}

World w = BukkitAdapter.adapt(bukkitWorld);
Expand All @@ -104,19 +107,25 @@ public List<RegionSnapshot> getAllRegions(UUID worldUUID) {
List<Vector2d> points = getPointsForRegion(pr);
//Convert color flags to Color Objects, if applicable
String color = pr.getFlag(COLOR_FLAG);
Color colorRGBA = null;
Color colorRGBA;
if (color != null && hexPatternRGBA.matcher(color).matches()) {
colorRGBA = new Color("#" + color);
} else {
colorRGBA = BlueBridgeWGConfig.getInstance().defaultColor();
}
String bordercolor = pr.getFlag(OUTLINE_FLAG);
Color colorRGB = null;
Color colorRGB;
if (bordercolor != null && hexPatternRGB.matcher(bordercolor).matches()) {
colorRGB = new Color("#" + bordercolor);
} else {
colorRGB = BlueBridgeWGConfig.getInstance().defaultOutlineColor();
}

int outlineWidth = pr.getFlag(OUTLINE_WIDTH_FLAG) != null ? pr.getFlag(OUTLINE_WIDTH_FLAG) : BlueBridgeWGConfig.getInstance().defaultOutlineWidth();
if (outlineWidth <= 0) {
outlineWidth = BlueBridgeWGConfig.getInstance().defaultOutlineWidth();
}

StateFlag.State depthCheckVal = pr.getFlag(DEPTH_CHECK_FLAG);
boolean depthCheck = depthCheckVal != null ? depthCheckVal == StateFlag.State.ALLOW : BlueBridgeWGConfig.getInstance().defaultDepthCheck();

Expand All @@ -142,6 +151,7 @@ public List<RegionSnapshot> getAllRegions(UUID worldUUID) {
.setDepthCheck(depthCheck)
.setColor(colorRGBA)
.setBorderColor(colorRGB)
.setOutlineWidth(outlineWidth)
.setMaxDistance(maxDistance)
.setMinDistance(minDistance)
.build();
Expand Down