Skip to content

Commit 16936d6

Browse files
authored
Merge pull request #350 from BentoBoxWorld/349_hiding_block_in_value_panel
349 hiding block in value panel
2 parents 677a95d + 9ce190f commit 16936d6

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<!-- Do not change unless you want different name for local builds. -->
6868
<build.number>-LOCAL</build.number>
6969
<!-- This allows to change between versions. -->
70-
<build.version>2.19.0</build.version>
70+
<build.version>2.19.1</build.version>
7171
<sonar.projectKey>BentoBoxWorld_Level</sonar.projectKey>
7272
<sonar.organization>bentobox-world</sonar.organization>
7373
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

src/main/java/world/bentobox/level/config/BlockConfig.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,9 @@ public Integer getValue(World world, Object obj) {
238238
* @return true if hidden
239239
*/
240240
public boolean isHiddenBlock(Object obj) {
241-
if (obj instanceof Material m) {
241+
if (obj instanceof String s) {
242+
return hiddenBlocks.contains(s);
243+
} else if (obj instanceof Material m) {
242244
return hiddenBlocks.contains(m.name());
243245
}
244246
return hiddenBlocks.contains(Material.SPAWNER.name());
@@ -250,11 +252,7 @@ public boolean isHiddenBlock(Object obj) {
250252
* @return false if hidden
251253
*/
252254
public boolean isNotHiddenBlock(Object obj) {
253-
if (obj instanceof Material m) {
254-
return !hiddenBlocks.contains(m.name());
255-
} else {
256-
return !hiddenBlocks.contains(Material.SPAWNER.name());
257-
}
255+
return !isHiddenBlock(obj);
258256
}
259257

260258
/**

src/main/java/world/bentobox/level/panels/ValuePanel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ private ValuePanel(Level addon,
135135
this.activeFilter = Filter.NAME_ASC;
136136

137137
addon.getBlockConfig().getBlockValues().entrySet().stream().filter(en -> this.getIcon(en.getKey()) != null)
138+
.filter(en -> addon.getBlockConfig().isNotHiddenBlock(en.getKey()))
138139
.forEach(en -> blockRecordList
139140
.add(new BlockRecord(en.getKey(), Objects.requireNonNullElse(en.getValue(), 0),
140141
Objects.requireNonNullElse(addon.getBlockConfig().getLimit(en.getKey()), 0))));

0 commit comments

Comments
 (0)