Skip to content

Commit

Permalink
improve materialutil
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Jan 4, 2024
1 parent 9c1c076 commit 45ccd3a
Showing 1 changed file with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
public class MaterialUtil {

public static final HashSet<Material> PLAYER_HEADS = Stream.of(
XMaterial.PLAYER_HEAD,
XMaterial.PLAYER_WALL_HEAD
XMaterial.PLAYER_HEAD,
XMaterial.PLAYER_WALL_HEAD
).filter(XMaterial::isSupported)
.map(XMaterial::parseMaterial)
.collect(Collectors.toCollection(HashSet::new));
Expand All @@ -33,13 +33,13 @@ public class MaterialUtil {
.collect(Collectors.toCollection(HashSet::new));

public static final HashSet<Material> SOLID_INDESTRUCTIBLES = Stream.of(
XMaterial.BEDROCK,
XMaterial.END_PORTAL_FRAME,
XMaterial.REINFORCED_DEEPSLATE,
XMaterial.STRUCTURE_BLOCK,
XMaterial.STRUCTURE_VOID,
XMaterial.BARRIER,
XMaterial.COMMAND_BLOCK
XMaterial.BEDROCK,
XMaterial.END_PORTAL_FRAME,
XMaterial.REINFORCED_DEEPSLATE,
XMaterial.STRUCTURE_BLOCK,
XMaterial.STRUCTURE_VOID,
XMaterial.BARRIER,
XMaterial.COMMAND_BLOCK
).filter(XMaterial::isSupported)
.map(XMaterial::parseMaterial)
.collect(Collectors.toCollection(HashSet::new));
Expand Down Expand Up @@ -179,13 +179,7 @@ public static boolean isShulkerBox(ItemStack item) {
.collect(Collectors.toCollection(HashSet::new));

public static final HashSet<Material> SPAWN_EGGS = Arrays.stream(XMaterial.values())
.filter(xMaterial -> {
if (xMaterial.isSupported()) {
final String name = xMaterial.name().toUpperCase();
return name.contains("SPAWN_EGG") || name.contains("MONSTER_EGG");
}
return false;
})
.filter(xMaterial -> xMaterial.name().toUpperCase().endsWith("_SPAWN_EGG") && xMaterial.isSupported())
.map(XMaterial::parseMaterial)
.collect(Collectors.toCollection(HashSet::new));

Expand Down

0 comments on commit 45ccd3a

Please sign in to comment.