Skip to content

Commit

Permalink
Fix issue when users could not select non-block items as icons for ch…
Browse files Browse the repository at this point in the history
…allenges and levels. (#190)
  • Loading branch information
BONNe committed Sep 28, 2019
1 parent 29a5057 commit 0c47f81
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- This allows to change between versions and snapshots. -->
<build.version>0.8.0</build.version>
<build.version>0.9.0</build.version>
<build.number>-LOCAL</build.number>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,36 @@ public SelectBlocksGUI(User user, BiConsumer<Boolean, Set<Material>> consumer)

public SelectBlocksGUI(User user, boolean singleSelect, BiConsumer<Boolean, Set<Material>> consumer)
{
this(user, singleSelect, new HashSet<>(), consumer);
this.consumer = consumer;
this.user = user;
this.singleSelect = singleSelect;

// Current GUI cannot display air blocks. It crashes with null-pointer
Set<Material> excludedMaterial = new HashSet<>();

excludedMaterial.add(Material.AIR);
excludedMaterial.add(Material.CAVE_AIR);
excludedMaterial.add(Material.VOID_AIR);

// Piston head and moving piston is not necessary. useless.
excludedMaterial.add(Material.PISTON_HEAD);
excludedMaterial.add(Material.MOVING_PISTON);

// Barrier cannot be accessible to user.
excludedMaterial.add(Material.BARRIER);

this.elements = new ArrayList<>();
this.selectedMaterials = new HashSet<>();

for (Material material : Material.values())
{
if (!material.isLegacy() && !excludedMaterial.contains(material))
{
this.elements.add(material);
}
}

this.build(0);
}


Expand Down

0 comments on commit 0c47f81

Please sign in to comment.