Add /hullhider to BauSystem

/hullhider hides the inside of the build area hull of a region from the
players who toggle it, like the hull hider of a fight. Each region gets its
own hull while somebody uses it; it is rebuilt every time somebody enables it,
as WorldEdit and Axiom changes do not update it. /techhider, /xray and
/hullhider exclude each other per player and region.

Which players may see the hull contents is now decided by Viewers, a sealed
class with HiddenByDefault (fight) and VisibleByDefault (bau). Added players
are stored in a set; isViewer alone defines what being added means.
This commit is contained in:
2026-10-31 15:32:18 +01:00
parent d1fb4ca67e
commit f02f356b2b
11 changed files with 391 additions and 39 deletions
@@ -32,6 +32,7 @@ import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.states.StateDependentTask;
import de.steamwar.hullhider.Hull;
import de.steamwar.hullhider.HullHider;
import de.steamwar.hullhider.Viewers;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@@ -56,7 +57,7 @@ public class FightHullHider {
Fight.teams().forEach(team -> {
Region region = team.getSchemRegion();
hullHider.addHull(team, new Hull(FightSystem.getPlugin(), Config.world, region.toHullRegion(), region.getMinY() != Config.PlayerRegion.getMinY(), Config.GameModeConfig.Techhider.HiddenBlocks));
hullHider.addHull(team, new Hull(FightSystem.getPlugin(), Config.world, region.toHullRegion(), region.getMinY() != Config.PlayerRegion.getMinY(), Config.GameModeConfig.Techhider.HiddenBlocks, new Viewers.HiddenByDefault()));
});
new StateDependentListener(TechHiderWrapper.ENABLED, FightState.All, new MembershipListener());
@@ -109,7 +110,13 @@ public class FightHullHider {
FightTeam team = Fight.getPlayerTeam(player);
FightPlayer fp = Fight.getFightPlayer(player);
hullHider.forEach((hullTeam, hull) -> hullHider.setViewer(player, hullTeam, Config.isReferee(player) || hullTeam == team || (fp != null && fp.canEntern())));
hullHider.forEach((hullTeam, hull) -> {
if (Config.isReferee(player) || hullTeam == team || (fp != null && fp.canEntern())) {
hullHider.addViewer(player, hullTeam);
} else {
hullHider.removeViewer(player, hullTeam);
}
});
}
public void blockUpdate(Block block, Material changedType) {