Fix casting error.
This commit is contained in:
parent
e659eca5be
commit
4cc71ae667
@ -70,7 +70,7 @@ public class EventListener implements Listener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
plugin.sendSit();
|
plugin.sendSit();
|
||||||
}
|
}
|
||||||
}, 20 );
|
}, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -335,14 +335,24 @@ 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,26 +363,26 @@ 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);
|
||||||
int x = relative.getLocation().getBlockX();
|
if (checkDirection(block, relative)) {
|
||||||
int y = relative.getLocation().getBlockY();
|
continue;
|
||||||
int z = relative.getLocation().getBlockZ();
|
}
|
||||||
if (!isValidChair(relative) || (block.getState().getData() instanceof Stairs
|
if (relative.getType().equals(Material.AIR)) {
|
||||||
&& ((Stairs) relative.getState().getData()).getDescendingDirection()
|
int x = relative.getLocation().getBlockX();
|
||||||
!= ((Stairs) block.getState().getData()).getDescendingDirection())) {
|
int y = relative.getLocation().getBlockY();
|
||||||
if (relative.getType().equals(Material.AIR)) {
|
int z = relative.getLocation().getBlockZ();
|
||||||
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();
|
||||||
int y2 = e.getLocation().getBlockY();
|
int y2 = e.getLocation().getBlockY();
|
||||||
int z2 = e.getLocation().getBlockZ();
|
int z2 = e.getLocation().getBlockZ();
|
||||||
if (x == x2 && y == y2 && z == z2) {
|
if (x == x2 && y == y2 && z == z2) {
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user