SimpleClans
English
English
  • 😃Introduction
  • Discord Support
  • Bugs and Suggestions
  • Javadoc
  • How to Setup
    • 📘Configuration
    • 🍕Translation
    • 💰Member Fee
    • 💲Clan Upkeep
    • 👇Clan Below Player's Name
    • 👆Clan on Tablist
  • Commands and Permissions
    • 📌Commands
    • 🚦Permissions
    • 🪖Clan Alliances and Rivalries
    • 🏅Ranks with Permissions
    • 👍Verified Clan
    • ⌛Permanent clan
  • Integration
    • 🏝️Land Claiming
    • 👾DiscordSRV
  • Other
    • ♟️API Examples
    • 🪜Placeholders
    • 💸Logging server economy
    • 🪓Known issues
Powered by GitBook
On this page
  • Step 1. Add the SimpleClans API to your plugin
  • Maven
  • Locally
  • Step 2. Use the SimpleClans API
  • Step 3. Continue your learning

Was this helpful?

Edit on GitHub
  1. Other

API Examples

This page will help you understand how to install and use the SimpleClans API in your plugins.

Step 1. Add the SimpleClans API to your plugin

There are two ways to do this: via Maven or locally. We strongly recommend doing this via Maven.

Maven

Add the following lines to pom.xml:

<repositories>
    <repository>
        <id>roinujnosde-repo</id>
        <url>https://repo.roinujnosde.me/releases/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
        <artifactId>SimpleClans</artifactId>
        <version>2.19.2</version> 
        <!-- You can find out the latest available version in the note below -->
        <scope>provided</scope>
    </dependency>
</dependencies>

Locally

In this example, we will use the IntelliJ IDEA, but the following actions also work in other IDEs.

  1. Open the structure of your project (F4)

  2. Select Libraries, click on the cross, select "New Project Library -> Java" in the window that appears and add SimpleClans.

Return to the project structure, then go to Project Settings - > Modules, set the compilation mode to "Provided".

Step 2. Use the SimpleClans API

What do you need to know?

Example of using SimpleClans API

You can hook into SimpleClans plugin like so:

public class MyPlugin extends JavaPlugin {
    private static MyPlugin instance;
    private SimpleClans sc;
     
    @Override   
    public void onEnable() {
      instance = this;
      
      Plugin plug = getServer().getPluginManager().getPlugin("SimpleClans");
      if (plug != null) {
          sc = (SimpleClans) plug;
      }
    }
    
    public SimpleClans getSCPlugin() {
        return sc;
    }
    
    public static getInstance() {
        return instance;
    }
}
public class Example {

    public void doClanStuff(Player player) {
        UUID playerUuid = player.getUniqueId();
        
        // Get a ClanManager object
        ClanManager cm = MyPlugin.getInstance().getSCPlugin().getClanManager();
        
        // Get a ClanPlayer object
        ClanPlayer cp = cm.getClanPlayer(playerUuid);
            
        if (cp != null) {
            Clan clan = cp.getClan();
        } else {
            // Player is not in a clan
        }
    
        // Get a clan from a clan tag
        Clan clan = cm.getClan("staff");
    
        if (clan != null) {
            // Clan exists
        }
    }
}

If you don't want to specify a check for the presence of SimpleClans, you can always specify a dependency in plugin.yml:

depend:
    - SimpleClans

Step 3. Continue your learning

PreviousDiscordSRVNextPlaceholders

Last updated 1 year ago

Was this helpful?

Note The latest version can be found here:

is a class that represents a player object. This class contains information about the player, his clan, etc.

is a class that presents a clan object. It has methods for getting clan players, clan tag, allies, leaders, etc.

is a class that allows you to retrieve Clan and ClanPlayer.

Don't stop in your beginnings, feel free to learn our API: .

♟️
link
ClanPlayer
Clan
ClanManager
javadocs