diff --git a/src/main/java/org/maxgamer/quickshop/Listeners/PlayerListener.java b/src/main/java/org/maxgamer/quickshop/Listeners/PlayerListener.java index 4f5d71b7b..b85d6c5a6 100644 --- a/src/main/java/org/maxgamer/quickshop/Listeners/PlayerListener.java +++ b/src/main/java/org/maxgamer/quickshop/Listeners/PlayerListener.java @@ -50,7 +50,7 @@ public class PlayerListener implements Listener { public void onClick(PlayerInteractEvent e) { if (e.getAction().equals(Action.LEFT_CLICK_BLOCK)) { Block b = e.getClickedBlock(); - if (!Util.canBeShop(b,e.getPlayer(),false) && b.getType() != Material.WALL_SIGN) { + if (!Util.canBeShop(b,e.getPlayer().getUniqueId(),false) && b.getType() != Material.WALL_SIGN) { Util.debugLog("No shop block"); return; } diff --git a/src/main/java/org/maxgamer/quickshop/Util/Util.java b/src/main/java/org/maxgamer/quickshop/Util/Util.java index 9b411a0ad..361508879 100644 --- a/src/main/java/org/maxgamer/quickshop/Util/Util.java +++ b/src/main/java/org/maxgamer/quickshop/Util/Util.java @@ -138,18 +138,18 @@ public class Util { * @param b The block to check, Possibly a chest, dispenser, etc. player The player, can be null if onlyCheck=true, onlyCheck The option to disable check AreaShop use player. * @return True if it can be made into a shop, otherwise false. */ - public static boolean canBeShop(Block b,Player player, boolean onlyCheck) { - if (plugin.special_region_only&&onlyCheck==false) { + public static boolean canBeShop(Block b,UUID player, boolean onlyCheck) { + if (plugin.special_region_only&&!onlyCheck) { List regions = me.wiefferink.areashop.tools.Utils.getImportantRentRegions(b.getLocation()); boolean passTheRegionCheck = false; for (RentRegion rentRegion : regions) { - if(rentRegion.getRenter()==player.getUniqueId()) { + if((rentRegion.getRenter()==player)||(rentRegion.getOwner()==player)||(rentRegion.getLandlord()==player)) { passTheRegionCheck=true; break; //If there passed, will continue to check BlockState } } if(!passTheRegionCheck) { - Util.debugLog("Not passed check for player "+player.getName()+" createing request."); + Util.debugLog("Not passed check for player "+player.toString()+" createing request."); return false; } }