Code Cleanup & Fix With Fly Unclaiming

This commit is contained in:
Driftay
2020-05-27 23:40:46 -04:00
parent 3e530487d7
commit e84c69f2b0
43 changed files with 1915 additions and 2292 deletions

View File

@@ -48,7 +48,8 @@ public class Econ {
}
econ = rsp.getProvider();
FactionsPlugin.getInstance().log("Economy integration through Vault plugin successful.");
if (!Conf.econEnabled) FactionsPlugin.getInstance().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
if (!Conf.econEnabled)
FactionsPlugin.getInstance().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
//FactionsPlugin.getInstance().cmdBase.cmdHelp.updateHelp();
}

View File

@@ -1,151 +1,129 @@
package com.massivecraft.factions.integration.dynmap;
import java.awt.Point;
import java.util.ArrayList;
import java.util.List;
import org.dynmap.markers.AreaMarker;
import org.dynmap.markers.MarkerSet;
public class TempAreaMarker
{
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* @author FactionsUUID Team
*/
public class TempAreaMarker {
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
/**
* @author FactionsUUID Team
*/
public String label;
public String world;
public double[] x;
public double[] z;
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private List<List<Point>> polyLine = new ArrayList<List<Point>>();
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 fillColor;
public double fillOpacity;
public boolean boost;
private List<List<Point>> polyLine = new ArrayList<List<Point>>();
public String description;
// -------------------------------------------- //
// CREATE
// -------------------------------------------- //
public int lineColor;
public double lineOpacity;
public int lineWeight;
public static boolean equals(AreaMarker marker, double[] x, double[] z) {
int length = marker.getCornerCount();
public int fillColor;
public double fillOpacity;
if (x.length != length) {
return false;
}
if (z.length != length) {
return false;
}
public boolean boost;
for (int i = 0; i < length; i++) {
if (marker.getCornerX(i) != x[i]) {
return false;
}
if (marker.getCornerZ(i) != z[i]) {
return false;
}
}
// -------------------------------------------- //
// CREATE
// -------------------------------------------- //
return true;
}
public static boolean equals(AreaMarker marker, double[] x, double[] z)
{
int length = marker.getCornerCount();
public List<List<Point>> getPolyLine() {
return polyLine;
}
if (x.length != length)
{
return false;
}
if (z.length != length)
{
return false;
}
public void setPolyLine(List<List<Point>> points) {
polyLine.clear();
polyLine.addAll(points);
}
for (int i = 0; i < length; i++)
{
if (marker.getCornerX(i) != x[i])
{
return false;
}
if (marker.getCornerZ(i) != z[i])
{
return false;
}
}
// -------------------------------------------- //
// UPDATE
// -------------------------------------------- //
return true;
}
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;
}
public void setPolyLine(List<List<Point>> points)
{
polyLine.clear();
polyLine.addAll(points);
}
int counter = 0;
public List<List<Point>> getPolyLine()
{
return polyLine;
}
// Description
ret.setDescription(this.description);
// -------------------------------------------- //
// UPDATE
// -------------------------------------------- //
// Line Style
ret.setLineStyle(0, 0, 0);
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;
}
// Fill Style
ret.setFillStyle(this.fillOpacity, this.fillColor);
int counter = 0;
// Boost Flag
ret.setBoostFlag(this.boost);
// Description
ret.setDescription(this.description);
return ret;
}
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
// Line Style
ret.setLineStyle(0, 0, 0);
public void update(AreaMarker marker) {
// Corner Locations
if (!equals(marker, this.x, this.z)) {
marker.setCornerLocations(this.x, this.z);
}
// Fill Style
ret.setFillStyle(this.fillOpacity, this.fillColor);
// Label
if (!marker.getLabel().equals(this.label)) {
marker.setLabel(this.label);
}
if (!marker.getDescription().equals(this.description)) {
marker.setDescription(this.description);
}
// Boost Flag
ret.setBoostFlag(this.boost);
// // Line Style
// if (marker.getLineWeight() != this.lineWeight || marker.getLineOpacity() != this.lineOpacity || marker.getLineColor() != this.lineColor)
// {
// marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
// }
return ret;
}
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
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);
}
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);
// }
// 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

