> For the complete documentation index, see [llms.txt](https://xyness.gitbook.io/simpleclaimsystem/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xyness.gitbook.io/simpleclaimsystem/api/working-with-claims.md).

# Working with claims

How to work with claims with SimpleClaimSystem API

Available methods :&#x20;

[Claim.java](https://github.com/Xyness/SimpleClaimSystem/blob/main/src/main/java/fr/xyness/SCS/Claim.java)

Example of use :

<pre class="language-java"><code class="lang-java">/** Instance of SimpleClaimSystem API */
private SimpleClaimSystemAPI scs;

// Access to the SimpleClaimSystem API
scs = SimpleClaimSystemAPI_Provider.getAPI();
<strong>
</strong><strong>// Get the player (we suppose players are online)
</strong><strong>Player player = Bukkit.getPlayer("Xyness");
</strong><strong>Player targetPlayer = Bukkit.getPlayer("User1");
</strong><strong>
</strong><strong>// Get the claim by its name
</strong><strong>Claim claim = scs.getPlayerClaim(player, "claim-1");
</strong><strong>if (claim != null) {
</strong><strong>    if(scs.addPlayerToClaim(claim,targetPlayer.getName())) {
</strong><strong>        String claimName = claim.getName();
</strong><strong>        String claimOwner = claim.getOwner();
</strong><strong>        String message = String.format("You have been added to the claim '%s' of %s.", claimName, claimOwner);
</strong><strong>        targetPlayer.sendMessage(message);
</strong><strong>    } else {
</strong><strong>        String message = "§cAn error has occurred, please contact an administrator.";
</strong><strong>        targetPlayer.sendMessage(message);
</strong><strong>} else {
</strong><strong>    String message = String.format("The 'claim-1' claim of the player Xyness does not exist.";
</strong><strong>}
</strong></code></pre>
