Possibly fixes #25

This commit is contained in:
stijnb1234 2020-02-16 09:19:31 +01:00
parent 789881d1ab
commit 70b1af39e8
3 changed files with 7 additions and 4 deletions

View file

@ -19,7 +19,7 @@ public class LiftBlock implements Comparable<LiftBlock> {
@Getter private int z; @Getter private int z;
//Only used for cabine blocks, because those need caching! //Only used for cabine blocks, because those need caching!
@Getter private Material mat; @Getter @Setter private Material mat;
@Getter private byte data; @Getter private byte data;
@Getter private BlockFace face; @Getter private BlockFace face;
@Getter private String bisected; @Getter private String bisected;

View file

@ -197,6 +197,7 @@ public class MoveLift implements Runnable {
lib.setY(lib.getY() + 1); lib.setY(lib.getY() + 1);
block = Objects.requireNonNull(Bukkit.getWorld(lib.getWorld()), "World is null at MoveLift").getBlockAt(lib.getX(), lib.getY(), lib.getZ()); block = Objects.requireNonNull(Bukkit.getWorld(lib.getWorld()), "World is null at MoveLift").getBlockAt(lib.getX(), lib.getY(), lib.getZ());
BlockState state = block.getState(); BlockState state = block.getState();
if (lib.getMat() == null) lib.setMat(Material.AIR);
state.setType(lib.getMat()); state.setType(lib.getMat());
if (!XMaterial.isNewVersion()) { if (!XMaterial.isNewVersion()) {
state.setRawData(lib.getData()); state.setRawData(lib.getData());
@ -241,6 +242,7 @@ public class MoveLift implements Runnable {
for (LiftBlock lib : tb) { for (LiftBlock lib : tb) {
block = Objects.requireNonNull(Bukkit.getWorld(lib.getWorld()), "World is null at MoveLift").getBlockAt(lib.getX(), lib.getY(), lib.getZ()); block = Objects.requireNonNull(Bukkit.getWorld(lib.getWorld()), "World is null at MoveLift").getBlockAt(lib.getX(), lib.getY(), lib.getZ());
BlockState state = block.getState(); BlockState state = block.getState();
if (lib.getMat() == null) lib.setMat(Material.AIR);
state.setType(lib.getMat()); state.setType(lib.getMat());
if (!XMaterial.isNewVersion()) { if (!XMaterial.isNewVersion()) {
state.setRawData(lib.getData()); state.setRawData(lib.getData());
@ -330,6 +332,7 @@ public class MoveLift implements Runnable {
y = lib.getY(); y = lib.getY();
block = world.getBlockAt(lib.getX(), lib.getY(), lib.getZ()); block = world.getBlockAt(lib.getX(), lib.getY(), lib.getZ());
BlockState state = block.getState(); BlockState state = block.getState();
if (lib.getMat() == null) lib.setMat(Material.AIR);
state.setType(lib.getMat()); state.setType(lib.getMat());
if (!XMaterial.isNewVersion()) { if (!XMaterial.isNewVersion()) {
state.setRawData(lib.getData()); state.setRawData(lib.getData());
@ -354,6 +357,7 @@ public class MoveLift implements Runnable {
for (LiftBlock lib : tb) { for (LiftBlock lib : tb) {
block = Objects.requireNonNull(Bukkit.getWorld(lib.getWorld()), "World is null at MoveLift").getBlockAt(lib.getX(), lib.getY(), lib.getZ()); block = Objects.requireNonNull(Bukkit.getWorld(lib.getWorld()), "World is null at MoveLift").getBlockAt(lib.getX(), lib.getY(), lib.getZ());
BlockState state = block.getState(); BlockState state = block.getState();
if (lib.getMat() == null) lib.setMat(Material.AIR);
state.setType(lib.getMat()); state.setType(lib.getMat());
if (!XMaterial.isNewVersion()) { if (!XMaterial.isNewVersion()) {
state.setRawData(lib.getData()); state.setRawData(lib.getData());
@ -411,6 +415,7 @@ public class MoveLift implements Runnable {
quiter.remove(); quiter.remove();
rope.setCurrently(rope.getCurrently() - 1); rope.setCurrently(rope.getCurrently() - 1);
block = world.getBlockAt(rope.getX(), rope.getCurrently(), rope.getZ()); block = world.getBlockAt(rope.getX(), rope.getCurrently(), rope.getZ());
if (rope.getType() == null) rope.setType(Material.AIR);
block.setType(rope.getType()); block.setType(rope.getType());
if (XMaterial.isNewVersion()) { if (XMaterial.isNewVersion()) {
DirectionUtil.setDirection(block, rope.getFace()); DirectionUtil.setDirection(block, rope.getFace());
@ -426,6 +431,7 @@ public class MoveLift implements Runnable {
world = Objects.requireNonNull(Bukkit.getWorld(rope.getWorld()), "World is null at MoveLift"); world = Objects.requireNonNull(Bukkit.getWorld(rope.getWorld()), "World is null at MoveLift");
rope.setCurrently(rope.getCurrently() - 1); rope.setCurrently(rope.getCurrently() - 1);
block = world.getBlockAt(rope.getX(), rope.getCurrently(), rope.getZ()); block = world.getBlockAt(rope.getX(), rope.getCurrently(), rope.getZ());
if (rope.getType() == null) rope.setType(Material.AIR);
block.setType(rope.getType()); block.setType(rope.getType());
if (XMaterial.isNewVersion()) { if (XMaterial.isNewVersion()) {
DirectionUtil.setDirection(block, rope.getFace()); DirectionUtil.setDirection(block, rope.getFace());

View file

@ -37,9 +37,6 @@ public class V10LiftPlugin extends JavaPlugin {
config = new YamlFile("config"); config = new YamlFile("config");
config.loadDefaults(); config.loadDefaults();
//Disable the start/stop logging op HikariCP
Logger.getLogger("com.zaxxer.hikari.HikariDataSource").setLevel(Level.OFF);
//Load the database //Load the database
dbManager = new DBManager("data"); dbManager = new DBManager("data");
try { try {