diff --git a/lib/PlotSquared-Bukkit-4.4.495.jar b/lib/PlotSquared-Bukkit-4.4.495.jar deleted file mode 100644 index 5ea845b..0000000 Binary files a/lib/PlotSquared-Bukkit-4.4.495.jar and /dev/null differ diff --git a/lib/Towny-0.93.1.0.jar b/lib/Towny-0.93.1.0.jar deleted file mode 100644 index aeb647f..0000000 Binary files a/lib/Towny-0.93.1.0.jar and /dev/null differ diff --git a/pom.xml b/pom.xml index c560e0e..55d3408 100644 --- a/pom.xml +++ b/pom.xml @@ -67,13 +67,9 @@ sk89q-repo http://maven.sk89q.com/artifactory/repo/ - - athion-repo - http://ci.athion.net/job/PlotSquared-Releases/ws/mvn/ - uskyblock-repo - https://raw.github.com/rlf/uSkyBlock/mvn-repo/ + https://www.uskyblock.ovh/maven/uskyblock/ jitpack-repo @@ -84,13 +80,17 @@ http://maven.wiefferink.me - plotsquared-repo + plotsquared-legacy-repo https://plotsquared.com/mvn/ inventive-repo https://repo.inventivetalent.org/content/groups/public/ + + intellectualsites-repo + https://mvn.intellectualsites.com/content/groups/public/ + @@ -114,14 +114,14 @@ com.plotsquared - PlotSquared - 5.1 + PlotSquared-Core + 6.0.8-SNAPSHOT provided com.github.rlf uSkyBlock-API - 2.6.4 + 2.9.0 provided @@ -133,7 +133,7 @@ com.github.TechFortress GriefPrevention - 16.11.6 + 16.17.1 provided @@ -145,15 +145,20 @@ world.bentobox bentobox - 1.11.1 + 1.17.2 provided - com.palmergames + com.github.intellectualsites.plotsquared + PlotSquared-API + 4.514 + provided + + + com.github.TownyAdvanced Towny - 0.93.1.0 - system - ${project.basedir}/lib/Towny-0.93.1.0.jar + 0.97.0.0 + provided pl.gnacik @@ -162,14 +167,8 @@ system ${project.basedir}/lib/IslandWorld-8.5.jar - - com.github.intellectualsites.plotsquared - PlotSquared-API - 4.495 - system - ${project.basedir}/lib/PlotSquared-Bukkit-4.4.495.jar - + org.projectlombok lombok diff --git a/src/main/java/de/epiceric/shopchest/ShopChest.java b/src/main/java/de/epiceric/shopchest/ShopChest.java index 92646a7..b3fc0a4 100644 --- a/src/main/java/de/epiceric/shopchest/ShopChest.java +++ b/src/main/java/de/epiceric/shopchest/ShopChest.java @@ -16,7 +16,6 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Stream; import com.palmergames.bukkit.towny.Towny; -import com.plotsquared.core.PlotSquared; import com.wasteofplastic.askyblock.ASkyBlock; import org.bstats.bukkit.Metrics; @@ -209,7 +208,7 @@ public class ShopChest extends JavaPlugin { hologramFormat = new HologramFormat(this); shopCommand = new ShopCommand(this); shopCreationThreadPool = new ThreadPoolExecutor(0, 8, - 5L, TimeUnit.SECONDS, new LinkedBlockingQueue()); + 5L, TimeUnit.SECONDS, new LinkedBlockingQueue<>()); loadExternalPlugins(); loadMetrics(); @@ -579,14 +578,14 @@ public class ShopChest extends JavaPlugin { * @return Whether the plugin 'AreaShop' is enabled */ public boolean hasAreaShop() { - return areaShop != null && areaShop.isEnabled(); + return Config.enableAreaShopIntegration && areaShop != null && areaShop.isEnabled(); } /** * @return Whether the plugin 'GriefPrevention' is enabled */ 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 */ public boolean hasIslandWorld() { - return islandWorld != null && islandWorld.isEnabled(); + return Config.enableIslandWorldIntegration && islandWorld != null && islandWorld.isEnabled(); } /** * @return Whether the plugin 'ASkyBlock' is enabled */ public boolean hasASkyBlock() { - return aSkyBlock != null && aSkyBlock.isEnabled(); + return Config.enableASkyblockIntegration && aSkyBlock != null && aSkyBlock.isEnabled(); } /** * @return Whether the plugin 'uSkyBlock' is enabled */ 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 */ public boolean hasPlotSquared() { + if (!Config.enablePlotsquaredIntegration) { + return false; + } + if (Utils.getMajorVersion() < 13) { // Supported PlotSquared versions don't support versions below 1.13 return false; @@ -639,27 +642,27 @@ public class ShopChest extends JavaPlugin { * @return Whether the plugin 'AuthMe' is enabled */ public boolean hasAuthMe() { - return authMe != null && authMe.isEnabled(); + return Config.enableAuthMeIntegration && authMe != null && authMe.isEnabled(); } /** * @return Whether the plugin 'Towny' is enabled */ public boolean hasTowny() { - return towny != null && towny.isEnabled(); + return Config.enableTownyIntegration && towny != null && towny.isEnabled(); } /** * @return Whether the plugin 'WorldGuard' is enabled */ public boolean hasWorldGuard() { - return worldGuard != null && worldGuard.isEnabled(); + return Config.enableWorldGuardIntegration && worldGuard != null && worldGuard.isEnabled(); } /** * @return Whether the plugin 'WorldGuard' is enabled */ public boolean hasBentoBox() { - return bentoBox != null && bentoBox.isEnabled(); + return Config.enableBentoBoxIntegration && bentoBox != null && bentoBox.isEnabled(); } /** diff --git a/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java b/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java index e461788..8ecaa86 100644 --- a/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java +++ b/src/main/java/de/epiceric/shopchest/external/PlotSquaredShopFlag.java @@ -4,9 +4,9 @@ import java.util.Arrays; import java.util.Collection; import java.util.Locale; -import com.plotsquared.core.configuration.Caption; -import com.plotsquared.core.configuration.Captions; -import com.plotsquared.core.configuration.StaticCaption; +import com.plotsquared.core.configuration.caption.Caption; +import com.plotsquared.core.configuration.caption.StaticCaption; +import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.GlobalFlagContainer; @@ -16,6 +16,7 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import de.epiceric.shopchest.ShopChest; +import net.kyori.adventure.text.minimessage.Template; public class PlotSquaredShopFlag { public enum Group { @@ -75,7 +76,7 @@ public class PlotSquaredShopFlag { public static class CreateShopFlag extends GroupFlag { 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 @@ -86,7 +87,7 @@ public class PlotSquaredShopFlag { public static class UseShopFlag extends GroupFlag { 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 @@ -96,8 +97,8 @@ public class PlotSquaredShopFlag { } public abstract static class GroupFlag> extends PlotFlag { - public GroupFlag(Group value, Caption description) { - super(value, Captions.FLAG_CATEGORY_ENUM, description); + protected GroupFlag(Group value, Caption description) { + super(value, TranslatableCaption.of("flags.flag_category_enum"), description); } @Override @@ -141,7 +142,8 @@ public class PlotSquaredShopFlag { 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 diff --git a/src/main/java/de/epiceric/shopchest/external/listeners/PlotSquaredListener.java b/src/main/java/de/epiceric/shopchest/external/listeners/PlotSquaredListener.java index 3cab944..c102de3 100644 --- a/src/main/java/de/epiceric/shopchest/external/listeners/PlotSquaredListener.java +++ b/src/main/java/de/epiceric/shopchest/external/listeners/PlotSquaredListener.java @@ -70,7 +70,7 @@ public class PlotSquaredListener implements Listener { try { 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(); isAllowed = PlotSquaredShopFlag.isFlagAllowedOnPlot(plot, PlotSquaredShopFlag.CREATE_SHOP, player); } catch (ClassNotFoundException ex) { diff --git a/src/main/java/de/epiceric/shopchest/external/listeners/TownyListener.java b/src/main/java/de/epiceric/shopchest/external/listeners/TownyListener.java index 85c736b..db59382 100644 --- a/src/main/java/de/epiceric/shopchest/external/listeners/TownyListener.java +++ b/src/main/java/de/epiceric/shopchest/external/listeners/TownyListener.java @@ -7,7 +7,8 @@ import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; import com.palmergames.bukkit.towny.object.Resident; import com.palmergames.bukkit.towny.object.Town; 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.entity.Player; @@ -50,11 +51,11 @@ public class TownyListener implements Listener { } private boolean handleForLocation(Player player, Location loc, Cancellable e) { - TownBlock townBlock = TownyUniverse.getTownBlock(loc); - if (townBlock == null) - return false; - try { + TownBlock townBlock = TownyUniverse.getInstance().getTownBlock(WorldCoord.parseWorldCoord(loc)); + if (townBlock == null) + return false; + Town town = townBlock.getTown(); Optional playerResident = town.getResidents().stream() .filter(r -> r.getName().equals(player.getName())) diff --git a/src/main/java/de/epiceric/shopchest/listeners/BentoBoxListener.java b/src/main/java/de/epiceric/shopchest/listeners/BentoBoxListener.java index 45035de..4170250 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/BentoBoxListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/BentoBoxListener.java @@ -12,12 +12,12 @@ import org.bukkit.util.BoundingBox; import de.epiceric.shopchest.ShopChest; import de.epiceric.shopchest.config.Config; import de.epiceric.shopchest.shop.Shop; -import world.bentobox.bentobox.api.events.island.IslandEvent.IslandBanEvent; -import world.bentobox.bentobox.api.events.island.IslandEvent.IslandDeleteChunksEvent; -import world.bentobox.bentobox.api.events.island.IslandEvent.IslandDeletedEvent; -import world.bentobox.bentobox.api.events.island.IslandEvent.IslandResettedEvent; -import world.bentobox.bentobox.api.events.team.TeamEvent.TeamKickEvent; -import world.bentobox.bentobox.api.events.team.TeamEvent.TeamLeaveEvent; +import world.bentobox.bentobox.api.events.island.IslandBanEvent; +import world.bentobox.bentobox.api.events.island.IslandDeleteChunksEvent; +import world.bentobox.bentobox.api.events.island.IslandDeletedEvent; +import world.bentobox.bentobox.api.events.island.IslandResettedEvent; +import world.bentobox.bentobox.api.events.team.TeamKickEvent; +import world.bentobox.bentobox.api.events.team.TeamLeaveEvent; import world.bentobox.bentobox.database.objects.Island; import world.bentobox.bentobox.database.objects.IslandDeletion; diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java index 0702daf..40e315b 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java @@ -261,7 +261,7 @@ public class ShopInteractListener implements Listener { try { Class.forName("com.plotsquared.core.PlotSquared"); 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(); externalPluginsAllowed = PlotSquaredShopFlag.isFlagAllowedOnPlot(plot, PlotSquaredShopFlag.USE_SHOP, p); } catch (ClassNotFoundException ex) { @@ -386,7 +386,7 @@ public class ShopInteractListener implements Listener { try { Class.forName("com.plotsquared.core.PlotSquared"); 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(); externalPluginsAllowed = PlotSquaredShopFlag.isFlagAllowedOnPlot(plot, PlotSquaredShopFlag.USE_SHOP, p); } catch (ClassNotFoundException ex) { diff --git a/src/main/java/de/epiceric/shopchest/utils/Utils.java b/src/main/java/de/epiceric/shopchest/utils/Utils.java index 0b5a01d..ebdd9e1 100644 --- a/src/main/java/de/epiceric/shopchest/utils/Utils.java +++ b/src/main/java/de/epiceric/shopchest/utils/Utils.java @@ -33,11 +33,8 @@ import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.ItemMeta; 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.minecraft.NMSClassResolver; -import org.inventivetalent.reflection.resolver.minecraft.OBCClassResolver; import de.epiceric.shopchest.ShopChest; import de.epiceric.shopchest.config.Placeholder;