mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-12 10:44:42 +01:00
sponge: Fix NPE in pet owner check.
This commit is contained in:
parent
89e57c17ba
commit
cb69fab753
@ -459,6 +459,7 @@ public boolean protectEntity(Event event, Entity targetEntity, Cause cause, Dama
|
||||
}
|
||||
if (targetEntity instanceof Living && targetEntity.get(Keys.TAMED_OWNER).isPresent()) {
|
||||
final UUID ownerID = targetEntity.get(Keys.TAMED_OWNER).get().orElse(null);
|
||||
if (ownerID != null) {
|
||||
// always allow owner to interact with their pets
|
||||
if (player.getUniqueId().equals(ownerID)) {
|
||||
return false;
|
||||
@ -475,6 +476,7 @@ public boolean protectEntity(Event event, Entity targetEntity, Cause cause, Dama
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GriefDefenderPlugin.isSourceIdBlacklisted(Flags.ENTITY_DAMAGE.getName(), source, targetEntity.getWorld().getProperties())) {
|
||||
return false;
|
||||
|
@ -701,6 +701,7 @@ public void onPlayerInteractEntity(InteractEntityEvent.Primary event, @First Pla
|
||||
}
|
||||
if (targetEntity instanceof Living && targetEntity.get(Keys.TAMED_OWNER).isPresent()) {
|
||||
final UUID ownerID = targetEntity.get(Keys.TAMED_OWNER).get().orElse(null);
|
||||
if (ownerID != null) {
|
||||
// always allow owner to interact with their pets
|
||||
if (player.getUniqueId().equals(ownerID)) {
|
||||
GDTimings.PLAYER_INTERACT_ENTITY_PRIMARY_EVENT.stopTimingIfSync();
|
||||
@ -718,6 +719,7 @@ public void onPlayerInteractEntity(InteractEntityEvent.Primary event, @First Pla
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Location<World> location = targetEntity.getLocation();
|
||||
GDClaim claim = this.dataStore.getClaimAt(location);
|
||||
@ -760,6 +762,7 @@ public void onPlayerInteractEntity(InteractEntityEvent.Secondary event, @First P
|
||||
final GDPlayerData playerData = this.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
|
||||
if (targetEntity instanceof Living && targetEntity.get(Keys.TAMED_OWNER).isPresent()) {
|
||||
final UUID ownerID = targetEntity.get(Keys.TAMED_OWNER).get().orElse(null);
|
||||
if (ownerID != null) {
|
||||
// always allow owner to interact with their pets
|
||||
if (player.getUniqueId().equals(ownerID) || playerData.canIgnoreClaim(claim)) {
|
||||
if (playerData.petRecipientUniqueId != null) {
|
||||
@ -783,6 +786,7 @@ public void onPlayerInteractEntity(InteractEntityEvent.Secondary event, @First P
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (playerData.canIgnoreClaim(claim)) {
|
||||
GDTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.stopTimingIfSync();
|
||||
|
Loading…
Reference in New Issue
Block a user