mirror of
https://github.com/YouHaveTrouble/PreventStabby.git
synced 2026-05-12 05:16:55 +00:00
fixed npe preventing spawn protection working
This commit is contained in:
@@ -29,7 +29,6 @@ public class PlayerAttackListener implements Listener {
|
|||||||
Player victim = (Player) victimEntity;
|
Player victim = (Player) victimEntity;
|
||||||
|
|
||||||
ConfigCache config = TogglePvp.getPlugin().getConfigCache();
|
ConfigCache config = TogglePvp.getPlugin().getConfigCache();
|
||||||
|
|
||||||
SmartCache smartCache = TogglePvp.getPlugin().getSmartCache();
|
SmartCache smartCache = TogglePvp.getPlugin().getSmartCache();
|
||||||
|
|
||||||
if (Instant.now().getEpochSecond() < smartCache.getPlayerData(victim.getUniqueId()).getLoginTimestamp()) {
|
if (Instant.now().getEpochSecond() < smartCache.getPlayerData(victim.getUniqueId()).getLoginTimestamp()) {
|
||||||
|
|||||||
+2
-1
@@ -18,7 +18,8 @@ public class PlayerJoinAndLeaveListener implements Listener {
|
|||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event) {
|
public void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
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());
|
playerData.setLoginTimestamp(Instant.now().getEpochSecond());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user