diff --git a/build.gradle.kts b/build.gradle.kts index 9de5a2a..7ad14c8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -35,9 +35,9 @@ dependencies { compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT") // Adventure - implementation("net.kyori:adventure-api:4.15.0") + compileOnly("net.kyori:adventure-api:4.15.0") implementation("net.kyori:adventure-platform-bukkit:4.3.2") - implementation("net.kyori:adventure-text-minimessage:4.15.0") + compileOnly("net.kyori:adventure-text-minimessage:4.15.0") // Other implementation("co.aikar:taskchain-bukkit:3.7.2") @@ -50,6 +50,7 @@ dependencies { implementation("co.aikar:idb-core:1.0.0-SNAPSHOT") implementation("com.zaxxer:HikariCP:5.1.0") implementation("com.github.retrooper.packetevents:spigot:2.2.0") + compileOnly("com.github.N0RSKA:DeluxeSellwandsAPI:32c") compileOnly("com.ghostchu:quickshop-api:5.2.0.8") compileOnly("com.google.guava:guava:33.0.0-jre") compileOnly("net.milkbowl.vault:VaultAPI:1.7") @@ -71,16 +72,22 @@ dependencies { tasks { shadowJar { archiveFileName.set("${rootProject.name}.jar") - + // for some reason cache2k does not like being relocated, likely due to generative class loading & relocation not playing nice + relocate("co.aikar.locales", "net.crashcraft.crashclaim.aikarlocales") relocate("co.aikar.commands", "net.crashcraft.crashclaim.acf") relocate("co.aikar.idb", "net.crashcraft.crashclaim.idb") relocate("co.aikar.taskchain", "net.crashcraft.crashclaim.taskchain") relocate("io.papermc.lib", "net.crashcraft.crashclaim.paperlib") relocate("it.unimi.dsi", "net.crashcraft.crashclaim.fastutil") - relocate("org.cache2k.IntCache", "net.crashcraft.crashclaim.cache2k") relocate("com.zaxxer.hikari", "net.crashcraft.crashclaim.hikari") relocate("com.github.retrooper.packetevents", "net.crashcraft.crashclaim.packetevents.api") relocate("io.github.retrooper.packetevents", "net.crashcraft.crashclaim.packetevents.impl") + relocate("net.wesjd", "net.crashcraft.crashclaim.anvilgui") + + exclude("/com/google/gson/**") + exclude("/org/intellij/**") + exclude("/org/jetbrains/**") + exclude("/org/slf4j/**") } build { diff --git a/src/main/java/net/crashcraft/crashclaim/CrashClaim.java b/src/main/java/net/crashcraft/crashclaim/CrashClaim.java index 487b515..cb66337 100644 --- a/src/main/java/net/crashcraft/crashclaim/CrashClaim.java +++ b/src/main/java/net/crashcraft/crashclaim/CrashClaim.java @@ -74,6 +74,7 @@ public void onLoad() { this.crashUtils = new CrashUtils(this); this.pluginSupport = new PluginSupportManager(this); // Enable plugin support + this.pluginSupport.onLoad(); // Load all plugin support } @Override @@ -114,7 +115,6 @@ public void onEnable() { PacketListenerPriority.LOW); PacketEvents.getAPI().init(); - if (PaperLib.isPaper()) { getLogger().info("Using extra protections provided by the paper api"); Bukkit.getPluginManager().registerEvents(new PaperListener(manager, visualizationManager), this); @@ -266,8 +266,7 @@ public PluginSupport getPluginSupport(){ return pluginSupport.getSupportDistributor(); } - public PluginSupportManager getPluginSupportManager(){ + public PluginSupportManager getPluginSupportManager() { return pluginSupport; } - } diff --git a/src/main/java/net/crashcraft/crashclaim/api/CrashClaimAPI.java b/src/main/java/net/crashcraft/crashclaim/api/CrashClaimAPI.java index 7a5faf7..a3d4486 100644 --- a/src/main/java/net/crashcraft/crashclaim/api/CrashClaimAPI.java +++ b/src/main/java/net/crashcraft/crashclaim/api/CrashClaimAPI.java @@ -6,6 +6,7 @@ import net.crashcraft.crashclaim.menus.list.ClaimListMenu; import net.crashcraft.crashclaim.permissions.PermissionHelper; import net.crashcraft.crashclaim.pluginsupport.PluginSupport; +import net.crashcraft.crashclaim.pluginsupport.PluginSupportLoader; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -166,6 +167,10 @@ public PermissionHelper getPermissionHelper(){ return PermissionHelper.getPermissionHelper(); } + public void registerHook(PluginSupportLoader pluginSupportLoader){ + crashClaim.getPluginSupportManager().register(pluginSupportLoader); + } + public void registerHook(PluginSupport pluginSupport){ crashClaim.getPluginSupportManager().register(pluginSupport); } diff --git a/src/main/java/net/crashcraft/crashclaim/crashutils/ServiceUtil.java b/src/main/java/net/crashcraft/crashclaim/crashutils/ServiceUtil.java index d83a603..9523628 100644 --- a/src/main/java/net/crashcraft/crashclaim/crashutils/ServiceUtil.java +++ b/src/main/java/net/crashcraft/crashclaim/crashutils/ServiceUtil.java @@ -37,7 +37,7 @@ public static List getServices(Class clazz, List def) { final List services = new ArrayList<>(); ServiceLoader.load(clazz).iterator().forEachRemaining(services::add); if (services.isEmpty()) { - services.addAll(def); + return def; } return services; } @@ -46,7 +46,7 @@ public static List getServices(Class clazz, ClassLoader loader, List services = new ArrayList<>(); ServiceLoader.load(clazz, loader).iterator().forEachRemaining(services::add); if (services.isEmpty()) { - services.addAll(def); + return def; } return services; } diff --git a/src/main/java/net/crashcraft/crashclaim/localization/Localization.java b/src/main/java/net/crashcraft/crashclaim/localization/Localization.java index 97f868b..8efd985 100644 --- a/src/main/java/net/crashcraft/crashclaim/localization/Localization.java +++ b/src/main/java/net/crashcraft/crashclaim/localization/Localization.java @@ -13,7 +13,6 @@ import net.kyori.adventure.text.serializer.craftbukkit.BukkitComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.chat.ComponentSerializer; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.enchantments.Enchantment; diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupport.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupport.java index 2a01275..7053482 100644 --- a/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupport.java +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupport.java @@ -6,7 +6,7 @@ import org.bukkit.plugin.Plugin; public interface PluginSupport { - boolean isUnSupportedVersion(String version); + boolean isUnsupportedVersion(String version); boolean canLoad(); @@ -26,5 +26,7 @@ default boolean canInteract(Player player, Location location) { return true; } - GroupSettings getPlayerGroupSettings(Player player); + default GroupSettings getPlayerGroupSettings(Player player) { + return null; + } } diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupportDistributor.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupportDistributor.java index 9d8f407..e9d1d90 100644 --- a/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupportDistributor.java +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupportDistributor.java @@ -6,7 +6,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import java.util.List; import java.util.Set; public class PluginSupportDistributor implements PluginSupport { @@ -17,7 +16,7 @@ public PluginSupportDistributor(PluginSupportManager manager){ } @Override - public boolean isUnSupportedVersion(String version) { + public boolean isUnsupportedVersion(String version) { throw new RuntimeException("Unsupported Operation."); } diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupportLoader.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupportLoader.java new file mode 100644 index 0000000..4edff50 --- /dev/null +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupportLoader.java @@ -0,0 +1,13 @@ +package net.crashcraft.crashclaim.pluginsupport; + +import org.bukkit.plugin.Plugin; + +public interface PluginSupportLoader { + boolean isUnsupportedVersion(String version); + + boolean canLoad(); + + String getPluginName(); + + void load(Plugin plugin); +} diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupportManager.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupportManager.java index d8037d8..e000e17 100644 --- a/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupportManager.java +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/PluginSupportManager.java @@ -30,11 +30,16 @@ public PluginSupportManager(CrashClaim crashClaim) { allSupport = new ArrayList<>(); enabledSupport = new HashSet<>(); - for (PluginSupport service : ServiceUtil.getServices(PluginSupport.class)) { + supportDistributor = new PluginSupportDistributor(this); + } + + public void onLoad() { + List services = ServiceUtil.getServices(PluginSupportLoader.class, crashClaim.getClass().getClassLoader()); + + logger.info("Found " + services.size() + " plugin support services."); + for (PluginSupportLoader service : services) { register(service); } - - supportDistributor = new PluginSupportDistributor(this); } public void onEnable(){ @@ -50,6 +55,23 @@ public void onDisable(){ enabledSupport.clear(); } + public void register(PluginSupportLoader pluginSupportLoader){ + if (!pluginSupportLoader.canLoad()) { + logger.warning("Plugin support for " + pluginSupportLoader.getPluginName() + " is not enabled."); + return; + } + + Plugin plugin = Bukkit.getPluginManager().getPlugin(pluginSupportLoader.getPluginName()); + String version = plugin.getDescription().getVersion(); + + if (pluginSupportLoader.isUnsupportedVersion(version)) { + logger.warning("Plugin [" + pluginSupportLoader.getPluginName() + "] was found but version " + version + ", is not supported."); + return; + } + + pluginSupportLoader.load(plugin); + } + public void register(PluginSupport pluginSupport){ if (allSupport.contains(pluginSupport)) { logger.warning("Plugin support for " + pluginSupport.getPluginName() + " is already registered."); @@ -59,13 +81,14 @@ public void register(PluginSupport pluginSupport){ allSupport.add(pluginSupport); if (!pluginSupport.canLoad()) { + logger.warning("Not enabling plugin support for " + pluginSupport.getPluginName() + ", plugin is not enabled."); return; } Plugin plugin = Bukkit.getPluginManager().getPlugin(pluginSupport.getPluginName()); String version = plugin.getDescription().getVersion(); - if (pluginSupport.isUnSupportedVersion(version)) { + if (pluginSupport.isUnsupportedVersion(version)) { logger.warning("Plugin [" + pluginSupport.getPluginName() + "] was found but version " + version + ", is not supported."); return; } @@ -95,7 +118,7 @@ public void onPluginEnable(PluginEnableEvent event) { String version = plugin.getDescription().getVersion(); - if (service.isUnSupportedVersion(version)) { + if (service.isUnsupportedVersion(version)) { logger.warning("Plugin [" + service.getPluginName() + "] was found but version " + version + ", is not supported."); continue; } diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/DeluxeSellwandSupportLoader.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/DeluxeSellwandSupportLoader.java new file mode 100644 index 0000000..532ccd2 --- /dev/null +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/DeluxeSellwandSupportLoader.java @@ -0,0 +1,34 @@ +package net.crashcraft.crashclaim.pluginsupport.loader; + +import com.google.auto.service.AutoService; +import net.crashcraft.crashclaim.CrashClaim; +import net.crashcraft.crashclaim.pluginsupport.PluginSupportLoader; +import net.crashcraft.crashclaim.pluginsupport.plugins.DeluxeSellwandSupport; +import net.crashcraft.crashclaim.pluginsupport.plugins.LuckPermsSupport; +import org.bukkit.Bukkit; +import org.bukkit.plugin.Plugin; + +@AutoService(PluginSupportLoader.class) +public class DeluxeSellwandSupportLoader implements PluginSupportLoader { + + @Override + public boolean isUnsupportedVersion(String version) { + return false; + } + + @Override + public boolean canLoad() { + return Bukkit.getPluginManager().getPlugin(getPluginName()) != null; + } + + @Override + public String getPluginName() { + return "DeluxeSellwands"; + } + + @Override + public void load(Plugin plugin) { + CrashClaim.getPlugin().getPluginSupportManager().register(new DeluxeSellwandSupport()); + } + +} diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/LuckPermSupportLoader.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/LuckPermSupportLoader.java new file mode 100644 index 0000000..475ea45 --- /dev/null +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/LuckPermSupportLoader.java @@ -0,0 +1,32 @@ +package net.crashcraft.crashclaim.pluginsupport.loader; + +import com.google.auto.service.AutoService; +import net.crashcraft.crashclaim.CrashClaim; +import net.crashcraft.crashclaim.pluginsupport.PluginSupportLoader; +import net.crashcraft.crashclaim.pluginsupport.plugins.LuckPermsSupport; +import org.bukkit.Bukkit; +import org.bukkit.plugin.Plugin; + +@AutoService(PluginSupportLoader.class) +public class LuckPermSupportLoader implements PluginSupportLoader { + + @Override + public boolean isUnsupportedVersion(String version) { + return false; + } + + @Override + public boolean canLoad() { + return Bukkit.getPluginManager().getPlugin(getPluginName()) != null; + } + + @Override + public String getPluginName() { + return "LuckPerms"; + } + + @Override + public void load(Plugin plugin) { + CrashClaim.getPlugin().getPluginSupportManager().register(new LuckPermsSupport()); + } +} diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/QuickShopHikariSupportLoader.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/QuickShopHikariSupportLoader.java new file mode 100644 index 0000000..187217d --- /dev/null +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/QuickShopHikariSupportLoader.java @@ -0,0 +1,31 @@ +package net.crashcraft.crashclaim.pluginsupport.loader; + +import com.google.auto.service.AutoService; +import net.crashcraft.crashclaim.CrashClaim; +import net.crashcraft.crashclaim.pluginsupport.PluginSupportLoader; +import net.crashcraft.crashclaim.pluginsupport.plugins.QuickShopHikariSupport; +import org.bukkit.Bukkit; +import org.bukkit.plugin.Plugin; + +@AutoService(PluginSupportLoader.class) +public class QuickShopHikariSupportLoader implements PluginSupportLoader { + @Override + public boolean isUnsupportedVersion(String version) { + return false; + } + + @Override + public boolean canLoad() { + return Bukkit.getPluginManager().getPlugin(getPluginName()) != null; + } + + @Override + public String getPluginName() { + return "QuickShop-Hikari"; + } + + @Override + public void load(Plugin plugin) { + CrashClaim.getPlugin().getPluginSupportManager().register(new QuickShopHikariSupport()); + } +} diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/WorldGuardSupportLoader.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/WorldGuardSupportLoader.java new file mode 100644 index 0000000..e941a98 --- /dev/null +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/loader/WorldGuardSupportLoader.java @@ -0,0 +1,31 @@ +package net.crashcraft.crashclaim.pluginsupport.loader; + +import com.google.auto.service.AutoService; +import net.crashcraft.crashclaim.CrashClaim; +import net.crashcraft.crashclaim.pluginsupport.PluginSupportLoader; +import net.crashcraft.crashclaim.pluginsupport.plugins.WorldGuardSupport; +import org.bukkit.Bukkit; +import org.bukkit.plugin.Plugin; + +@AutoService(PluginSupportLoader.class) +public class WorldGuardSupportLoader implements PluginSupportLoader { + @Override + public boolean isUnsupportedVersion(String version) { + return (int) version.charAt(0) < 7; + } + + @Override + public boolean canLoad() { + return Bukkit.getPluginManager().getPlugin(getPluginName()) != null; + } + + @Override + public String getPluginName() { + return "WorldGuard"; + } + + @Override + public void load(Plugin plugin) { + CrashClaim.getPlugin().getPluginSupportManager().register(new WorldGuardSupport()); + } +} diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/DeluxeSellwandSupport.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/DeluxeSellwandSupport.java new file mode 100644 index 0000000..6cdbcc8 --- /dev/null +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/DeluxeSellwandSupport.java @@ -0,0 +1,72 @@ +package net.crashcraft.crashclaim.pluginsupport.plugins; + +import dev.norska.dsw.api.DeluxeSellwandPreSellEvent; +import net.crashcraft.crashclaim.CrashClaim; +import net.crashcraft.crashclaim.localization.Localization; +import net.crashcraft.crashclaim.permissions.PermissionHelper; +import net.crashcraft.crashclaim.permissions.PermissionRoute; +import net.crashcraft.crashclaim.pluginsupport.PluginSupport; +import net.crashcraft.crashclaim.visualize.VisualizationManager; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.inventory.BlockInventoryHolder; +import org.bukkit.plugin.Plugin; + +public class DeluxeSellwandSupport implements PluginSupport, Listener { + + private VisualizationManager visual; + + @Override + public boolean isUnsupportedVersion(String version) { + return false; + } + + @Override + public boolean canLoad() { + return Bukkit.getPluginManager().getPlugin(getPluginName()) != null; + } + + @Override + public String getPluginName() { + return "DeluxeSellwands"; + } + + @Override + public void load(Plugin plugin) { + + } + + @Override + public void enable(Plugin plugin) { + Bukkit.getPluginManager().registerEvents(this, CrashClaim.getPlugin()); + visual = CrashClaim.getPlugin().getVisualizationManager(); + } + + @Override + public void disable() { + HandlerList.unregisterAll(this); + } + + @EventHandler + public void onWandUse(DeluxeSellwandPreSellEvent event) { + Player player = event.getPlayer(); + PermissionHelper helper = PermissionHelper.getPermissionHelper(); + Location location = event.getClickedBlock().getLocation(); + + if (event.getClickedBlock().getState() instanceof BlockInventoryHolder){ + if (helper.hasPermission(player.getUniqueId(), location, event.getClickedBlock().getType())){ + return; + } + + event.setCancelled(true); + visual.sendAlert(player, Localization.ALERT__NO_PERMISSIONS__CONTAINERS.getMessage(player)); + } else if (!helper.hasPermission(player.getUniqueId(), location, PermissionRoute.INTERACTIONS)){ + event.setCancelled(true); + visual.sendAlert(player, Localization.ALERT__NO_PERMISSIONS__INTERACTION.getMessage(player)); + } + } +} diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/LuckPermsSupport.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/LuckPermsSupport.java index d740597..4af3e82 100644 --- a/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/LuckPermsSupport.java +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/LuckPermsSupport.java @@ -1,6 +1,5 @@ package net.crashcraft.crashclaim.pluginsupport.plugins; -import com.google.auto.service.AutoService; import net.crashcraft.crashclaim.config.GlobalConfig; import net.crashcraft.crashclaim.config.GroupSettings; import net.crashcraft.crashclaim.pluginsupport.PluginSupport; @@ -8,22 +7,20 @@ import net.luckperms.api.LuckPermsProvider; import net.luckperms.api.model.PermissionHolder; import org.bukkit.Bukkit; -import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -@AutoService(PluginSupport.class) public class LuckPermsSupport implements PluginSupport { private LuckPerms luckPerms; @Override - public boolean isUnSupportedVersion(String version) { + public boolean isUnsupportedVersion(String version) { return false; } @Override public boolean canLoad() { - return Bukkit.getPluginManager().isPluginEnabled(getPluginName()); + return Bukkit.getPluginManager().getPlugin(getPluginName()) != null; } @Override @@ -46,16 +43,6 @@ public void disable() { luckPerms = null; } - @Override - public boolean canClaim(Location minLoc, Location maxLoc) { - return true; - } - - @Override - public boolean canInteract(Player player, Location location) { - return true; - } - @Override public GroupSettings getPlayerGroupSettings(Player player) { PermissionHolder user = luckPerms.getUserManager().getUser(player.getUniqueId()); diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/QuickShopHikariSupport.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/QuickShopHikariSupport.java index 1fc214e..ca09670 100644 --- a/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/QuickShopHikariSupport.java +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/QuickShopHikariSupport.java @@ -2,8 +2,6 @@ import com.ghostchu.quickshop.api.QuickShopAPI; import com.ghostchu.quickshop.api.shop.Shop; -import com.google.auto.service.AutoService; -import net.crashcraft.crashclaim.config.GroupSettings; import net.crashcraft.crashclaim.pluginsupport.PluginSupport; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -13,19 +11,22 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -@AutoService(PluginSupport.class) public class QuickShopHikariSupport implements PluginSupport { - //Originally from https://github.com/MCCasper/CrashClaim/commit/4375601a04e4e126b338c9df3aff4e43eb9a1d51 private QuickShopAPI quickShopAPI; @Override - public boolean isUnSupportedVersion(String version) { + public void load(Plugin plugin) { + + } + + @Override + public boolean isUnsupportedVersion(String version) { return false; } @Override public boolean canLoad() { - return Bukkit.getPluginManager().isPluginEnabled(getPluginName()); + return Bukkit.getPluginManager().getPlugin(getPluginName()) != null; } @Override @@ -33,11 +34,6 @@ public String getPluginName() { return "QuickShop-Hikari"; } - @Override - public void load(Plugin plugin) { - - } - @Override public void enable(Plugin plugin) { this.quickShopAPI = QuickShopAPI.getInstance(); @@ -48,11 +44,6 @@ public void disable() { } - @Override - public boolean canClaim(Location minLoc, Location maxLoc) { - return true; - } - @Override public boolean canInteract(Player player, Location location) { if (!(location.getBlock().getBlockData() instanceof Directional directional)) { @@ -72,11 +63,6 @@ public boolean canInteract(Player player, Location location) { return shop != null; } - @Override - public GroupSettings getPlayerGroupSettings(Player player) { - return null; - } - private BlockFace invertFace(BlockFace face){ return switch (face) { case NORTH -> BlockFace.SOUTH; diff --git a/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/WorldGuardSupport.java b/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/WorldGuardSupport.java index e4ea4b2..b8f0091 100644 --- a/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/WorldGuardSupport.java +++ b/src/main/java/net/crashcraft/crashclaim/pluginsupport/plugins/WorldGuardSupport.java @@ -1,6 +1,5 @@ package net.crashcraft.crashclaim.pluginsupport.plugins; -import com.google.auto.service.AutoService; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldguard.WorldGuard; @@ -14,26 +13,23 @@ import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.RegionContainer; import net.crashcraft.crashclaim.CrashClaim; -import net.crashcraft.crashclaim.config.GroupSettings; import net.crashcraft.crashclaim.pluginsupport.PluginSupport; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -@AutoService(PluginSupport.class) public class WorldGuardSupport implements PluginSupport { private StateFlag ALLOW_CLAIMING; @Override - public boolean isUnSupportedVersion(String version) { + public boolean isUnsupportedVersion(String version) { return (int) version.charAt(0) < 7; } @Override public boolean canLoad() { - return Bukkit.getPluginManager().isPluginEnabled(getPluginName()); + return Bukkit.getPluginManager().getPlugin(getPluginName()) != null; } @Override @@ -91,14 +87,4 @@ public boolean canClaim(Location minLoc, Location maxLoc){ return set.testState(null, ALLOW_CLAIMING); } - - @Override - public boolean canInteract(Player player, Location location) { - return true; - } - - @Override - public GroupSettings getPlayerGroupSettings(Player player) { - return null; - } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 7a38493..07aec06 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -2,6 +2,6 @@ name: CrashClaim version: ${version} description: A modern advanced user oriented claiming system author: Chasewhip -softdepend: [Vault, GriefPrevention, WorldGuard, PlaceholderAPI, Multiverse-Core, Hyperverse, LuckPerms, QuickShop-Hikari ] +softdepend: [Vault, GriefPrevention, WorldGuard, PlaceholderAPI, Multiverse-Core, Hyperverse, LuckPerms, QuickShop-Hikari, DeluxeSellwands ] main: net.crashcraft.crashclaim.CrashClaim api-version: 1.16 \ No newline at end of file