mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-12-20 16:17:38 +01:00
Add shulker to in chest count (#275)
This commit is contained in:
parent
42249a8fc9
commit
a493c12f6e
@ -24,13 +24,11 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Container;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.block.*;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Slab;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.bgsoftware.wildstacker.api.WildStackerAPI;
|
||||
@ -445,10 +443,16 @@ public class IslandLevelCalculator {
|
||||
}
|
||||
|
||||
private void countItemStack(ItemStack i) {
|
||||
if (i != null && i.getType().isBlock()) {
|
||||
for (int c = 0; c < i.getAmount(); c++) {
|
||||
checkBlock(i.getType(), false);
|
||||
if (i == null || !i.getType().isBlock()) return;
|
||||
|
||||
for (int c = 0; c < i.getAmount(); c++) {
|
||||
if (addon.getSettings().isIncludeShulkersInChest()
|
||||
&& i.getItemMeta() instanceof BlockStateMeta blockStateMeta
|
||||
&& blockStateMeta.getBlockState() instanceof ShulkerBox shulkerBox) {
|
||||
shulkerBox.getSnapshotInventory().forEach(this::countItemStack);
|
||||
}
|
||||
|
||||
checkBlock(i.getType(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,6 +119,12 @@ public class ConfigSettings implements ConfigObject {
|
||||
@ConfigComment("Shows large level values rounded down, e.g., 10,345 -> 10k")
|
||||
@ConfigEntry(path = "shorthand")
|
||||
private boolean shorthand = false;
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Include Shulker Box content in chests in level calculations.")
|
||||
@ConfigComment("Will count blocks in Shulker Boxes inside of chests.")
|
||||
@ConfigComment("NOTE: include-chests needs to be enabled for this to work!.")
|
||||
@ConfigEntry(path = "include-shulkers-in-chest")
|
||||
private boolean includeShulkersInChest = false;
|
||||
|
||||
|
||||
/**
|
||||
@ -385,4 +391,17 @@ public class ConfigSettings implements ConfigObject {
|
||||
this.logReportToConsole = logReportToConsole;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return includeShulkersInChest
|
||||
*/
|
||||
public boolean isIncludeShulkersInChest() {
|
||||
return includeShulkersInChest;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param includeShulkersInChest the includeChests to set
|
||||
*/
|
||||
public void setIncludeShulkersInChest(boolean includeShulkersInChest) {
|
||||
this.includeShulkersInChest = includeShulkersInChest;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user