Skip to content

Cytooxien/Realms-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Realms Api

This is the repository of the Cytooxien Realm API. Here you can find the wiki which contain basic information about the usage of this API.

Maven

Repository:

<repository>  
   <id>exceptionflug</id>  
   <url>https://mvn.exceptionflug.de/repository/exceptionflug-public/</url>  
</repository>

Dependencies:

<!-- Actual RealmsAPI -->
<dependency>  
   <groupId>de.exceptionflug</groupId>  
   <artifactId>realms-api</artifactId>  
   <version>1.2-SNAPSHOT</version>  
   <scope>provided</scope>  
</dependency>
<!-- Cytooxien Realms Display System -->
<dependency>
  <groupId>de.cytooxien.realms</groupId>
  <artifactId>realms-spigot-display</artifactId>
  <version>0.1</version>
  <scope>provided</scope>
</dependency>

Gradle

Repository:

repositories {
    maven {
        url 'https://mvn.exceptionflug.de/repository/exceptionflug-public/'
    }
}

Dependencies:

dependencies {
    <!-- Actual RealmsAPI -->
    implementation 'de.exceptionflug:realms-api:1.2-20211008.144955-5'
    <!-- Cytooxien Realms Display System -->
    implementation 'de.cytooxien.realms:realms-spigot-display:0.1'
}

Access Providers

All providers are registered using Bukkit's internal ServicesManager. This is how you get an instance of a provider:

RealmInformationProvider informationProvider = Bukkit.getServicesManager().load(RealmInformationProvider.class);

Access Display System

You can access the display system using the following code:

DisplayController controller = JavaPlugin.getPlugin(DisplayPlugin.class).displayController();

Changing the prefix of a player

This is a quick example on how to change the prefix of a player:

DisplayController controller = JavaPlugin.getPlugin(DisplayPlugin.class).displayController();
MasterDisplayData masterDisplayData = controller.getCache().getMaster(player.getUniqueId());
// This sets prefix to "§a" for CHAT, TABLIST and NAMETAG
masterDisplayData.getPrefixes().forEach((displayTarget, map) -> map.put("group", "§a"));

Add suffix for a player which can only be seen by another player

You can edit the DisplayData for a special viewer:

DisplayController controller = JavaPlugin.getPlugin(DisplayPlugin.class).displayController();
DiffedDisplayData diff = controller.getCache().getDiff(player.getUniqueId(), viewer.getUniqueId());
diff.getSuffixes().get(DisplayTarget.TABLIST).put("party", "§8[§dParty§8]");

About

The official api for interacting with Cytooxien Realms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages