One Final Reformat

This commit is contained in:
Driftay
2019-08-24 13:21:39 -04:00
parent 72f76aeb71
commit 6a7258b692
53 changed files with 6311 additions and 6312 deletions

View File

@@ -3,105 +3,105 @@ package com.massivecraft.factions.integration.dynmap;
import com.massivecraft.factions.Conf;
public class DynmapStyle {
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public String lineColor = null;
public Double lineOpacity = null;
public Integer lineWeight = null;
public String fillColor = null;
public Double fillOpacity = null;
// NOTE: We just return the string here. We do not return the resolved Dynmap MarkerIcon object.
// The reason is we use this class in the MConf. For serialization to work Dynmap would have to be loaded and we can't require that.
// Using dynmap is optional.
public String homeMarker = null;
public Boolean boost = null;
public String lineColor = null;
public Double lineOpacity = null;
public Integer lineWeight = null;
public String fillColor = null;
public Double fillOpacity = null;
// NOTE: We just return the string here. We do not return the resolved Dynmap MarkerIcon object.
// The reason is we use this class in the MConf. For serialization to work Dynmap would have to be loaded and we can't require that.
// Using dynmap is optional.
public String homeMarker = null;
public Boolean boost = null;
@SafeVarargs
public static <T> T coalesce(T... items) {
for (T item : items) {
if (item != null) {
return item;
}
}
return null;
}
@SafeVarargs
public static <T> T coalesce(T... items) {
for (T item : items) {
if (item != null) {
return item;
}
}
return null;
}
public static int getColor(String string) {
int ret = 0x00FF00;
try {
ret = Integer.parseInt(string.substring(1), 16);
} catch (NumberFormatException ignored) {
}
return ret;
}
public static int getColor(String string) {
int ret = 0x00FF00;
try {
ret = Integer.parseInt(string.substring(1), 16);
} catch (NumberFormatException ignored) {
}
return ret;
}
public int getLineColor() {
return getColor(coalesce(this.lineColor, Conf.dynmapDefaultStyle.lineColor, Conf.DYNMAP_STYLE_LINE_COLOR));
}
public int getLineColor() {
return getColor(coalesce(this.lineColor, Conf.dynmapDefaultStyle.lineColor, Conf.DYNMAP_STYLE_LINE_COLOR));
}
public DynmapStyle setStrokeColor(String strokeColor) {
this.lineColor = strokeColor;
return this;
}
public DynmapStyle setStrokeColor(String strokeColor) {
this.lineColor = strokeColor;
return this;
}
public double getLineOpacity() {
return coalesce(this.lineOpacity, Conf.dynmapDefaultStyle.lineOpacity, Conf.DYNMAP_STYLE_LINE_OPACITY);
}
public double getLineOpacity() {
return coalesce(this.lineOpacity, Conf.dynmapDefaultStyle.lineOpacity, Conf.DYNMAP_STYLE_LINE_OPACITY);
}
public DynmapStyle setLineOpacity(Double strokeOpacity) {
this.lineOpacity = strokeOpacity;
return this;
}
public DynmapStyle setLineOpacity(Double strokeOpacity) {
this.lineOpacity = strokeOpacity;
return this;
}
public int getLineWeight() {
return coalesce(this.lineWeight, Conf.dynmapDefaultStyle.lineWeight, Conf.DYNMAP_STYLE_LINE_WEIGHT);
}
public int getLineWeight() {
return coalesce(this.lineWeight, Conf.dynmapDefaultStyle.lineWeight, Conf.DYNMAP_STYLE_LINE_WEIGHT);
}
public DynmapStyle setLineWeight(Integer strokeWeight) {
this.lineWeight = strokeWeight;
return this;
}
public DynmapStyle setLineWeight(Integer strokeWeight) {
this.lineWeight = strokeWeight;
return this;
}
public int getFillColor() {
return getColor(coalesce(this.fillColor, Conf.dynmapDefaultStyle.fillColor, Conf.DYNMAP_STYLE_FILL_COLOR));
}
public int getFillColor() {
return getColor(coalesce(this.fillColor, Conf.dynmapDefaultStyle.fillColor, Conf.DYNMAP_STYLE_FILL_COLOR));
}
public DynmapStyle setFillColor(String fillColor) {
this.fillColor = fillColor;
return this;
}
public DynmapStyle setFillColor(String fillColor) {
this.fillColor = fillColor;
return this;
}
public double getFillOpacity() {
return coalesce(this.fillOpacity, Conf.dynmapDefaultStyle.fillOpacity, Conf.DYNMAP_STYLE_FILL_OPACITY);
}
public double getFillOpacity() {
return coalesce(this.fillOpacity, Conf.dynmapDefaultStyle.fillOpacity, Conf.DYNMAP_STYLE_FILL_OPACITY);
}
public DynmapStyle setFillOpacity(Double fillOpacity) {
this.fillOpacity = fillOpacity;
return this;
}
public DynmapStyle setFillOpacity(Double fillOpacity) {
this.fillOpacity = fillOpacity;
return this;
}
public String getHomeMarker() {
return coalesce(this.homeMarker, Conf.dynmapDefaultStyle.homeMarker, Conf.DYNMAP_STYLE_HOME_MARKER);
}
public String getHomeMarker() {
return coalesce(this.homeMarker, Conf.dynmapDefaultStyle.homeMarker, Conf.DYNMAP_STYLE_HOME_MARKER);
}
public DynmapStyle setHomeMarker(String homeMarker) {
this.homeMarker = homeMarker;
return this;
}
public DynmapStyle setHomeMarker(String homeMarker) {
this.homeMarker = homeMarker;
return this;
}
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
public boolean getBoost() {
return coalesce(this.boost, Conf.dynmapDefaultStyle.boost, Conf.DYNMAP_STYLE_BOOST);
}
public boolean getBoost() {
return coalesce(this.boost, Conf.dynmapDefaultStyle.boost, Conf.DYNMAP_STYLE_BOOST);
}
public DynmapStyle setBoost(Boolean boost) {
this.boost = boost;
return this;
}
public DynmapStyle setBoost(Boolean boost) {
this.boost = boost;
return this;
}
}

