From b9cb6842e254c109a0ec9727249bea27feb18e1d Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 10 Jul 2021 10:40:44 +0100 Subject: [PATCH] Add an online check for teleport listener - Some plugins seem to like teleport players before they're online (e.g. NoCheatPlus) - Addresses #3142 --- .../com/plotsquared/bukkit/listener/PlayerEventListener.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index 74e3a9789..fd2b384ee 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -383,6 +383,10 @@ public class PlayerEventListener extends PlotListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onTeleport(PlayerTeleportEvent event) { Player player = event.getPlayer(); + //We need to account for bad plugins like NoCheatPlus that teleports player on/before login -_- + if (!player.isOnline()) { + return; + } BukkitPlayer pp = BukkitUtil.adapt(player); try (final MetaDataAccess lastPlotAccess = pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {