HuskClaims icon indicating copy to clipboard operation
HuskClaims copied to clipboard

Difficulties in using Huskclaims API

Open al1sonsz opened this issue 3 months ago • 1 comments

I am developing a land sales system using the Huskclaims API, but I am struggling to make it work properly. I believe the method I am using is correct, according to API documentation, but the system is not responding as expected.

The system is designed to work as follows: I created a menu in which members can buy advertised land, paying with coins. However, when the member makes the purchase, the change of land ownership is not made correctly.

Could you take a look at the code and check if I am making a mistake or if there is anything missing?

@Override public void setOwner(String id, UUID friendId) { try{ BukkitHuskClaimsAPI huskClaimsAPI = BukkitHuskClaimsAPI.getInstance();

        for (ClaimWorld claimWorld : huskClaimsAPI.getClaimWorlds()){
            for (net.william278.huskclaims.claim.Claim claim : claimWorld.getClaims()){
                String claimId = String.format("%s_%s_%s", claim.getRegion().getNearCorner().getLongChunkCoords(), claim.getRegion().getFarCorner().getLongChunkCoords(), claimWorld);

                if (claimId.equals(id)) {
                    claim.setOwner(friendId);
                    break;
                }
            }
        }

    }catch (Throwable ignored){}
}

al1sonsz avatar Sep 28 '25 20:09 al1sonsz

hello?

al1sonsz avatar Oct 26 '25 16:10 al1sonsz