fixed npe preventing spawn protection working

This commit is contained in:
YouHaveTrouble
2021-02-25 15:17:05 +01:00
parent b43a9853e8
commit c2033f5bcb
2 changed files with 2 additions and 2 deletions
@@ -29,7 +29,6 @@ public class PlayerAttackListener implements Listener {
Player victim = (Player) victimEntity;
ConfigCache config = TogglePvp.getPlugin().getConfigCache();
SmartCache smartCache = TogglePvp.getPlugin().getSmartCache();
if (Instant.now().getEpochSecond() < smartCache.getPlayerData(victim.getUniqueId()).getLoginTimestamp()) {
@@ -18,7 +18,8 @@ public class PlayerJoinAndLeaveListener implements Listener {
@EventHandler(ignoreCancelled = true)
public void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event) {
Player player = event.getPlayer();
PlayerData playerData = TogglePvp.getPlugin().getPlayerManager().getPlayer(player.getUniqueId());
SmartCache smartCache = TogglePvp.getPlugin().getSmartCache();
PlayerData playerData = smartCache.getPlayerData(player.getUniqueId());
playerData.setLoginTimestamp(Instant.now().getEpochSecond());
}