Add BentoBox compatibility

This commit is contained in:
ceze88 2023-04-01 15:55:37 +02:00
parent 588dcbd6a3
commit 818ecf3d9a
3 changed files with 17 additions and 2 deletions

View File

@ -13,6 +13,7 @@ import com.songoda.core.database.SQLiteConnector;
import com.songoda.core.gui.GuiManager;
import com.songoda.core.hooks.EntityStackerManager;
import com.songoda.core.hooks.HologramManager;
import com.songoda.core.hooks.ProtectionManager;
import com.songoda.core.hooks.WorldGuardHook;
import com.songoda.core.utils.TextUtils;
import com.songoda.ultimatestacker.commands.CommandConvert;
@ -170,6 +171,10 @@ public class UltimateStacker extends SongodaPlugin {
spawnerFile.load();
spawnerFile.saveChanges();
if (Bukkit.getPluginManager().isPluginEnabled("BentoBox")) {
ProtectionManager.load(Bukkit.getPluginManager().getPlugin("BentoBox"));
}
this.spawnerStackManager = new SpawnerStackManager();
this.entityStackManager = new EntityStackManager(this);
this.blockStackManager = new BlockStackManager();

View File

@ -2,6 +2,8 @@ package com.songoda.ultimatestacker.listeners;
import com.songoda.core.compatibility.CompatibleHand;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.hooks.ProtectionManager;
import com.songoda.core.hooks.protection.BentoBoxProtection;
import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.events.SpawnerBreakEvent;
@ -46,10 +48,18 @@ public class BlockListeners implements Listener {
if (event.useInteractedBlock() == Event.Result.DENY) return;
Block block = event.getClickedBlock();
Player player = event.getPlayer();
if (block == null) return;
if (!ProtectionManager.canInteract(player, block.getLocation()) || !ProtectionManager.canBreak(player, block.getLocation())) {
if (!player.isOp()) {
return;
}
}
CompatibleHand hand = CompatibleHand.getHand(event);
ItemStack inHand = hand.getItem(player);
if (block == null) return;
if (Settings.STACK_BLOCKS.getBoolean()) {
BlockStackManager blockStackManager = plugin.getBlockStackManager();

View File

@ -1,7 +1,7 @@
name: UltimateStacker
description: UltimateStacker
version: maven-version-number
softdepend: [MythicMobs, HolographicDisplays, Holograms, CMI, WorldGuard, EpicSpawners, mcMMO, WildStacker, StackMob]
softdepend: [MythicMobs, HolographicDisplays, Holograms, CMI, WorldGuard, EpicSpawners, mcMMO, WildStacker, StackMob, BentoBox]
loadbefore: [WorldGuard]
main: com.songoda.ultimatestacker.UltimateStacker
author: songoda