Skip to content

Commit

Permalink
Grant first kills to other nearby players
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenEarth-git authored Sep 7, 2024
1 parent c174e05 commit e06badf
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,26 @@ public void entityDeathEvent(EntityDeathEvent event) {
}
});
} else {
// Not a boss, just record kill for the killer
// Not a boss, record kill for the killer
try {
mStorage.recordKill(player, soul);
} catch (Exception ex) {
mLogger.warning(ex.getMessage());
}

// also check if any nearby player has not killed that mob before, and give them the kill
// good for both unlocking the entry in group play, and also to stop descriptions from showing up too many times
List<Player> otherPlayers = player.getWorld().getPlayers();
otherPlayers.remove(player);
otherPlayers.removeIf(p -> p.getLocation().distanceSquared(player.getLocation()) > 20 * 20);
otherPlayers.removeIf(p -> getKillsForMob(p, soul) > 0);
for (Player p : otherPlayers) {
try {
mStorage.recordKill(p, soul);
} catch (Exception ex) {
mLogger.warning(ex.getMessage());
}
}
}
}
} catch (Exception ex) {
Expand Down

0 comments on commit e06badf

Please sign in to comment.