View File

@@ -4,113 +4,113 @@ import org.dynmap.markers.AreaMarker;
import org.dynmap.markers.MarkerSet;
public class TempAreaMarker {
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public String label;
public String world;
public double[] x;
public double[] z;
public String description;
public String label;
public String world;
public double[] x;
public double[] z;
public String description;
public int lineColor;
public double lineOpacity;
public int lineWeight;
public int lineColor;
public double lineOpacity;
public int lineWeight;
public int fillColor;
public double fillOpacity;
public int fillColor;
public double fillOpacity;
public boolean boost;
public boolean boost;
// -------------------------------------------- //
// CREATE
// -------------------------------------------- //
// -------------------------------------------- //
// CREATE
// -------------------------------------------- //
public static boolean equals(AreaMarker marker, double[] x, double[] z) {
int length = marker.getCornerCount();
public static boolean equals(AreaMarker marker, double[] x, double[] z) {
int length = marker.getCornerCount();
if (x.length != length) {
return false;
}
if (z.length != length) {
return false;
}
if (x.length != length) {
return false;
}
if (z.length != length) {
return false;
}
for (int i = 0; i < length; i++) {
if (marker.getCornerX(i) != x[i]) {
return false;
}
if (marker.getCornerZ(i) != z[i]) {
return false;
}
}
for (int i = 0; i < length; i++) {
if (marker.getCornerX(i) != x[i]) {
return false;
}
if (marker.getCornerZ(i) != z[i]) {
return false;
}
}
return true;
}
return true;
}
// -------------------------------------------- //
// UPDATE
// -------------------------------------------- //
// -------------------------------------------- //
// UPDATE
// -------------------------------------------- //
public AreaMarker create(MarkerSet markerset, String markerId) {
AreaMarker ret = markerset.createAreaMarker(markerId, this.label, false, this.world, this.x, this.z, false // not persistent
);
public AreaMarker create(MarkerSet markerset, String markerId) {
AreaMarker ret = markerset.createAreaMarker(markerId, this.label, false, this.world, this.x, this.z, false // not persistent
);
if (ret == null) {
return null;
}
if (ret == null) {
return null;
}
// Description
ret.setDescription(this.description);
// Description
ret.setDescription(this.description);
// Line Style
ret.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
// Line Style
ret.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
// Fill Style
ret.setFillStyle(this.fillOpacity, this.fillColor);
// Fill Style
ret.setFillStyle(this.fillOpacity, this.fillColor);
// Boost Flag
ret.setBoostFlag(this.boost);
// Boost Flag
ret.setBoostFlag(this.boost);
return ret;
}
return ret;
}
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
public void update(AreaMarker marker) {
// Corner Locations
if (!equals(marker, this.x, this.z)) {
marker.setCornerLocations(this.x, this.z);
}
public void update(AreaMarker marker) {
// Corner Locations
if (!equals(marker, this.x, this.z)) {
marker.setCornerLocations(this.x, this.z);
}
// Label
if (!marker.getLabel().equals(this.label)) {
marker.setLabel(this.label);
}
// Label
if (!marker.getLabel().equals(this.label)) {
marker.setLabel(this.label);
}
// Description
if (!marker.getDescription().equals(this.description)) {
marker.setDescription(this.description);
}
// Description
if (!marker.getDescription().equals(this.description)) {
marker.setDescription(this.description);
}
// Line Style
if (marker.getLineWeight() != this.lineWeight ||
marker.getLineOpacity() != this.lineOpacity ||
marker.getLineColor() != this.lineColor) {
marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
}
// Line Style
if (marker.getLineWeight() != this.lineWeight ||
marker.getLineOpacity() != this.lineOpacity ||
marker.getLineColor() != this.lineColor) {
marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
}
// Fill Style
if ((marker.getFillOpacity() != this.fillOpacity) || (marker.getFillColor() != this.fillColor)) {
marker.setFillStyle(this.fillOpacity, this.fillColor);
}
// Boost Flag
if (marker.getBoostFlag() != this.boost) {
marker.setBoostFlag(this.boost);
}
}
// Fill Style
if ((marker.getFillOpacity() != this.fillOpacity) || (marker.getFillColor() != this.fillColor)) {
marker.setFillStyle(this.fillOpacity, this.fillColor);
}
// Boost Flag
if (marker.getBoostFlag() != this.boost) {
marker.setBoostFlag(this.boost);
}
}
}

