Sends messages only once to all players on the island (#2389)

Was sending to visitors and all players so visitors saw it twice.
This commit is contained in:
tastybento 2024-05-26 17:56:46 -07:00 committed by GitHub
parent 1fd4a9043f
commit fc9b00233b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -225,9 +225,7 @@ public class PVPListener extends FlagListener {
// Only care about PVP Flags
if (Flags.PVP_OVERWORLD.equals(flag) || Flags.PVP_NETHER.equals(flag) || Flags.PVP_END.equals(flag)) {
String message = "protection.flags." + flag.getID() + "." + (e.isSetTo() ? "enabled" : "disabled");
// Send the message to visitors
e.getIsland().getVisitors().forEach(visitor -> User.getInstance(visitor).sendMessage(message));
// Send the message to players on the island
// Send the message to all players on the island
e.getIsland().getPlayersOnIsland().forEach(player -> User.getInstance(player).sendMessage(message));
}
}
@ -269,7 +267,7 @@ public class PVPListener extends FlagListener {
private void alertUser(@NonNull Player player, Flag flag) {
String message = "protection.flags." + flag.getID() + ".enabled";
User.getInstance(player).sendMessage(message);
User.getInstance(player).notify(message);
player.playSound(player.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER,2F, 1F);
}
}