diff --git a/pom.xml b/pom.xml
index 2d610e9..bb961b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
com.songoda
EpicHoppers
4.0.0
- 4.6.5
+ 4.6.6
clean install
EpicHoppers-${project.version}
@@ -103,6 +103,11 @@
spigot
1.15
+
+ com.songoda
+ skyblock
+ 2.2.13
+
com.songoda
SongodaCore
diff --git a/src/main/java/com/songoda/epichoppers/EpicHoppers.java b/src/main/java/com/songoda/epichoppers/EpicHoppers.java
index f4b2a1e..7a3624e 100644
--- a/src/main/java/com/songoda/epichoppers/EpicHoppers.java
+++ b/src/main/java/com/songoda/epichoppers/EpicHoppers.java
@@ -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;
diff --git a/src/main/java/com/songoda/epichoppers/compatiility/EpicHoppersPermission.java b/src/main/java/com/songoda/epichoppers/compatiility/EpicHoppersPermission.java
new file mode 100644
index 0000000..f68d47b
--- /dev/null
+++ b/src/main/java/com/songoda/epichoppers/compatiility/EpicHoppersPermission.java
@@ -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);
+ }
+
+}
diff --git a/src/main/java/com/songoda/epichoppers/database/DataManager.java b/src/main/java/com/songoda/epichoppers/database/DataManager.java
index e05f8f7..616feb3 100644
--- a/src/main/java/com/songoda/epichoppers/database/DataManager.java
+++ b/src/main/java/com/songoda/epichoppers/database/DataManager.java
@@ -172,20 +172,20 @@ public class DataManager extends DataManagerAbstract {
Map items = new HashMap<>();
Filter filter = hopper.getFilter();
- for (ItemStack item : filter.getWhiteList())
- items.put(item, ItemType.WHITELIST);
+ for (ItemStack item : filter.getWhiteList())
+ items.put(item, ItemType.WHITELIST);
- for (ItemStack item : filter.getBlackList())
- items.put(item, ItemType.BLACKLIST);
+ for (ItemStack item : filter.getBlackList())
+ items.put(item, ItemType.BLACKLIST);
- for (ItemStack item : filter.getVoidList())
- items.put(item, ItemType.VOID);
+ for (ItemStack item : filter.getVoidList())
+ items.put(item, ItemType.VOID);
- for (ItemStack item : filter.getAutoSellWhiteList())
- items.put(item, ItemType.AUTO_SELL_WHITELIST);
+ for (ItemStack item : filter.getAutoSellWhiteList())
+ items.put(item, ItemType.AUTO_SELL_WHITELIST);
- for (ItemStack item : filter.getAutoSellBlackList())
- items.put(item, ItemType.AUTO_SELL_BLACKLIST);
+ for (ItemStack item : filter.getAutoSellBlackList())
+ items.put(item, ItemType.AUTO_SELL_BLACKLIST);
String createItem = "INSERT INTO " + this.getTablePrefix() + "items (hopper_id, item_type, item) VALUES (?, ?, ?)";
try (PreparedStatement statement = connection.prepareStatement(createItem)) {
@@ -218,17 +218,17 @@ public class DataManager extends DataManagerAbstract {
for (Map.Entry entry : links.entrySet()) {
statement.setInt(1, hopper.getId());
- statement.setString(2,entry.getValue().name());
+ statement.setString(2, entry.getValue().name());
- Location location = entry.getKey();
- statement.setString(3, location.getWorld().getName());
- statement.setInt(4, location.getBlockX());
- statement.setInt(5, location.getBlockY());
- statement.setInt(6, location.getBlockZ());
- statement.addBatch();
+ Location location = entry.getKey();
+ statement.setString(3, location.getWorld().getName());
+ statement.setInt(4, location.getBlockX());
+ statement.setInt(5, location.getBlockY());
+ statement.setInt(6, location.getBlockZ());
+ statement.addBatch();
+ }
+ statement.executeBatch();
}
- statement.executeBatch();
- }
}), "create");
}
@@ -327,8 +327,10 @@ public class DataManager extends DataManagerAbstract {
int z = result.getInt("z");
Location location = new Location(world, x, y, z);
+ Hopper hopper = hoppers.get(id);
+ if (hopper == null) break;
- hoppers.get(id).addLinkedBlock(location, type);
+ hopper.addLinkedBlock(location, type);
}
}
@@ -347,8 +349,11 @@ public class DataManager extends DataManagerAbstract {
e.printStackTrace();
}
+ Hopper hopper = hoppers.get(id);
+ if (hopper == null) break;
+
if (item != null)
- hoppers.get(id).getFilter().addItem(item, type);
+ hopper.getFilter().addItem(item, type);
}
}
this.sync(() -> callback.accept(hoppers));
diff --git a/src/main/java/com/songoda/epichoppers/listeners/InteractListeners.java b/src/main/java/com/songoda/epichoppers/listeners/InteractListeners.java
index 54bcb8c..44a3913 100644
--- a/src/main/java/com/songoda/epichoppers/listeners/InteractListeners.java
+++ b/src/main/java/com/songoda/epichoppers/listeners/InteractListeners.java
@@ -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) {