Only listen to WallSign when creating shops.

This commit is contained in:
Len 2024-07-20 16:20:54 +02:00 committed by destro174
parent 851d816abf
commit 4e1f2d57bc
2 changed files with 6 additions and 8 deletions

View File

@ -81,11 +81,10 @@ public class PlayerListener extends EventListener {
return; return;
BlockFace facing; BlockFace facing;
BlockData data = b.getState().getBlockData(); BlockData data = b.getState().getBlockData();
if (data instanceof WallSign) { if (!(data instanceof WallSign wallSign)) {
facing = ((Directional) data).getFacing(); return;
} else {
facing = ((Rotatable) data).getRotation();
} }
facing = wallSign.getFacing();
Block bRelative = b.getRelative(facing.getOppositeFace()); Block bRelative = b.getRelative(facing.getOppositeFace());

View File

@ -122,11 +122,10 @@ public class ShopListener extends EventListener {
BlockFace facing; BlockFace facing;
BlockData data = block.getState().getBlockData(); BlockData data = block.getState().getBlockData();
if (data instanceof WallSign) { if (!(data instanceof WallSign wallSign)) {
facing = ((Directional) data).getFacing(); return;
} else {
facing = ((Rotatable) data).getRotation();
} }
facing = wallSign.getFacing();
Block relativeBlock = block.getRelative(facing.getOppositeFace()); Block relativeBlock = block.getRelative(facing.getOppositeFace());
PlayerShop shop = shopHandler.getShop(relativeBlock.getLocation()); PlayerShop shop = shopHandler.getShop(relativeBlock.getLocation());