Update dependencies and their implementations

PlotSquared integration will not work with version 5.x anymore!

Towny and BentoBox may also require a more recent version.
This commit is contained in:
Eric 2021-07-29 14:17:50 +02:00
parent 5606f2a4e5
commit 5157cc42ac
10 changed files with 60 additions and 58 deletions

Binary file not shown.

Binary file not shown.

43
pom.xml
View File

@ -67,13 +67,9 @@
<id>sk89q-repo</id> <id>sk89q-repo</id>
<url>http://maven.sk89q.com/artifactory/repo/</url> <url>http://maven.sk89q.com/artifactory/repo/</url>
</repository> </repository>
<repository>
<id>athion-repo</id>
<url>http://ci.athion.net/job/PlotSquared-Releases/ws/mvn/</url>
</repository>
<repository> <repository>
<id>uskyblock-repo</id> <id>uskyblock-repo</id>
<url>https://raw.github.com/rlf/uSkyBlock/mvn-repo/</url> <url>https://www.uskyblock.ovh/maven/uskyblock/</url>
</repository> </repository>
<repository> <repository>
<id>jitpack-repo</id> <id>jitpack-repo</id>
@ -84,13 +80,17 @@
<url>http://maven.wiefferink.me</url> <url>http://maven.wiefferink.me</url>
</repository> </repository>
<repository> <repository>
<id>plotsquared-repo</id> <id>plotsquared-legacy-repo</id>
<url>https://plotsquared.com/mvn/</url> <url>https://plotsquared.com/mvn/</url>
</repository> </repository>
<repository> <repository>
<id>inventive-repo</id> <id>inventive-repo</id>
<url>https://repo.inventivetalent.org/content/groups/public/</url> <url>https://repo.inventivetalent.org/content/groups/public/</url>
</repository> </repository>
<repository>
<id>intellectualsites-repo</id>
<url>https://mvn.intellectualsites.com/content/groups/public/</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
@ -114,14 +114,14 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.plotsquared</groupId> <groupId>com.plotsquared</groupId>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared-Core</artifactId>
<version>5.1</version> <version>6.0.8-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.rlf</groupId> <groupId>com.github.rlf</groupId>
<artifactId>uSkyBlock-API</artifactId> <artifactId>uSkyBlock-API</artifactId>
<version>2.6.4</version> <version>2.9.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -133,7 +133,7 @@
<dependency> <dependency>
<groupId>com.github.TechFortress</groupId> <groupId>com.github.TechFortress</groupId>
<artifactId>GriefPrevention</artifactId> <artifactId>GriefPrevention</artifactId>
<version>16.11.6</version> <version>16.17.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -145,15 +145,20 @@
<dependency> <dependency>
<groupId>world.bentobox</groupId> <groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId> <artifactId>bentobox</artifactId>
<version>1.11.1</version> <version>1.17.2</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.palmergames</groupId> <groupId>com.github.intellectualsites.plotsquared</groupId>
<artifactId>PlotSquared-API</artifactId>
<version>4.514</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.TownyAdvanced</groupId>
<artifactId>Towny</artifactId> <artifactId>Towny</artifactId>
<version>0.93.1.0</version> <version>0.97.0.0</version>
<scope>system</scope> <scope>provided</scope>
<systemPath>${project.basedir}/lib/Towny-0.93.1.0.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>pl.gnacik</groupId> <groupId>pl.gnacik</groupId>
@ -162,14 +167,8 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/lib/IslandWorld-8.5.jar</systemPath> <systemPath>${project.basedir}/lib/IslandWorld-8.5.jar</systemPath>
</dependency> </dependency>
<dependency>
<groupId>com.github.intellectualsites.plotsquared</groupId>
<artifactId>PlotSquared-API</artifactId>
<version>4.495</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/PlotSquared-Bukkit-4.4.495.jar</systemPath>
</dependency>
<!-- Only required for build to succeed ? -->
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>

View File

