1
0
Fork 0
mirror of https://github.com/xHyroM/lighteco.git synced 2024-11-09 17:18:05 +01:00

feat: make lighteco-bukkit actually supports bukkit

This commit is contained in:
Jozef Steinhübl 2023-08-30 10:32:53 +02:00
parent 1ae9a2e5bc
commit f6fa8ad8f2
8 changed files with 36 additions and 16 deletions

View file

@ -3,8 +3,11 @@ plugins {
}
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
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 {
@ -13,7 +16,7 @@ dependencies {
implementation("dev.jorel:commandapi-bukkit-shade:9.1.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
compileOnly("me.clip:placeholderapi:2.11.3")

View file

@ -29,7 +29,7 @@ public class BukkitLightEcoBootstrap implements LightEcoBootstrap, LoaderBootstr
public BukkitLightEcoBootstrap(JavaPlugin loader) {
this.loader = loader;
this.logger = new BukkitLogger(loader.getSLF4JLogger());
this.logger = new BukkitLogger(loader.getLogger());
this.scheduler = new BukkitSchedulerAdapter(this);
}

View file

@ -1,8 +1,10 @@
package dev.xhyrom.lighteco.bukkit.hooks;
import dev.xhyrom.lighteco.bukkit.BukkitLightEcoPlugin;
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit;
@UtilityClass
public class Hooks {
private static PlaceholderAPIExpansion placeholderAPIExpansion;

View file

@ -2,7 +2,9 @@ package dev.xhyrom.lighteco.bukkit.listeners;
import dev.xhyrom.lighteco.bukkit.BukkitLightEcoPlugin;
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.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -32,9 +34,16 @@ public class BukkitConnectionListener implements Listener {
this.plugin.getBootstrap().getLogger()
.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."
));
);
event.disallow(
AsyncPlayerPreLoginEvent.Result.KICK_OTHER,
LegacyComponentSerializer.legacySection().serialize(
reason
)
);
}
}

View file

@ -1,7 +1,9 @@
package dev.xhyrom.lighteco.bukkit.logger;
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 {
private final Logger logger;
@ -22,41 +24,41 @@ public class BukkitLogger implements PluginLogger {
@Override
public void warn(String message) {
this.logger.warn(message);
this.logger.log(Level.WARNING, message);
}
@Override
public void warn(String message, Object... args) {
this.logger.warn(String.format(message, args));
this.logger.log(Level.WARNING, String.format(message, args));
}
@Override
public void warn(String message, Throwable throwable) {
this.logger.warn(message, throwable);
this.logger.log(Level.WARNING, message, throwable);
}
@Override
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
public void error(String message) {
this.logger.error(message);
this.logger.severe(message);
}
@Override
public void error(String message, Object... args) {
this.logger.error(String.format(message, args));
this.logger.severe(String.format(message, args));
}
@Override
public void error(String message, Throwable throwable) {
this.logger.error(message, throwable);
this.logger.log(Level.SEVERE, message, throwable);
}
@Override
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);
}
}

View file

@ -3,7 +3,7 @@ description: ${description}
version: ${version}
main: dev.xhyrom.lighteco.bukkit.BukkitLightEcoLoader
author: ${author}
api-version: 1.20
api-version: 1.16
load: STARTUP
softdepend:

0
currency-money/README.md Normal file
View file

View file

@ -7,8 +7,12 @@ import dev.xhyrom.lighteco.api.manager.CurrencyManager;
import dev.xhyrom.lighteco.api.model.currency.Currency;
import dev.xhyrom.lighteco.currency.money.bukkit.hooks.vault.VaultFactory;
import dev.xhyrom.lighteco.currency.money.common.MoneyCurrency;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.UUID;
public class BukkitMCLoader extends JavaPlugin {
private VaultFactory vaultFactory;
@ -24,7 +28,7 @@ public class BukkitMCLoader extends JavaPlugin {
commandManager.registerCurrencyCommand(currency, true);
if (getServer().getPluginManager().getPlugin("Vault") != null) {
getSLF4JLogger().info("Vault found, hooking...");
getLogger().info("Vault found, hooking...");
this.vaultFactory = new VaultFactory(this);
this.vaultFactory.hook();