Skip to content

Commit

Permalink
fix entity.shooter npe
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 19, 2020
1 parent 01957d3 commit 5d9b63e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Expand Up @@ -31,6 +31,8 @@ public class PlayerClicksBlockScriptEvent extends BukkitScriptEvent implements L
//
// @Group Player
//
// @Warning this event may in some cases double-fire, requiring usage of the 'ratelimit' command (like 'ratelimit <player> 1t') to prevent doubling actions.
//
// @Switch with:<item> to only process the event if a specified item was held.
// @Switch using:hand/off_hand/either_hand to only process the event if the specified hand was used to click.
// @Switch in:<area> to only process the event if it occurred within a specified area.
Expand Down
Expand Up @@ -26,6 +26,8 @@ public class PlayerRightClicksEntityScriptEvent extends BukkitScriptEvent implem
// @Switch in:<area> to only process the event if it occurred within a specified area.
// @Switch with:<item> to only process the event when the player is holding a specified item.
//
// @Warning this event may in some cases double-fire, requiring usage of the 'ratelimit' command (like 'ratelimit <player> 1t') to prevent doubling actions.
//
// @Cancellable true
//
// @Triggers when a player right clicks on an entity.
Expand Down
Expand Up @@ -1747,7 +1747,11 @@ else if (mtr.angle == BlockFace.EAST) {
// Returns the entity's shooter, if any.
// -->
registerSpawnedOnlyTag("shooter", (attribute, object) -> {
return object.getShooter().getDenizenObject();
EntityTag shooter = object.getShooter();
if (shooter == null) {
return null;
}
return shooter.getDenizenObject();
}, "get_shooter");

// <--[tag]
Expand Down
Expand Up @@ -3663,6 +3663,10 @@ else if (bal > goal) {
// Sends the player to the specified Bungee server.
// -->
if (mechanism.matches("send_to") && mechanism.hasValue()) {
if (!isOnline()) {
Debug.echoError("Cannot use send_to on offline player.");
return;
}
Depends.bungeeSendPlayer(getPlayerEntity(), mechanism.getValue().asString());
}

Expand Down

0 comments on commit 5d9b63e

Please sign in to comment.