Fix casting error.
This commit is contained in:
parent
e659eca5be
commit
4cc71ae667
@ -335,15 +335,25 @@ public class EventListener implements Listener {
|
|||||||
// Go through the blocks next to the clicked block and check if are signs on the end.
|
// Go through the blocks next to the clicked block and check if are signs on the end.
|
||||||
for (int i = 1; i <= 100; i++) {
|
for (int i = 1; i <= 100; i++) {
|
||||||
Block relative = block.getRelative(face, i);
|
Block relative = block.getRelative(face, i);
|
||||||
if (!isValidChair(relative) || (block.getState().getData() instanceof Stairs
|
if (checkDirection(block, relative)) {
|
||||||
&& ((Stairs) relative.getState().getData()).getDescendingDirection()
|
continue;
|
||||||
!= ((Stairs) block.getState().getData()).getDescendingDirection())) {
|
}
|
||||||
if (plugin.validSigns.contains(relative.getType())) {
|
if (plugin.validSigns.contains(relative.getType())) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkDirection(Block block1, Block block2) {
|
||||||
|
if (block1.getState().getData() instanceof Stairs
|
||||||
|
&& block2.getState().getData() instanceof Stairs) {
|
||||||
|
if (((Stairs) block1.getState().getData()).getDescendingDirection()
|
||||||
|
.equals(((Stairs) block2.getState().getData()).getDescendingDirection())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -353,13 +363,13 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
for (int i = 1; i <= 100; i++) {
|
for (int i = 1; i <= 100; i++) {
|
||||||
Block relative = block.getRelative(face, i);
|
Block relative = block.getRelative(face, i);
|
||||||
|
if (checkDirection(block, relative)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (relative.getType().equals(Material.AIR)) {
|
||||||
int x = relative.getLocation().getBlockX();
|
int x = relative.getLocation().getBlockX();
|
||||||
int y = relative.getLocation().getBlockY();
|
int y = relative.getLocation().getBlockY();
|
||||||
int z = relative.getLocation().getBlockZ();
|
int z = relative.getLocation().getBlockZ();
|
||||||
if (!isValidChair(relative) || (block.getState().getData() instanceof Stairs
|
|
||||||
&& ((Stairs) relative.getState().getData()).getDescendingDirection()
|
|
||||||
!= ((Stairs) block.getState().getData()).getDescendingDirection())) {
|
|
||||||
if (relative.getType().equals(Material.AIR)) {
|
|
||||||
for (Entity e : player.getNearbyEntities(plugin.distance, plugin.distance, plugin.distance)) {
|
for (Entity e : player.getNearbyEntities(plugin.distance, plugin.distance, plugin.distance)) {
|
||||||
if (e instanceof ItemFrame && plugin.validSigns.contains(Material.ITEM_FRAME)) {
|
if (e instanceof ItemFrame && plugin.validSigns.contains(Material.ITEM_FRAME)) {
|
||||||
int x2 = e.getLocation().getBlockX();
|
int x2 = e.getLocation().getBlockX();
|
||||||
@ -370,11 +380,11 @@ public class EventListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user