Class HybridMask

java.lang.Object
io.github.projectunified.craftux.mask.MultiMask<Mask>
io.github.projectunified.craftux.mask.HybridMask
All Implemented Interfaces:
Element, Mask

public class HybridMask extends MultiMask<Mask>
A mask that combines multiple child masks, merging their position-action mappings. When multiple masks define actions for the same position, they are combined sequentially using Consumer.andThen.

Example usage:


 HybridMask hybridMask = new HybridMask();
 hybridMask.add(
     new SingleMask(Position.of(0, 0), new SimpleButton(new ItemStack(Material.APPLE))),
     new SingleMask(Position.of(0, 0), new SimpleButton(new ItemStack(Material.CARROT)))
 );
 Map<Position, Consumer<ActionItem>> combinedActions = hybridMask.apply(playerUUID);
 
  • Constructor Details

    • HybridMask

      public HybridMask()
  • Method Details

    • apply

      @NotNull public @NotNull Map<Position,Consumer<ActionItem>> apply(@NotNull @NotNull UUID uuid)
      Description copied from interface: Mask
      Get a map of positions to action item consumers
      Parameters:
      uuid - the uuid of the player
      Returns:
      the map, or null if no items should be displayed. Can return null in a conditional case (e.g. predicate mask)