Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies {

implementation("com.github.GriefPrevention:GriefPrevention:18.0.0")
implementation("com.github.IncrediblePlugins:LandsAPI:7.25.4")
implementation("com.github.Xyness:SimpleClaimSystem-API:v2.1.1")
implementation("com.github.Xyness:SimpleClaimSystem:1.13.0.1")
implementation("com.github.Zrips:Residence:6.0.0.1") {
exclude(group = "org.bukkit")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import org.bukkit.plugin.Plugin;
import fr.xyness.SCS.API.SimpleClaimSystemAPI_Provider;
import fr.xyness.SCS.SimpleClaimSystem;
import fr.xyness.SimpleClaimSystem.API.SCS_API_Provider;
import fr.xyness.SimpleClaimSystem.API.SCS_API;

import java.util.logging.Level;

Expand All @@ -30,6 +32,7 @@ public class IntegrationManager {
private boolean hasSuperiorSkyblock2 = false;
private boolean hasBentoBox = false;
private boolean hasSimpleClaimSystem = false;
private boolean hasSimpleClaimSystem2 = false;
private boolean hasRedProtect = false;
private boolean hasMinePlots = false;
private boolean hasMythicMobs = false;
Expand Down Expand Up @@ -108,6 +111,22 @@ private void checkProtectionPlugins() {
return SimpleClaimSystemAPI_Provider.getAPI() != null;
}, true);

hasSimpleClaimSystem2 = checkPlugin("SimpleClaimSystem", () -> {
Plugin simpleClaimPlugin = Bukkit.getPluginManager().getPlugin("SimpleClaimSystem");
if (simpleClaimPlugin == null || !simpleClaimPlugin.isEnabled()) {
return false;
}
// Prevent SimpleClaimSystem free version (1.x.x)
if (simpleClaimPlugin.getPluginMeta().getVersion().startsWith("1.")) {
return false;
}
if (SCS_API_Provider.isRegistered()) {
SCS_API api = SCS_API_Provider.get();
return api != null;
}
return false;
}, true);

hasRedProtect = checkPlugin("RedProtect", () -> {
Plugin pRP = Bukkit.getPluginManager().getPlugin("RedProtect");
return pRP != null && pRP.isEnabled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static boolean CanPlayerBreakBlock(@NotNull final Player player, @NotNull
if (integrationManager.isHasLands() && !Lands.canPlayerBreakClaimBlock(player, location)) return false;
if (integrationManager.isHasTowny() && !Towny.canPlayerInteractSpawner(player, location)) return false;
if (integrationManager.isHasSimpleClaimSystem() && !SimpleClaimSystem.canPlayerBreakClaimBlock(player, location)) return false;
if (integrationManager.isHasSimpleClaimSystem2() && !SimpleClaimSystem2.canPlayerBreakClaimBlock(player, location)) return false;
if (integrationManager.isHasPlotSquared() && !PlotSquared.canInteract(player, location)) return false;
if (integrationManager.isHasResidence() && !Residence.canPlayerBreakBlock(player, location)) return false;
if (integrationManager.isHasMinePlots() && !MinePlots.canPlayerBreakBlock(player, location)) return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public static boolean CanPlayerOpenMenu(@NotNull final Player player, @NotNull L
if (integrationManager.isHasBentoBox() && !BentoBoxAPI.canPlayerOpenMenu(player, location)) return false;
if (integrationManager.isHasSimpleClaimSystem() && !SimpleClaimSystem.canPlayerOpenMenuOnClaim(player, location))
return false;
if (integrationManager.isHasSimpleClaimSystem2() && !SimpleClaimSystem2.canPlayerOpenMenuOnClaim(player, location))
return false;
if (integrationManager.isHasMinePlots() && !MinePlots.canPlayerOpenMenu(player, location)) return false;
if (integrationManager.isHasIridiumSkyblock() && !IridiumSkyblock.canPlayerOpenMenu(player, location)) return false;
if (integrationManager.isHasPlotSquared() && !PlotSquared.canInteract(player, location)) return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public static boolean CanPlayerPlaceBlock(@NotNull final Player player, @NotNull
if (integrationManager.isHasBentoBox() && !BentoBoxAPI.canPlayerStackBlock(player, location)) return false;
if (integrationManager.isHasSimpleClaimSystem() && !SimpleClaimSystem.canPlayerStackClaimBlock(player, location))
return false;
if (integrationManager.isHasSimpleClaimSystem2() && !SimpleClaimSystem2.canPlayerStackClaimBlock(player, location))
return false;
if (integrationManager.isHasMinePlots() && !MinePlots.canPlayerStackBlock(player, location)) return false;
if (integrationManager.isHasIridiumSkyblock() && !IridiumSkyblock.canPlayerStackBlock(player, location)) return false;
if (integrationManager.isHasPlotSquared() && !PlotSquared.canInteract(player, location)) return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package github.nighter.smartspawner.hooks.protections.api;

import java.util.Optional;

import fr.xyness.SimpleClaimSystem.API.SCS_API;
import fr.xyness.SimpleClaimSystem.API.SCS_API_Provider;
import fr.xyness.SimpleClaimSystem.Types.Claim;

import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public class SimpleClaimSystem2 {
private static final SCS_API api = SCS_API_Provider.get();

public static boolean canPlayerBreakClaimBlock(@NotNull final Player player, @NotNull Location location) {
if (api == null) return true;
Optional<Claim> claim = api.getClaim(player.getLocation().getChunk());
if(claim.isPresent()) {
Claim c = claim.get();
boolean canDestroy = c.getPermission(c.getRole(player.getUniqueId()), "destroy_block");
if(canDestroy) {
boolean canDestroySpawners = c.getPermission(c.getRole(player.getUniqueId()), "destroy_spawners");
return canDestroySpawners;
}
return canDestroy;
}
return true;
}

public static boolean canPlayerStackClaimBlock(@NotNull final Player player, @NotNull Location location) {
if (api == null) return true;
Optional<Claim> claim = api.getClaim(player.getLocation().getChunk());
if(claim.isPresent()) {
Claim c = claim.get();
boolean canInteract = c.getPermission(c.getRole(player.getUniqueId()), "interact_spawner");
return canInteract;
}
return true;
}

public static boolean canPlayerOpenMenuOnClaim(@NotNull final Player player, @NotNull Location location) {
if (api == null) return true;
Optional<Claim> claim = api.getClaim(player.getLocation().getChunk());
if(claim.isPresent()) {
Claim c = claim.get();
boolean canInteract = c.getPermission(c.getRole(player.getUniqueId()), "interact_spawner");
return canInteract;
}
return true;
}
}
Loading