mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-18 21:32:04 +01:00
Fixes bug with null flags
This class is called before all the flags are initialized so it cannot reference them directly. This fixes the situation by using Strings, but it can be improved.
This commit is contained in:
parent
21916b5a59
commit
86e39a801e
@ -3,6 +3,7 @@ package world.bentobox.bentobox.listeners.flags.protection;
|
|||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -30,115 +31,115 @@ import world.bentobox.bentobox.lists.Flags;
|
|||||||
*/
|
*/
|
||||||
public class BlockInteractionListener extends FlagListener {
|
public class BlockInteractionListener extends FlagListener {
|
||||||
|
|
||||||
private final Map<Material, Flag> inHandItems;
|
private final Map<Material, String> inHandItems;
|
||||||
|
|
||||||
private final Map<Material, Flag> clickedBlocks;
|
private final Map<Material, String> clickedBlocks;
|
||||||
|
|
||||||
public BlockInteractionListener() {
|
public BlockInteractionListener() {
|
||||||
inHandItems = new EnumMap<>(Material.class);
|
inHandItems = new EnumMap<>(Material.class);
|
||||||
inHandItems.put(Material.ENDER_PEARL, Flags.ENDER_PEARL);
|
inHandItems.put(Material.ENDER_PEARL, "ENDER_PEARL");
|
||||||
inHandItems.put(Material.BONE_MEAL, Flags.PLACE_BLOCKS);
|
inHandItems.put(Material.BONE_MEAL, "PLACE_BLOCKS");
|
||||||
clickedBlocks = new EnumMap<>(Material.class);
|
clickedBlocks = new EnumMap<>(Material.class);
|
||||||
clickedBlocks.put(Material.ANVIL, Flags.ANVIL);
|
clickedBlocks.put(Material.ANVIL, "ANVIL");
|
||||||
clickedBlocks.put(Material.CHIPPED_ANVIL, Flags.ANVIL);
|
clickedBlocks.put(Material.CHIPPED_ANVIL, "ANVIL");
|
||||||
clickedBlocks.put(Material.DAMAGED_ANVIL, Flags.ANVIL);
|
clickedBlocks.put(Material.DAMAGED_ANVIL, "ANVIL");
|
||||||
clickedBlocks.put(Material.BEACON, Flags.BEACON);
|
clickedBlocks.put(Material.BEACON, "BEACON");
|
||||||
clickedBlocks.put(Material.BLACK_BED, Flags.BED);
|
clickedBlocks.put(Material.BLACK_BED, "BED");
|
||||||
clickedBlocks.put(Material.BLUE_BED, Flags.BED);
|
clickedBlocks.put(Material.BLUE_BED, "BED");
|
||||||
clickedBlocks.put(Material.BROWN_BED, Flags.BED);
|
clickedBlocks.put(Material.BROWN_BED, "BED");
|
||||||
clickedBlocks.put(Material.CYAN_BED, Flags.BED);
|
clickedBlocks.put(Material.CYAN_BED, "BED");
|
||||||
clickedBlocks.put(Material.GRAY_BED, Flags.BED);
|
clickedBlocks.put(Material.GRAY_BED, "BED");
|
||||||
clickedBlocks.put(Material.GREEN_BED, Flags.BED);
|
clickedBlocks.put(Material.GREEN_BED, "BED");
|
||||||
clickedBlocks.put(Material.LIGHT_BLUE_BED, Flags.BED);
|
clickedBlocks.put(Material.LIGHT_BLUE_BED, "BED");
|
||||||
clickedBlocks.put(Material.LIGHT_GRAY_BED, Flags.BED);
|
clickedBlocks.put(Material.LIGHT_GRAY_BED, "BED");
|
||||||
clickedBlocks.put(Material.LIME_BED, Flags.BED);
|
clickedBlocks.put(Material.LIME_BED, "BED");
|
||||||
clickedBlocks.put(Material.MAGENTA_BED, Flags.BED);
|
clickedBlocks.put(Material.MAGENTA_BED, "BED");
|
||||||
clickedBlocks.put(Material.ORANGE_BED, Flags.BED);
|
clickedBlocks.put(Material.ORANGE_BED, "BED");
|
||||||
clickedBlocks.put(Material.PINK_BED, Flags.BED);
|
clickedBlocks.put(Material.PINK_BED, "BED");
|
||||||
clickedBlocks.put(Material.PURPLE_BED, Flags.BED);
|
clickedBlocks.put(Material.PURPLE_BED, "BED");
|
||||||
clickedBlocks.put(Material.RED_BED, Flags.BED);
|
clickedBlocks.put(Material.RED_BED, "BED");
|
||||||
clickedBlocks.put(Material.WHITE_BED, Flags.BED);
|
clickedBlocks.put(Material.WHITE_BED, "BED");
|
||||||
clickedBlocks.put(Material.YELLOW_BED, Flags.BED);
|
clickedBlocks.put(Material.YELLOW_BED, "BED");
|
||||||
clickedBlocks.put(Material.BREWING_STAND, Flags.BREWING);
|
clickedBlocks.put(Material.BREWING_STAND, "BREWING");
|
||||||
clickedBlocks.put(Material.CAULDRON, Flags.BREWING);
|
clickedBlocks.put(Material.CAULDRON, "BREWING");
|
||||||
clickedBlocks.put(Material.BARREL, Flags.CONTAINER);
|
clickedBlocks.put(Material.BARREL, "CONTAINER");
|
||||||
clickedBlocks.put(Material.CHEST, Flags.CONTAINER);
|
clickedBlocks.put(Material.CHEST, "CONTAINER");
|
||||||
clickedBlocks.put(Material.CHEST_MINECART, Flags.CONTAINER);
|
clickedBlocks.put(Material.CHEST_MINECART, "CONTAINER");
|
||||||
clickedBlocks.put(Material.TRAPPED_CHEST, Flags.CONTAINER);
|
clickedBlocks.put(Material.TRAPPED_CHEST, "CONTAINER");
|
||||||
clickedBlocks.put(Material.BLACK_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.BLACK_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.BLUE_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.BLUE_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.BROWN_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.BROWN_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.CYAN_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.CYAN_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.GRAY_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.GRAY_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.GREEN_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.GREEN_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.LIGHT_BLUE_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.LIGHT_BLUE_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.LIME_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.LIME_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.PINK_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.PINK_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.MAGENTA_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.MAGENTA_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.ORANGE_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.ORANGE_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.PURPLE_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.PURPLE_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.RED_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.RED_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.LIGHT_GRAY_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.LIGHT_GRAY_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.WHITE_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.WHITE_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.YELLOW_SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.YELLOW_SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.SHULKER_BOX, Flags.CONTAINER);
|
clickedBlocks.put(Material.SHULKER_BOX, "CONTAINER");
|
||||||
clickedBlocks.put(Material.FLOWER_POT, Flags.CONTAINER);
|
clickedBlocks.put(Material.FLOWER_POT, "CONTAINER");
|
||||||
clickedBlocks.put(Material.COMPOSTER, Flags.CONTAINER);
|
clickedBlocks.put(Material.COMPOSTER, "CONTAINER");
|
||||||
clickedBlocks.put(Material.DISPENSER, Flags.DISPENSER);
|
clickedBlocks.put(Material.DISPENSER, "DISPENSER");
|
||||||
clickedBlocks.put(Material.DROPPER, Flags.DROPPER);
|
clickedBlocks.put(Material.DROPPER, "DROPPER");
|
||||||
clickedBlocks.put(Material.HOPPER, Flags.HOPPER);
|
clickedBlocks.put(Material.HOPPER, "HOPPER");
|
||||||
clickedBlocks.put(Material.HOPPER_MINECART, Flags.HOPPER);
|
clickedBlocks.put(Material.HOPPER_MINECART, "HOPPER");
|
||||||
clickedBlocks.put(Material.ACACIA_DOOR, Flags.DOOR);
|
clickedBlocks.put(Material.ACACIA_DOOR, "DOOR");
|
||||||
clickedBlocks.put(Material.BIRCH_DOOR, Flags.DOOR);
|
clickedBlocks.put(Material.BIRCH_DOOR, "DOOR");
|
||||||
clickedBlocks.put(Material.DARK_OAK_DOOR, Flags.DOOR);
|
clickedBlocks.put(Material.DARK_OAK_DOOR, "DOOR");
|
||||||
clickedBlocks.put(Material.IRON_DOOR, Flags.DOOR);
|
clickedBlocks.put(Material.IRON_DOOR, "DOOR");
|
||||||
clickedBlocks.put(Material.JUNGLE_DOOR, Flags.DOOR);
|
clickedBlocks.put(Material.JUNGLE_DOOR, "DOOR");
|
||||||
clickedBlocks.put(Material.SPRUCE_DOOR, Flags.DOOR);
|
clickedBlocks.put(Material.SPRUCE_DOOR, "DOOR");
|
||||||
clickedBlocks.put(Material.OAK_DOOR, Flags.DOOR);
|
clickedBlocks.put(Material.OAK_DOOR, "DOOR");
|
||||||
clickedBlocks.put(Material.ACACIA_TRAPDOOR, Flags.TRAPDOOR);
|
clickedBlocks.put(Material.ACACIA_TRAPDOOR, "TRAPDOOR");
|
||||||
clickedBlocks.put(Material.BIRCH_TRAPDOOR, Flags.TRAPDOOR);
|
clickedBlocks.put(Material.BIRCH_TRAPDOOR, "TRAPDOOR");
|
||||||
clickedBlocks.put(Material.DARK_OAK_TRAPDOOR, Flags.TRAPDOOR);
|
clickedBlocks.put(Material.DARK_OAK_TRAPDOOR, "TRAPDOOR");
|
||||||
clickedBlocks.put(Material.OAK_TRAPDOOR, Flags.TRAPDOOR);
|
clickedBlocks.put(Material.OAK_TRAPDOOR, "TRAPDOOR");
|
||||||
clickedBlocks.put(Material.JUNGLE_TRAPDOOR, Flags.TRAPDOOR);
|
clickedBlocks.put(Material.JUNGLE_TRAPDOOR, "TRAPDOOR");
|
||||||
clickedBlocks.put(Material.SPRUCE_TRAPDOOR, Flags.TRAPDOOR);
|
clickedBlocks.put(Material.SPRUCE_TRAPDOOR, "TRAPDOOR");
|
||||||
clickedBlocks.put(Material.IRON_TRAPDOOR, Flags.TRAPDOOR);
|
clickedBlocks.put(Material.IRON_TRAPDOOR, "TRAPDOOR");
|
||||||
clickedBlocks.put(Material.ACACIA_FENCE_GATE, Flags.GATE);
|
clickedBlocks.put(Material.ACACIA_FENCE_GATE, "GATE");
|
||||||
clickedBlocks.put(Material.BIRCH_FENCE_GATE, Flags.GATE);
|
clickedBlocks.put(Material.BIRCH_FENCE_GATE, "GATE");
|
||||||
clickedBlocks.put(Material.DARK_OAK_FENCE_GATE, Flags.GATE);
|
clickedBlocks.put(Material.DARK_OAK_FENCE_GATE, "GATE");
|
||||||
clickedBlocks.put(Material.OAK_FENCE_GATE, Flags.GATE);
|
clickedBlocks.put(Material.OAK_FENCE_GATE, "GATE");
|
||||||
clickedBlocks.put(Material.JUNGLE_FENCE_GATE, Flags.GATE);
|
clickedBlocks.put(Material.JUNGLE_FENCE_GATE, "GATE");
|
||||||
clickedBlocks.put(Material.SPRUCE_FENCE_GATE, Flags.GATE);
|
clickedBlocks.put(Material.SPRUCE_FENCE_GATE, "GATE");
|
||||||
clickedBlocks.put(Material.BLAST_FURNACE, Flags.FURNACE);
|
clickedBlocks.put(Material.BLAST_FURNACE, "FURNACE");
|
||||||
clickedBlocks.put(Material.CAMPFIRE, Flags.FURNACE);
|
clickedBlocks.put(Material.CAMPFIRE, "FURNACE");
|
||||||
clickedBlocks.put(Material.FURNACE_MINECART, Flags.FURNACE);
|
clickedBlocks.put(Material.FURNACE_MINECART, "FURNACE");
|
||||||
clickedBlocks.put(Material.FURNACE, Flags.FURNACE);
|
clickedBlocks.put(Material.FURNACE, "FURNACE");
|
||||||
clickedBlocks.put(Material.SMOKER, Flags.FURNACE);
|
clickedBlocks.put(Material.SMOKER, "FURNACE");
|
||||||
clickedBlocks.put(Material.ENCHANTING_TABLE, Flags.ENCHANTING);
|
clickedBlocks.put(Material.ENCHANTING_TABLE, "ENCHANTING");
|
||||||
clickedBlocks.put(Material.ENDER_CHEST, Flags.ENDER_CHEST);
|
clickedBlocks.put(Material.ENDER_CHEST, "ENDER_CHEST");
|
||||||
clickedBlocks.put(Material.JUKEBOX, Flags.JUKEBOX);
|
clickedBlocks.put(Material.JUKEBOX, "JUKEBOX");
|
||||||
clickedBlocks.put(Material.NOTE_BLOCK, Flags.NOTE_BLOCK);
|
clickedBlocks.put(Material.NOTE_BLOCK, "NOTE_BLOCK");
|
||||||
clickedBlocks.put(Material.CRAFTING_TABLE, Flags.CRAFTING);
|
clickedBlocks.put(Material.CRAFTING_TABLE, "CRAFTING");
|
||||||
clickedBlocks.put(Material.CARTOGRAPHY_TABLE, Flags.CRAFTING);
|
clickedBlocks.put(Material.CARTOGRAPHY_TABLE, "CRAFTING");
|
||||||
clickedBlocks.put(Material.GRINDSTONE, Flags.CRAFTING);
|
clickedBlocks.put(Material.GRINDSTONE, "CRAFTING");
|
||||||
clickedBlocks.put(Material.STONECUTTER, Flags.CRAFTING);
|
clickedBlocks.put(Material.STONECUTTER, "CRAFTING");
|
||||||
clickedBlocks.put(Material.LOOM, Flags.CRAFTING);
|
clickedBlocks.put(Material.LOOM, "CRAFTING");
|
||||||
clickedBlocks.put(Material.STONE_BUTTON, Flags.BUTTON);
|
clickedBlocks.put(Material.STONE_BUTTON, "BUTTON");
|
||||||
clickedBlocks.put(Material.ACACIA_BUTTON, Flags.BUTTON);
|
clickedBlocks.put(Material.ACACIA_BUTTON, "BUTTON");
|
||||||
clickedBlocks.put(Material.BIRCH_BUTTON, Flags.BUTTON);
|
clickedBlocks.put(Material.BIRCH_BUTTON, "BUTTON");
|
||||||
clickedBlocks.put(Material.DARK_OAK_BUTTON, Flags.BUTTON);
|
clickedBlocks.put(Material.DARK_OAK_BUTTON, "BUTTON");
|
||||||
clickedBlocks.put(Material.JUNGLE_BUTTON, Flags.BUTTON);
|
clickedBlocks.put(Material.JUNGLE_BUTTON, "BUTTON");
|
||||||
clickedBlocks.put(Material.OAK_BUTTON, Flags.BUTTON);
|
clickedBlocks.put(Material.OAK_BUTTON, "BUTTON");
|
||||||
clickedBlocks.put(Material.SPRUCE_BUTTON, Flags.BUTTON);
|
clickedBlocks.put(Material.SPRUCE_BUTTON, "BUTTON");
|
||||||
clickedBlocks.put(Material.LEVER, Flags.LEVER);
|
clickedBlocks.put(Material.LEVER, "LEVER");
|
||||||
clickedBlocks.put(Material.REPEATER, Flags.REDSTONE);
|
clickedBlocks.put(Material.REPEATER, "REDSTONE");
|
||||||
clickedBlocks.put(Material.COMPARATOR, Flags.REDSTONE);
|
clickedBlocks.put(Material.COMPARATOR, "REDSTONE");
|
||||||
clickedBlocks.put(Material.DAYLIGHT_DETECTOR, Flags.REDSTONE);
|
clickedBlocks.put(Material.DAYLIGHT_DETECTOR, "REDSTONE");
|
||||||
clickedBlocks.put(Material.DRAGON_EGG, Flags.DRAGON_EGG);
|
clickedBlocks.put(Material.DRAGON_EGG, "DRAGON_EGG");
|
||||||
clickedBlocks.put(Material.END_PORTAL_FRAME, Flags.PLACE_BLOCKS);
|
clickedBlocks.put(Material.END_PORTAL_FRAME, "PLACE_BLOCKS");
|
||||||
clickedBlocks.put(Material.ITEM_FRAME, Flags.ITEM_FRAME);
|
clickedBlocks.put(Material.ITEM_FRAME, "ITEM_FRAME");
|
||||||
clickedBlocks.put(Material.LECTERN, Flags.BREAK_BLOCKS);
|
clickedBlocks.put(Material.LECTERN, "BREAK_BLOCKS");
|
||||||
clickedBlocks.put(Material.SWEET_BERRY_BUSH, Flags.BREAK_BLOCKS);
|
clickedBlocks.put(Material.SWEET_BERRY_BUSH, "BREAK_BLOCKS");
|
||||||
clickedBlocks.put(Material.CAKE, Flags.CAKE);
|
clickedBlocks.put(Material.CAKE, "CAKE");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -166,7 +167,7 @@ public class BlockInteractionListener extends FlagListener {
|
|||||||
if (e.getItem() != null && !e.getItem().getType().equals(Material.AIR)) {
|
if (e.getItem() != null && !e.getItem().getType().equals(Material.AIR)) {
|
||||||
// Boats
|
// Boats
|
||||||
if (e.getItem().getType().name().endsWith("_BOAT")) {
|
if (e.getItem().getType().name().endsWith("_BOAT")) {
|
||||||
checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.PLACE_BLOCKS);
|
checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.BOAT);
|
||||||
}
|
}
|
||||||
// Spawn eggs
|
// Spawn eggs
|
||||||
else if (e.getItem().getType().name().endsWith("_SPAWN_EGG")) {
|
else if (e.getItem().getType().name().endsWith("_SPAWN_EGG")) {
|
||||||
@ -174,11 +175,14 @@ public class BlockInteractionListener extends FlagListener {
|
|||||||
}
|
}
|
||||||
// Other items
|
// Other items
|
||||||
else if (inHandItems.containsKey(e.getItem().getType())) {
|
else if (inHandItems.containsKey(e.getItem().getType())) {
|
||||||
checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), inHandItems.get(e.getItem().getType()));
|
getInHandItemFlag(e.getItem().getType()).ifPresent(f -> checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Optional<Flag> getInHandItemFlag(Material type) {
|
||||||
|
return BentoBox.getInstance().getFlagsManager().getFlag(inHandItems.get(type));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Check if an action can occur on a clicked block
|
* Check if an action can occur on a clicked block
|
||||||
* @param e - event called
|
* @param e - event called
|
||||||
@ -192,8 +196,9 @@ public class BlockInteractionListener extends FlagListener {
|
|||||||
checkIsland(e, player, loc, Flags.CONTAINER);
|
checkIsland(e, player, loc, Flags.CONTAINER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clickedBlocks.containsKey(type)) {
|
if (clickedBlocks.containsKey(type)) {
|
||||||
checkIsland(e, player, loc, clickedBlocks.get(type));
|
getClickedBlockFlag(type).ifPresent(f -> checkIsland(e, player, loc, f));
|
||||||
}
|
}
|
||||||
if (stringFlags.containsKey(type.name())) {
|
if (stringFlags.containsKey(type.name())) {
|
||||||
Optional<Flag> f = BentoBox.getInstance().getFlagsManager().getFlag(stringFlags.get(type.name()));
|
Optional<Flag> f = BentoBox.getInstance().getFlagsManager().getFlag(stringFlags.get(type.name()));
|
||||||
@ -201,6 +206,10 @@ public class BlockInteractionListener extends FlagListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Optional<Flag> getClickedBlockFlag(Material type) {
|
||||||
|
return BentoBox.getInstance().getFlagsManager().getFlag(clickedBlocks.get(type));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When breaking blocks is allowed, this protects
|
* When breaking blocks is allowed, this protects
|
||||||
* specific blocks from being broken, which would bypass the protection.
|
* specific blocks from being broken, which would bypass the protection.
|
||||||
@ -233,16 +242,24 @@ public class BlockInteractionListener extends FlagListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the inHandItems
|
* @return the inHandItems with flag values
|
||||||
*/
|
*/
|
||||||
public Map<Material, Flag> getInHandItems() {
|
public Map<Material, Flag> getInHandItems() {
|
||||||
return inHandItems;
|
return inHandItems.entrySet().stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
e -> e.getKey(),
|
||||||
|
e -> BentoBox.getInstance().getFlagsManager().getFlag(e.getValue()).orElse(null)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the clickedBlocks
|
* @return the clickedBlocks with flag values
|
||||||
*/
|
*/
|
||||||
public Map<Material, Flag> getClickedBlocks() {
|
public Map<Material, Flag> getClickedBlocks() {
|
||||||
return clickedBlocks;
|
return clickedBlocks.entrySet().stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
e -> e.getKey(),
|
||||||
|
e -> BentoBox.getInstance().getFlagsManager().getFlag(e.getValue()).orElse(null)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user