|
| 1 | +# LoreEditor |
| 2 | + |
| 3 | +Packet-level item lore modification for Spigot and its forks. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Add lore lines to items, without affecting an actual item. |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +You can download the latest version of LoreEditor from the [Modrinth](https://modrinth.com/plugin/loreeditor) and then place it in your `plugins` folder. |
| 12 | + |
| 13 | +## Developer API |
| 14 | + |
| 15 | +LoreEditor provides a simple API for developers to use. |
| 16 | + |
| 17 | +### Dependency |
| 18 | + |
| 19 | +#### plugin.yml |
| 20 | + |
| 21 | +To use LoreEditor in your plugin, you need to add the following to your `plugin.yml`: |
| 22 | + |
| 23 | +```yaml |
| 24 | +depend: [LoreEditor] |
| 25 | +``` |
| 26 | +
|
| 27 | +#### Maven |
| 28 | +
|
| 29 | +If you are using Maven, add the following to your `<repositories>` tag in `pom.xml`: |
| 30 | + |
| 31 | +```xml |
| 32 | +<repository> |
| 33 | + <id>azisaba</id> |
| 34 | + <url>https://repo.azisaba.net/repository/maven-public/</url> |
| 35 | +</repository> |
| 36 | +``` |
| 37 | + |
| 38 | +And add the following to your `<dependencies>` tag in `pom.xml`: |
| 39 | + |
| 40 | +```xml |
| 41 | +<dependency> |
| 42 | + <groupId>net.azisaba.loreeditor</groupId> |
| 43 | + <artifactId>api</artifactId> |
| 44 | + <version>[version]</version> |
| 45 | + <scope>provided</scope> |
| 46 | + <classifier>all</classifier> <!-- don't forget "all" classifier --> |
| 47 | +</dependency> |
| 48 | +``` |
| 49 | + |
| 50 | +#### Gradle (Kotlin DSL) |
| 51 | + |
| 52 | +```kotlin |
| 53 | +repositories { |
| 54 | + maven("https://repo.azisaba.net/repository/maven-public/") |
| 55 | +} |
| 56 | +
|
| 57 | +dependencies { |
| 58 | + compileOnly("net.azisaba.loreeditor:api:[version]:all") // don't forget "all" classifier |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | +### Usage |
| 63 | + |
| 64 | +#### Add lore lines |
| 65 | + |
| 66 | +```java |
| 67 | +import net.azisaba.loreeditor.api.event.EventBus; |
| 68 | +import net.azisaba.loreeditor.api.event.ItemEvent; |
| 69 | +import net.azisaba.loreeditor.libs.net.kyori.adventure.text.Component; |
| 70 | +import org.bukkit.plugin.java.JavaPlugin; |
| 71 | +
|
| 72 | +public class TestPlugin extends JavaPlugin { |
| 73 | + @Override |
| 74 | + public void onEnable() { |
| 75 | + // In LoreEditor, we use EventBus to listen for events. |
| 76 | + // This example adds "Hello, world!" to the lore of the every item. |
| 77 | + // Please note that blocking operations (such as file IO and database operations) should not be performed in the event listener. |
| 78 | + EventBus.INSTANCE.register(this, ItemEvent.class, 0, e -> { |
| 79 | + e.addLore(Component.text("Hello, world!")); |
| 80 | + // more lore lines... |
| 81 | + }); |
| 82 | + } |
| 83 | +
|
| 84 | + // we don't need to unregister the listener because LoreEditor will handle it. |
| 85 | +} |
| 86 | +``` |
| 87 | + |
| 88 | +## License |
| 89 | + |
| 90 | +LoreEditor is licensed under the [GNU General Public License v3.0](LICENSE). |
0 commit comments