🌳
SimpleClaimSystem
  • SimpleClaimSystem
  • Installation
    • Prerequisites
    • Installation
  • Configuration
    • config.yml
    • How to set up a gui
    • Langs
    • Claim settings
  • Commands
    • Player commands
    • Admin commands
  • Permissions
    • How to set up
    • Commands
    • Claims
    • Settings
  • Support
    • PlaceholderAPI
    • WorldGuard
    • Vault
    • Dynmap
    • Bluemap
    • Pl3xMap
    • GriefPrevention
  • API
    • Dependency
    • Accessing
    • Working with players
    • Working with claims
Powered by GitBook
On this page
  1. API

Working with claims

How to work with claims with SimpleClaimSystem API

PreviousWorking with players

Last updated 10 months ago

Available methods :

Example of use :

/** Instance of SimpleClaimSystem API */
private SimpleClaimSystemAPI scs;

// Access to the SimpleClaimSystem API
scs = SimpleClaimSystemAPI_Provider.getAPI();

// Get the player (we suppose players are online)
Player player = Bukkit.getPlayer("Xyness");
Player targetPlayer = Bukkit.getPlayer("User1");

// Get the claim by its name
Claim claim = scs.getPlayerClaim(player, "claim-1");
if (claim != null) {
    if(scs.addPlayerToClaim(claim,targetPlayer.getName())) {
        String claimName = claim.getName();
        String claimOwner = claim.getOwner();
        String message = String.format("You have been added to the claim '%s' of %s.", claimName, claimOwner);
        targetPlayer.sendMessage(message);
    } else {
        String message = "§cAn error has occurred, please contact an administrator.";
        targetPlayer.sendMessage(message);
} else {
    String message = String.format("The 'claim-1' claim of the player Xyness does not exist.";
}
Claim.java