@@ -1,62 +1,49 @@
package com.massivecraft.factions.integration.dynmap;
import java.awt.Point;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class TempLine
{
private Point p1;
private Point p2;
private List<TempLine> connectedLines = new ArrayList<TempLine>();
public class TempLine {
private Point p1;
private Point p2;
private List<TempLine> connectedLines = new ArrayList<TempLine>();
TempLine(Point p1, Point p2)
{
this.p1 = p1;
this.p2 = p2;
TempLine(Point p1, Point p2) {
this.p1 = p1;
this.p2 = p2;
}
public Point getP1() {
return p1;
}
public Point getP2() {
return p2;
}
public void addAdditionLines(List<TempLine> connectedLines) {
this.connectedLines = connectedLines;
}
public List<TempLine> getConnectedLines() {
return connectedLines;
}
@Override
public boolean equals(Object o) {
TempLine line = (TempLine) o;
if (line.p1.x == this.p1.x && line.p2.x == this.p2.x && line.p1.y == this.p1.y && line.p2.y == this.p2.y) {
return true;
}
return line.p1.x == this.p2.x && line.p2.x == this.p1.x && line.p1.y == this.p2.y && line.p2.y == this.p1.y;
}
public Point getP1()
{
return p1;
}
public Point getP2()
{
return p2;
}
public void addAdditionLines(List<TempLine> connectedLines)
{
this.connectedLines = connectedLines;
}
public List<TempLine> getConnectedLines()
{
return connectedLines;
}
@Override
public boolean equals(Object o)
{
TempLine line = (TempLine) o;
if (line.p1.x == this.p1.x && line.p2.x == this.p2.x && line.p1.y == this.p1.y && line.p2.y == this.p2.y)
{
return true;
}
if (line.p1.x == this.p2.x && line.p2.x == this.p1.x && line.p1.y == this.p2.y && line.p2.y == this.p1.y)
{
return true;
}
return false;
}
@Override
public int hashCode()
{
String test = "" + (p1.x + p2.x);
test += " " + (p1.y + p2.y);
return test.hashCode();
}
@Override
public int hashCode() {
String test = "" + (p1.x + p2.x);
test += " " + (p1.y + p2.y);
return test.hashCode();
}
}

View File

@@ -1,111 +1,99 @@
package com.massivecraft.factions.integration.dynmap;
import java.awt.Point;
import java.util.ArrayList;
import java.util.List;
import org.dynmap.markers.MarkerSet;
import org.dynmap.markers.PolyLineMarker;
public class TempPolyLineMarker
{
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* @author FactionsUUID Team
*/
public class TempPolyLineMarker {
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
/**
* @author FactionsUUID Team
*/
public String world;
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public List<Point> polyLine = new ArrayList<Point>();
public String world;
public int lineColor;
public double lineOpacity;
public int lineWeight;
public List<Point> polyLine = new ArrayList<Point>();
// -------------------------------------------- //
// CREATE
// -------------------------------------------- //
public int lineColor;
public double lineOpacity;
public int lineWeight;
public static boolean equals(PolyLineMarker marker, List<Point> points)
{
int length = marker.getCornerCount();
// -------------------------------------------- //
// CREATE
// -------------------------------------------- //
if (points.size() != length)
{
return false;
}
for (int i = 0; i < length; i++)
{
if (marker.getCornerX(i) != points.get(i).x)
{
return false;
}
if (marker.getCornerZ(i) != points.get(i).y)
{
return false;
}
}
public static boolean equals(PolyLineMarker marker, List<Point> points) {
int length = marker.getCornerCount();
return true;
}
if (points.size() != length) {
return false;
}
for (int i = 0; i < length; i++) {
if (marker.getCornerX(i) != points.get(i).x) {
return false;
}
if (marker.getCornerZ(i) != points.get(i).y) {
return false;
}
}
// -------------------------------------------- //
// UPDATE
// -------------------------------------------- //
return true;
}
public PolyLineMarker create(MarkerSet markerset, String markerId)
{
double[] polyX = new double[polyLine.size()];
double[] polyY = new double[polyLine.size()];
double[] polyZ = new double[polyLine.size()];
for (int i = 0; i < polyLine.size(); i++)
{
Point p = polyLine.get(i);
polyX[i] = p.getX();
polyY[i] = 64;
polyZ[i] = p.getY();
}
PolyLineMarker poly = markerset.createPolyLineMarker(markerId, "", false, this.world, polyX, polyY, polyZ, false);
// Poly Line Style
if (poly != null)
{
poly.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
}
return poly;
}
// -------------------------------------------- //
// UPDATE
// -------------------------------------------- //
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
public PolyLineMarker create(MarkerSet markerset, String markerId) {
double[] polyX = new double[polyLine.size()];
double[] polyY = new double[polyLine.size()];
double[] polyZ = new double[polyLine.size()];
for (int i = 0; i < polyLine.size(); i++) {
Point p = polyLine.get(i);
polyX[i] = p.getX();
polyY[i] = 64;
polyZ[i] = p.getY();
}
PolyLineMarker poly = markerset.createPolyLineMarker(markerId, "", false, this.world, polyX, polyY, polyZ, false);
// Poly Line Style
if (poly != null) {
poly.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
}
return poly;
}
public void update(PolyLineMarker marker)
{
// Corner Locations
if (!equals(marker, polyLine))
{
double[] polyX = new double[polyLine.size()];
double[] polyY = new double[polyLine.size()];
double[] polyZ = new double[polyLine.size()];
for (int i = 0; i < polyLine.size(); i++)
{
Point p = polyLine.get(i);
polyX[i] = p.getX();
polyY[i] = 64;
polyZ[i] = p.getY();
}
marker.setCornerLocations(polyX, polyY, polyZ);
marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
}
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
// Line Style
if (marker.getLineWeight() != this.lineWeight || marker.getLineOpacity() != this.lineOpacity || marker.getLineColor() != this.lineColor)
{
marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
}
public void update(PolyLineMarker marker) {
// Corner Locations
if (!equals(marker, polyLine)) {
double[] polyX = new double[polyLine.size()];
double[] polyY = new double[polyLine.size()];
double[] polyZ = new double[polyLine.size()];
for (int i = 0; i < polyLine.size(); i++) {
Point p = polyLine.get(i);
polyX[i] = p.getX();
polyY[i] = 64;
polyZ[i] = p.getY();
}
marker.setCornerLocations(polyX, polyY, polyZ);
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);
}
}
}