@ -16,7 +16,6 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Stream; import java.util.stream.Stream;
import com.palmergames.bukkit.towny.Towny; import com.palmergames.bukkit.towny.Towny;
import com.plotsquared.core.PlotSquared;
import com.wasteofplastic.askyblock.ASkyBlock; import com.wasteofplastic.askyblock.ASkyBlock;
import org.bstats.bukkit.Metrics; import org.bstats.bukkit.Metrics;
@ -209,7 +208,7 @@ public class ShopChest extends JavaPlugin {
hologramFormat = new HologramFormat(this); hologramFormat = new HologramFormat(this);
shopCommand = new ShopCommand(this); shopCommand = new ShopCommand(this);
shopCreationThreadPool = new ThreadPoolExecutor(0, 8, shopCreationThreadPool = new ThreadPoolExecutor(0, 8,
5L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); 5L, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
loadExternalPlugins(); loadExternalPlugins();
loadMetrics(); loadMetrics();
@ -579,14 +578,14 @@ public class ShopChest extends JavaPlugin {
* @return Whether the plugin 'AreaShop' is enabled * @return Whether the plugin 'AreaShop' is enabled
*/ */
public boolean hasAreaShop() { public boolean hasAreaShop() {
return areaShop != null && areaShop.isEnabled(); return Config.enableAreaShopIntegration && areaShop != null && areaShop.isEnabled();
} }
/** /**
* @return Whether the plugin 'GriefPrevention' is enabled * @return Whether the plugin 'GriefPrevention' is enabled
*/ */
public boolean hasGriefPrevention() { public boolean hasGriefPrevention() {
return griefPrevention != null && griefPrevention.isEnabled(); return Config.enableGriefPreventionIntegration && griefPrevention != null && griefPrevention.isEnabled();
} }
/** /**
@ -600,20 +599,20 @@ public class ShopChest extends JavaPlugin {
* @return Whether the plugin 'IslandWorld' is enabled * @return Whether the plugin 'IslandWorld' is enabled
*/ */
public boolean hasIslandWorld() { public boolean hasIslandWorld() {
return islandWorld != null && islandWorld.isEnabled(); return Config.enableIslandWorldIntegration && islandWorld != null && islandWorld.isEnabled();
} }
/** /**
* @return Whether the plugin 'ASkyBlock' is enabled * @return Whether the plugin 'ASkyBlock' is enabled
*/ */
public boolean hasASkyBlock() { public boolean hasASkyBlock() {
return aSkyBlock != null && aSkyBlock.isEnabled(); return Config.enableASkyblockIntegration && aSkyBlock != null && aSkyBlock.isEnabled();
} }
/** /**
* @return Whether the plugin 'uSkyBlock' is enabled * @return Whether the plugin 'uSkyBlock' is enabled
*/ */
public boolean hasUSkyBlock() { public boolean hasUSkyBlock() {
return uSkyBlock != null && uSkyBlock.isEnabled(); return Config.enableUSkyblockIntegration && uSkyBlock != null && uSkyBlock.isEnabled();
} }
/** /**
@ -627,6 +626,10 @@ public class ShopChest extends JavaPlugin {
* @return Whether the plugin 'PlotSquared' is enabled * @return Whether the plugin 'PlotSquared' is enabled
*/ */
public boolean hasPlotSquared() { public boolean hasPlotSquared() {
if (!Config.enablePlotsquaredIntegration) {
return false;
}
if (Utils.getMajorVersion() < 13) { if (Utils.getMajorVersion() < 13) {
// Supported PlotSquared versions don't support versions below 1.13 // Supported PlotSquared versions don't support versions below 1.13
return false; return false;
@ -639,27 +642,27 @@ public class ShopChest extends JavaPlugin {
* @return Whether the plugin 'AuthMe' is enabled * @return Whether the plugin 'AuthMe' is enabled
*/ */
public boolean hasAuthMe() { public boolean hasAuthMe() {
return authMe != null && authMe.isEnabled(); return Config.enableAuthMeIntegration && authMe != null && authMe.isEnabled();
} }
/** /**
* @return Whether the plugin 'Towny' is enabled * @return Whether the plugin 'Towny' is enabled
*/ */
public boolean hasTowny() { public boolean hasTowny() {
return towny != null && towny.isEnabled(); return Config.enableTownyIntegration && towny != null && towny.isEnabled();
} }
/** /**
* @return Whether the plugin 'WorldGuard' is enabled * @return Whether the plugin 'WorldGuard' is enabled
*/ */
public boolean hasWorldGuard() { public boolean hasWorldGuard() {
return worldGuard != null && worldGuard.isEnabled(); return Config.enableWorldGuardIntegration && worldGuard != null && worldGuard.isEnabled();
} }
/** /**
* @return Whether the plugin 'WorldGuard' is enabled * @return Whether the plugin 'WorldGuard' is enabled
*/ */
public boolean hasBentoBox() { public boolean hasBentoBox() {
return bentoBox != null && bentoBox.isEnabled(); return Config.enableBentoBoxIntegration && bentoBox != null && bentoBox.isEnabled();
} }
/** /**

View File

@ -4,9 +4,9 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Locale; import java.util.Locale;
import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.caption.Caption;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.StaticCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.FlagParseException;
import com.plotsquared.core.plot.flag.GlobalFlagContainer; import com.plotsquared.core.plot.flag.GlobalFlagContainer;
@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import de.epiceric.shopchest.ShopChest; import de.epiceric.shopchest.ShopChest;
import net.kyori.adventure.text.minimessage.Template;
public class PlotSquaredShopFlag { public class PlotSquaredShopFlag {
public enum Group { public enum Group {
@ -75,7 +76,7 @@ public class PlotSquaredShopFlag {
public static class CreateShopFlag extends GroupFlag<CreateShopFlag> { public static class CreateShopFlag extends GroupFlag<CreateShopFlag> {
public CreateShopFlag(Group value) { public CreateShopFlag(Group value) {
super(value, new StaticCaption("Set to the group that is allowed to create shops.")); super(value, StaticCaption.of("Set to the group that is allowed to create shops."));
} }
@Override @Override
@ -86,7 +87,7 @@ public class PlotSquaredShopFlag {
public static class UseShopFlag extends GroupFlag<UseShopFlag> { public static class UseShopFlag extends GroupFlag<UseShopFlag> {
public UseShopFlag(Group value) { public UseShopFlag(Group value) {
super(value, new StaticCaption("Set to the group that is allowed to use shops.")); super(value, StaticCaption.of("Set to the group that is allowed to use shops."));
} }
@Override @Override
@ -96,8 +97,8 @@ public class PlotSquaredShopFlag {
} }
public abstract static class GroupFlag<F extends PlotFlag<Group, F>> extends PlotFlag<Group, F> { public abstract static class GroupFlag<F extends PlotFlag<Group, F>> extends PlotFlag<Group, F> {
public GroupFlag(Group value, Caption description) { protected GroupFlag(Group value, Caption description) {
super(value, Captions.FLAG_CATEGORY_ENUM, description); super(value, TranslatableCaption.of("flags.flag_category_enum"), description);
} }
@Override @Override
@ -141,7 +142,8 @@ public class PlotSquaredShopFlag {
return this.flagOf(Group.NONE); return this.flagOf(Group.NONE);
} }
throw new FlagParseException(this, input, Captions.FLAG_ERROR_ENUM, (Object[]) lowercaseValues); throw new FlagParseException(this, input, TranslatableCaption.of("flags.flag_error_enum"),
Template.of("list", String.join(", ", lowercaseValues)));
} }
@Override @Override

View File

@ -70,7 +70,7 @@ public class PlotSquaredListener implements Listener {
try { try {
Class.forName("com.plotsquared.core.PlotSquared"); Class.forName("com.plotsquared.core.PlotSquared");
Location plotLocation = new Location(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); Location plotLocation = Location.at(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
Plot plot = plotLocation.getOwnedPlot(); Plot plot = plotLocation.getOwnedPlot();
isAllowed = PlotSquaredShopFlag.isFlagAllowedOnPlot(plot, PlotSquaredShopFlag.CREATE_SHOP, player); isAllowed = PlotSquaredShopFlag.isFlagAllowedOnPlot(plot, PlotSquaredShopFlag.CREATE_SHOP, player);
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {

View File

@ -7,7 +7,8 @@ import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident; import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town; import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock; import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownyUniverse; import com.palmergames.bukkit.towny.object.WorldCoord;
import com.palmergames.bukkit.towny.TownyUniverse;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -50,11 +51,11 @@ public class TownyListener implements Listener {
} }
private boolean handleForLocation(Player player, Location loc, Cancellable e) { private boolean handleForLocation(Player player, Location loc, Cancellable e) {
TownBlock townBlock = TownyUniverse.getTownBlock(loc);
if (townBlock == null)
return false;
try { try {
TownBlock townBlock = TownyUniverse.getInstance().getTownBlock(WorldCoord.parseWorldCoord(loc));
if (townBlock == null)
return false;
Town town = townBlock.getTown(); Town town = townBlock.getTown();
Optional<Resident> playerResident = town.getResidents().stream() Optional<Resident> playerResident = town.getResidents().stream()
.filter(r -> r.getName().equals(player.getName())) .filter(r -> r.getName().equals(player.getName()))

View File

@ -12,12 +12,12 @@ import org.bukkit.util.BoundingBox;
import de.epiceric.shopchest.ShopChest; import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.config.Config; import de.epiceric.shopchest.config.Config;
import de.epiceric.shopchest.shop.Shop; import de.epiceric.shopchest.shop.Shop;
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandBanEvent; import world.bentobox.bentobox.api.events.island.IslandBanEvent;
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandDeleteChunksEvent; import world.bentobox.bentobox.api.events.island.IslandDeleteChunksEvent;
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandDeletedEvent; import world.bentobox.bentobox.api.events.island.IslandDeletedEvent;
import world.bentobox.bentobox.api.events.island.IslandEvent.IslandResettedEvent; import world.bentobox.bentobox.api.events.island.IslandResettedEvent;
import world.bentobox.bentobox.api.events.team.TeamEvent.TeamKickEvent; import world.bentobox.bentobox.api.events.team.TeamKickEvent;
import world.bentobox.bentobox.api.events.team.TeamEvent.TeamLeaveEvent; import world.bentobox.bentobox.api.events.team.TeamLeaveEvent;
import world.bentobox.bentobox.database.objects.Island; import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.database.objects.IslandDeletion; import world.bentobox.bentobox.database.objects.IslandDeletion;

View File

@ -261,7 +261,7 @@ public class ShopInteractListener implements Listener {
try { try {
Class.forName("com.plotsquared.core.PlotSquared"); Class.forName("com.plotsquared.core.PlotSquared");
com.plotsquared.core.location.Location plotLocation = com.plotsquared.core.location.Location plotLocation =
new com.plotsquared.core.location.Location(b.getWorld().getName(), b.getX(), b.getY(), b.getZ()); com.plotsquared.core.location.Location.at(b.getWorld().getName(), b.getX(), b.getY(), b.getZ());
com.plotsquared.core.plot.Plot plot = plotLocation.getOwnedPlot(); com.plotsquared.core.plot.Plot plot = plotLocation.getOwnedPlot();
externalPluginsAllowed = PlotSquaredShopFlag.isFlagAllowedOnPlot(plot, PlotSquaredShopFlag.USE_SHOP, p); externalPluginsAllowed = PlotSquaredShopFlag.isFlagAllowedOnPlot(plot, PlotSquaredShopFlag.USE_SHOP, p);
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
@ -386,7 +386,7 @@ public class ShopInteractListener implements Listener {
try { try {
Class.forName("com.plotsquared.core.PlotSquared"); Class.forName("com.plotsquared.core.PlotSquared");
com.plotsquared.core.location.Location plotLocation = com.plotsquared.core.location.Location plotLocation =
new com.plotsquared.core.location.Location(b.getWorld().getName(), b.getX(), b.getY(), b.getZ()); com.plotsquared.core.location.Location.at(b.getWorld().getName(), b.getX(), b.getY(), b.getZ());
com.plotsquared.core.plot.Plot plot = plotLocation.getOwnedPlot(); com.plotsquared.core.plot.Plot plot = plotLocation.getOwnedPlot();
externalPluginsAllowed = PlotSquaredShopFlag.isFlagAllowedOnPlot(plot, PlotSquaredShopFlag.USE_SHOP, p); externalPluginsAllowed = PlotSquaredShopFlag.isFlagAllowedOnPlot(plot, PlotSquaredShopFlag.USE_SHOP, p);
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {

View File

@ -33,11 +33,8 @@ import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.inventivetalent.reflection.minecraft.DataWatcher;
import org.inventivetalent.reflection.resolver.ClassResolver;
import org.inventivetalent.reflection.resolver.FieldResolver; import org.inventivetalent.reflection.resolver.FieldResolver;
import org.inventivetalent.reflection.resolver.minecraft.NMSClassResolver; import org.inventivetalent.reflection.resolver.minecraft.NMSClassResolver;
import org.inventivetalent.reflection.resolver.minecraft.OBCClassResolver;
import de.epiceric.shopchest.ShopChest; import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.config.Placeholder; import de.epiceric.shopchest.config.Placeholder;