Fixed GSON issues for 1.14+ & fixed dir blocks
This commit is contained in:
parent
c712ad1775
commit
c61063ebdf
5 changed files with 163 additions and 46 deletions
6
pom.xml
6
pom.xml
|
@ -90,6 +90,12 @@
|
||||||
<version>1.18.10</version>
|
<version>1.18.10</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Needed for 1.15, becuase that version is wrong -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<version>2.8.6</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class LiftBlock implements Comparable<LiftBlock> {
|
||||||
@Getter private final Material mat;
|
@Getter private final Material mat;
|
||||||
@Getter private final byte data;
|
@Getter private final byte data;
|
||||||
@Getter private final BlockFace face;
|
@Getter private final BlockFace face;
|
||||||
|
@Getter private final Object bisected;
|
||||||
@Getter private final String[] signLines;
|
@Getter private final String[] signLines;
|
||||||
|
|
||||||
//Only used for inputs!
|
//Only used for inputs!
|
||||||
|
@ -29,6 +30,7 @@ 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 */
|
||||||
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;
|
||||||
|
@ -39,20 +41,12 @@ public class LiftBlock implements Comparable<LiftBlock> {
|
||||||
this.face = null;
|
this.face = null;
|
||||||
this.signLines = null;
|
this.signLines = null;
|
||||||
this.floor = floor;
|
this.floor = floor;
|
||||||
|
this.bisected = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiftBlock(String world, int x, int y, int z, Material mat) {
|
/** 1.12 liftblocks **/
|
||||||
this.world = world;
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
this.mat = mat;
|
|
||||||
this.face = null;
|
|
||||||
this.data = 0;
|
|
||||||
this.signLines = null;
|
|
||||||
this.floor = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* 1.12 liftblock (Directional) */
|
||||||
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;
|
||||||
|
@ -63,20 +57,10 @@ public class LiftBlock implements Comparable<LiftBlock> {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.signLines = null;
|
this.signLines = null;
|
||||||
this.floor = null;
|
this.floor = null;
|
||||||
|
this.bisected = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face, String[] signLines) {
|
/* 1.12 liftblock (sign) */
|
||||||
this.world = world;
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
this.mat = mat;
|
|
||||||
this.face = face;
|
|
||||||
this.data = 0;
|
|
||||||
this.signLines = signLines;
|
|
||||||
this.floor = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -87,6 +71,65 @@ public class LiftBlock implements Comparable<LiftBlock> {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.signLines = signLines;
|
this.signLines = signLines;
|
||||||
this.floor = null;
|
this.floor = null;
|
||||||
|
this.bisected = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 1.13 liftblocks **/
|
||||||
|
|
||||||
|
/* 1.13 liftblock (no Dir) */
|
||||||
|
public LiftBlock(String world, int x, int y, int z, Material mat) {
|
||||||
|
this.world = world;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.mat = mat;
|
||||||
|
this.face = null;
|
||||||
|
this.data = 0;
|
||||||
|
this.signLines = null;
|
||||||
|
this.floor = null;
|
||||||
|
this.bisected = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 1.13 liftblock (Directional) */
|
||||||
|
public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face) {
|
||||||
|
this.world = world;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.mat = mat;
|
||||||
|
this.face = face;
|
||||||
|
this.data = 0;
|
||||||
|
this.signLines = null;
|
||||||
|
this.floor = null;
|
||||||
|
this.bisected = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 1.13 liftblock (dir & bisec) */
|
||||||
|
public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face, Object bisected) {
|
||||||
|
this.world = world;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.mat = mat;
|
||||||
|
this.face = face;
|
||||||
|
this.data = 0;
|
||||||
|
this.signLines = null;
|
||||||
|
this.floor = null;
|
||||||
|
this.bisected = bisected;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 1.13 liftblock (sign) */
|
||||||
|
public LiftBlock(String world, int x, int y, int z, Material mat, BlockFace face, String[] signLines) {
|
||||||
|
this.world = world;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.mat = mat;
|
||||||
|
this.face = face;
|
||||||
|
this.data = 0;
|
||||||
|
this.signLines = signLines;
|
||||||
|
this.floor = null;
|
||||||
|
this.bisected = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -205,6 +205,7 @@ public class MoveLift implements Runnable {
|
||||||
state.update(true);
|
state.update(true);
|
||||||
if (XMaterial.isNewVersion()) {
|
if (XMaterial.isNewVersion()) {
|
||||||
DirectionUtil.setDirection(block, lib.getFace());
|
DirectionUtil.setDirection(block, lib.getFace());
|
||||||
|
DirectionUtil.setBisected(block, lib.getBisected());
|
||||||
}
|
}
|
||||||
lb = lift.getBlocks().first();
|
lb = lift.getBlocks().first();
|
||||||
for (Entity ent : Objects.requireNonNull(Bukkit.getWorld(lib.getWorld()), "World is null at MoveLift").getBlockAt(lib.getX(), lib.getY(), lib.getZ()).getChunk().getEntities()) {
|
for (Entity ent : Objects.requireNonNull(Bukkit.getWorld(lib.getWorld()), "World is null at MoveLift").getBlockAt(lib.getX(), lib.getY(), lib.getZ()).getChunk().getEntities()) {
|
||||||
|
@ -248,6 +249,7 @@ public class MoveLift implements Runnable {
|
||||||
state.update(true);
|
state.update(true);
|
||||||
if (XMaterial.isNewVersion()) {
|
if (XMaterial.isNewVersion()) {
|
||||||
DirectionUtil.setDirection(block, lib.getFace());
|
DirectionUtil.setDirection(block, lib.getFace());
|
||||||
|
DirectionUtil.setBisected(block, lib.getBisected());
|
||||||
}
|
}
|
||||||
lift.getBlocks().add(lib);
|
lift.getBlocks().add(lib);
|
||||||
if (lib.getSignLines() != null) {
|
if (lib.getSignLines() != null) {
|
||||||
|
@ -336,6 +338,7 @@ public class MoveLift implements Runnable {
|
||||||
state.update(true);
|
state.update(true);
|
||||||
if (XMaterial.isNewVersion()) {
|
if (XMaterial.isNewVersion()) {
|
||||||
DirectionUtil.setDirection(block, lib.getFace());
|
DirectionUtil.setDirection(block, lib.getFace());
|
||||||
|
DirectionUtil.setBisected(block, lib.getBisected());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
veiter = lift.getToMove().iterator();
|
veiter = lift.getToMove().iterator();
|
||||||
|
@ -359,6 +362,7 @@ public class MoveLift implements Runnable {
|
||||||
state.update(true);
|
state.update(true);
|
||||||
if (XMaterial.isNewVersion()) {
|
if (XMaterial.isNewVersion()) {
|
||||||
DirectionUtil.setDirection(block, lib.getFace());
|
DirectionUtil.setDirection(block, lib.getFace());
|
||||||
|
DirectionUtil.setBisected(block, lib.getBisected());
|
||||||
}
|
}
|
||||||
lift.getBlocks().add(lib);
|
lift.getBlocks().add(lib);
|
||||||
if (lib.getSignLines() != null) {
|
if (lib.getSignLines() != null) {
|
||||||
|
@ -410,8 +414,9 @@ public class MoveLift implements Runnable {
|
||||||
block = world.getBlockAt(rope.getX(), rope.getCurrently(), rope.getZ());
|
block = world.getBlockAt(rope.getX(), rope.getCurrently(), rope.getZ());
|
||||||
block.setType(rope.getType());
|
block.setType(rope.getType());
|
||||||
if (XMaterial.isNewVersion()) {
|
if (XMaterial.isNewVersion()) {
|
||||||
org.bukkit.block.data.type.Ladder ladder = (org.bukkit.block.data.type.Ladder) block.getBlockData();
|
org.bukkit.block.data.Directional data = (org.bukkit.block.data.Directional) block.getBlockData();
|
||||||
ladder.setFacing(rope.getFace());
|
data.setFacing(rope.getFace());
|
||||||
|
block.setBlockData(data);
|
||||||
} else {
|
} else {
|
||||||
BlockState state = block.getState();
|
BlockState state = block.getState();
|
||||||
org.bukkit.material.Ladder ladder = new org.bukkit.material.Ladder(rope.getType());
|
org.bukkit.material.Ladder ladder = new org.bukkit.material.Ladder(rope.getType());
|
||||||
|
@ -426,8 +431,9 @@ public class MoveLift implements Runnable {
|
||||||
block = world.getBlockAt(rope.getX(), rope.getCurrently(), rope.getZ());
|
block = world.getBlockAt(rope.getX(), rope.getCurrently(), rope.getZ());
|
||||||
block.setType(rope.getType());
|
block.setType(rope.getType());
|
||||||
if (XMaterial.isNewVersion()) {
|
if (XMaterial.isNewVersion()) {
|
||||||
org.bukkit.block.data.type.Ladder ladder = (org.bukkit.block.data.type.Ladder) block.getBlockData();
|
org.bukkit.block.data.Directional data = (org.bukkit.block.data.Directional) block.getBlockData();
|
||||||
ladder.setFacing(rope.getFace());
|
data.setFacing(rope.getFace());
|
||||||
|
block.setBlockData(data);
|
||||||
} else {
|
} else {
|
||||||
BlockState state = block.getState();
|
BlockState state = block.getState();
|
||||||
org.bukkit.material.Ladder ladder = new org.bukkit.material.Ladder(rope.getType());
|
org.bukkit.material.Ladder ladder = new org.bukkit.material.Ladder(rope.getType());
|
||||||
|
|
|
@ -173,17 +173,34 @@ public class V10LiftAPI {
|
||||||
public int addBlockToLift(Set<LiftBlock> blocks, @Nonnull Block block) {
|
public int addBlockToLift(Set<LiftBlock> blocks, @Nonnull Block block) {
|
||||||
Material type = block.getType();
|
Material type = block.getType();
|
||||||
LiftBlock lb;
|
LiftBlock lb;
|
||||||
if (type.toString().contains("SIGN")) {
|
if (XMaterial.isNewVersion()) {
|
||||||
//SIGN
|
Class<?> biClass;
|
||||||
if (XMaterial.isNewVersion()) {
|
try {
|
||||||
|
biClass = Class.forName("org.bukkit.block.data.Bisected");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.toString().contains("SIGN")) {
|
||||||
|
Bukkit.getLogger().info("Block instanceof Dir 1.13 & is sign");
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), ((Sign) block.getState()).getLines());
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), ((Sign) block.getState()).getLines());
|
||||||
|
} else if (block.getBlockData() instanceof org.bukkit.block.data.Directional && block.getBlockData().getClass().isInstance(biClass)) {
|
||||||
|
Bukkit.getLogger().info("Block instanceof Dir 1.13 & bisected");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), DirectionUtil.getBisected(block));
|
||||||
|
} else if (block.getBlockData() instanceof org.bukkit.block.data.Directional) {
|
||||||
|
Bukkit.getLogger().info("Block instanceof Dir 1.13");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block));
|
||||||
} else {
|
} else {
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData(), ((Sign) block.getState()).getLines());
|
Bukkit.getLogger().info("Block not instanceof Dir 1.13");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (XMaterial.isNewVersion()) {
|
if (type.toString().contains("SIGN")) {
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type);
|
Bukkit.getLogger().info("Block instanceof Dir 1.12 & is sign");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData(), ((Sign) block.getState()).getLines());
|
||||||
} else {
|
} else {
|
||||||
|
Bukkit.getLogger().info("Block no sign 1.12");
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData());
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,17 +235,34 @@ public class V10LiftAPI {
|
||||||
Lift lift = DataManager.getLift(liftName);
|
Lift lift = DataManager.getLift(liftName);
|
||||||
Material type = block.getType();
|
Material type = block.getType();
|
||||||
LiftBlock lb;
|
LiftBlock lb;
|
||||||
if (type.toString().contains("SIGN")) {
|
if (XMaterial.isNewVersion()) {
|
||||||
//SIGN
|
Class<?> biClass;
|
||||||
if (XMaterial.isNewVersion()) {
|
try {
|
||||||
|
biClass = Class.forName("org.bukkit.block.data.Bisected");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.toString().contains("SIGN")) {
|
||||||
|
Bukkit.getLogger().info("Block instanceof Dir 1.13 & is sign");
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), ((Sign) block.getState()).getLines());
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), ((Sign) block.getState()).getLines());
|
||||||
|
} else if (block.getBlockData() instanceof org.bukkit.block.data.Directional && block.getBlockData().getClass().isInstance(biClass)) {
|
||||||
|
Bukkit.getLogger().info("Block instanceof Dir 1.13 & bisected");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), DirectionUtil.getBisected(block));
|
||||||
|
} else if (block.getBlockData() instanceof org.bukkit.block.data.Directional) {
|
||||||
|
Bukkit.getLogger().info("Block instanceof Dir 1.13");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block));
|
||||||
} else {
|
} else {
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData(), ((Sign) block.getState()).getLines());
|
Bukkit.getLogger().info("Block not instanceof Dir 1.13");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (XMaterial.isNewVersion()) {
|
if (type.toString().contains("SIGN")) {
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type);
|
Bukkit.getLogger().info("Block instanceof Dir 1.12 & is sign");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData(), ((Sign) block.getState()).getLines());
|
||||||
} else {
|
} else {
|
||||||
|
Bukkit.getLogger().info("Block no sign 1.12");
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData());
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,17 +297,26 @@ public class V10LiftAPI {
|
||||||
Material type = block.getType();
|
Material type = block.getType();
|
||||||
if (getFBM().isForbidden(type)) return -2;
|
if (getFBM().isForbidden(type)) return -2;
|
||||||
LiftBlock lb;
|
LiftBlock lb;
|
||||||
if (type.toString().contains("SIGN")) {
|
if (XMaterial.isNewVersion()) {
|
||||||
//SIGN
|
if (type.toString().contains("SIGN")) {
|
||||||
if (XMaterial.isNewVersion()) {
|
Bukkit.getLogger().info("Block instanceof Dir 1.13 & is sign");
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), ((Sign) block.getState()).getLines());
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), ((Sign) block.getState()).getLines());
|
||||||
|
} else if (block.getBlockData() instanceof org.bukkit.block.data.Directional && block.getBlockData() instanceof org.bukkit.block.data.Bisected) {
|
||||||
|
Bukkit.getLogger().info("Block instanceof Dir 1.13 & bisected");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), DirectionUtil.getBisected(block));
|
||||||
|
} else if (block.getBlockData() instanceof org.bukkit.block.data.Directional) {
|
||||||
|
Bukkit.getLogger().info("Block instanceof Dir 1.13");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block));
|
||||||
} else {
|
} else {
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData(), ((Sign) block.getState()).getLines());
|
Bukkit.getLogger().info("Block not instanceof Dir 1.13");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (XMaterial.isNewVersion()) {
|
if (type.toString().contains("SIGN")) {
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type);
|
Bukkit.getLogger().info("Block instanceof Dir 1.12 & is sign");
|
||||||
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData(), ((Sign) block.getState()).getLines());
|
||||||
} else {
|
} else {
|
||||||
|
Bukkit.getLogger().info("Block no sign 1.12");
|
||||||
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData());
|
lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, block.getState().getRawData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package nl.SBDeveloper.V10Lift.Utils;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.Bisected;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.block.data.Directional;
|
import org.bukkit.block.data.Directional;
|
||||||
|
|
||||||
|
@ -20,11 +21,29 @@ public class DirectionUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDirection(@Nonnull Block block, BlockFace blockFace) {
|
public static void setDirection(@Nonnull Block block, BlockFace blockFace) {
|
||||||
if (block.getBlockData() instanceof Directional) {
|
if (blockFace != null && block.getBlockData() instanceof Directional) {
|
||||||
BlockData bd = block.getBlockData();
|
BlockData bd = block.getBlockData();
|
||||||
Directional dir = (Directional) bd;
|
Directional dir = (Directional) bd;
|
||||||
dir.setFacing(blockFace);
|
dir.setFacing(blockFace);
|
||||||
block.setBlockData(bd);
|
block.setBlockData(bd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static Object getBisected(@Nonnull Block block) {
|
||||||
|
if (block.getBlockData() instanceof Bisected) {
|
||||||
|
Bisected bis = (Bisected) block.getBlockData();
|
||||||
|
return bis.getHalf();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setBisected(@Nonnull Block block, Object bisected) {
|
||||||
|
if (bisected != null && block.getBlockData() instanceof Bisected && bisected instanceof Bisected.Half) {
|
||||||
|
BlockData bd = block.getBlockData();
|
||||||
|
Bisected bis = (Bisected) bd;
|
||||||
|
bis.setHalf((Bisected.Half) bisected);
|
||||||
|
block.setBlockData(bd);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue