From 13b5ab69a23393b4556c58de7ba8ee2ee6a9cc55 Mon Sep 17 00:00:00 2001 From: stijnb1234 Date: Sat, 8 Feb 2020 11:56:17 +0100 Subject: [PATCH] Fixed lombok building (javadoc) & fixed equals() and toString() methods --- pom.xml | 24 ++++ .../V10Lift/API/Objects/Floor.java | 65 ----------- .../SBDeveloper/V10Lift/API/Objects/Lift.java | 77 ------------- .../V10Lift/API/Objects/LiftRope.java | 73 ------------ .../V10Lift/API/Objects/LiftSign.java | 67 ----------- .../V10Lift/API/Objects/Floor.java | 49 ++++++++ .../SBDeveloper/V10Lift/API/Objects/Lift.java | 105 ++++++++++++++++++ .../V10Lift/API/Objects/LiftBlock.java | 78 +++++++------ .../V10Lift/API/Objects/LiftRope.java | 67 +++++++++++ .../V10Lift/API/Objects/LiftSign.java | 59 ++++++++++ .../V10Lift/API/Objects/V10Entity.java | 64 +++++------ .../V10Lift/API/Runnables/DoorCloser.java | 0 .../V10Lift/API/Runnables/MoveLift.java | 0 .../SBDeveloper/V10Lift/API/V10LiftAPI.java | 0 .../V10Lift/Commands/V10LiftCommand.java | 0 .../V10Lift/Listeners/BlockBreakListener.java | 0 .../Listeners/EntityDamageListener.java | 0 .../Listeners/PlayerInteractListener.java | 0 .../V10Lift/Listeners/SignChangeListener.java | 0 .../Managers/AntiCopyBlockManager.java | 0 .../V10Lift/Managers/DBManager.java | 0 .../V10Lift/Managers/DataManager.java | 0 .../Managers/ForbiddenBlockManager.java | 0 .../SBDeveloper/V10Lift/Utils/ConfigUtil.java | 0 .../V10Lift/Utils/DirectionUtil.java | 0 .../SBDeveloper/V10Lift/Utils/XMaterial.java | 0 .../nl/SBDeveloper/V10Lift/Utils/XSound.java | 0 .../nl/SBDeveloper/V10Lift/V10LiftPlugin.java | 0 28 files changed, 374 insertions(+), 354 deletions(-) delete mode 100644 src/main/java/nl/SBDeveloper/V10Lift/API/Objects/Floor.java delete mode 100644 src/main/java/nl/SBDeveloper/V10Lift/API/Objects/Lift.java delete mode 100644 src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftRope.java delete mode 100644 src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftSign.java create mode 100644 src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/Floor.java create mode 100644 src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/Lift.java rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/API/Objects/LiftBlock.java (69%) create mode 100644 src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/LiftRope.java create mode 100644 src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/LiftSign.java rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/API/Objects/V10Entity.java (51%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/API/Runnables/DoorCloser.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/API/Runnables/MoveLift.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/API/V10LiftAPI.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Commands/V10LiftCommand.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Listeners/BlockBreakListener.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Listeners/EntityDamageListener.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Listeners/PlayerInteractListener.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Listeners/SignChangeListener.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Managers/AntiCopyBlockManager.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Managers/DBManager.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Managers/DataManager.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Managers/ForbiddenBlockManager.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Utils/ConfigUtil.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Utils/DirectionUtil.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Utils/XMaterial.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/Utils/XSound.java (100%) rename src/main/{java => lombok}/nl/SBDeveloper/V10Lift/V10LiftPlugin.java (100%) diff --git a/pom.xml b/pom.xml index 829d30b..6831cb5 100644 --- a/pom.xml +++ b/pom.xml @@ -60,6 +60,30 @@ -parameters + + org.projectlombok + lombok-maven-plugin + 1.18.10.0 + + + generate-sources + + delombok + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + + nl/SBDeveloper/V10Lift/API/*.java + nl/SBDeveloper/V10Lift/API/Objects/*.java + + + diff --git a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/Floor.java b/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/Floor.java deleted file mode 100644 index a7d6f9a..0000000 --- a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/Floor.java +++ /dev/null @@ -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 doorBlocks = new ArrayList<>(); - private HashSet 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(); - } -} diff --git a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/Lift.java b/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/Lift.java deleted file mode 100644 index c90f5b4..0000000 --- a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/Lift.java +++ /dev/null @@ -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 owners; - //@Getter @Setter private ArrayList whitelist; - @Getter private final TreeSet blocks = new TreeSet<>(); - @Getter private final LinkedHashMap floors = new LinkedHashMap<>(); - @Getter private final HashSet signs = new HashSet<>(); - @Getter private final HashSet inputs = new HashSet<>(); - @Getter private HashSet offlineInputs = new HashSet<>(); - @Getter @Setter private LinkedHashMap queue = null; - @Getter private final HashSet ropes = new HashSet<>(); - @Getter private final ArrayList 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 owners, int speed, boolean realistic) { - this.owners = owners; - this.speed = speed; - this.realistic = realistic; - } - - public Lift(UUID owner, int speed, boolean realistic) { - HashSet 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(); - } -} diff --git a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftRope.java b/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftRope.java deleted file mode 100644 index 9985dee..0000000 --- a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftRope.java +++ /dev/null @@ -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(); - } -} diff --git a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftSign.java b/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftSign.java deleted file mode 100644 index a4442c0..0000000 --- a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftSign.java +++ /dev/null @@ -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(); - } -} diff --git a/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/Floor.java b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/Floor.java new file mode 100644 index 0000000..dbef7e6 --- /dev/null +++ b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/Floor.java @@ -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 doorBlocks = new ArrayList<>(); + private HashSet 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 + + '}'; + } +} diff --git a/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/Lift.java b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/Lift.java new file mode 100644 index 0000000..39d35af --- /dev/null +++ b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/Lift.java @@ -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 owners; + //@Getter @Setter private ArrayList whitelist; + @Getter private final TreeSet blocks = new TreeSet<>(); + @Getter private final LinkedHashMap floors = new LinkedHashMap<>(); + @Getter private final HashSet signs = new HashSet<>(); + @Getter private final HashSet inputs = new HashSet<>(); + @Getter private HashSet offlineInputs = new HashSet<>(); + @Getter @Setter private LinkedHashMap queue = null; + @Getter private final HashSet ropes = new HashSet<>(); + @Getter private final ArrayList 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 owners, int speed, boolean realistic) { + this.owners = owners; + this.speed = speed; + this.realistic = realistic; + } + + public Lift(UUID owner, int speed, boolean realistic) { + HashSet 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 + + '}'; + } +} diff --git a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftBlock.java b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/LiftBlock.java similarity index 69% rename from src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftBlock.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/LiftBlock.java index 799b702..c7fa45d 100644 --- a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/LiftBlock.java +++ b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/LiftBlock.java @@ -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 { @@ -143,43 +144,48 @@ public class LiftBlock implements Comparable { 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) + + '}'; } } diff --git a/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/LiftRope.java b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/LiftRope.java new file mode 100644 index 0000000..5add956 --- /dev/null +++ b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/LiftRope.java @@ -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 + + '}'; + } +} diff --git a/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/LiftSign.java b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/LiftSign.java new file mode 100644 index 0000000..f3e268f --- /dev/null +++ b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/LiftSign.java @@ -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 + + '}'; + } +} diff --git a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/V10Entity.java b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/V10Entity.java similarity index 51% rename from src/main/java/nl/SBDeveloper/V10Lift/API/Objects/V10Entity.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/V10Entity.java index 32fb61a..f3be72a 100644 --- a/src/main/java/nl/SBDeveloper/V10Lift/API/Objects/V10Entity.java +++ b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Objects/V10Entity.java @@ -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 + + '}'; } } diff --git a/src/main/java/nl/SBDeveloper/V10Lift/API/Runnables/DoorCloser.java b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Runnables/DoorCloser.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/API/Runnables/DoorCloser.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/API/Runnables/DoorCloser.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/API/Runnables/MoveLift.java b/src/main/lombok/nl/SBDeveloper/V10Lift/API/Runnables/MoveLift.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/API/Runnables/MoveLift.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/API/Runnables/MoveLift.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/API/V10LiftAPI.java b/src/main/lombok/nl/SBDeveloper/V10Lift/API/V10LiftAPI.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/API/V10LiftAPI.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/API/V10LiftAPI.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Commands/V10LiftCommand.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Commands/V10LiftCommand.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Commands/V10LiftCommand.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Commands/V10LiftCommand.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Listeners/BlockBreakListener.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Listeners/BlockBreakListener.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Listeners/BlockBreakListener.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Listeners/BlockBreakListener.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Listeners/EntityDamageListener.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Listeners/EntityDamageListener.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Listeners/EntityDamageListener.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Listeners/EntityDamageListener.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Listeners/PlayerInteractListener.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Listeners/PlayerInteractListener.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Listeners/PlayerInteractListener.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Listeners/PlayerInteractListener.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Listeners/SignChangeListener.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Listeners/SignChangeListener.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Listeners/SignChangeListener.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Listeners/SignChangeListener.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Managers/AntiCopyBlockManager.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Managers/AntiCopyBlockManager.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Managers/AntiCopyBlockManager.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Managers/AntiCopyBlockManager.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Managers/DBManager.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Managers/DBManager.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Managers/DBManager.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Managers/DBManager.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Managers/DataManager.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Managers/DataManager.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Managers/DataManager.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Managers/DataManager.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Managers/ForbiddenBlockManager.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Managers/ForbiddenBlockManager.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Managers/ForbiddenBlockManager.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Managers/ForbiddenBlockManager.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Utils/ConfigUtil.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Utils/ConfigUtil.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Utils/ConfigUtil.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Utils/ConfigUtil.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Utils/DirectionUtil.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Utils/DirectionUtil.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Utils/DirectionUtil.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Utils/DirectionUtil.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Utils/XMaterial.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Utils/XMaterial.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Utils/XMaterial.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Utils/XMaterial.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/Utils/XSound.java b/src/main/lombok/nl/SBDeveloper/V10Lift/Utils/XSound.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/Utils/XSound.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/Utils/XSound.java diff --git a/src/main/java/nl/SBDeveloper/V10Lift/V10LiftPlugin.java b/src/main/lombok/nl/SBDeveloper/V10Lift/V10LiftPlugin.java similarity index 100% rename from src/main/java/nl/SBDeveloper/V10Lift/V10LiftPlugin.java rename to src/main/lombok/nl/SBDeveloper/V10Lift/V10LiftPlugin.java