From f16c4a4dc39aaa067db451fde6df99a98f2a7092 Mon Sep 17 00:00:00 2001
From: Ghost_chu <2908803755@qq.com>
Date: Sat, 29 Dec 2018 20:34:05 +0800
Subject: [PATCH] Fix nullpointer exception
Former-commit-id: d39a33b1685dcb24affa55bc22b030be94e2ca4d [formerly 6caa2ccad8b8e49b084e2c279be4d9160e9e3a2d]
Former-commit-id: cf2792124846ae1531b14c93061e80a7d97f0487
---
pom.xml | 2 +-
.../org/maxgamer/quickshop/Util/Util.java | 19 +++++++++++++------
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/pom.xml b/pom.xml
index f142834ed..fe6f2deb8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
org.maxgamer
QuickShop
- Reremake 1.3.2-SNAPSHOT-5
+ Reremake 1.3.2-SNAPSHOT-6
diff --git a/src/main/java/org/maxgamer/quickshop/Util/Util.java b/src/main/java/org/maxgamer/quickshop/Util/Util.java
index 31095086e..3d2d2802a 100644
--- a/src/main/java/org/maxgamer/quickshop/Util/Util.java
+++ b/src/main/java/org/maxgamer/quickshop/Util/Util.java
@@ -145,13 +145,20 @@ public class Util {
List regions = me.wiefferink.areashop.tools.Utils.getImportantRentRegions(b.getLocation());
boolean passTheRegionCheck = false;
for (RentRegion rentRegion : regions) {
- Util.debugLog("Region: "+rentRegion.getName());
- Util.debugLog("Owner: "+rentRegion.getOwner().toString());
- Util.debugLog("Renter: "+rentRegion.getRenter().toString());
- Util.debugLog("LandLore: "+rentRegion.getLandlord().toString());
- if((rentRegion.getRenter()==player)||(rentRegion.getOwner()==player)||(rentRegion.getLandlord()==player)) {
+ if(rentRegion.getRenter()!=null&&rentRegion.getRenter()==player) {
passTheRegionCheck=true;
- break; //If there passed, will continue to check BlockState
+ Util.debugLog("Passed check: Same renter.");
+ break;
+ }
+ if(rentRegion.getOwner()!=null&&rentRegion.getOwner()==player) {
+ passTheRegionCheck=true;
+ Util.debugLog("Passed check: Same owner.");
+ break;
+ }
+ if(rentRegion.getLandlord()!=null&&rentRegion.getLandlord()==player) {
+ passTheRegionCheck=true;
+ Util.debugLog("Passed check: Same landlord.");
+ break;
}
}
if(!passTheRegionCheck) {