From 312cb2996c6551247f992ee6c9d12257af8edaa6 Mon Sep 17 00:00:00 2001 From: Traks <58818927+traksag@users.noreply.github.com> Date: Wed, 22 Jun 2022 13:50:46 +0200 Subject: [PATCH] Better handling of offline projectile shooters (#3705) --- .../bukkit/listener/ProjectileEventListener.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java index 4293038df..2f37df132 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java @@ -149,6 +149,18 @@ public class ProjectileEventListener implements Listener { Plot plot = area.getPlot(location); ProjectileSource shooter = entity.getShooter(); if (shooter instanceof Player) { + if (!((Player) shooter).isOnline()) { + if (plot != null) { + if (plot.isAdded(((Player) shooter).getUniqueId()) || plot.getFlag(ProjectilesFlag.class)) { + return; + } + } + + entity.remove(); + event.setCancelled(true); + return; + } + PlotPlayer pp = BukkitUtil.adapt((Player) shooter); if (plot == null) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {