Add checks to BaseItemLine.onPickup()

This commit is contained in:
filoghost 2021-07-29 09:04:47 +02:00
parent 55643651c9
commit f470dddc40

View File

@ -11,6 +11,7 @@ import me.filoghost.holographicdisplays.api.hologram.PickupHandler;
import me.filoghost.holographicdisplays.common.hologram.StandardItemLine; import me.filoghost.holographicdisplays.common.hologram.StandardItemLine;
import me.filoghost.holographicdisplays.plugin.hologram.tracking.ItemLineTracker; import me.filoghost.holographicdisplays.plugin.hologram.tracking.ItemLineTracker;
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager; import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager;
import org.bukkit.GameMode;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.MustBeInvokedByOverriders; import org.jetbrains.annotations.MustBeInvokedByOverriders;
@ -33,7 +34,12 @@ public abstract class BaseItemLine extends BaseTouchableLine implements Standard
@Override @Override
public void onPickup(Player player) { public void onPickup(Player player) {
if (pickupHandler == null || !isVisibleTo(player)) { if (isDeleted()
|| !player.isOnline()
|| !isTrackedPlayer(player)
|| player.getGameMode() == GameMode.SPECTATOR
|| pickupHandler == null
|| !isVisibleTo(player)) {
return; return;
} }