Fixed lombok building (javadoc) & fixed equals() and toString() methods
This commit is contained in:
parent
27bf53aaad
commit
13b5ab69a2
28 changed files with 374 additions and 354 deletions
24
pom.xml
24
pom.xml
|
@ -60,6 +60,30 @@
|
|||
<compilerArgument>-parameters</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok-maven-plugin</artifactId>
|
||||
<version>1.18.10.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>delombok</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<sourceFileIncludes>
|
||||
<include>nl/SBDeveloper/V10Lift/API/*.java</include>
|
||||
<include>nl/SBDeveloper/V10Lift/API/Objects/*.java</include>
|
||||
</sourceFileIncludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
public class Floor {
|
||||
private String world;
|
||||
private int y;
|
||||
private ArrayList<LiftBlock> doorBlocks = new ArrayList<>();
|
||||
private HashSet<UUID> whitelist = new HashSet<>();
|
||||
|
||||
public Floor(int y, String world) {
|
||||
this.y = y;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null) return false;
|
||||
if (getClass() != obj.getClass()) return false;
|
||||
Floor other = (Floor) obj;
|
||||
if (getWorld() == null) {
|
||||
if (other.getWorld() != null) return false;
|
||||
} else if (!getWorld().equals(other.getWorld())) {
|
||||
return false;
|
||||
}
|
||||
return getY() == other.getY();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
String newLine = System.getProperty("line.separator");
|
||||
|
||||
result.append(this.getClass().getName());
|
||||
result.append(" Object {");
|
||||
result.append(newLine);
|
||||
|
||||
//determine fields declared in this class only (no fields of superclass)
|
||||
Field[] fields = this.getClass().getDeclaredFields();
|
||||
|
||||
//print field names paired with their values
|
||||
for (Field field: fields) {
|
||||
result.append(" ");
|
||||
try {
|
||||
result.append(field.getName());
|
||||
result.append(": ");
|
||||
//requires access to private field:
|
||||
result.append(field.get(this));
|
||||
} catch (IllegalAccessException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
result.append(newLine);
|
||||
}
|
||||
result.append("}");
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import nl.SBDeveloper.V10Lift.API.Runnables.DoorCloser;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
public class Lift {
|
||||
@Getter @Setter private String worldName;
|
||||
@Getter @Setter private int y;
|
||||
@Getter private HashSet<UUID> owners;
|
||||
//@Getter @Setter private ArrayList<String> whitelist;
|
||||
@Getter private final TreeSet<LiftBlock> blocks = new TreeSet<>();
|
||||
@Getter private final LinkedHashMap<String, Floor> floors = new LinkedHashMap<>();
|
||||
@Getter private final HashSet<LiftSign> signs = new HashSet<>();
|
||||
@Getter private final HashSet<LiftBlock> inputs = new HashSet<>();
|
||||
@Getter private HashSet<LiftBlock> offlineInputs = new HashSet<>();
|
||||
@Getter @Setter private LinkedHashMap<String, Floor> queue = null;
|
||||
@Getter private final HashSet<LiftRope> ropes = new HashSet<>();
|
||||
@Getter private final ArrayList<V10Entity> toMove = new ArrayList<>();
|
||||
@Getter @Setter private int speed;
|
||||
@Getter @Setter private boolean realistic;
|
||||
@Getter @Setter private boolean offline = false;
|
||||
@Getter @Setter private boolean sound = true;
|
||||
@Getter @Setter private boolean defective = false;
|
||||
@Getter @Setter private String signText = null;
|
||||
@Getter @Setter private int counter = 0;
|
||||
@Getter @Setter private Floor doorOpen = null;
|
||||
@Getter @Setter private DoorCloser doorCloser = null;
|
||||
|
||||
public Lift(HashSet<UUID> owners, int speed, boolean realistic) {
|
||||
this.owners = owners;
|
||||
this.speed = speed;
|
||||
this.realistic = realistic;
|
||||
}
|
||||
|
||||
public Lift(UUID owner, int speed, boolean realistic) {
|
||||
HashSet<UUID> hs = new HashSet<>();
|
||||
hs.add(owner);
|
||||
this.owners = hs;
|
||||
this.speed = speed;
|
||||
this.realistic = realistic;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
String newLine = System.getProperty("line.separator");
|
||||
|
||||
result.append(this.getClass().getName());
|
||||
result.append(" Object {");
|
||||
result.append(newLine);
|
||||
|
||||
//determine fields declared in this class only (no fields of superclass)
|
||||
Field[] fields = this.getClass().getDeclaredFields();
|
||||
|
||||
//print field names paired with their values
|
||||
for (Field field: fields) {
|
||||
result.append(" ");
|
||||
try {
|
||||
result.append(field.getName());
|
||||
result.append(": ");
|
||||
//requires access to private field:
|
||||
result.append(field.get(this));
|
||||
} catch (IllegalAccessException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
result.append(newLine);
|
||||
}
|
||||
result.append("}");
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
public class LiftRope {
|
||||
private Material type;
|
||||
private BlockFace face;
|
||||
private String world;
|
||||
private int x;
|
||||
private int minY;
|
||||
private int maxY;
|
||||
private int z;
|
||||
private int currently;
|
||||
|
||||
public LiftRope(Material type, BlockFace face, String world, int x, int minY, int maxY, int z) {
|
||||
this.type = type;
|
||||
this.face = face;
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.minY = minY;
|
||||
this.maxY = maxY;
|
||||
this.z = z;
|
||||
this.currently = minY;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null) return false;
|
||||
if (!(obj instanceof LiftRope)) return false;
|
||||
LiftRope other = (LiftRope) obj;
|
||||
return getWorld().equals(other.getWorld())
|
||||
&& getX() == other.getX()
|
||||
&& getMinY() == other.getMinY()
|
||||
&& getMaxY() == other.getMaxY()
|
||||
&& getZ() == other.getZ();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
String newLine = System.getProperty("line.separator");
|
||||
|
||||
result.append(this.getClass().getName());
|
||||
result.append(" Object {");
|
||||
result.append(newLine);
|
||||
|
||||
//determine fields declared in this class only (no fields of superclass)
|
||||
Field[] fields = this.getClass().getDeclaredFields();
|
||||
|
||||
//print field names paired with their values
|
||||
for (Field field: fields) {
|
||||
result.append(" ");
|
||||
try {
|
||||
result.append(field.getName());
|
||||
result.append(": ");
|
||||
//requires access to private field:
|
||||
result.append(field.get(this));
|
||||
} catch (IllegalAccessException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
result.append(newLine);
|
||||
}
|
||||
result.append("}");
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
public class LiftSign {
|
||||
private String world;
|
||||
private int x;
|
||||
private int z;
|
||||
private int y;
|
||||
private String oldText = null;
|
||||
private byte type;
|
||||
private byte state;
|
||||
|
||||
public LiftSign(String world, int x, int y, int z, byte type, byte state) {
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.type = type;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof LiftSign)) {
|
||||
if (!(obj instanceof LiftBlock)) return false;
|
||||
LiftBlock other = (LiftBlock) obj;
|
||||
return getWorld().equals(other.getWorld()) && getX() == other.getX() && getY() == other.getY() && getZ() == other.getZ();
|
||||
}
|
||||
LiftSign other = (LiftSign) obj;
|
||||
return getWorld().equals(other.getWorld()) && getX() == other.getX() && getY() == other.getY() && getZ() == other.getZ();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
String newLine = System.getProperty("line.separator");
|
||||
|
||||
result.append(this.getClass().getName());
|
||||
result.append(" Object {");
|
||||
result.append(newLine);
|
||||
|
||||
//determine fields declared in this class only (no fields of superclass)
|
||||
Field[] fields = this.getClass().getDeclaredFields();
|
||||
|
||||
//print field names paired with their values
|
||||
for (Field field: fields) {
|
||||
result.append(" ");
|
||||
try {
|
||||
result.append(field.getName());
|
||||
result.append(": ");
|
||||
//requires access to private field:
|
||||
result.append(field.get(this));
|
||||
} catch (IllegalAccessException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
result.append(newLine);
|
||||
}
|
||||
result.append("}");
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
public class Floor {
|
||||
private String world;
|
||||
private int y;
|
||||
private ArrayList<LiftBlock> doorBlocks = new ArrayList<>();
|
||||
private HashSet<UUID> whitelist = new HashSet<>();
|
||||
|
||||
public Floor(int y, String world) {
|
||||
this.y = y;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Floor floor = (Floor) o;
|
||||
return y == floor.y &&
|
||||
Objects.equals(world, floor.world) &&
|
||||
Objects.equals(doorBlocks, floor.doorBlocks) &&
|
||||
Objects.equals(whitelist, floor.whitelist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(world, y, doorBlocks, whitelist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Floor{" +
|
||||
"world='" + world + '\'' +
|
||||
", y=" + y +
|
||||
", doorBlocks=" + doorBlocks +
|
||||
", whitelist=" + whitelist +
|
||||
'}';
|
||||
}
|
||||
}
|
105
src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/Lift.java
Normal file
105
src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/Lift.java
Normal file
|
@ -0,0 +1,105 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import nl.SBDeveloper.V10Lift.API.Runnables.DoorCloser;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
public class Lift {
|
||||
@Getter @Setter private String worldName;
|
||||
@Getter @Setter private int y;
|
||||
@Getter private HashSet<UUID> owners;
|
||||
//@Getter @Setter private ArrayList<String> whitelist;
|
||||
@Getter private final TreeSet<LiftBlock> blocks = new TreeSet<>();
|
||||
@Getter private final LinkedHashMap<String, Floor> floors = new LinkedHashMap<>();
|
||||
@Getter private final HashSet<LiftSign> signs = new HashSet<>();
|
||||
@Getter private final HashSet<LiftBlock> inputs = new HashSet<>();
|
||||
@Getter private HashSet<LiftBlock> offlineInputs = new HashSet<>();
|
||||
@Getter @Setter private LinkedHashMap<String, Floor> queue = null;
|
||||
@Getter private final HashSet<LiftRope> ropes = new HashSet<>();
|
||||
@Getter private final ArrayList<V10Entity> toMove = new ArrayList<>();
|
||||
@Getter @Setter private int speed;
|
||||
@Getter @Setter private boolean realistic;
|
||||
@Getter @Setter private boolean offline = false;
|
||||
@Getter @Setter private boolean sound = true;
|
||||
@Getter @Setter private boolean defective = false;
|
||||
@Getter @Setter private String signText = null;
|
||||
@Getter @Setter private int counter = 0;
|
||||
@Getter @Setter private Floor doorOpen = null;
|
||||
@Getter @Setter private DoorCloser doorCloser = null;
|
||||
|
||||
public Lift(HashSet<UUID> owners, int speed, boolean realistic) {
|
||||
this.owners = owners;
|
||||
this.speed = speed;
|
||||
this.realistic = realistic;
|
||||
}
|
||||
|
||||
public Lift(UUID owner, int speed, boolean realistic) {
|
||||
HashSet<UUID> hs = new HashSet<>();
|
||||
hs.add(owner);
|
||||
this.owners = hs;
|
||||
this.speed = speed;
|
||||
this.realistic = realistic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Lift lift = (Lift) o;
|
||||
return y == lift.y &&
|
||||
speed == lift.speed &&
|
||||
realistic == lift.realistic &&
|
||||
offline == lift.offline &&
|
||||
sound == lift.sound &&
|
||||
defective == lift.defective &&
|
||||
counter == lift.counter &&
|
||||
Objects.equals(worldName, lift.worldName) &&
|
||||
Objects.equals(owners, lift.owners) &&
|
||||
Objects.equals(blocks, lift.blocks) &&
|
||||
Objects.equals(floors, lift.floors) &&
|
||||
Objects.equals(signs, lift.signs) &&
|
||||
Objects.equals(inputs, lift.inputs) &&
|
||||
Objects.equals(offlineInputs, lift.offlineInputs) &&
|
||||
Objects.equals(queue, lift.queue) &&
|
||||
Objects.equals(ropes, lift.ropes) &&
|
||||
Objects.equals(toMove, lift.toMove) &&
|
||||
Objects.equals(signText, lift.signText) &&
|
||||
Objects.equals(doorOpen, lift.doorOpen) &&
|
||||
Objects.equals(doorCloser, lift.doorCloser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(worldName, y, owners, blocks, floors, signs, inputs, offlineInputs, queue, ropes, toMove, speed, realistic, offline, sound, defective, signText, counter, doorOpen, doorCloser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Lift{" +
|
||||
"worldName='" + worldName + '\'' +
|
||||
", y=" + y +
|
||||
", owners=" + owners +
|
||||
", blocks=" + blocks +
|
||||
", floors=" + floors +
|
||||
", signs=" + signs +
|
||||
", inputs=" + inputs +
|
||||
", offlineInputs=" + offlineInputs +
|
||||
", queue=" + queue +
|
||||
", ropes=" + ropes +
|
||||
", toMove=" + toMove +
|
||||
", speed=" + speed +
|
||||
", realistic=" + realistic +
|
||||
", offline=" + offline +
|
||||
", sound=" + sound +
|
||||
", defective=" + defective +
|
||||
", signText='" + signText + '\'' +
|
||||
", counter=" + counter +
|
||||
", doorOpen=" + doorOpen +
|
||||
", doorCloser=" + doorCloser +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -7,8 +7,9 @@ import org.bukkit.Material;
|
|||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@NoArgsConstructor
|
||||
public class LiftBlock implements Comparable<LiftBlock> {
|
||||
|
@ -143,43 +144,48 @@ public class LiftBlock implements Comparable<LiftBlock> {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof LiftBlock)) {
|
||||
if (!(obj instanceof LiftSign)) return false;
|
||||
LiftSign other = (LiftSign) obj;
|
||||
return getWorld().equals(other.getWorld()) && getX() == other.getX() && getY() == other.getY() && getZ() == other.getZ();
|
||||
}
|
||||
LiftBlock other = (LiftBlock) obj;
|
||||
return getWorld().equals(other.getWorld()) && getX() == other.getX() && getY() == other.getY() && getZ() == other.getZ();
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
LiftBlock liftBlock = (LiftBlock) o;
|
||||
return x == liftBlock.x &&
|
||||
y == liftBlock.y &&
|
||||
z == liftBlock.z &&
|
||||
data == liftBlock.data &&
|
||||
active == liftBlock.active &&
|
||||
Objects.equals(world, liftBlock.world) &&
|
||||
mat == liftBlock.mat &&
|
||||
face == liftBlock.face &&
|
||||
Objects.equals(bisected, liftBlock.bisected) &&
|
||||
Arrays.equals(signLines, liftBlock.signLines) &&
|
||||
Objects.equals(floor, liftBlock.floor) &&
|
||||
Arrays.equals(serializedItemStacks, liftBlock.serializedItemStacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = Objects.hash(world, x, y, z, mat, data, face, bisected, floor, active);
|
||||
result = 31 * result + Arrays.hashCode(signLines);
|
||||
result = 31 * result + Arrays.hashCode(serializedItemStacks);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
String newLine = System.getProperty("line.separator");
|
||||
|
||||
result.append(this.getClass().getName());
|
||||
result.append(" Object {");
|
||||
result.append(newLine);
|
||||
|
||||
//determine fields declared in this class only (no fields of superclass)
|
||||
Field[] fields = this.getClass().getDeclaredFields();
|
||||
|
||||
//print field names paired with their values
|
||||
for (Field field: fields) {
|
||||
result.append(" ");
|
||||
try {
|
||||
result.append(field.getName());
|
||||
result.append(": ");
|
||||
//requires access to private field:
|
||||
result.append(field.get(this));
|
||||
} catch (IllegalAccessException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
result.append(newLine);
|
||||
}
|
||||
result.append("}");
|
||||
|
||||
return result.toString();
|
||||
return "LiftBlock{" +
|
||||
"world='" + world + '\'' +
|
||||
", x=" + x +
|
||||
", y=" + y +
|
||||
", z=" + z +
|
||||
", mat=" + mat +
|
||||
", data=" + data +
|
||||
", face=" + face +
|
||||
", bisected='" + bisected + '\'' +
|
||||
", signLines=" + Arrays.toString(signLines) +
|
||||
", floor='" + floor + '\'' +
|
||||
", active=" + active +
|
||||
", serializedItemStacks=" + Arrays.toString(serializedItemStacks) +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
public class LiftRope {
|
||||
private Material type;
|
||||
private BlockFace face;
|
||||
private String world;
|
||||
private int x;
|
||||
private int minY;
|
||||
private int maxY;
|
||||
private int z;
|
||||
private int currently;
|
||||
|
||||
public LiftRope(Material type, BlockFace face, String world, int x, int minY, int maxY, int z) {
|
||||
this.type = type;
|
||||
this.face = face;
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.minY = minY;
|
||||
this.maxY = maxY;
|
||||
this.z = z;
|
||||
this.currently = minY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
LiftRope liftRope = (LiftRope) o;
|
||||
return x == liftRope.x &&
|
||||
minY == liftRope.minY &&
|
||||
maxY == liftRope.maxY &&
|
||||
z == liftRope.z &&
|
||||
currently == liftRope.currently &&
|
||||
type == liftRope.type &&
|
||||
face == liftRope.face &&
|
||||
Objects.equals(world, liftRope.world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(type, face, world, x, minY, maxY, z, currently);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LiftRope{" +
|
||||
"type=" + type +
|
||||
", face=" + face +
|
||||
", world='" + world + '\'' +
|
||||
", x=" + x +
|
||||
", minY=" + minY +
|
||||
", maxY=" + maxY +
|
||||
", z=" + z +
|
||||
", currently=" + currently +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
public class LiftSign {
|
||||
private String world;
|
||||
private int x;
|
||||
private int z;
|
||||
private int y;
|
||||
private String oldText = null;
|
||||
private byte type;
|
||||
private byte state;
|
||||
|
||||
public LiftSign(String world, int x, int y, int z, byte type, byte state) {
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.type = type;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
LiftSign liftSign = (LiftSign) o;
|
||||
return x == liftSign.x &&
|
||||
z == liftSign.z &&
|
||||
y == liftSign.y &&
|
||||
type == liftSign.type &&
|
||||
state == liftSign.state &&
|
||||
Objects.equals(world, liftSign.world) &&
|
||||
Objects.equals(oldText, liftSign.oldText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(world, x, z, y, oldText, type, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LiftSign{" +
|
||||
"world='" + world + '\'' +
|
||||
", x=" + x +
|
||||
", z=" + z +
|
||||
", y=" + y +
|
||||
", oldText='" + oldText + '\'' +
|
||||
", type=" + type +
|
||||
", state=" + state +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import org.bukkit.Location;
|
|||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter @NoArgsConstructor
|
||||
|
@ -46,44 +47,35 @@ public class V10Entity {
|
|||
entity.teleport(new Location(Bukkit.getWorld(world), locX, locY, locZ));
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null) return false;
|
||||
if (obj instanceof V10Entity) {
|
||||
return ((V10Entity) obj).getEntityUUID().equals(getEntityUUID());
|
||||
} else if (obj instanceof Entity) {
|
||||
return ((Entity) obj).getUniqueId().equals(getEntityUUID());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
V10Entity v10Entity = (V10Entity) o;
|
||||
return locX == v10Entity.locX &&
|
||||
locY == v10Entity.locY &&
|
||||
locZ == v10Entity.locZ &&
|
||||
y == v10Entity.y &&
|
||||
step == v10Entity.step &&
|
||||
Objects.equals(entityUUID, v10Entity.entityUUID) &&
|
||||
Objects.equals(world, v10Entity.world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(entityUUID, world, locX, locY, locZ, y, step);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
String newLine = System.getProperty("line.separator");
|
||||
|
||||
result.append(this.getClass().getName());
|
||||
result.append(" Object {");
|
||||
result.append(newLine);
|
||||
|
||||
//determine fields declared in this class only (no fields of superclass)
|
||||
Field[] fields = this.getClass().getDeclaredFields();
|
||||
|
||||
//print field names paired with their values
|
||||
for (Field field: fields) {
|
||||
result.append(" ");
|
||||
try {
|
||||
result.append(field.getName());
|
||||
result.append(": ");
|
||||
//requires access to private field:
|
||||
result.append(field.get(this));
|
||||
} catch (IllegalAccessException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
result.append(newLine);
|
||||
}
|
||||
result.append("}");
|
||||
|
||||
return result.toString();
|
||||
return "V10Entity{" +
|
||||
"entityUUID=" + entityUUID +
|
||||
", world='" + world + '\'' +
|
||||
", locX=" + locX +
|
||||
", locY=" + locY +
|
||||
", locZ=" + locZ +
|
||||
", y=" + y +
|
||||
", step=" + step +
|
||||
'}';
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue