Fix NPE in admin claims (#1011)
This commit is contained in:
parent
2048a9f31d
commit
b5542e24b1
|
|
@ -69,6 +69,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
//event handlers related to blocks
|
//event handlers related to blocks
|
||||||
|
|
@ -516,7 +517,7 @@ public class BlockEventHandler implements Listener
|
||||||
{
|
{
|
||||||
Block invadedBlock = pistonBlock.getRelative(direction);
|
Block invadedBlock = pistonBlock.getRelative(direction);
|
||||||
Claim invadedClaim = this.dataStore.getClaimAt(invadedBlock.getLocation(), false, pistonClaim);
|
Claim invadedClaim = this.dataStore.getClaimAt(invadedBlock.getLocation(), false, pistonClaim);
|
||||||
if (invadedClaim != null && (pistonClaim == null || !pistonClaim.ownerID.equals(invadedClaim.ownerID)))
|
if (invadedClaim != null && (pistonClaim == null || !Objects.equals(pistonClaim.ownerID, invadedClaim.ownerID)))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
@ -601,7 +602,7 @@ public class BlockEventHandler implements Listener
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If owners are different, cancel.
|
// If owners are different, cancel.
|
||||||
if (pistonClaim == null || !pistonClaim.ownerID.equals(claim.ownerID))
|
if (pistonClaim == null || !Objects.equals(pistonClaim.ownerID, claim.ownerID))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
|
@ -648,7 +649,7 @@ public class BlockEventHandler implements Listener
|
||||||
lastClaim = claim;
|
lastClaim = claim;
|
||||||
|
|
||||||
// If pushing this block will change ownership, cancel the event and take away the piston (for performance reasons).
|
// If pushing this block will change ownership, cancel the event and take away the piston (for performance reasons).
|
||||||
if (pistonClaim == null || !pistonClaim.ownerID.equals(claim.ownerID))
|
if (pistonClaim == null || !Objects.equals(pistonClaim.ownerID, claim.ownerID))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
pistonBlock.getWorld().createExplosion(pistonBlock.getLocation(), 0);
|
pistonBlock.getWorld().createExplosion(pistonBlock.getLocation(), 0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user