mirror of
https://github.com/xHyroM/lighteco.git
synced 2024-11-21 14:31:09 +01:00
feat: placeholderapi hook [WIP]
This commit is contained in:
parent
f937943bdd
commit
eafed192d3
6 changed files with 50 additions and 2 deletions
|
@ -4,6 +4,7 @@ plugins {
|
|||
|
||||
repositories {
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
maven("https://repo.extendedclip.com/content/repositories/placeholderapi")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -14,6 +15,9 @@ dependencies {
|
|||
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
|
||||
|
||||
// PlaceholderAPI
|
||||
compileOnly("me.clip:placeholderapi:2.11.3")
|
||||
|
||||
compileOnly("org.projectlombok:lombok:1.18.28")
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.28")
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.UUID;
|
|||
@Getter
|
||||
public class BukkitLightEcoBootstrap implements LightEcoBootstrap, LoaderBootstrap {
|
||||
private final JavaPlugin loader;
|
||||
@Getter
|
||||
private final BukkitLightEcoPlugin plugin = new BukkitLightEcoPlugin(this);
|
||||
|
||||
@Getter
|
||||
|
|
|
@ -2,11 +2,13 @@ package dev.xhyrom.lighteco.bukkit;
|
|||
|
||||
import dev.jorel.commandapi.CommandAPI;
|
||||
import dev.jorel.commandapi.CommandAPIBukkitConfig;
|
||||
import dev.xhyrom.lighteco.bukkit.hooks.PlaceholderAPIExpansion;
|
||||
import dev.xhyrom.lighteco.common.plugin.bootstrap.LoaderBootstrap;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class BukkitLightEcoLoader extends JavaPlugin {
|
||||
private final LoaderBootstrap bootstrap;
|
||||
private final BukkitLightEcoBootstrap bootstrap;
|
||||
|
||||
public BukkitLightEcoLoader() {
|
||||
this.bootstrap = new BukkitLightEcoBootstrap(this);
|
||||
|
@ -22,6 +24,9 @@ public class BukkitLightEcoLoader extends JavaPlugin {
|
|||
public void onEnable() {
|
||||
CommandAPI.onEnable();
|
||||
this.bootstrap.onEnable();
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null)
|
||||
new PlaceholderAPIExpansion(this.bootstrap.getPlugin()).register();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package dev.xhyrom.lighteco.bukkit.hooks;
|
||||
|
||||
import dev.xhyrom.lighteco.bukkit.BukkitLightEcoPlugin;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class PlaceholderAPIExpansion extends PlaceholderExpansion {
|
||||
private final BukkitLightEcoPlugin plugin;
|
||||
|
||||
@Override
|
||||
public @NotNull String getIdentifier() {
|
||||
return "lighteco";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getAuthor() {
|
||||
return this.plugin.getBootstrap().getLoader().getDescription().getAuthors().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getVersion() {
|
||||
return this.plugin.getBootstrap().getLoader().getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String onRequest(OfflinePlayer player, @NotNull String params) {
|
||||
return "lighteco";
|
||||
}
|
||||
}
|
|
@ -4,4 +4,7 @@ version: ${version}
|
|||
main: dev.xhyrom.lighteco.bukkit.BukkitLightEcoLoader
|
||||
author: ${author}
|
||||
api-version: 1.20
|
||||
load: STARTUP
|
||||
load: STARTUP
|
||||
|
||||
softdepend:
|
||||
- PlaceholderAPI
|
|
@ -9,7 +9,9 @@ repositories {
|
|||
|
||||
dependencies {
|
||||
compileOnly(project(":lighteco-api"))
|
||||
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
|
||||
|
||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7")
|
||||
|
||||
compileOnly("org.projectlombok:lombok:1.18.28")
|
||||
|
|
Loading…
Reference in a new issue