Skip to content

Commit

Permalink
0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiao-MoMi committed Feb 27, 2024
1 parent 6eaeddd commit ba87d56
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 8 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ Residence \
SaberFactions \
SuperiorSkyBlock \
Towny \
UltimateClaims \
UltimateClans \
USkyBlock \
WorldGuard
WorldGuard \
XClaim

### Use this project as dependency
![GitHub](https://img.shields.io/github/license/Xiao-MoMi/AntiGriefLib)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
projectVersion = 0.5
projectVersion = 0.6
projectGroup=net.momirealms

#systemProp.socks.proxyHost=127.0.0.1
Expand Down
19 changes: 13 additions & 6 deletions project/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,44 +1,51 @@
repositories {
mavenCentral() // ProtectionStones
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/") // Paper, PlotSquared
maven("https://maven.enginehub.org/repo/") // WorldGuard
maven("https://jitpack.io/") // Lands, GriefPrevention
maven("https://nexus.iridiumdevelopment.net/repository/maven-releases/") // IridiumSkyblock
maven("https://nexus.iridiumdevelopment.net/repository/maven-releases/") // IridiumSkyBlock
maven("https://repo.codemc.org/repository/maven-public/") // BentoBox
maven("https://repo.glaremasters.me/repository/bloodshot/") // GriefDefender
maven("https://repo.william278.net/releases/") // HuskTowns, HuskClaims
maven("https://repo.bg-software.com/repository/api/") // SuperiorSkyblock
maven("https://repo.bg-software.com/repository/api/") // SuperiorSkyBlock
maven("https://repo.glaremasters.me/repository/towny/") // Towny
maven("https://repo.craftaro.com/repository/minecraft-plugins/") // FabledSkyBlock
maven("https://repo.craftaro.com/repository/minecraft-plugins/") // FabledSkyBlock, UltimateClaims
maven("https://ci.ender.zone/plugin/repository/everything/") // FactionsUUID
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") // RedProtect
maven("https://eldonexus.de/repository/maven-releases/") // Landlord
maven("https://www.uskyblock.ovh/maven/uskyblock/") // uSkyBlock
}

@Suppress
dependencies {
implementation(project(":common"))
implementation(project(":conflict-packages")) // SaberFactions

compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT") // Paper
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.9") // WorldGuard
compileOnly("com.github.angeschossen:LandsAPI:6.44.10") // Lands
compileOnly("com.iridium:IridiumSkyblock:4.0.8") // IridiumSkyblock
compileOnly("com.iridium:IridiumSkyblock:4.0.8") // IridiumSkyBlock
compileOnly("world.bentobox:bentobox:2.1.0-SNAPSHOT") // BentoBox
compileOnly("com.griefdefender:api:2.1.0-SNAPSHOT") // GriefDefender
compileOnly("net.william278.husktowns:husktowns-bukkit:3.0.2") // HuskTowns
compileOnly("net.william278.huskclaims:huskclaims-bukkit:1.0.3") // HuskClaims
compileOnly("com.intellectualsites.plotsquared:plotsquared-bukkit:7.3.5") // PlotSquared
compileOnly("com.bgsoftware:SuperiorSkyblockAPI:2023.3") // SuperiorSkyblock2
compileOnly("com.bgsoftware:SuperiorSkyblockAPI:2023.3") // SuperiorSkyBlock2
compileOnly("com.palmergames.bukkit.towny:towny:0.100.1.17") // Towny
compileOnly("com.craftaro:FabledSkyBlock:3.0.4") // FabledSkyBlock
compileOnly("com.craftaro:UltimateClaims:2.2.0") // FabledSkyBlock
compileOnly("com.github.TechFortress:GriefPrevention:16.18.2") // GriefPrevention
compileOnly("com.massivecraft:Factions:1.6.9.5-U0.6.33") // FactionsUUID
compileOnly("dev.espi:protectionstones:2.10.2") // ProtectionStones
compileOnly("biz.princeps:landlord-core:4.364") // Landlord
compileOnly("ovh.uskyblock:uSkyBlock-Core:3.0.0") // uSkyBlock
compileOnly("com.github.UlrichBR:UClansV7-API:7.4.0-r1") // UltimateClans

compileOnly(files("libs/Residence-pruned.jar")) // Residence
compileOnly(files("libs/KingdomsX-pruned.jar")) // KingdomsX
compileOnly(files("libs/CrashClaim-pruned.jar")) // CrashClaim
compileOnly(files("libs/XClaim.jar")) // XClaim

compileOnly("io.github.fabiozumbi12.RedProtect:RedProtect-Core:8.1.1") { exclude(group = "*") } // RedProtect
compileOnly("io.github.fabiozumbi12.RedProtect:RedProtect-Spigot:8.1.1") { exclude(group = "*") } // RedProtect
}
Expand Down
Binary file added project/libs/XClaim.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,15 @@ private void detectSupportedPlugins() {
if (manager.getPlugin("uSkyBlock") != null) {
registerNewCompatibility(new USkyBlockComp(plugin));
}
if (manager.getPlugin("XClaim") != null) {
registerNewCompatibility(new XClaimComp(plugin));
}
if (manager.getPlugin("UltimateClaims") != null) {
registerNewCompatibility(new UltimateClaimsComp(plugin));
}
if (manager.getPlugin("UltimateClans") != null) {
registerNewCompatibility(new UltimateClansComp(plugin));
}
if (manager.getPlugin("Factions") != null) {
try {
Class.forName("com.massivecraft.factions.zcore.fperms.PermissableAction");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package net.momirealms.antigrieflib.comp;

import com.craftaro.ultimateclaims.UltimateClaims;
import com.craftaro.ultimateclaims.member.ClaimPerm;
import me.ulrich.clans.Clans;
import me.ulrich.clans.api.RegionAPIManager;
import net.momirealms.antigrieflib.AbstractComp;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Optional;

public class UltimateClaimsComp extends AbstractComp {

private UltimateClaims ultimateClaims;

public UltimateClaimsComp(JavaPlugin plugin) {
super(plugin, "UltimateClaims");
}

@Override
public void init() {
this.ultimateClaims = (UltimateClaims) Bukkit.getPluginManager().getPlugin("UltimateClaims");
}

@Override
public boolean canPlace(Player player, Location location) {
return Optional.ofNullable(ultimateClaims.getClaimManager().getClaim(location.getChunk()))
.map(claim -> claim.playerHasPerms(player, ClaimPerm.PLACE))
.orElse(true);
}

@Override
public boolean canBreak(Player player, Location location) {
return Optional.ofNullable(ultimateClaims.getClaimManager().getClaim(location.getChunk()))
.map(claim -> claim.playerHasPerms(player, ClaimPerm.BREAK))
.orElse(true);
}

@Override
public boolean canInteract(Player player, Location location) {
return Optional.ofNullable(ultimateClaims.getClaimManager().getClaim(location.getChunk()))
.map(claim -> claim.playerHasPerms(player, ClaimPerm.INTERACT))
.orElse(true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package net.momirealms.antigrieflib.comp;

import com.craftaro.ultimateclaims.UltimateClaims;
import com.craftaro.ultimateclaims.member.ClaimPerm;
import me.ulrich.clans.Clans;
import me.ulrich.clans.interfaces.ClaimImplement;
import net.momirealms.antigrieflib.AbstractComp;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Map;
import java.util.Optional;

public class UltimateClansComp extends AbstractComp {

private Clans clans;

public UltimateClansComp(JavaPlugin plugin) {
super(plugin, "UltimateClans");
}

@Override
public void init() {
this.clans = (Clans) Bukkit.getPluginManager().getPlugin("UltimateClans");
}

@Override
public boolean canPlace(Player player, Location location) {
return checkClaimedMember(player, location);
}

@Override
public boolean canBreak(Player player, Location location) {
return checkClaimedMember(player, location);
}

@Override
public boolean canInteract(Player player, Location location) {
return checkClaimedMember(player, location);
}

private boolean checkClaimedMember(Player player, Location location) {
for (Map.Entry<String, ClaimImplement> entry : this.clans.getClaimAPI().findClaimedLocationImplement(location)) {
ClaimImplement implement = entry.getValue();
if (implement.canDestroyClaimLocation(player, location)) {
continue;
}
if (!implement.isOwnerClaimLocation(player, location) && !implement.isMemberClaimLocation(player, location)) {
return false;
}
}
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package net.momirealms.antigrieflib.comp;

import codes.wasabi.xclaim.api.Claim;
import codes.wasabi.xclaim.api.enums.Permission;
import net.momirealms.antigrieflib.AbstractComp;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Optional;

public class XClaimComp extends AbstractComp {


public XClaimComp(JavaPlugin plugin) {
super(plugin, "XClaim");
}

@Override
public void init() {
}

@Override
public boolean canPlace(Player player, Location location) {
return Optional.ofNullable(Claim.getByChunk(location.getChunk()))
.map(claim -> claim.getUserPermission(player, Permission.BUILD))
.orElse(true);
}

@Override
public boolean canBreak(Player player, Location location) {
return Optional.ofNullable(Claim.getByChunk(location.getChunk()))
.map(claim -> claim.getUserPermission(player, Permission.BREAK))
.orElse(true);
}

@Override
public boolean canInteract(Player player, Location location) {
return Optional.ofNullable(Claim.getByChunk(location.getChunk()))
.map(claim -> claim.getUserPermission(player, Permission.INTERACT))
.orElse(true);
}
}

0 comments on commit ba87d56

Please sign in to comment.