View File

@@ -7,68 +7,68 @@ import org.dynmap.markers.MarkerIcon;
import org.dynmap.markers.MarkerSet;
public class TempMarker {
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public String label;
public String world;
public double x;
public double y;
public double z;
public String iconName;
public String description;
public String label;
public String world;
public double x;
public double y;
public double z;
public String iconName;
public String description;
// -------------------------------------------- //
// CREATE
// -------------------------------------------- //
// -------------------------------------------- //
// CREATE
// -------------------------------------------- //
public static MarkerIcon getMarkerIcon(MarkerAPI markerApi, String name) {
MarkerIcon ret = markerApi.getMarkerIcon(name);
if (ret == null) {
ret = markerApi.getMarkerIcon(Conf.DYNMAP_STYLE_HOME_MARKER);
}
return ret;
}
public static MarkerIcon getMarkerIcon(MarkerAPI markerApi, String name) {
MarkerIcon ret = markerApi.getMarkerIcon(name);
if (ret == null) {
ret = markerApi.getMarkerIcon(Conf.DYNMAP_STYLE_HOME_MARKER);
}
return ret;
}
// -------------------------------------------- //
// UPDATE
// -------------------------------------------- //
// -------------------------------------------- //
// UPDATE
// -------------------------------------------- //
public Marker create(MarkerAPI markerApi, MarkerSet markerset, String markerId) {
Marker ret = markerset.createMarker(markerId, this.label, this.world, this.x, this.y, this.z, getMarkerIcon(markerApi, this.iconName), false // not persistent
);
public Marker create(MarkerAPI markerApi, MarkerSet markerset, String markerId) {
Marker ret = markerset.createMarker(markerId, this.label, this.world, this.x, this.y, this.z, getMarkerIcon(markerApi, this.iconName), false // not persistent
);
if (ret == null) {
return null;
}
if (ret == null) {
return null;
}
ret.setDescription(this.description);
ret.setDescription(this.description);
return ret;
}
return ret;
}
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
public void update(MarkerAPI markerApi, Marker marker) {
if (!this.world.equals(marker.getWorld()) || this.x != marker.getX() || this.y != marker.getY() || this.z != marker.getZ()) {
marker.setLocation(this.world, this.x, this.y, this.z);
}
public void update(MarkerAPI markerApi, Marker marker) {
if (!this.world.equals(marker.getWorld()) || this.x != marker.getX() || this.y != marker.getY() || this.z != marker.getZ()) {
marker.setLocation(this.world, this.x, this.y, this.z);
}
if (!marker.getLabel().equals(this.label)) {
marker.setLabel(this.label);
}
if (!marker.getLabel().equals(this.label)) {
marker.setLabel(this.label);
}
MarkerIcon icon = getMarkerIcon(markerApi, this.iconName);
if (marker.getMarkerIcon() == null || marker.getMarkerIcon().equals(icon)) {
marker.setMarkerIcon(icon);
}
MarkerIcon icon = getMarkerIcon(markerApi, this.iconName);
if (marker.getMarkerIcon() == null || marker.getMarkerIcon().equals(icon)) {
marker.setMarkerIcon(icon);
}
if (!marker.getDescription().equals(this.description)) {
marker.setDescription(this.description);
}
}
if (!marker.getDescription().equals(this.description)) {
marker.setDescription(this.description);
}
}
}

