Get Started
- 📚 Setup
- ➡️ Importers
- 📄 Config
- 📝 Translations
- 🔌 Hooks
Documentation
- 🖥️ Commands
- ⛔ Permissions
- 🥄 Claims
- ❤️ Trust
- 🎛️ Operation Groups
- 🪧 Sign Moderation
- 🪦 Drops Moderation
- 😴 Inactivity Pruning
- 🐕 Pets
HuskClaims provides API for trusting users in claims and registering trust tags.
HuskClaimsAPI#getTrustLevels()
.TrustLevel
object, you can get the various privileges and their associated TrustLevel.Privilege
s using #getPrivileges()
, and allowed OperationType
s using #getFlags()
.void showTrustLevels(org.bukkit.command.CommandSender sender) {
sender.sendMessage("Registered trust levels: " + huskClaims.getTrustLevels().stream()
.map(TrustLevel::getName).collect(Collectors.joining(", ")));
}
UserGroup
s using HuskClaimsAPI#getUserGroups(User user)
.UserGroup
by name using HuskClaimsAPI#getUserGroupByName(User owner, String name)
.void showUserGroups(org.bukkit.Player player) {
final OnlineUser user = huskClaims.getOnlineUser(player);
player.sendMessage("Registered user groups for " + user.getName() + ": " + huskClaims.getUserGroups(user).stream()
.map(UserGroup::getName).collect(Collectors.joining(", ")));
}
HuskClaimsAPI#setTrustLevel(Claim claim, ClaimWorld claimWorld, Trustable trustable, TrustLevel trustLevel)
method to set a user's trust level in a claim.
Claim
and ClaimWorld
from a Position
Trustables
include a User
(or extending classes, such as an OnlineUser
), a TrustTag
, or a UserGroup
.void trustUserInClaim(Claim claim, ClaimWorld claimWorld, User user) {
huskClaims.setTrustLevel(claim, claimWorld, user, TrustLevel.BUILD);
}
TrustTag
is a tag that can be trusted on claims that represents a set of Users
.TrustTag
abstract class which you can extend to create your own trust tag, which you can then provide via the HuskClaimsAPI#registerTrustTag(TrustTag)
method.#(tag)
./huskclaims status
menu.HuskClaimsAPI#getTrustTags()
.TrustTag
by name using HuskClaimsAPI#getTrustTagByName(String name)
.
#getTrustTagByName("public")
to get the built-in PublicTrustTag
which you can use to grant public trust on a Claim
.void showTrustTags(org.bukkit.command.CommandSender sender) {
sender.sendMessage("Registered trust tags: " + huskClaims.getTrustTags().stream()
.map(TrustTag::getName).collect(Collectors.joining(", ")));
}
Note:Check the built-inLuckPermsTrustTag
class for an example of a trust tag implementation.
TrustTag
is a simple abstract class. In the constructor, you must pass a tag name
and description
, and you must implement one method: boolean includes(@NotNull User trustable);
true
if the supplied User
is included in the tag, and false
otherwise.boolean canUse(@NotNull User user);
method to return true
if the supplied User
is allowed to trust others with the tag, or false
otherwise (e.g. to restrict the tag behind a permission node).public class MyTrustTag extends TrustTag {
public TrustTag() {
// Name / description
super("mytag", "Grants access to upside-down people.");
}
@Override
public boolean includes(@NotNull User trustable) {
// Return true if the supplied user is included in the tag, false otherwise
return user.getName().equals("Dinnerbone") || user.getName().equals("Grumm"); // Include Dinnerbone or Grumm!
}
@Override
public boolean canUse(@NotNull User user) {
// Return true if the supplied user is allowed to trust others with the tag, false otherwise
return true; // Let everyone trust others with this tag in their claims
}
}
You can register your trust tag by calling HuskClaimsAPI#registerTrustTag(TrustTag)
with your created trust tag instance.
void onEnable() {
huskClaims.registerTrustTag(new MyTrustTag());
}
And users will be able to use /(trust_level_command) #mytag
to trust the tag in their claims!