Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not disclose GM maps to players in status UI #4982

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,24 @@ private void refreshCount() {
new StringBuilder(I18N.getText("ConnectionStatusPanel.playersLoadedZone", loaded, total));

for (Player player : players) {
var zone =
player.getZoneId() == null ? null : MapTool.getCampaign().getZone(player.getZoneId());

var text =
I18N.getText(
player.getLoaded() ? "connections.playerIsInZone" : "connections.playerIsLoadingZone",
player.toString(),
zone == null ? null : zone.getDisplayName());
// GMs can see everyone's zone, players can only see each other's.
var showZone = MapTool.getPlayer().isGM() || !player.isGM();

String text;
if (showZone) {
var zone =
player.getZoneId() == null ? null : MapTool.getCampaign().getZone(player.getZoneId());
text =
I18N.getText(
player.getLoaded()
? "connections.playerIsInZone"
: "connections.playerIsLoadingZone",
player.toString(),
zone == null ? null : zone.getDisplayName());
} else {
text = player.toString();
}

sb.append("\n");
sb.append(text);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,26 @@ public class PlayerListCellRenderer extends DefaultListCellRenderer {
public Component getListCellRendererComponent(
JList<?> list, Object value, int index, boolean isSelected, boolean hasFocus) {
if (value instanceof Player player) {
var zone =
player.getZoneId() == null ? null : MapTool.getCampaign().getZone(player.getZoneId());
// GMs can see everyone's zone, players can only see each other's.
var showZone = MapTool.getPlayer().isGM() || !player.isGM();

String text =
I18N.getText(
player.getLoaded() ? "connections.playerIsInZone" : "connections.playerIsLoadingZone",
player.toString(),
zone == null ? null : zone.getDisplayName());
String text;
if (showZone) {
var zone =
player.getZoneId() == null ? null : MapTool.getCampaign().getZone(player.getZoneId());
text =
I18N.getText(
player.getLoaded()
? "connections.playerIsInZone"
: "connections.playerIsLoadingZone",
player.toString(),
zone == null ? null : zone.getDisplayName());
} else {
text = player.toString();
}
return super.getListCellRendererComponent(list, text, index, isSelected, hasFocus);
}

return super.getListCellRendererComponent(list, value, index, isSelected, hasFocus);
}
}
Loading