View File

@@ -5,51 +5,51 @@ import org.dynmap.markers.MarkerSet;
public class TempMarkerSet {
public String label;
public int minimumZoom;
public int priority;
public boolean hideByDefault;
public String label;
public int minimumZoom;
public int priority;
public boolean hideByDefault;
public MarkerSet create(MarkerAPI markerApi, String id) {
MarkerSet ret = markerApi.createMarkerSet(id, this.label, null, false); // ("null, false" at the end means "all icons allowed, not perisistent")
public MarkerSet create(MarkerAPI markerApi, String id) {
MarkerSet ret = markerApi.createMarkerSet(id, this.label, null, false); // ("null, false" at the end means "all icons allowed, not perisistent")
if (ret == null) {
return null;
}
if (ret == null) {
return null;
}
// Minimum Zoom
if (this.minimumZoom > 0) {
ret.setMinZoom(this.minimumZoom);
}
// Minimum Zoom
if (this.minimumZoom > 0) {
ret.setMinZoom(this.minimumZoom);
}
// Priority
ret.setLayerPriority(this.priority);
// Priority
ret.setLayerPriority(this.priority);
// Hide by Default
ret.setHideByDefault(this.hideByDefault);
// Hide by Default
ret.setHideByDefault(this.hideByDefault);
return ret;
}
return ret;
}
public void update(MarkerSet markerset) {
// Name
if (!markerset.getMarkerSetLabel().equals(this.label)) {
markerset.setMarkerSetLabel(this.label);
}
public void update(MarkerSet markerset) {
// Name
if (!markerset.getMarkerSetLabel().equals(this.label)) {
markerset.setMarkerSetLabel(this.label);
}
if (this.minimumZoom > 0) {
if (markerset.getMinZoom() != this.minimumZoom) {
markerset.setMinZoom(this.minimumZoom);
}
}
if (this.minimumZoom > 0) {
if (markerset.getMinZoom() != this.minimumZoom) {
markerset.setMinZoom(this.minimumZoom);
}
}
if (markerset.getLayerPriority() != this.priority) {
markerset.setLayerPriority(this.priority);
}
if (markerset.getLayerPriority() != this.priority) {
markerset.setLayerPriority(this.priority);
}
if (markerset.getHideByDefault() != this.hideByDefault) {
markerset.setHideByDefault(this.hideByDefault);
}
}
if (markerset.getHideByDefault() != this.hideByDefault) {
markerset.setHideByDefault(this.hideByDefault);
}
}
}