Critical Patch

Fixed a critical issue where a class level block list was populated and never cleared.
This commit is contained in:
Paldiu 2022-05-09 23:18:02 -05:00
parent 724222553f
commit 086a310479
5 changed files with 92 additions and 5 deletions

View File

@ -0,0 +1,82 @@
# The overall settings for the plugin itself
plugin_settings:
# The permission required to use the assist feature.
permission: "toolassist.activate"
# How many blocks outwards should be scanned
search_radius: 15
# Whether a user must be sneaking to activate
sneak_activation: true
# Whether to use the respective tool to trigger activation, or to use the groupings listed below.
no_config: false
# The block material that can be targeted by the respective tool grouping
tool_settings:
# Blocks which are affected by pickaxes
pickaxe:
- COAL_ORE
- COPPER_ORE
- IRON_ORE
- GOLD_ORE
- REDSTONE_ORE
- LAPIS_LAZULI_ORE
- EMERALD_ORE
- DIAMOND_ORE
- DEEPSLATE_COAL_ORE
- DEEPSLATE_IRON_ORE
- DEEPSLATE_GOLD_ORE
- DEEPSLATE_REDSTONE_ORE
- DEEPSLATE_LAPIS_ORE
- DEEPSLATE_EMERALD_ORE
- DEEPSLATE_DIAMOND_ORE
- DEEPSLATE_COPPER_ORE
- NETHER_QUARTZ_ORE
- NETHER_GOLD_ORE
# Blocks which are affected by axes
axe:
- OAK_LOG
- DARK_OAK_LOG
- BIRCH_LOG
- SPRUCE_LOG
- JUNGLE_LOG
- ACACIA_LOG
- STRIPPED_OAK_LOG
- STRIPPED_DARK_OAK_LOG
- STRIPPED_BIRCH_LOG
- STRIPPED_SPRUCE_LOG
- STRIPPED_JUNGLE_LOG
- STRIPPED_ACACIA_LOG
# Blocks which are affected by shovels
shovel:
- SAND
- GRAVEL
# Blocks which are affected by hoes
hoe:
- WARPED_WART_BLOCK
- NETHER_WART_BLOCK
- SPONGE
- WET_SPONGE
# Blocks which are affected by swords
sword:
- COBWEB
# Blocks which are affected by shears
shears:
- OAK_LEAVES
- DARK_OAK_LEAVES
- BIRCH_LEAVES
- JUNGLE_LEAVES
- ACACIA_LEAVES
- SPRUCE_LEAVES
- VINE
- CAVE_VINES_PLANT
- WEEPING_VINES_PLANT
- TWISTING_VINES_PLANT

View File

@ -0,0 +1,6 @@
name: ToolAssist
version: 'v1.0-Alpha'
main: io.github.simplex.toolassist.ToolAssist
api-version: 1.18
authors: [ SimplexDevelopment ]
description: A lightweight vein-mining plugin.

Binary file not shown.

View File

@ -0,0 +1,2 @@
Manifest-Version: 1.0

View File

@ -9,7 +9,6 @@ import java.util.ArrayList;
import java.util.List;
public class BlockIdentifier {
private final List<Block> blockList = new ArrayList<>();
private final ToolAssist plugin;
boolean isValid = false;
@ -18,9 +17,9 @@ public class BlockIdentifier {
}
public List<Block> populateAndRetrieve(Block block, ItemStack requiredItem) {
List<Block> surroundingBlocks = new ArrayList<>();
Location start = block.getLocation().clone();
int radius = plugin.getConfig().getSettings().radius();
List<Block> surroundingBlocks = new ArrayList<>();
for (double x = start.getX() - radius; x <= start.getX() + radius; x++) {
for (double y = start.getY() - radius; y <= start.getY() + radius; y++) {
for (double z = start.getZ() - radius; z <= start.getZ() + radius; z++) {
@ -31,9 +30,7 @@ public class BlockIdentifier {
}
}
}
blockList.addAll(surroundingBlocks);
return blockList;
return surroundingBlocks;
}
public boolean checkBlock(Block block, ItemStack targetItem) {