From 35d0572340c569d88e87dffffdbd6f048f9a8bd7 Mon Sep 17 00:00:00 2001 From: sandtechnology Date: Wed, 22 Sep 2021 20:53:57 +0800 Subject: [PATCH] [Repo back online] Revert "Remove fabledskyblock support since it repo down" This reverts commit 0016337e --- pom.xml | 24 +- .../integration/IntegrationHelper.java | 3 +- .../fabledskyblock/FabledIntegration.java | 250 +++++++++--------- 3 files changed, 145 insertions(+), 132 deletions(-) diff --git a/pom.xml b/pom.xml index 7f4a8e35c..52f2b75b2 100644 --- a/pom.xml +++ b/pom.xml @@ -866,18 +866,18 @@ 4.9.2 ${project.basedir}/lib/TNE.jar - - - - - - - - - - - - + + com.songoda + skyblock + 2.2.13 + provided + + + MVdWPlaceholderAPI + be.maximvdw + + + diff --git a/src/main/java/org/maxgamer/quickshop/integration/IntegrationHelper.java b/src/main/java/org/maxgamer/quickshop/integration/IntegrationHelper.java index 5d6346582..7e080e929 100644 --- a/src/main/java/org/maxgamer/quickshop/integration/IntegrationHelper.java +++ b/src/main/java/org/maxgamer/quickshop/integration/IntegrationHelper.java @@ -26,6 +26,7 @@ import org.bukkit.plugin.PluginManager; import org.jetbrains.annotations.NotNull; import org.maxgamer.quickshop.QuickShop; import org.maxgamer.quickshop.integration.advancedregionmarket.AdvancedShopRegionMarketIntegration; +import org.maxgamer.quickshop.integration.fabledskyblock.FabledIntegration; import org.maxgamer.quickshop.integration.factionsuuid.FactionsUUIDIntegration; import org.maxgamer.quickshop.integration.griefprevention.GriefPreventionIntegration; import org.maxgamer.quickshop.integration.iridiumskyblock.IridiumSkyblockIntegration; @@ -56,7 +57,7 @@ public class IntegrationHelper extends QuickShopInstanceHolder { integratedPluginNameMap.put("Residence", ResidenceIntegration.class); integratedPluginNameMap.put("Towny", TownyIntegration.class); integratedPluginNameMap.put("WorldGuard", WorldGuardIntegration.class); - //integratedPluginNameMap.put("FabledSkyblock", FabledIntegration.class); + integratedPluginNameMap.put("FabledSkyblock", FabledIntegration.class); integratedPluginNameMap.put("IridiumSkyblock", IridiumSkyblockIntegration.class); integratedPluginNameMap.put("SuperiorSkyblock", SuperiorSkyblock2Integration.class); integratedPluginNameMap.put("AdvancedRegionMarket", AdvancedShopRegionMarketIntegration.class); diff --git a/src/main/java/org/maxgamer/quickshop/integration/fabledskyblock/FabledIntegration.java b/src/main/java/org/maxgamer/quickshop/integration/fabledskyblock/FabledIntegration.java index e7497cc6e..f818280e6 100644 --- a/src/main/java/org/maxgamer/quickshop/integration/fabledskyblock/FabledIntegration.java +++ b/src/main/java/org/maxgamer/quickshop/integration/fabledskyblock/FabledIntegration.java @@ -1,119 +1,131 @@ -///* -// * This file is a part of project QuickShop, the name is FabledIntegration.java -// * Copyright (C) PotatoCraft Studio and contributors -// * -// * This program is free software: you can redistribute it and/or modify it -// * under the terms of the GNU General Public License as published by the -// * Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, but WITHOUT -// * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// * for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see . -// * -// */ -// -//package org.maxgamer.quickshop.integration.fabledskyblock; -// -//import com.songoda.skyblock.SkyBlock; -//import com.songoda.skyblock.island.Island; -//import com.songoda.skyblock.island.IslandRole; -//import org.bukkit.Location; -//import org.bukkit.entity.Player; -//import org.jetbrains.annotations.NotNull; -//import org.maxgamer.quickshop.QuickShop; -//import org.maxgamer.quickshop.integration.IntegrateStage; -//import org.maxgamer.quickshop.integration.IntegrationStage; -//import org.maxgamer.quickshop.integration.QSIntegratedPlugin; -// -//@IntegrationStage(loadStage = IntegrateStage.onEnableAfter) -//public class FabledIntegration extends QSIntegratedPlugin { -// -// private final boolean ignoreDisabledWorlds; -// private final boolean whitelist; -// -// public FabledIntegration(QuickShop plugin) { -// super(plugin); -// ignoreDisabledWorlds = plugin.getConfig().getBoolean("integration.fabledskyblock.ignore-disabled-worlds"); -// whitelist = plugin.getConfig().getBoolean("integration.fabledskyblock.whitelist-mode"); -// this.registerListener(); -// } -// -// /** -// * Return the integrated plugin name. -// * For example, Residence -// * -// * @return integrated plugin -// */ -// @Override -// public @NotNull String getName() { -// return "FabledSkyblock"; -// } -// -// /** -// * Check if a player can create shop here -// * -// * @param player the player want to create shop -// * @param location shop location -// * @return If you can create shop here -// */ -// @Override -// public boolean canCreateShopHere(@NotNull Player player, @NotNull Location location) { -// Island island = SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location); -// if (island == null) return whitelist; -// return island.getRole(player).equals(IslandRole.Member) || island.getRole(player).equals(IslandRole.Owner) -// || island.getRole(player).equals(IslandRole.Operator); -// } -// -// /** -// * Check if a player can trade with shop here -// * -// * @param player the player want to trade with shop -// * @param location shop location -// * @return If you can trade with shop here -// */ -// @Override -// public boolean canTradeShopHere(@NotNull Player player, @NotNull Location location) { -// if (SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location) == null) { -// return ignoreDisabledWorlds; -// } -// return true; -// } -// -// /** -// * Check if a player can delete a shop here -// * -// * @param player the player want to delete the shop -// * @param location shop location -// * @return If you can delete the shop here -// */ -// @Override -// public boolean canDeleteShopHere(@NotNull Player player, @NotNull Location location) { -// Island island = SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location); -// if (island == null) return whitelist; -// return island.getRole(player).equals(IslandRole.Member) || island.getRole(player).equals(IslandRole.Owner) -// || island.getRole(player).equals(IslandRole.Operator); -// } -// -// /** -// * Loading logic -// * Execute Stage defined by IntegrationStage -// */ -// @Override -// public void load() { -// -// } -// -// /** -// * Unloding logic -// * Will execute when Quickshop unloading -// */ -// @Override -// public void unload() { -// -// } -//} +/* + * This file is a part of project QuickShop, the name is FabledIntegration.java + * Copyright (C) PotatoCraft Studio and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +package org.maxgamer.quickshop.integration.fabledskyblock; + +import com.songoda.skyblock.SkyBlock; +import com.songoda.skyblock.island.Island; +import com.songoda.skyblock.island.IslandRole; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.maxgamer.quickshop.QuickShop; +import org.maxgamer.quickshop.integration.IntegrateStage; +import org.maxgamer.quickshop.integration.IntegrationStage; +import org.maxgamer.quickshop.integration.QSIntegratedPlugin; +import org.maxgamer.quickshop.util.reload.ReloadResult; +import org.maxgamer.quickshop.util.reload.ReloadStatus; + +@IntegrationStage(loadStage = IntegrateStage.onEnableAfter) +public class FabledIntegration extends QSIntegratedPlugin { + + private boolean ignoreDisabledWorlds; + private boolean whitelist; + + public FabledIntegration(QuickShop plugin) { + super(plugin); + loadConfiguration(); + registerListener(); + } + + private void loadConfiguration() { + ignoreDisabledWorlds = plugin.getConfig().getBoolean("integration.fabledskyblock.ignore-disabled-worlds"); + whitelist = plugin.getConfig().getBoolean("integration.fabledskyblock.whitelist-mode"); + } + + /** + * Return the integrated plugin name. + * For example, Residence + * + * @return integrated plugin + */ + @Override + public @NotNull String getName() { + return "FabledSkyblock"; + } + + /** + * Check if a player can create shop here + * + * @param player the player want to create shop + * @param location shop location + * @return If you can create shop here + */ + @Override + public boolean canCreateShopHere(@NotNull Player player, @NotNull Location location) { + Island island = SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location); + if (island == null) return whitelist; + return island.getRole(player).equals(IslandRole.Member) || island.getRole(player).equals(IslandRole.Owner) + || island.getRole(player).equals(IslandRole.Operator); + } + + /** + * Check if a player can trade with shop here + * + * @param player the player want to trade with shop + * @param location shop location + * @return If you can trade with shop here + */ + @Override + public boolean canTradeShopHere(@NotNull Player player, @NotNull Location location) { + if (SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location) == null) { + return ignoreDisabledWorlds; + } + return true; + } + + /** + * Check if a player can delete a shop here + * + * @param player the player want to delete the shop + * @param location shop location + * @return If you can delete the shop here + */ + @Override + public boolean canDeleteShopHere(@NotNull Player player, @NotNull Location location) { + Island island = SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location); + if (island == null) return whitelist; + return island.getRole(player).equals(IslandRole.Member) || island.getRole(player).equals(IslandRole.Owner) + || island.getRole(player).equals(IslandRole.Operator); + } + + /** + * Loading logic + * Execute Stage defined by IntegrationStage + */ + @Override + public void load() { + + } + + /** + * Unloding logic + * Will execute when Quickshop unloading + */ + @Override + public void unload() { + + } + + @Override + public ReloadResult reloadModule() throws Exception { + loadConfiguration(); + return ReloadResult.builder().status(ReloadStatus.SUCCESS).build(); + } +}