diff --git a/pom.xml b/pom.xml
index 6202eff..4380ea5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -182,6 +182,12 @@
3.0.6.2
provided
+
+ pl.gnacik
+ IslandWorld
+ 7.0
+ provided
+
diff --git a/src/main/java/de/epiceric/shopchest/ShopChest.java b/src/main/java/de/epiceric/shopchest/ShopChest.java
index 5342f70..b741589 100644
--- a/src/main/java/de/epiceric/shopchest/ShopChest.java
+++ b/src/main/java/de/epiceric/shopchest/ShopChest.java
@@ -28,6 +28,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
+import pl.islandworld.IslandWorld;
import us.talabrek.ultimateskyblock.api.uSkyBlockAPI;
import java.io.*;
@@ -53,6 +54,7 @@ public class ShopChest extends JavaPlugin {
private AuthMe authMe;
private uSkyBlockAPI uSkyBlock;
private ASkyBlock aSkyBlock;
+ private IslandWorld islandWorld;
private ShopUpdater updater;
/**
@@ -176,6 +178,11 @@ public class ShopChest extends JavaPlugin {
aSkyBlock = (ASkyBlock) aSkyBlockPlugin;
}
+ Plugin islandWorldPlugin = Bukkit.getServer().getPluginManager().getPlugin("IslandWorld");
+ if (islandWorldPlugin instanceof IslandWorld) {
+ islandWorld = (IslandWorld) islandWorldPlugin;
+ }
+
if (hasPlotSquared()) {
new PlotSquaredShopFlag().register(this);
}
@@ -401,6 +408,20 @@ public class ShopChest extends JavaPlugin {
this.updater = updater;
}
+ /**
+ * @return Whether the plugin 'IslandWorld' is enabled
+ */
+ public boolean hasIslandWorld() {
+ return islandWorld != null && islandWorld.isEnabled();
+ }
+
+ /**
+ * @return An instance of {@link IslandWorld} or {@code null} if IslandWorld is not enabled
+ */
+ public IslandWorld getIslandWorld() {
+ return islandWorld;
+ }
+
/**
* @return Whether the plugin 'ASkyBlock' is enabled
*/
diff --git a/src/main/java/de/epiceric/shopchest/config/Config.java b/src/main/java/de/epiceric/shopchest/config/Config.java
index c27d628..bee834b 100644
--- a/src/main/java/de/epiceric/shopchest/config/Config.java
+++ b/src/main/java/de/epiceric/shopchest/config/Config.java
@@ -122,6 +122,9 @@ public class Config {
/** Whether ASkyBlock integration should be enabled **/
public boolean enable_askyblock_integration;
+ /** Whether IslandWorld integration should be enabled **/
+ public boolean enable_islandworld_integration;
+
/** Whether the vendor of the shop should get messages about buys and sells **/
public boolean enable_vendor_messages;
@@ -366,6 +369,7 @@ public class Config {
enable_plotsquared_integration = plugin.getConfig().getBoolean("enable-plotsquared-integration");
enable_uskyblock_integration = plugin.getConfig().getBoolean("enable-uskyblock-integration");
enable_askyblock_integration = plugin.getConfig().getBoolean("enable-askyblock-integration");
+ enable_islandworld_integration = plugin.getConfig().getBoolean("enable-islandworld-integration");
enable_vendor_messages = plugin.getConfig().getBoolean("enable-vendor-messages");
explosion_protection = plugin.getConfig().getBoolean("explosion-protection");
only_show_shops_in_sight = plugin.getConfig().getBoolean("only-show-shops-in-sight");
diff --git a/src/main/java/de/epiceric/shopchest/listeners/ChestProtectListener.java b/src/main/java/de/epiceric/shopchest/listeners/ChestProtectListener.java
index c74a6b4..622500a 100644
--- a/src/main/java/de/epiceric/shopchest/listeners/ChestProtectListener.java
+++ b/src/main/java/de/epiceric/shopchest/listeners/ChestProtectListener.java
@@ -39,6 +39,7 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.InventoryHolder;
+import pl.islandworld.api.IslandWorldApi;
import us.talabrek.ultimateskyblock.api.IslandInfo;
import java.util.ArrayList;
@@ -199,6 +200,12 @@ public class ChestProtectListener implements Listener {
externalPluginsAllowed &= island.getMembers().contains(p.getUniqueId()) || island.getOwner().equals(p.getUniqueId());
}
+ if (plugin.hasIslandWorld() && config.enable_islandworld_integration && IslandWorldApi.isInitialized()) {
+ if (b.getWorld().getName().equals(IslandWorldApi.getIslandWorld().getName())) {
+ externalPluginsAllowed &= IslandWorldApi.canBuildOnLocation(p, b.getLocation(), true);
+ }
+ }
+
if (externalPluginsAllowed || p.hasPermission(Permissions.EXTEND_PROTECTED)) {
if (shop.getVendor().getUniqueId().equals(p.getUniqueId()) || p.hasPermission(Permissions.EXTEND_OTHER)) {
diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java
index 3ce7c0f..2af4532 100644
--- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java
+++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java
@@ -56,6 +56,7 @@ import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.Potion;
+import pl.islandworld.api.IslandWorldApi;
import us.talabrek.ultimateskyblock.api.IslandInfo;
import java.util.HashMap;
@@ -181,6 +182,16 @@ public class ShopInteractListener implements Listener {
}
}
+ if (plugin.hasIslandWorld() && config.enable_islandworld_integration && IslandWorldApi.isInitialized()) {
+ for (Location loc : chestLocations) {
+ if (loc != null) {
+ if (loc.getWorld().getName().equals(IslandWorldApi.getIslandWorld().getName())) {
+ externalPluginsAllowed &= IslandWorldApi.canBuildOnLocation(p, loc, true);
+ }
+ }
+ }
+ }
+
if ((e.isCancelled() || !externalPluginsAllowed) && !p.hasPermission(Permissions.CREATE_PROTECTED)) {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_CREATE_PROTECTED));
ClickType.removePlayerClickType(p);
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index c900c34..b91b535 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -57,6 +57,10 @@ enable-uskyblock-integration: true
# Of course, this only works if ASkyBlock is installed
enable-askyblock-integration: true
+# Set whether IslandWorld integration should be enabled
+# Of course, this only works if IslandWorld is installed
+enable-islandworld-integration: true
+
# Set whether the vendor of a shop should get messages when players
# buy or sell something from/to his shop or if his shop is out of stock
enable-vendor-messages: true
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index fd161d4..e5b131b 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -5,7 +5,7 @@ main: de.epiceric.shopchest.ShopChest
version: ${project.version}
author: EpicEric
website: ${project.url}
-softdepend: [WorldGuard, Towny, AuthMe, PlotSquared, uSkyBlock, ASkyBlock]
+softdepend: [WorldGuard, Towny, AuthMe, PlotSquared, uSkyBlock, ASkyBlock, IslandWorld]
depend: [Vault]
permissions: