mirror of
https://github.com/YouHaveTrouble/PreventStabby.git
synced 2026-05-12 13:26:56 +00:00
prevent null players being forwarded to events and message sending logic edge case
This commit is contained in:
@@ -46,15 +46,16 @@ public class PlayerManager {
|
||||
for (PlayerData playerData : playerList.values()) {
|
||||
if (playerData == null) continue;
|
||||
Player player = Bukkit.getPlayer(playerData.getPlayerUuid());
|
||||
playerData.getRelatedEntities().removeIf( uuid -> {
|
||||
Entity entity = Bukkit.getEntity(uuid);
|
||||
return entity == null;
|
||||
});
|
||||
if (player == null || !player.isOnline()) {
|
||||
// player not online, so check for related entities
|
||||
playerData.getRelatedEntities().removeIf( uuid -> {
|
||||
Entity entity = Bukkit.getEntity(uuid);
|
||||
return entity == null;
|
||||
});
|
||||
if (playerData.getRelatedEntities().isEmpty()) continue;
|
||||
}
|
||||
playerData.refreshCacheTime(); // Refresh cache timer if player is online
|
||||
playerData.refreshCacheTime();
|
||||
if (player == null || !player.isOnline()) continue; // If player is offline, skip the rest of the logic
|
||||
// leaving combat logic
|
||||
if (playerData.getLastCombatCheckState() && !playerData.isInCombat()) {
|
||||
PlayerLeaveCombatEvent leaveCombatEvent = null;
|
||||
|
||||
Reference in New Issue
Block a user