@Override public boolean isBlockSolid(PlotBlock block) { try { Material material = Material.getMaterial(block.id); if (material.isBlock() && material.isSolid() && !material.hasGravity()) { Class<? extends MaterialData> data = material.getData(); if (data.equals(MaterialData.class) || data.equals(Tree.class) || data.equals(Sandstone.class) || data.equals(Wool.class) || data.equals(Step.class)) { return true; } } return false; } catch (Exception e) { return false; } }
@Override public boolean isBlockSolid(PlotBlock block) { try { Material material = Material.getMaterial(block.id); if (material.isBlock() && material.isSolid() && !material.hasGravity()) { Class<? extends MaterialData> data = material.getData(); if (data.equals(MaterialData.class) && !material.isTransparent() && material.isOccluding() || data.equals(Tree.class) || data.equals(Sandstone.class) || data.equals(Wool.class) || data.equals(Step.class) || data.equals(WoodenStep.class)) { switch (material) { case NOTE_BLOCK: case MOB_SPAWNER: return false; default: return true; } } } return false; } catch (Exception ignored) { return false; } }
public Sandstone() { }
public Sandstone(SandstoneType type) { }
@Deprecated public Sandstone(int type) { }
public Sandstone(Material type) { }
@Deprecated public Sandstone(int type, byte data) { }
@Deprecated public Sandstone(Material type, byte data) { }
public Sandstone clone() { return null; }
public static MaterialData getMaterialData(String identifier) { final String[] split = identifier.replaceAll("\\s+", "_").split("\\W"); // TODO: Add additional material/name database like essentials/worldedit have Material material = matchMaterial(split[0]); if (material == null) { // try worldedit material = getWEMaterial(split[0]); if (material == null) return null; } if (split.length == 1) { return new MaterialData(material); } try { final byte rawData = Byte.parseByte(split[1]); return new MaterialData(material, rawData); } catch (NumberFormatException e) { // ignore } switch (material) { case LEAVES: return getMaterialData(material, Leaves::new, TreeSpecies.class, split[1]); case COAL: return getMaterialData(material, Coal::new, CoalType.class, split[1]); case LONG_GRASS: return getMaterialData(material, LongGrass::new, GrassSpecies.class, split[1]); case SANDSTONE: return getMaterialData(material, Sandstone::new, SandstoneType.class, split[1]); case MONSTER_EGG: return getMaterialData(material, SpawnEgg::new, EntityType.class, split[1]); case LOG: return getMaterialData(material, Tree::new, TreeSpecies.class, split[1]); case WOOD_STEP: return getMaterialData(material, WoodenStep::new, TreeSpecies.class, split[1]); case WOOL: return getMaterialData(material, Wool::new, DyeColor.class, split[1]); // TODO: Add Dye here when Spigot finally accepts my PR to match other MaterialData types default: // Couldn't find additional data for this material return new MaterialData(material); } }