mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Add more check
Former-commit-id: 02487c6a74333aa05017464b473a41485f2a5d75 [formerly e31ac6fa37231a0de5932dac8cab963a77b9c035] Former-commit-id: 733bbdd37da88050cbbb4786a5e792e16ff7b014
This commit is contained in:
1 parent
0f2150022d
commit
963f3b9ea4
2 files changed
+5
-5
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<RentRegion> 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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user