mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-09 20:21:07 +00:00
Added support for IslandWorld
Only players who can build on the island (owner and members) are allowed to create a shop, but anyone can use it (if not limited by other plugins like WorldGuard)
This commit is contained in:
parent
7c1cb7f665
commit
bc222b6b37
6
pom.xml
6
pom.xml
@ -182,6 +182,12 @@
|
||||
<version>3.0.6.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pl.gnacik</groupId>
|
||||
<artifactId>IslandWorld</artifactId>
|
||||
<version>7.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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");
|
||||
|
@ -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)) {
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user