-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
174 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
project/src/main/java/net/momirealms/antigrieflib/comp/UltimateClaimsComp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
project/src/main/java/net/momirealms/antigrieflib/comp/UltimateClansComp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
project/src/main/java/net/momirealms/antigrieflib/comp/XClaimComp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |