Please also see Developer API for more information about how Gucci provides developer API's and how to better support your team. Please do not share or use product jars for development.
Adding Guilds as a dependency
Please note the versions on this page may not be the most up-to-date! Please check our for the latest build versions.
Interacting with Guild object - Stores info about a given guild. Members, Roles, Leader and more.
// Getting a Guild from the database (cached)
Guild guild = Guilds.getInstance()
.get("guild-id")
.orElse(Guilds.getInstance().getWilderness());
if (guildOne.isWilderness()) {
// No Guild Check
}
// Create a new guild
Guild guildTwo = Guilds.getInstance().createNewPlayerGuild(String tag, UUID creator);
// Creating a System Guild:
guildTwo.setLeaderName("System"); // optional
guildTwo.setSystemGuild(true);
// Comparing Guilds
if (guildTwo.getIdentifier().equals(guildOne.get().getIdentifier())) {} // Tags change
// Checking Permissions
boolean hasAccessToAction = guildTwo.hasPermission(GuildPlayer, PermissibleAction);
// Checking Relations
Relation relation = guildOne.getRelationTo(guildTwo); // Relation or Peaceful
Interacting with GuildPlayer - Stores guild data about a given player.
// Getting a GuildPlayer from the database (cached)
Optional<GuildPlayer> guildPlayerOne = GuildPlayers.getInstance().get(UUID uuid);
// Async API
GuildPlayers.getInstance().getByFieldAsync("username", context.getArgument(0).parse(String.class).get())
.thenAcceptSync(playerQuery -> {
if (playerQuery.isEmpty()) {
Language.sendMessage(context.getPlayer(), Core.getInstance().getLang().getGeneric().getGenericMemberNotInGuild());
return;
}
GuildPlayer gp = playerQuery.get();
// Do something - This method is executed "sync" once complete.
});
// GuildPlayer should never return empty optionals as the player is created when joining
// Still safe to check if the optional is present as errors or poor execution could
// result in a empty optional for a player.
if (guildPlayerOne.isEmpty()) {
// Error/Bug - Should report to us if this happens
}
GuildPlayer gp = guildPlayerOne.get();
Guild guild = gp.getGuild(); // Guild or wilderness
boolean isAdminBypassing = gp.isAdminBypassing();
boolean isGuildChatting = gp.isGuildChatting();
Interacting with the claim board Board - Stores info about claims and the map.
// Getting the guild that claims a specific chunk
Guild guildAt = Board.getInstance().getGuildAt(e.getBlock().getLocation());
// Side Note, ChunkCoords How-To
new ChunkCoords(Block)
new ChunkCoords(Location)
new ChunkCoords(Player)
new ChunkCoords(String worldName, int x, int z)
// Getting all the claims of a given Guild
Set<ChunkCoords> allClaims = Board.getInstance().getAllClaims(String guildId);
// Claiming a chunk for a Guild
Board.getInstance().claim(String guildId, ChunkCoords chunk);
// Unclaiming a chunk for a Guild - No guild needed as it goes back to wilderness.
Board.getInstance().unclaim(ChunkCoords chunk);
Board.getInstance().unclaimAll(String guildId);