A simple TextComponents implementation that provides support for SpigotMC via it's ChatComponent API
This implementation does NOT support CraftBukkit! Furthermore, it will never due to the annoyance of NMS
The following methods are added to all IComponents in this implementation:
Name | Parameters | Return Type | Function |
---|---|---|---|
sendTo | CommandSender | Sends the component to the provided CommandSender | |
toSpigot | BaseComponent | Converts the component into a BaseComponent |
The following methods do not work within this implementation:
#getSeperator()
, #setSeperator()
This is due to the limitations of the underlying SelectorComponent and cannot be resolved
I have requested a fix of this in this feature request
The following methods may not work:
#getTranslationFallback()
, #setTranslationFallback()
While the underlying api now supports this feature spigot's version of it doesn't seem to have caught up yet. As a result an attempt to modify the field is performed upon calling these methods (for when it's updated) but if that fails an error message is displayed once.
It is best to use an implementation rather than depending on this as methods for sending messages will not be accessible
TextComponents is available on Maven from either the Official Maven Repository or JitPack
The latest version is hosted on an Official Maven Repository
First include the repository:
<repository>
<id>bb1-repository-releases</id>
<name>BradBot_1's Repository</name>
<url>https://repo.bb1.fun/releases</url>
</repository>
Then add the dependency:
<dependency>
<groupId>com.tubmc</groupId>
<artifactId>text-components-spigot</artifactId>
<version>1.0.0</version>
</dependency>
If the official repository is down or you choose not to trust it you can always pull it from JitPack
First include the repository:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
Then add the dependency:
<dependency>
<groupId>com.github.BradBot1</groupId>
<artifactId>text-components-spigot</artifactId>
<version>LATEST</version>
</dependency>
Just run the following commands:
git clone https://github.com/TubMC/TextComponents-Spigot.git
cd TextComponents-Spigot
mvn clean install
It will then be accessible from your local Maven Repoistory
Now you can simply add the following dependency without a repository:
<dependency>
<groupId>com.tubmc</groupId>
<artifactId>text-components-spigot</artifactId>
<version>1.0.0</version>
</dependency>