diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/SensibleToolboxPlugin.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/SensibleToolboxPlugin.java index 6c763807..af1d2610 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/SensibleToolboxPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/SensibleToolboxPlugin.java @@ -172,6 +172,7 @@ public class SensibleToolboxPlugin extends JavaPlugin implements ConfigurationLi private MinecraftVersion minecraftVersion = MinecraftVersion.UNKNOWN; private ConfigurationManager configManager; + private boolean slimefunEnabled = false; private boolean protocolLibEnabled = false; private SoundMufflerListener soundMufflerListener; private boolean enabled = false; @@ -258,6 +259,7 @@ public void onEnable() { scheduleEnergyNetTicker(); if (getServer().getPluginManager().isPluginEnabled("Slimefun")) { + slimefunEnabled = true; new SlimefunBridge(this); } @@ -485,6 +487,10 @@ private void setupProtocolLib() { } } + public boolean isSlimefunEnabled() { + return slimefunEnabled; + } + public boolean isProtocolLibEnabled() { return protocolLibEnabled; } diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/items/multibuilder/MultiBuilder.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/items/multibuilder/MultiBuilder.java index d31ae98a..623ae86f 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/items/multibuilder/MultiBuilder.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/items/multibuilder/MultiBuilder.java @@ -30,8 +30,10 @@ import org.bukkit.inventory.Recipe; import org.bukkit.inventory.ShapedRecipe; +import me.mrCookieSlime.Slimefun.api.BlockStorage; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; +import io.github.thebusybiscuit.sensibletoolbox.SensibleToolboxPlugin; import io.github.thebusybiscuit.sensibletoolbox.api.SensibleToolbox; import io.github.thebusybiscuit.sensibletoolbox.api.energy.Chargeable; import io.github.thebusybiscuit.sensibletoolbox.api.items.BaseSTBItem; @@ -253,14 +255,21 @@ private int howMuchDoesPlayerHave(Player p, Material mat) { } protected boolean canReplace(Player player, Block b) { - // we won't replace any block which can hold items, or any STB block, or any unbreakable block + // Check for non-replaceable block types. + // STB Blocks if (SensibleToolbox.getBlockAt(b.getLocation(), true) != null) { return false; + // Vanilla inventories } else if (VanillaInventoryUtils.isVanillaInventory(b)) { return false; + // Slimefun Blocks + } else if (SensibleToolboxPlugin.getInstance().isSlimefunEnabled() && BlockStorage.hasBlockInfo(b)) { + return false; + // Unbreakable Blocks } else if (b.getType().getHardness() >= 3600000) { return false; } else { + // Block is replaceable, return permission to break return SensibleToolbox.getProtectionManager().hasPermission(player, b, ProtectableAction.BREAK_BLOCK); } }