mirror of
https://github.com/xHyroM/lighteco.git
synced 2024-11-12 18:38:07 +01:00
feat: make lighteco-bukkit actually supports bukkit
This commit is contained in:
parent
1ae9a2e5bc
commit
f6fa8ad8f2
8 changed files with 36 additions and 16 deletions
|
@ -3,8 +3,11 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
|
||||||
maven("https://repo.extendedclip.com/content/repositories/placeholderapi")
|
maven("https://repo.extendedclip.com/content/repositories/placeholderapi")
|
||||||
|
|
||||||
|
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||||
|
maven("https://oss.sonatype.org/content/repositories/snapshots")
|
||||||
|
maven("https://oss.sonatype.org/content/repositories/central")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -13,7 +16,7 @@ dependencies {
|
||||||
implementation("dev.jorel:commandapi-bukkit-shade:9.1.0")
|
implementation("dev.jorel:commandapi-bukkit-shade:9.1.0")
|
||||||
implementation("net.kyori:adventure-platform-bukkit:4.2.0")
|
implementation("net.kyori:adventure-platform-bukkit:4.2.0")
|
||||||
|
|
||||||
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
|
compileOnly("org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT")
|
||||||
|
|
||||||
// PlaceholderAPI
|
// PlaceholderAPI
|
||||||
compileOnly("me.clip:placeholderapi:2.11.3")
|
compileOnly("me.clip:placeholderapi:2.11.3")
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class BukkitLightEcoBootstrap implements LightEcoBootstrap, LoaderBootstr
|
||||||
public BukkitLightEcoBootstrap(JavaPlugin loader) {
|
public BukkitLightEcoBootstrap(JavaPlugin loader) {
|
||||||
this.loader = loader;
|
this.loader = loader;
|
||||||
|
|
||||||
this.logger = new BukkitLogger(loader.getSLF4JLogger());
|
this.logger = new BukkitLogger(loader.getLogger());
|
||||||
this.scheduler = new BukkitSchedulerAdapter(this);
|
this.scheduler = new BukkitSchedulerAdapter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package dev.xhyrom.lighteco.bukkit.hooks;
|
package dev.xhyrom.lighteco.bukkit.hooks;
|
||||||
|
|
||||||
import dev.xhyrom.lighteco.bukkit.BukkitLightEcoPlugin;
|
import dev.xhyrom.lighteco.bukkit.BukkitLightEcoPlugin;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
@UtilityClass
|
||||||
public class Hooks {
|
public class Hooks {
|
||||||
private static PlaceholderAPIExpansion placeholderAPIExpansion;
|
private static PlaceholderAPIExpansion placeholderAPIExpansion;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,9 @@ package dev.xhyrom.lighteco.bukkit.listeners;
|
||||||
|
|
||||||
import dev.xhyrom.lighteco.bukkit.BukkitLightEcoPlugin;
|
import dev.xhyrom.lighteco.bukkit.BukkitLightEcoPlugin;
|
||||||
import dev.xhyrom.lighteco.common.model.user.User;
|
import dev.xhyrom.lighteco.common.model.user.User;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
@ -32,9 +34,16 @@ public class BukkitConnectionListener implements Listener {
|
||||||
this.plugin.getBootstrap().getLogger()
|
this.plugin.getBootstrap().getLogger()
|
||||||
.error("Failed to load user data for %s (%s)", e, event.getName(), event.getUniqueId());
|
.error("Failed to load user data for %s (%s)", e, event.getName(), event.getUniqueId());
|
||||||
|
|
||||||
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, miniMessage.deserialize(
|
Component reason = miniMessage.deserialize(
|
||||||
"<bold>LightEco</bold> <red>Failed to load your data. Contact a staff member for assistance."
|
"<bold>LightEco</bold> <red>Failed to load your data. Contact a staff member for assistance."
|
||||||
));
|
);
|
||||||
|
|
||||||
|
event.disallow(
|
||||||
|
AsyncPlayerPreLoginEvent.Result.KICK_OTHER,
|
||||||
|
LegacyComponentSerializer.legacySection().serialize(
|
||||||
|
reason
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package dev.xhyrom.lighteco.bukkit.logger;
|
package dev.xhyrom.lighteco.bukkit.logger;
|
||||||
|
|
||||||
import dev.xhyrom.lighteco.common.plugin.logger.PluginLogger;
|
import dev.xhyrom.lighteco.common.plugin.logger.PluginLogger;
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class BukkitLogger implements PluginLogger {
|
public class BukkitLogger implements PluginLogger {
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
|
@ -22,41 +24,41 @@ public class BukkitLogger implements PluginLogger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void warn(String message) {
|
public void warn(String message) {
|
||||||
this.logger.warn(message);
|
this.logger.log(Level.WARNING, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void warn(String message, Object... args) {
|
public void warn(String message, Object... args) {
|
||||||
this.logger.warn(String.format(message, args));
|
this.logger.log(Level.WARNING, String.format(message, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void warn(String message, Throwable throwable) {
|
public void warn(String message, Throwable throwable) {
|
||||||
this.logger.warn(message, throwable);
|
this.logger.log(Level.WARNING, message, throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void warn(String message, Throwable throwable, Object... args) {
|
public void warn(String message, Throwable throwable, Object... args) {
|
||||||
this.logger.warn(String.format(message, args), throwable);
|
this.logger.log(Level.WARNING, String.format(message, args), throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(String message) {
|
public void error(String message) {
|
||||||
this.logger.error(message);
|
this.logger.severe(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(String message, Object... args) {
|
public void error(String message, Object... args) {
|
||||||
this.logger.error(String.format(message, args));
|
this.logger.severe(String.format(message, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(String message, Throwable throwable) {
|
public void error(String message, Throwable throwable) {
|
||||||
this.logger.error(message, throwable);
|
this.logger.log(Level.SEVERE, message, throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(String message, Throwable throwable, Object... args) {
|
public void error(String message, Throwable throwable, Object... args) {
|
||||||
this.logger.error(String.format(message, args), throwable);
|
this.logger.log(Level.SEVERE, String.format(message, args), throwable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ description: ${description}
|
||||||
version: ${version}
|
version: ${version}
|
||||||
main: dev.xhyrom.lighteco.bukkit.BukkitLightEcoLoader
|
main: dev.xhyrom.lighteco.bukkit.BukkitLightEcoLoader
|
||||||
author: ${author}
|
author: ${author}
|
||||||
api-version: 1.20
|
api-version: 1.16
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
|
|
||||||
softdepend:
|
softdepend:
|
||||||
|
|
0
currency-money/README.md
Normal file
0
currency-money/README.md
Normal file
|
@ -7,8 +7,12 @@ import dev.xhyrom.lighteco.api.manager.CurrencyManager;
|
||||||
import dev.xhyrom.lighteco.api.model.currency.Currency;
|
import dev.xhyrom.lighteco.api.model.currency.Currency;
|
||||||
import dev.xhyrom.lighteco.currency.money.bukkit.hooks.vault.VaultFactory;
|
import dev.xhyrom.lighteco.currency.money.bukkit.hooks.vault.VaultFactory;
|
||||||
import dev.xhyrom.lighteco.currency.money.common.MoneyCurrency;
|
import dev.xhyrom.lighteco.currency.money.common.MoneyCurrency;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class BukkitMCLoader extends JavaPlugin {
|
public class BukkitMCLoader extends JavaPlugin {
|
||||||
private VaultFactory vaultFactory;
|
private VaultFactory vaultFactory;
|
||||||
|
|
||||||
|
@ -24,7 +28,7 @@ public class BukkitMCLoader extends JavaPlugin {
|
||||||
commandManager.registerCurrencyCommand(currency, true);
|
commandManager.registerCurrencyCommand(currency, true);
|
||||||
|
|
||||||
if (getServer().getPluginManager().getPlugin("Vault") != null) {
|
if (getServer().getPluginManager().getPlugin("Vault") != null) {
|
||||||
getSLF4JLogger().info("Vault found, hooking...");
|
getLogger().info("Vault found, hooking...");
|
||||||
|
|
||||||
this.vaultFactory = new VaultFactory(this);
|
this.vaultFactory = new VaultFactory(this);
|
||||||
this.vaultFactory.hook();
|
this.vaultFactory.hook();
|
||||||
|
|
Loading…
Reference in a new issue