Skip to content
Open
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 @@ -28,6 +28,7 @@
import vg.civcraft.mc.civmodcore.players.settings.SettingChangeListener;
import vg.civcraft.mc.civmodcore.players.settings.impl.DisplayLocationSetting;
import vg.civcraft.mc.namelayer.NameLayerAPI;
import vg.civcraft.mc.namelayer.group.Group;
import vg.civcraft.mc.namelayer.permission.PermissionType;

public class ModeListener implements Listener {
Expand Down Expand Up @@ -110,7 +111,11 @@ private void updateDisplayedInformation(Player player, Location location) {
Set<BastionType> alliedBastions = new HashSet<>();
Set<BastionType> enemyBastions = new HashSet<>();
for (BastionBlock bastion : bastionBlocks) {
if (NameLayerAPI.getGroupManager().hasAccess(bastion.getGroup(), player.getUniqueId(), placePerm)) {
// getGroup() is null when the bastion's reinforcement isn't loaded (its block sits on an
// unloaded chunk at the field edge). Treat that as not-allied without asking hasAccess,
// which otherwise logs a stack trace for the null group on every move event.
Group group = bastion.getGroup();
if (group != null && NameLayerAPI.getGroupManager().hasAccess(group, player.getUniqueId(), placePerm)) {
alliedBastions.add(bastion.getType());
} else {
enemyBastions.add(bastion.getType());
Expand Down