Fixed BlockState issues
This commit is contained in:
parent
f24b35a2df
commit
52758e18a1
2 changed files with 9 additions and 9 deletions
|
@ -184,9 +184,9 @@ 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();
|
||||||
state.setType(lb.getMat());
|
state.setType(lib.getMat());
|
||||||
if (!XMaterial.isNewVersion()) {
|
if (!XMaterial.isNewVersion()) {
|
||||||
state.setRawData(lb.getData());
|
state.setRawData(lib.getData());
|
||||||
}
|
}
|
||||||
state.update(true);
|
state.update(true);
|
||||||
lb = lift.getBlocks().first();
|
lb = lift.getBlocks().first();
|
||||||
|
@ -224,9 +224,9 @@ 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();
|
||||||
state.setType(lb.getMat());
|
state.setType(lib.getMat());
|
||||||
if (!XMaterial.isNewVersion()) {
|
if (!XMaterial.isNewVersion()) {
|
||||||
state.setRawData(lb.getData());
|
state.setRawData(lib.getData());
|
||||||
}
|
}
|
||||||
state.update(true);
|
state.update(true);
|
||||||
lift.getBlocks().add(lib);
|
lift.getBlocks().add(lib);
|
||||||
|
@ -309,9 +309,9 @@ 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();
|
||||||
state.setType(lb.getMat());
|
state.setType(lib.getMat());
|
||||||
if (!XMaterial.isNewVersion()) {
|
if (!XMaterial.isNewVersion()) {
|
||||||
state.setRawData(lb.getData());
|
state.setRawData(lib.getData());
|
||||||
}
|
}
|
||||||
state.update(true);
|
state.update(true);
|
||||||
}
|
}
|
||||||
|
@ -329,9 +329,9 @@ 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();
|
||||||
state.setType(lb.getMat());
|
state.setType(lib.getMat());
|
||||||
if (!XMaterial.isNewVersion()) {
|
if (!XMaterial.isNewVersion()) {
|
||||||
state.setRawData(lb.getData());
|
state.setRawData(lib.getData());
|
||||||
}
|
}
|
||||||
state.update(true);
|
state.update(true);
|
||||||
lift.getBlocks().add(lib);
|
lift.getBlocks().add(lib);
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class PlayerInteractListener implements Listener {
|
||||||
|
|
||||||
if (action == Action.RIGHT_CLICK_BLOCK
|
if (action == Action.RIGHT_CLICK_BLOCK
|
||||||
&& e.getHand() != EquipmentSlot.OFF_HAND
|
&& e.getHand() != EquipmentSlot.OFF_HAND
|
||||||
&& (button.toString().contains("_BUTTON") || button == XMaterial.LEVER.parseMaterial())) {
|
&& (button.toString().contains("BUTTON") || button == XMaterial.LEVER.parseMaterial())) {
|
||||||
String world = block.getWorld().getName();
|
String world = block.getWorld().getName();
|
||||||
int x = block.getX();
|
int x = block.getX();
|
||||||
int y = block.getY();
|
int y = block.getY();
|
||||||
|
|
Loading…
Reference in a new issue