mirror of
https://github.com/Flowsqy/ShopChest.git
synced 2024-11-26 01:05:12 +01:00
Fixed error when clicking an entity that is not an ArmorStand
(only occurred with WorldGuard)
This commit is contained in:
parent
c78f81a1b6
commit
39e3b4f837
@ -84,11 +84,12 @@ public class WorldGuardListener implements Listener {
|
|||||||
|
|
||||||
if (event.getOriginalEvent() instanceof PlayerInteractAtEntityEvent) {
|
if (event.getOriginalEvent() instanceof PlayerInteractAtEntityEvent) {
|
||||||
PlayerInteractAtEntityEvent orig = (PlayerInteractAtEntityEvent) event.getOriginalEvent();
|
PlayerInteractAtEntityEvent orig = (PlayerInteractAtEntityEvent) event.getOriginalEvent();
|
||||||
|
|
||||||
Entity e = orig.getRightClicked();
|
Entity e = orig.getRightClicked();
|
||||||
if (!Hologram.isPartOfHologram((ArmorStand) e)) return;
|
|
||||||
|
|
||||||
if (e.getType() == EntityType.ARMOR_STAND) {
|
if (e.getType() == EntityType.ARMOR_STAND) {
|
||||||
|
if (!Hologram.isPartOfHologram((ArmorStand) e))
|
||||||
|
return;
|
||||||
|
|
||||||
for (Shop shop : plugin.getShopUtils().getShops()) {
|
for (Shop shop : plugin.getShopUtils().getShops()) {
|
||||||
if (shop.getHologram().contains((ArmorStand) e)) {
|
if (shop.getHologram().contains((ArmorStand) e)) {
|
||||||
if (isAllowed(player, shop.getLocation(), Action.RIGHT_CLICK_BLOCK)) {
|
if (isAllowed(player, shop.getLocation(), Action.RIGHT_CLICK_BLOCK)) {
|
||||||
@ -112,11 +113,12 @@ public class WorldGuardListener implements Listener {
|
|||||||
|
|
||||||
if (event.getOriginalEvent() instanceof EntityDamageByEntityEvent) {
|
if (event.getOriginalEvent() instanceof EntityDamageByEntityEvent) {
|
||||||
EntityDamageByEntityEvent orig = (EntityDamageByEntityEvent) event.getOriginalEvent();
|
EntityDamageByEntityEvent orig = (EntityDamageByEntityEvent) event.getOriginalEvent();
|
||||||
|
|
||||||
Entity e = orig.getEntity();
|
Entity e = orig.getEntity();
|
||||||
if (!Hologram.isPartOfHologram((ArmorStand) e)) return;
|
|
||||||
|
|
||||||
if (e.getType() == EntityType.ARMOR_STAND) {
|
if (e.getType() == EntityType.ARMOR_STAND) {
|
||||||
|
if (!Hologram.isPartOfHologram((ArmorStand) e))
|
||||||
|
return;
|
||||||
|
|
||||||
for (Shop shop : plugin.getShopUtils().getShops()) {
|
for (Shop shop : plugin.getShopUtils().getShops()) {
|
||||||
if (shop.getHologram().contains((ArmorStand) e)) {
|
if (shop.getHologram().contains((ArmorStand) e)) {
|
||||||
if (isAllowed(player, shop.getLocation(), Action.LEFT_CLICK_BLOCK)) {
|
if (isAllowed(player, shop.getLocation(), Action.LEFT_CLICK_BLOCK)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user