9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2026-01-04 15:31:38 +00:00

Add option to set opacity and line opacity on dynmap

This commit is contained in:
SamB440
2023-05-21 13:29:14 +01:00
parent 7d15928b57
commit aed2c49717
2 changed files with 12 additions and 2 deletions

View File

@@ -75,6 +75,7 @@ public class ConfiguredRegion {
@EditableField(material = Material.NETHER_STAR, name = "Set teleport cost", description = "Set the cost for teleportation")
private double teleportCost;
private boolean showActionbar;
private double opacity, lineOpacity;
@EditableField(material = Material.RED_DYE, name = "Hex display colour", description = "Set the colour of the region. It is a hex colour (e.g 0x42f4f1 for red) and is used in dynmap.")
private final String colour;
private final String lineColour;
@@ -107,6 +108,7 @@ public class ConfiguredRegion {
this.teleportCooldown = 0;
this.teleportCost = 0.00;
this.showActionbar = true;
this.opacity = this.lineOpacity = 0.5;
this.colour = String.valueOf(13369344);
this.lineColour = String.valueOf(13369344);
this.dynmap = true;
@@ -384,11 +386,19 @@ public class ConfiguredRegion {
return RPGRegionsAPI.getAPI().getManagers().getIntegrationManager().getBoundingBoxPoints(this);
}
public double getOpacity() {
return opacity;
}
public String getColour() {
if (colour == null) return "0";
return colour;
}
public double getLineOpacity() {
return lineOpacity;
}
public String getLineColour() {
if (lineColour == null) return "0";
return lineColour;

View File

@@ -50,8 +50,8 @@ public class DynmapTask implements Runnable {
am.setCornerLocations(x, z);
am.setLabel(region.getCustomName(), true);
if (!region.getColour().equals("0")) am.setFillStyle(0.5, Integer.parseInt(region.getColour()));
if (!region.getLineColour().equals("0")) am.setLineStyle(1, 0.5, Integer.parseInt(region.getLineColour()));
if (!region.getColour().equals("0")) am.setFillStyle(region.getOpacity(), Integer.parseInt(region.getColour()));
if (!region.getLineColour().equals("0")) am.setLineStyle(1, region.getLineOpacity(), Integer.parseInt(region.getLineColour()));
am.setDescription("<b>" + region.getCustomName() + "</b>");
});
}