Add an online check for teleport listener

- Some plugins seem to like teleport players before they're online (e.g. NoCheatPlus)
 - Addresses #3142
This commit is contained in:
dordsor21 2021-07-10 10:40:44 +01:00
parent 991703914c
commit b9cb6842e2
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -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<Plot> lastPlotAccess =
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {