Added class documentation

This commit is contained in:
stijnb1234 2020-03-01 10:19:22 +01:00
parent 14c26b996b
commit 83f092c262
6 changed files with 144 additions and 12 deletions

View file

@ -8,6 +8,7 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.UUID; import java.util.UUID;
/** A floor object, for a floor in the lift. */
@Getter @Setter @NoArgsConstructor @Getter @Setter @NoArgsConstructor
public class Floor { public class Floor {
private String world; private String world;
@ -17,6 +18,12 @@ public class Floor {
private HashSet<UUID> userWhitelist = new HashSet<>(); private HashSet<UUID> userWhitelist = new HashSet<>();
private HashSet<String> groupWhitelist = new HashSet<>(); private HashSet<String> groupWhitelist = new HashSet<>();
/**
* Construct a new Floor
*
* @param y The y/height of the floor
* @param world The world of the floor
*/
public Floor(int y, String world) { public Floor(int y, String world) {
this.y = y; this.y = y;
this.world = world; this.world = world;

View file

@ -7,6 +7,7 @@ import nl.SBDeveloper.V10Lift.API.Runnables.DoorCloser;
import java.util.*; import java.util.*;
/** A lift object, to create a lift. */
@NoArgsConstructor @NoArgsConstructor
public class Lift { public class Lift {
@Getter @Setter private String worldName; @Getter @Setter private String worldName;
@ -31,12 +32,26 @@ public class Lift {
@Getter @Setter private Floor doorOpen = null; @Getter @Setter private Floor doorOpen = null;
@Getter @Setter private DoorCloser doorCloser = null; @Getter @Setter private DoorCloser doorCloser = null;
/**
* Construct a new Lift with multiple owners
*
* @param owners The owners, by uuid
* @param speed The speed, 1 is slowest, higher is faster
* @param realistic Realistic lift, or not
*/
public Lift(HashSet<UUID> owners, int speed, boolean realistic) { public Lift(HashSet<UUID> owners, int speed, boolean realistic) {
this.owners = owners; this.owners = owners;
this.speed = speed; this.speed = speed;
this.realistic = realistic; this.realistic = realistic;
} }
/**
* Construct a new Lift with one owners
*
* @param owner The owner, by uuid
* @param speed The speed, 1 is slowest, higher is faster
* @param realistic Realistic lift, or not
*/
public Lift(UUID owner, int speed, boolean realistic) { public Lift(UUID owner, int speed, boolean realistic) {
HashSet<UUID> hs = new HashSet<>(); HashSet<UUID> hs = new HashSet<>();
hs.add(owner); hs.add(owner);

View file

@ -10,6 +10,7 @@ import javax.annotation.Nonnull;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
/** A liftblock object, for a block in a lift. */
@NoArgsConstructor @NoArgsConstructor
public class LiftBlock implements Comparable<LiftBlock> { public class LiftBlock implements Comparable<LiftBlock> {
@ -33,7 +34,15 @@ public class LiftBlock implements Comparable<LiftBlock> {
//Only used for chests //Only used for chests
public Map<String, Object>[] serializedItemStacks = null; public Map<String, Object>[] serializedItemStacks = null;
/* Floor based liftblock, no material */ /**
* A floor based liftblock, without material (no caching)
*
* @param world The world
* @param x The x-pos
* @param y The y-pos
* @param z The z-pos
* @param floor The floorname of the block
*/
public LiftBlock(String world, int x, int y, int z, String floor) { public LiftBlock(String world, int x, int y, int z, String floor) {
this.world = world; this.world = world;
this.x = x; this.x = x;
@ -48,9 +57,16 @@ public class LiftBlock implements Comparable<LiftBlock> {
this.slabtype = null; this.slabtype = null;
} }
/** 1.12 liftblocks **/ /**
* 1.12 liftblock, with material and data [NO SIGN]
/* 1.12 liftblock (Directional) */ *
* @param world The world
* @param x The x-pos
* @param y The y-pos
* @param z The z-pos
* @param mat The Material of the block
* @param data The data of the block
*/
public LiftBlock(String world, int x, int y, int z, Material mat, byte data) { public LiftBlock(String world, int x, int y, int z, Material mat, byte data) {
this.world = world; this.world = world;
this.x = x; this.x = x;
@ -65,7 +81,17 @@ public class LiftBlock implements Comparable<LiftBlock> {
this.slabtype = null; this.slabtype = null;
} }
/* 1.12 liftblock (sign) */ /**
* 1.12 liftblock (signs)
*
* @param world The world
* @param x The x-pos
* @param y The y-pos
* @param z The z-pos
* @param mat The Material of the block
* @param data The data of the block
* @param signLines The lines of the sign
*/
public LiftBlock(String world, int x, int y, int z, Material mat, byte data, String[] signLines) { public LiftBlock(String world, int x, int y, int z, Material mat, byte data, String[] signLines) {
this.world = world; this.world = world;
this.x = x; this.x = x;
@ -80,9 +106,15 @@ public class LiftBlock implements Comparable<LiftBlock> {
this.slabtype = null; this.slabtype = null;
} }
/** 1.13 liftblocks **/ /**
* 1.13 liftblock, without a direction
/* 1.13 liftblock (no Dir) */ *
* @param world The world
* @param x The x-pos
* @param y The y-pos
* @param z The z-pos
* @param mat The Material of the block
*/
public LiftBlock(String world, int x, int y, int z, Material mat) { public LiftBlock(String world, int x, int y, int z, Material mat) {
this.world = world; this.world = world;
this.x = x; this.x = x;
@ -97,7 +129,16 @@ public class LiftBlock implements Comparable<LiftBlock> {
this.slabtype = null; this.slabtype = null;
} }
/* 1.13 liftblock (Directional) */ /**
* 1.13 liftblock with a direction
*
* @param world The world
* @param x The x-pos
* @param y The y-pos
* @param z The z-pos
* @param mat The Material of the block
* @param face The blockface of the block
*/
public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face) { public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face) {
this.world = world; this.world = world;
this.x = x; this.x = x;
@ -112,7 +153,17 @@ public class LiftBlock implements Comparable<LiftBlock> {
this.slabtype = null; this.slabtype = null;
} }
/* 1.13 liftblock (dir & bisec) */ /**
* 1.13 liftblock, with a direction and a bisected
*
* @param world The world
* @param x The x-pos
* @param y The y-pos
* @param z The z-pos
* @param mat The Material of the block
* @param face The blockface of the block
* @param bisected The bisected of the block
*/
public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face, String bisected) { public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face, String bisected) {
this.world = world; this.world = world;
this.x = x; this.x = x;
@ -127,7 +178,17 @@ public class LiftBlock implements Comparable<LiftBlock> {
this.slabtype = null; this.slabtype = null;
} }
/* 1.13 liftblock (sign) */ /**
* 1/13 liftblock (sign)
*
* @param world The world
* @param x The x-pos
* @param y The y-pos
* @param z The z-pos
* @param mat The Material of the block
* @param face The blockface of the block
* @param signLines The lines of the sign
*/
public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face, String[] signLines) { public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face, String[] signLines) {
this.world = world; this.world = world;
this.x = x; this.x = x;
@ -142,7 +203,16 @@ public class LiftBlock implements Comparable<LiftBlock> {
this.slabtype = null; this.slabtype = null;
} }
/* 1.13 liftblock (slab) */ /**
* 1.13 liftblock (slab)
*
* @param world The world
* @param x The x-pos
* @param y The y-pos
* @param z The z-pos
* @param mat The Material of the block
* @param slabtype The typ of slab (low, high, double)
*/
public LiftBlock(String world, int x, int y, int z, Material mat, String slabtype) { public LiftBlock(String world, int x, int y, int z, Material mat, String slabtype) {
this.world = world; this.world = world;
this.x = x; this.x = x;

View file

@ -8,6 +8,7 @@ import org.bukkit.block.BlockFace;
import java.util.Objects; import java.util.Objects;
/** A liftrope object, for a rope in the lift. */
@Getter @Setter @NoArgsConstructor @Getter @Setter @NoArgsConstructor
public class LiftRope { public class LiftRope {
private Material type; private Material type;
@ -19,6 +20,17 @@ public class LiftRope {
private int z; private int z;
private int currently; private int currently;
/**
* Construct a new liftrope
*
* @param type The material of the rope
* @param face The face of the rope
* @param world The world
* @param x The x-pos
* @param minY The starting x-pos
* @param maxY The stopping x-pos
* @param z The z-pos
*/
public LiftRope(Material type, BlockFace face, String world, int x, int minY, int maxY, int z) { public LiftRope(Material type, BlockFace face, String world, int x, int minY, int maxY, int z) {
this.type = type; this.type = type;
this.face = face; this.face = face;

View file

@ -4,6 +4,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
/** A liftsign object, for a info sign for the lift. */
@Getter @Setter @NoArgsConstructor @Getter @Setter @NoArgsConstructor
public class LiftSign { public class LiftSign {
private String world; private String world;
@ -14,6 +15,16 @@ public class LiftSign {
private byte type; private byte type;
private byte state; private byte state;
/**
* Construct a new liftsign
*
* @param world The world
* @param x The x-pos
* @param y The y-pos
* @param z The z-pos
* @param type The type of the sign
* @param state The state of the sign
*/
public LiftSign(String world, int x, int y, int z, byte type, byte state) { public LiftSign(String world, int x, int y, int z, byte type, byte state) {
this.world = world; this.world = world;
this.x = x; this.x = x;

View file

@ -9,6 +9,7 @@ import org.bukkit.entity.Entity;
import java.util.UUID; import java.util.UUID;
/** A v10entity object, for a entity in the lift. */
@Getter @NoArgsConstructor @Getter @NoArgsConstructor
public class V10Entity { public class V10Entity {
private UUID entityUUID; private UUID entityUUID;
@ -19,6 +20,16 @@ public class V10Entity {
private int y; private int y;
@Setter private short step; @Setter private short step;
/**
* Construct a new V10LiftEntity
*
* @param entityUUID The UUID of the entity
* @param worldName The world
* @param x The x-pos
* @param y The y-pos
* @param z The z-pos
* @param cury The current y-pos
*/
public V10Entity(UUID entityUUID, String worldName, int x, int y, int z, int cury) { public V10Entity(UUID entityUUID, String worldName, int x, int y, int z, int cury) {
this.entityUUID = entityUUID; this.entityUUID = entityUUID;
this.world = worldName; this.world = worldName;
@ -29,6 +40,9 @@ public class V10Entity {
this.step = 0; this.step = 0;
} }
/**
* Move a entity up
*/
public void moveUp() { public void moveUp() {
if (entityUUID == null) return; if (entityUUID == null) return;
Entity entity = Bukkit.getEntity(entityUUID); Entity entity = Bukkit.getEntity(entityUUID);
@ -37,6 +51,9 @@ public class V10Entity {
entity.teleport(new Location(Bukkit.getWorld(world), locX, locY, locZ)); entity.teleport(new Location(Bukkit.getWorld(world), locX, locY, locZ));
} }
/**
* Move a entity down
*/
public void moveDown() { public void moveDown() {
if (entityUUID == null) return; if (entityUUID == null) return;
Entity entity = Bukkit.getEntity(entityUUID); Entity entity = Bukkit.getEntity(entityUUID);