Skip to content

Commit

Permalink
Sends messages only once to all players on the island (#2389)
Browse files Browse the repository at this point in the history
Was sending to visitors and all players so visitors saw it twice.
  • Loading branch information
tastybento authored May 27, 2024
1 parent 1fd4a90 commit fc9b002
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,7 @@ public void onPVPFlagToggle(final FlagSettingChangeEvent e) {
// 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));
}
}
Expand Down Expand Up @@ -269,7 +267,7 @@ public void onPlayerTeleport(PlayerTeleportEvent e) {

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);
}
}

0 comments on commit fc9b002

Please sign in to comment.