diff --git a/pom.xml b/pom.xml
index c14ecad..e51785a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,10 +31,6 @@
vault-repo
http://nexus.hc.to/content/repositories/pub_releases/
-
- bstats-repo
- http://repo.bstats.org/content/repositories/releases/
-
codemc-repo
https://repo.codemc.org/repository/maven-public/
@@ -45,7 +41,7 @@
athion-repo
- http://ci.athion.net/job/PlotSquared/ws/mvn/
+ http://ci.athion.net/job/PlotSquared-Releases/ws/mvn/
uskyblock-repo
@@ -75,13 +71,13 @@
net.milkbowl.vault
VaultAPI
- 1.6
+ 1.7
provided
org.bstats
bstats-bukkit
- 1.1
+ 1.4
fr.xephi
@@ -90,9 +86,9 @@
provided
- com.plotsquared
- plotsquared-api
- latest
+ com.github.intellectualsites.plotsquared
+ PlotSquared-API
+ 4.226
provided
@@ -135,7 +131,7 @@
me.wiefferink
areashop
- 2.4.0
+ 2.6.0
provided
diff --git a/src/main/java/de/epiceric/shopchest/ShopChest.java b/src/main/java/de/epiceric/shopchest/ShopChest.java
index 1e58ab7..0737071 100644
--- a/src/main/java/de/epiceric/shopchest/ShopChest.java
+++ b/src/main/java/de/epiceric/shopchest/ShopChest.java
@@ -33,7 +33,7 @@ import fr.xephi.authme.AuthMe;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import me.wiefferink.areashop.AreaShop;
import net.milkbowl.vault.economy.Economy;
-import org.bstats.Metrics;
+import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -52,6 +52,7 @@ import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
+import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@@ -186,6 +187,7 @@ public class ShopChest extends JavaPlugin {
hologramFormat = new HologramFormat(this);
loadMetrics();
+ initDatabase();
checkForUpdates();
shopUtils = new ShopUtils(this);
@@ -283,11 +285,10 @@ public class ShopChest extends JavaPlugin {
private void loadMetrics() {
debug("Initializing Metrics...");
- Metrics metrics = new Metrics(this);
- metrics.addCustomChart(new Metrics.AdvancedPie("shop_type") {
- @Override
- public HashMap getValues(HashMap hashMap) {
+ Metrics metrics = new Metrics(this);
+ metrics.addCustomChart(new Metrics.SimplePie("database_type", () -> Config.databaseType.toString()));
+ metrics.addCustomChart(new Metrics.AdvancedPie("shop_type", () -> {
int normal = 0;
int admin = 0;
@@ -296,20 +297,16 @@ public class ShopChest extends JavaPlugin {
else if (shop.getShopType() == ShopType.ADMIN) admin++;
}
- hashMap.put("Admin", admin);
- hashMap.put("Normal", normal);
+ Map result = new HashMap<>();
- return hashMap;
- }
- });
+ result.put("Admin", admin);
+ result.put("Normal", normal);
- metrics.addCustomChart(new Metrics.SimplePie("database_type") {
- @Override
- public String getValue() {
- return Config.databaseType.toString();
- }
- });
+ return result;
+ }));
+ }
+ private void initDatabase() {
if (Config.databaseType == Database.DatabaseType.SQLite) {
debug("Using database type: SQLite");
getLogger().info("Using SQLite");
@@ -515,6 +512,10 @@ public class ShopChest extends JavaPlugin {
* @return Whether the plugin 'PlotSquared' is enabled
*/
public boolean hasPlotSquared() {
+ if (Utils.getMajorVersion() < 13) {
+ // Supported PlotSquared versions don't support versions below 1.13
+ return false;
+ }
Plugin p = getServer().getPluginManager().getPlugin("PlotSquared");
return p != null && p.isEnabled();
}
diff --git a/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java b/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java
index d807ac0..8a8805e 100644
--- a/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java
+++ b/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java
@@ -1,8 +1,8 @@
package de.epiceric.shopchest.external;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.flag.Flags;
-import com.intellectualcrafters.plot.object.Plot;
+import com.github.intellectualsites.plotsquared.plot.flag.Flag;
+import com.github.intellectualsites.plotsquared.plot.flag.Flags;
+import com.github.intellectualsites.plotsquared.plot.object.Plot;
import org.bukkit.entity.Player;
diff --git a/src/main/java/de/epiceric/shopchest/listeners/ChestProtectListener.java b/src/main/java/de/epiceric/shopchest/listeners/ChestProtectListener.java
index 2869b26..8210efb 100644
--- a/src/main/java/de/epiceric/shopchest/listeners/ChestProtectListener.java
+++ b/src/main/java/de/epiceric/shopchest/listeners/ChestProtectListener.java
@@ -236,8 +236,8 @@ public class ChestProtectListener implements Listener {
}
if (externalPluginsAllowed && plugin.hasPlotSquared() && Config.enablePlotsquaredIntegration) {
- com.intellectualcrafters.plot.object.Location loc =
- new com.intellectualcrafters.plot.object.Location(b.getWorld().getName(), b.getX(), b.getY(), b.getZ());
+ com.github.intellectualsites.plotsquared.plot.object.Location loc =
+ new com.github.intellectualsites.plotsquared.plot.object.Location(b.getWorld().getName(), b.getX(), b.getY(), b.getZ());
externalPluginsAllowed = PlotSquaredShopFlag.isFlagAllowedOnPlot(loc.getOwnedPlot(), PlotSquaredShopFlag.CREATE_SHOP, p);
}
diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java
index 7069dbe..ad153e6 100644
--- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java
+++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java
@@ -1,7 +1,7 @@
package de.epiceric.shopchest.listeners;
import com.google.gson.JsonPrimitive;
-import com.intellectualcrafters.plot.object.Plot;
+import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
@@ -223,7 +223,7 @@ public class ShopInteractListener implements Listener {
plugin.debug("Checking if PlotSquared allows shop creation...");
for (Location loc : chestLocations) {
if (loc != null) {
- com.intellectualcrafters.plot.object.Location plotLocation = new com.intellectualcrafters.plot.object.Location(
+ com.github.intellectualsites.plotsquared.plot.object.Location plotLocation = new com.github.intellectualsites.plotsquared.plot.object.Location(
loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
Plot plot = plotLocation.getOwnedPlot();
@@ -457,8 +457,8 @@ public class ShopInteractListener implements Listener {
boolean externalPluginsAllowed = true;
if (plugin.hasPlotSquared() && Config.enablePlotsquaredIntegration) {
- com.intellectualcrafters.plot.object.Location plotLocation =
- new com.intellectualcrafters.plot.object.Location(b.getWorld().getName(), b.getX(), b.getY(), b.getZ());
+ com.github.intellectualsites.plotsquared.plot.object.Location plotLocation =
+ new com.github.intellectualsites.plotsquared.plot.object.Location(b.getWorld().getName(), b.getX(), b.getY(), b.getZ());
Plot plot = plotLocation.getOwnedPlot();
GroupFlag flag = shop.getShopType() == Shop.ShopType.ADMIN ? PlotSquaredShopFlag.USE_ADMIN_SHOP : PlotSquaredShopFlag.USE_SHOP;
@@ -571,8 +571,8 @@ public class ShopInteractListener implements Listener {
boolean externalPluginsAllowed = true;
if (plugin.hasPlotSquared() && Config.enablePlotsquaredIntegration) {
- com.intellectualcrafters.plot.object.Location plotLocation =
- new com.intellectualcrafters.plot.object.Location(b.getWorld().getName(), b.getX(), b.getY(), b.getZ());
+ com.github.intellectualsites.plotsquared.plot.object.Location plotLocation =
+ new com.github.intellectualsites.plotsquared.plot.object.Location(b.getWorld().getName(), b.getX(), b.getY(), b.getZ());
Plot plot = plotLocation.getOwnedPlot();
GroupFlag flag = shop.getShopType() == Shop.ShopType.ADMIN ? PlotSquaredShopFlag.USE_ADMIN_SHOP : PlotSquaredShopFlag.USE_SHOP;