Adds full configuration for quest area marker style

This commit is contained in:
2022-11-03 17:15:37 +01:00
parent 0cbc7ae1b2
commit ac5b82b3f1
5 changed files with 216 additions and 22 deletions

View File

@ -0,0 +1,130 @@
package net.knarcraft.dynmapcitizens.settings;
import org.bukkit.configuration.file.FileConfiguration;
/**
* Stores information about one kind of area marker
*/
public class AreaMarkerSettings {
private boolean enabled;
private int markerSetPriority;
private String markerSetId;
private String markerSetName;
private boolean markersHiddenByDefault;
private String fillColor;
private String lineColor;
private double fillOpacity;
private double lineOpacity;
private int lineThickness;
/**
* Loads all configuration values for one area marker
*
* @param fileConfiguration <p>The file configuration to load settings from</p>
* @param configRoot <p>The config root node containing all config values for one marker</p>
*/
public void load(FileConfiguration fileConfiguration, String configRoot) {
this.enabled = fileConfiguration.getBoolean(configRoot + ".enabled", false);
this.markerSetPriority = fileConfiguration.getInt(configRoot + ".markerSetPriority", 1);
this.markerSetId = fileConfiguration.getString(configRoot + ".markerSetId", null);
this.markerSetName = fileConfiguration.getString(configRoot + ".markerSetName", null);
this.markersHiddenByDefault = fileConfiguration.getBoolean(configRoot + ".markersHiddenByDefault", true);
this.fillColor = fileConfiguration.getString(configRoot + ".fillColor", null);
this.lineColor = fileConfiguration.getString(configRoot + ".lineColor", null);
this.fillOpacity = fileConfiguration.getDouble(configRoot + ".lineColor", 0.3);
this.lineOpacity = fileConfiguration.getDouble(configRoot + ".lineOpacity", 1.0);
this.lineThickness = fileConfiguration.getInt(configRoot + ".lineThickness", 2);
}
/**
* Gets whether the display of this type of area marker is disabled
*
* @return <p>True if this are marker type is disabled</p>
*/
public boolean isDisabled() {
return !this.enabled;
}
/**
* Gets the priority of this marker-set's markers (dynmap layer priority)
*
* @return <p>The priority of this marker set</p>
*/
public int getMarkerSetPriority() {
return this.markerSetPriority;
}
/**
* Gets the dynmap id of this marker set
*
* @return <p>The dynmap id of this marker set</p>
*/
public String getMarkerSetId() {
return this.markerSetId;
}
/**
* Gets the name of this marker set
*
* @return <p>The name of this marker set</p>
*/
public String getMarkerSetName() {
return this.markerSetName;
}
/**
* Gets whether this marker set should be hidden by default
*
* @return <p>Whether this marker set should be hidden by default</p>
*/
public boolean markersHiddenByDefault() {
return this.markersHiddenByDefault;
}
/**
* Gets the color of the filled-in area of this set's markers
*
* @return <p>The marker fill color</p>
*/
public String getFillColor() {
return this.fillColor;
}
/**
* Gets the color of the line around the filled-in area of this set's markers
*
* @return <p>The marker outline color</p>
*/
public String getLineColor() {
return this.lineColor;
}
/**
* Gets the opacity of the filled-in are of this set's markers
*
* @return <p>The opacity of the filled area</p>
*/
public double getFillOpacity() {
return this.fillOpacity;
}
/**
* Gets the opacity of the line around the filled-in area of this set's markers
*
* @return <p>The marker outline opacity</p>
*/
public double getLineOpacity() {
return this.lineOpacity;
}
/**
* Gets the thickness of the line around the filled-in area of this set's markers
*
* @return <p>The marker outline thickness</p>
*/
public int getLineThickness() {
return this.lineThickness;
}
}

View File

@ -11,6 +11,8 @@ public class QuestsSettings extends AbstractTraitSettings {
private boolean displayPlannerInfo;
private boolean displayStageInfo;
private boolean displayRequirementInfo;
private final AreaMarkerSettings killAreaSettings = new AreaMarkerSettings();
private final AreaMarkerSettings reachAreaSettings = new AreaMarkerSettings();
@Override
public void load(FileConfiguration configuration) {
@ -19,6 +21,8 @@ public class QuestsSettings extends AbstractTraitSettings {
this.displayPlannerInfo = configuration.getBoolean(getTraitConfigRoot() + ".displayPlannerInfo", true);
this.displayStageInfo = configuration.getBoolean(getTraitConfigRoot() + ".displayStageInfo", true);
this.displayRequirementInfo = configuration.getBoolean(getTraitConfigRoot() + ".displayRequirementInfo", true);
this.killAreaSettings.load(configuration, getTraitConfigRoot() + ".circleMarker.killMarker");
this.reachAreaSettings.load(configuration, getTraitConfigRoot() + ".circleMarker.reachMarker");
}
@Override
@ -62,4 +66,22 @@ public class QuestsSettings extends AbstractTraitSettings {
return this.displayRequirementInfo;
}
/**
* Gets settings for the kill area markers
*
* @return <p>Settings for the kill area markers</p>
*/
public AreaMarkerSettings getKillAreaSettings() {
return killAreaSettings;
}
/**
* Gets settings for the reach area markers
*
* @return <p>Settings for the reach area markers</p>
*/
public AreaMarkerSettings getReachAreaSettings() {
return reachAreaSettings;
}
}