FabledSkyBlock compatibility (beta)

This commit is contained in:
Brianna 2020-05-30 09:01:50 -05:00
parent 6cf11be83f
commit 6684beff9e
3 changed files with 31 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import com.songoda.core.nms.nbt.NBTItem;
import com.songoda.epichoppers.boost.BoostData;
import com.songoda.epichoppers.boost.BoostManager;
import com.songoda.epichoppers.commands.*;
import com.songoda.epichoppers.compatiility.EpicHoppersPermission;
import com.songoda.epichoppers.database.DataManager;
import com.songoda.epichoppers.database.migrations._1_InitialMigration;
import com.songoda.epichoppers.handlers.TeleportHandler;
@ -32,6 +33,7 @@ import com.songoda.epichoppers.storage.types.StorageYaml;
import com.songoda.epichoppers.tasks.HopTask;
import com.songoda.epichoppers.utils.Methods;
import com.songoda.epichoppers.utils.TeleportTrigger;
import com.songoda.skyblock.SkyBlock;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -226,6 +228,10 @@ public class EpicHoppers extends SongodaPlugin {
pluginManager.registerEvents(new InteractListeners(this), this);
pluginManager.registerEvents(new InventoryListeners(), this);
if (pluginManager.isPluginEnabled("FabledSkyBlock")) {
SkyBlock.getInstance().getPermissionManager().registerPermission(new EpicHoppersPermission());
}
// Check for liquid tanks
if (pluginManager.isPluginEnabled("LiquidTanks")) liquidtanks = true;

View File

@ -0,0 +1,13 @@
package com.songoda.epichoppers.compatiility;
import com.songoda.skyblock.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class EpicHoppersPermission extends BasicPermission {
public EpicHoppersPermission() {
super("EpicHoppers", CompatibleMaterial.HOPPER, PermissionType.GENERIC);
}
}

View File

@ -8,6 +8,8 @@ import com.songoda.epichoppers.player.SyncType;
import com.songoda.epichoppers.settings.Settings;
import com.songoda.epichoppers.utils.Methods;
import com.songoda.epichoppers.utils.TeleportTrigger;
import com.songoda.skyblock.SkyBlock;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
@ -64,6 +66,16 @@ public class InteractListeners implements Listener {
if (WorldGuardHook.isInteractAllowed(event.getClickedBlock().getLocation()))
return;
if (Bukkit.getPluginManager().isPluginEnabled("FabledSkyBlock")) {
SkyBlock skyBlock = SkyBlock.getInstance();
if (skyBlock.getWorldManager().isIslandWorld(event.getPlayer().getWorld()))
if (!skyBlock.getPermissionManager().hasPermission(event.getPlayer(),
skyBlock.getIslandManager().getIslandAtLocation(event.getClickedBlock().getLocation()),
"EpicHoppers"))
return;
}
PlayerData playerData = instance.getPlayerDataManager().getPlayerData(player);
if (playerData.getSyncType() == null) {