Remove lag from legacy Material support issue

Spigot pulls in all the legacy marerials if you loop through the
material values.
This commit is contained in:
tastybento 2021-09-25 11:34:36 -07:00
parent 354806c060
commit c660575456
3 changed files with 9 additions and 1 deletions

View File

@ -23,11 +23,13 @@ import world.bentobox.greenhouses.world.AsyncWorldCache;
* @author tastybento
*
*/
@SuppressWarnings("deprecation")
public class Roof extends MinMaxXZ {
private static final List<Material> ROOF_BLOCKS;
static {
// Roof blocks
ROOF_BLOCKS = Arrays.stream(Material.values())
.filter(m -> !m.isLegacy())
.filter(Material::isBlock) // Blocks only, no items
.filter(m -> Tag.TRAPDOORS.isTagged(m) // All trapdoors
|| (m.name().contains("GLASS") && !m.name().contains("GLASS_PANE")) // All glass blocks

View File

@ -12,12 +12,14 @@ import world.bentobox.bentobox.BentoBox;
import world.bentobox.greenhouses.Greenhouses;
import world.bentobox.greenhouses.world.AsyncWorldCache;
@SuppressWarnings("deprecation")
public class Walls extends MinMaxXZ {
private static final List<Material> WALL_BLOCKS;
static {
// Hoppers
WALL_BLOCKS = Arrays.stream(Material.values())
.filter(Material::isBlock) // Blocks only, no items
.filter(m -> !m.isLegacy())
.filter(m -> !m.name().contains("TRAPDOOR")) // No trap doors
.filter(m -> m.name().contains("DOOR") // All doors
|| (m.name().contains("GLASS") && !m.name().contains("GLASS_PANE")) // All glass blocks

View File

@ -1,6 +1,10 @@
package world.bentobox.greenhouses.managers;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;