Make logging messages a bit less obnoxious
* Removed the ascii text from the startup output * Log messages (but not command output) is now sent through the standard server logger, and isn't colored
This commit is contained in:
parent
6baa472567
commit
b8c06904ab
@ -44,14 +44,18 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<minimizeJar>false</minimizeJar>
|
<minimizeJar>false</minimizeJar>
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>me.lucko.luckperms:luckperms-common</include>
|
||||||
|
<include>me.lucko.luckperms:luckperms-api</include>
|
||||||
|
</includes>
|
||||||
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
<!-- shaded dependencies -->
|
<!-- relocated dependencies -->
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>net.kyori.text</pattern>
|
<pattern>net.kyori.text</pattern>
|
||||||
<shadedPattern>me.lucko.luckperms.lib.text</shadedPattern>
|
<shadedPattern>me.lucko.luckperms.lib.text</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
|
||||||
<!-- relocated dependencies -->
|
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>com.github.benmanes.caffeine</pattern>
|
<pattern>com.github.benmanes.caffeine</pattern>
|
||||||
<shadedPattern>me.lucko.luckperms.lib.caffeine</shadedPattern>
|
<shadedPattern>me.lucko.luckperms.lib.caffeine</shadedPattern>
|
||||||
@ -117,29 +121,6 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- jsr305 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.findbugs</groupId>
|
|
||||||
<artifactId>jsr305</artifactId>
|
|
||||||
<version>3.0.2</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- caffeine -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
|
||||||
<artifactId>caffeine</artifactId>
|
|
||||||
<version>2.6.2</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<!-- HikariCP -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.zaxxer</groupId>
|
|
||||||
<artifactId>HikariCP</artifactId>
|
|
||||||
<version>3.2.0</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Spigot -->
|
<!-- Spigot -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
|
@ -30,6 +30,8 @@ import me.lucko.luckperms.bukkit.compat.NullSafeConsoleCommandSender;
|
|||||||
import me.lucko.luckperms.common.dependencies.classloader.PluginClassLoader;
|
import me.lucko.luckperms.common.dependencies.classloader.PluginClassLoader;
|
||||||
import me.lucko.luckperms.common.dependencies.classloader.ReflectionClassLoader;
|
import me.lucko.luckperms.common.dependencies.classloader.ReflectionClassLoader;
|
||||||
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
||||||
|
import me.lucko.luckperms.common.plugin.logging.JavaPluginLogger;
|
||||||
|
import me.lucko.luckperms.common.plugin.logging.PluginLogger;
|
||||||
|
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -49,6 +51,11 @@ import java.util.stream.Stream;
|
|||||||
*/
|
*/
|
||||||
public class LPBukkitBootstrap extends JavaPlugin implements LuckPermsBootstrap {
|
public class LPBukkitBootstrap extends JavaPlugin implements LuckPermsBootstrap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plugin logger
|
||||||
|
*/
|
||||||
|
private final PluginLogger logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scheduler adapter for the platform
|
* A scheduler adapter for the platform
|
||||||
*/
|
*/
|
||||||
@ -83,6 +90,7 @@ public class LPBukkitBootstrap extends JavaPlugin implements LuckPermsBootstrap
|
|||||||
private boolean incompatibleVersion = false;
|
private boolean incompatibleVersion = false;
|
||||||
|
|
||||||
public LPBukkitBootstrap() {
|
public LPBukkitBootstrap() {
|
||||||
|
this.logger = new JavaPluginLogger(getLogger());
|
||||||
this.schedulerAdapter = new BukkitSchedulerAdapter(this);
|
this.schedulerAdapter = new BukkitSchedulerAdapter(this);
|
||||||
this.classLoader = new ReflectionClassLoader(this);
|
this.classLoader = new ReflectionClassLoader(this);
|
||||||
this.console = new NullSafeConsoleCommandSender(getServer());
|
this.console = new NullSafeConsoleCommandSender(getServer());
|
||||||
@ -91,6 +99,11 @@ public class LPBukkitBootstrap extends JavaPlugin implements LuckPermsBootstrap
|
|||||||
|
|
||||||
// provide adapters
|
// provide adapters
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PluginLogger getPluginLogger() {
|
||||||
|
return this.logger;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BukkitSchedulerAdapter getScheduler() {
|
public BukkitSchedulerAdapter getScheduler() {
|
||||||
return this.schedulerAdapter;
|
return this.schedulerAdapter;
|
||||||
|
@ -115,7 +115,7 @@ public class LPBukkitPlugin extends AbstractLuckPermsPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Dependency> getGlobalDependencies() {
|
protected Set<Dependency> getGlobalDependencies() {
|
||||||
return EnumSet.of(Dependency.CAFFEINE, Dependency.OKIO, Dependency.OKHTTP);
|
return EnumSet.of(Dependency.TEXT, Dependency.CAFFEINE, Dependency.OKIO, Dependency.OKHTTP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,14 +44,18 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<minimizeJar>false</minimizeJar>
|
<minimizeJar>false</minimizeJar>
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>me.lucko.luckperms:luckperms-common</include>
|
||||||
|
<include>me.lucko.luckperms:luckperms-api</include>
|
||||||
|
</includes>
|
||||||
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
<!-- shaded dependencies -->
|
<!-- relocated dependencies -->
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>net.kyori.text</pattern>
|
<pattern>net.kyori.text</pattern>
|
||||||
<shadedPattern>me.lucko.luckperms.lib.text</shadedPattern>
|
<shadedPattern>me.lucko.luckperms.lib.text</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
|
||||||
<!-- relocated dependencies -->
|
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>com.github.benmanes.caffeine</pattern>
|
<pattern>com.github.benmanes.caffeine</pattern>
|
||||||
<shadedPattern>me.lucko.luckperms.lib.caffeine</shadedPattern>
|
<shadedPattern>me.lucko.luckperms.lib.caffeine</shadedPattern>
|
||||||
@ -117,14 +121,6 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- jsr305 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.findbugs</groupId>
|
|
||||||
<artifactId>jsr305</artifactId>
|
|
||||||
<version>3.0.2</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- BungeeCord -->
|
<!-- BungeeCord -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
|
@ -30,6 +30,8 @@ import me.lucko.luckperms.bungee.util.RedisBungeeUtil;
|
|||||||
import me.lucko.luckperms.common.dependencies.classloader.PluginClassLoader;
|
import me.lucko.luckperms.common.dependencies.classloader.PluginClassLoader;
|
||||||
import me.lucko.luckperms.common.dependencies.classloader.ReflectionClassLoader;
|
import me.lucko.luckperms.common.dependencies.classloader.ReflectionClassLoader;
|
||||||
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
||||||
|
import me.lucko.luckperms.common.plugin.logging.JavaPluginLogger;
|
||||||
|
import me.lucko.luckperms.common.plugin.logging.PluginLogger;
|
||||||
import me.lucko.luckperms.common.plugin.scheduler.SchedulerAdapter;
|
import me.lucko.luckperms.common.plugin.scheduler.SchedulerAdapter;
|
||||||
|
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
@ -47,6 +49,11 @@ import java.util.stream.Stream;
|
|||||||
*/
|
*/
|
||||||
public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
|
public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plugin logger
|
||||||
|
*/
|
||||||
|
private final PluginLogger logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scheduler adapter for the platform
|
* A scheduler adapter for the platform
|
||||||
*/
|
*/
|
||||||
@ -72,6 +79,7 @@ public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
|
|||||||
private final CountDownLatch enableLatch = new CountDownLatch(1);
|
private final CountDownLatch enableLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
public LPBungeeBootstrap() {
|
public LPBungeeBootstrap() {
|
||||||
|
this.logger = new JavaPluginLogger(getLogger());
|
||||||
this.schedulerAdapter = new BungeeSchedulerAdapter(this);
|
this.schedulerAdapter = new BungeeSchedulerAdapter(this);
|
||||||
this.classLoader = new ReflectionClassLoader(this);
|
this.classLoader = new ReflectionClassLoader(this);
|
||||||
this.plugin = new LPBungeePlugin(this);
|
this.plugin = new LPBungeePlugin(this);
|
||||||
@ -79,6 +87,11 @@ public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
|
|||||||
|
|
||||||
// provide adapters
|
// provide adapters
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PluginLogger getPluginLogger() {
|
||||||
|
return this.logger;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SchedulerAdapter getScheduler() {
|
public SchedulerAdapter getScheduler() {
|
||||||
return this.schedulerAdapter;
|
return this.schedulerAdapter;
|
||||||
|
@ -94,7 +94,7 @@ public class LPBungeePlugin extends AbstractLuckPermsPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Dependency> getGlobalDependencies() {
|
protected Set<Dependency> getGlobalDependencies() {
|
||||||
return EnumSet.of(Dependency.CAFFEINE, Dependency.OKIO, Dependency.OKHTTP);
|
return EnumSet.of(Dependency.TEXT, Dependency.CAFFEINE, Dependency.OKIO, Dependency.OKHTTP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
<groupId>com.google.code.findbugs</groupId>
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
<artifactId>jsr305</artifactId>
|
<artifactId>jsr305</artifactId>
|
||||||
<version>3.0.2</version>
|
<version>3.0.2</version>
|
||||||
<scope>provided</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- text -->
|
<!-- text -->
|
||||||
@ -76,35 +76,30 @@
|
|||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.7</version>
|
<version>2.7</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- guava -->
|
<!-- guava -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>19.0</version>
|
<version>19.0</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- caffeine -->
|
<!-- caffeine -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||||
<artifactId>caffeine</artifactId>
|
<artifactId>caffeine</artifactId>
|
||||||
<version>2.6.2</version>
|
<version>2.6.2</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- okhttp -->
|
<!-- okhttp -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
<artifactId>okhttp</artifactId>
|
<artifactId>okhttp</artifactId>
|
||||||
<version>3.10.0</version>
|
<version>3.10.0</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- okio -->
|
<!-- okio -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okio</groupId>
|
<groupId>com.squareup.okio</groupId>
|
||||||
<artifactId>okio</artifactId>
|
<artifactId>okio</artifactId>
|
||||||
<version>1.14.1</version>
|
<version>1.14.1</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- configurate -->
|
<!-- configurate -->
|
||||||
@ -112,7 +107,6 @@
|
|||||||
<groupId>me.lucko.configurate</groupId>
|
<groupId>me.lucko.configurate</groupId>
|
||||||
<artifactId>configurate-core</artifactId>
|
<artifactId>configurate-core</artifactId>
|
||||||
<version>3.5</version>
|
<version>3.5</version>
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
@ -125,7 +119,6 @@
|
|||||||
<groupId>me.lucko.configurate</groupId>
|
<groupId>me.lucko.configurate</groupId>
|
||||||
<artifactId>configurate-yaml</artifactId>
|
<artifactId>configurate-yaml</artifactId>
|
||||||
<version>3.5</version>
|
<version>3.5</version>
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.yaml</groupId>
|
<groupId>org.yaml</groupId>
|
||||||
@ -138,7 +131,6 @@
|
|||||||
<groupId>me.lucko.configurate</groupId>
|
<groupId>me.lucko.configurate</groupId>
|
||||||
<artifactId>configurate-gson</artifactId>
|
<artifactId>configurate-gson</artifactId>
|
||||||
<version>3.5</version>
|
<version>3.5</version>
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
@ -151,14 +143,12 @@
|
|||||||
<groupId>me.lucko.configurate</groupId>
|
<groupId>me.lucko.configurate</groupId>
|
||||||
<artifactId>configurate-hocon</artifactId>
|
<artifactId>configurate-hocon</artifactId>
|
||||||
<version>3.5</version>
|
<version>3.5</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- configurate toml -->
|
<!-- configurate toml -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.lucko.configurate</groupId>
|
<groupId>me.lucko.configurate</groupId>
|
||||||
<artifactId>configurate-toml</artifactId>
|
<artifactId>configurate-toml</artifactId>
|
||||||
<version>3.5</version>
|
<version>3.5</version>
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>com.moandjiezana.toml</groupId>
|
<groupId>com.moandjiezana.toml</groupId>
|
||||||
@ -171,28 +161,24 @@
|
|||||||
<groupId>com.zaxxer</groupId>
|
<groupId>com.zaxxer</groupId>
|
||||||
<artifactId>HikariCP</artifactId>
|
<artifactId>HikariCP</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.2.0</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Jedis -->
|
<!-- Jedis -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>redis.clients</groupId>
|
<groupId>redis.clients</groupId>
|
||||||
<artifactId>jedis</artifactId>
|
<artifactId>jedis</artifactId>
|
||||||
<version>2.9.0</version>
|
<version>2.9.0</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- MongoDB -->
|
<!-- MongoDB -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mongodb</groupId>
|
<groupId>org.mongodb</groupId>
|
||||||
<artifactId>mongo-java-driver</artifactId>
|
<artifactId>mongo-java-driver</artifactId>
|
||||||
<version>3.7.1</version>
|
<version>3.7.1</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- SnakeYAML -->
|
<!-- SnakeYAML -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.yaml</groupId>
|
<groupId>org.yaml</groupId>
|
||||||
<artifactId>snakeyaml</artifactId>
|
<artifactId>snakeyaml</artifactId>
|
||||||
<version>1.14</version>
|
<version>1.14</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -180,11 +180,6 @@ public final class ConfigKeys {
|
|||||||
*/
|
*/
|
||||||
public static final ConfigKey<Boolean> USE_ARGUMENT_BASED_COMMAND_PERMISSIONS = BooleanKey.of("argument-based-command-permissions", false);
|
public static final ConfigKey<Boolean> USE_ARGUMENT_BASED_COMMAND_PERMISSIONS = BooleanKey.of("argument-based-command-permissions", false);
|
||||||
|
|
||||||
/**
|
|
||||||
* If the plugin should log messages to the console in color.
|
|
||||||
*/
|
|
||||||
public static final ConfigKey<Boolean> USE_COLORED_LOGGER = BooleanKey.of("colored-logger", true);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If wildcards are being applied
|
* If wildcards are being applied
|
||||||
*/
|
*/
|
||||||
|
@ -59,6 +59,13 @@ public enum Dependency {
|
|||||||
"mmz3ltQbS8xXGA2scM0ZH6raISlt4nukjCiU2l9Jxfs="
|
"mmz3ltQbS8xXGA2scM0ZH6raISlt4nukjCiU2l9Jxfs="
|
||||||
),
|
),
|
||||||
|
|
||||||
|
TEXT(
|
||||||
|
"net{}kyori",
|
||||||
|
"text",
|
||||||
|
"1.11-1.4.0",
|
||||||
|
"drQpwf+oI1+DPrn0iCvEtoID+xXR3dpZK5ySaBrUiok=",
|
||||||
|
Relocation.of("text", "net{}kyori{}text")
|
||||||
|
),
|
||||||
CAFFEINE(
|
CAFFEINE(
|
||||||
"com{}github{}ben-manes{}caffeine",
|
"com{}github{}ben-manes{}caffeine",
|
||||||
"caffeine",
|
"caffeine",
|
||||||
|
@ -60,9 +60,6 @@ public enum Message {
|
|||||||
/*
|
/*
|
||||||
* Logging
|
* Logging
|
||||||
*/
|
*/
|
||||||
LOG_INFO("&7&l[&bL&3P&7&l] &3{}", false),
|
|
||||||
LOG_WARN("&7&l[&bLuck&3Perms&7&l] &c[WARN] {}", false),
|
|
||||||
LOG_ERROR("&7&l[&bLuck&3Perms&7&l] &4[ERROR] {}", false),
|
|
||||||
LOG(
|
LOG(
|
||||||
"{PREFIX}&3LOG &3&l> &8(&e{}&8) [&a{}&8] (&b{}&8)" + "\n" +
|
"{PREFIX}&3LOG &3&l> &8(&e{}&8) [&a{}&8] (&b{}&8)" + "\n" +
|
||||||
"{PREFIX}&3LOG &3&l> &f{}",
|
"{PREFIX}&3LOG &3&l> &f{}",
|
||||||
|
@ -46,7 +46,7 @@ import me.lucko.luckperms.common.inheritance.InheritanceHandler;
|
|||||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||||
import me.lucko.luckperms.common.messaging.InternalMessagingService;
|
import me.lucko.luckperms.common.messaging.InternalMessagingService;
|
||||||
import me.lucko.luckperms.common.messaging.MessagingFactory;
|
import me.lucko.luckperms.common.messaging.MessagingFactory;
|
||||||
import me.lucko.luckperms.common.plugin.util.PluginLogger;
|
import me.lucko.luckperms.common.plugin.logging.PluginLogger;
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.storage.Storage;
|
import me.lucko.luckperms.common.storage.Storage;
|
||||||
import me.lucko.luckperms.common.storage.StorageFactory;
|
import me.lucko.luckperms.common.storage.StorageFactory;
|
||||||
@ -64,7 +64,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
||||||
|
|
||||||
// init during load
|
// init during load
|
||||||
private PluginLogger logger;
|
|
||||||
private DependencyManager dependencyManager;
|
private DependencyManager dependencyManager;
|
||||||
|
|
||||||
// init during enable
|
// init during enable
|
||||||
@ -86,13 +85,12 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
|||||||
* Performs the initial actions to load the plugin
|
* Performs the initial actions to load the plugin
|
||||||
*/
|
*/
|
||||||
public final void load() {
|
public final void load() {
|
||||||
// load the sender factory instance and create a new logger for the plugin
|
|
||||||
setupSenderFactory();
|
|
||||||
this.logger = new PluginLogger(this, getConsoleSender());
|
|
||||||
|
|
||||||
// load dependencies
|
// load dependencies
|
||||||
this.dependencyManager = new DependencyManager(this);
|
this.dependencyManager = new DependencyManager(this);
|
||||||
this.dependencyManager.loadDependencies(getGlobalDependencies());
|
this.dependencyManager.loadDependencies(getGlobalDependencies());
|
||||||
|
|
||||||
|
// load the sender factory instance
|
||||||
|
setupSenderFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void enable() {
|
public final void enable() {
|
||||||
@ -237,6 +235,11 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
|||||||
|
|
||||||
protected void removePlatformHooks() {}
|
protected void removePlatformHooks() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PluginLogger getLogger() {
|
||||||
|
return getBootstrap().getPluginLogger();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMessagingService(InternalMessagingService messagingService) {
|
public void setMessagingService(InternalMessagingService messagingService) {
|
||||||
if (this.messagingService == null) {
|
if (this.messagingService == null) {
|
||||||
@ -244,11 +247,6 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PluginLogger getLogger() {
|
|
||||||
return this.logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DependencyManager getDependencyManager() {
|
public DependencyManager getDependencyManager() {
|
||||||
return this.dependencyManager;
|
return this.dependencyManager;
|
||||||
@ -320,12 +318,9 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void displayBanner(Sender sender) {
|
private void displayBanner(Sender sender) {
|
||||||
sender.sendMessage(MessageUtils.color("&b __ &3 __ ___ __ __ "));
|
sender.sendMessage(MessageUtils.color("&b &3 __ "));
|
||||||
sender.sendMessage(MessageUtils.color("&b | | | / ` |__/ &3|__) |__ |__) |\\/| /__` "));
|
sender.sendMessage(MessageUtils.color("&b | &3|__) " + "&2LuckPerms &bv" + getBootstrap().getVersion()));
|
||||||
sender.sendMessage(MessageUtils.color("&b |___ \\__/ \\__, | \\ &3| |___ | \\ | | .__/ "));
|
sender.sendMessage(MessageUtils.color("&b |___ &3| " + "&8running on " + getBootstrap().getType().getFriendlyName() + " - " + getBootstrap().getServerBrand()));
|
||||||
sender.sendMessage(MessageUtils.color(" "));
|
sender.sendMessage("");
|
||||||
sender.sendMessage(MessageUtils.color("&2 Loading version &bv" + getBootstrap().getVersion() + "&2 on " + getBootstrap().getType().getFriendlyName() + " - " + getBootstrap().getServerBrand()));
|
|
||||||
sender.sendMessage(MessageUtils.color("&8 Running on server version " + getBootstrap().getServerVersion()));
|
|
||||||
sender.sendMessage(MessageUtils.color(" "));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ import me.lucko.luckperms.common.managers.user.UserManager;
|
|||||||
import me.lucko.luckperms.common.messaging.InternalMessagingService;
|
import me.lucko.luckperms.common.messaging.InternalMessagingService;
|
||||||
import me.lucko.luckperms.common.model.User;
|
import me.lucko.luckperms.common.model.User;
|
||||||
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
||||||
|
import me.lucko.luckperms.common.plugin.logging.PluginLogger;
|
||||||
import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
|
import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
|
||||||
import me.lucko.luckperms.common.plugin.util.PluginLogger;
|
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.storage.Storage;
|
import me.lucko.luckperms.common.storage.Storage;
|
||||||
import me.lucko.luckperms.common.storage.dao.file.FileWatcher;
|
import me.lucko.luckperms.common.storage.dao.file.FileWatcher;
|
||||||
|
@ -27,6 +27,7 @@ package me.lucko.luckperms.common.plugin.bootstrap;
|
|||||||
|
|
||||||
import me.lucko.luckperms.api.platform.PlatformType;
|
import me.lucko.luckperms.api.platform.PlatformType;
|
||||||
import me.lucko.luckperms.common.dependencies.classloader.PluginClassLoader;
|
import me.lucko.luckperms.common.dependencies.classloader.PluginClassLoader;
|
||||||
|
import me.lucko.luckperms.common.plugin.logging.PluginLogger;
|
||||||
import me.lucko.luckperms.common.plugin.scheduler.SchedulerAdapter;
|
import me.lucko.luckperms.common.plugin.scheduler.SchedulerAdapter;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -48,6 +49,13 @@ import javax.annotation.Nullable;
|
|||||||
*/
|
*/
|
||||||
public interface LuckPermsBootstrap {
|
public interface LuckPermsBootstrap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the plugin logger
|
||||||
|
*
|
||||||
|
* @return the logger
|
||||||
|
*/
|
||||||
|
PluginLogger getPluginLogger();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an adapter for the platforms scheduler
|
* Gets an adapter for the platforms scheduler
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of LuckPerms, licensed under the MIT License.
|
||||||
|
*
|
||||||
|
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||||
|
* Copyright (c) contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms.common.plugin.logging;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
public class JavaPluginLogger implements PluginLogger {
|
||||||
|
private final Logger logger;
|
||||||
|
|
||||||
|
public JavaPluginLogger(Logger logger) {
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(String s) {
|
||||||
|
this.logger.info(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String s) {
|
||||||
|
this.logger.warning(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void severe(String s) {
|
||||||
|
this.logger.severe(s);
|
||||||
|
}
|
||||||
|
}
|
@ -23,15 +23,7 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package me.lucko.luckperms.common.plugin.util;
|
package me.lucko.luckperms.common.plugin.logging;
|
||||||
|
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
|
||||||
import me.lucko.luckperms.common.locale.message.Message;
|
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the logger instance being used by LuckPerms on the platform.
|
* Represents the logger instance being used by LuckPerms on the platform.
|
||||||
@ -39,32 +31,10 @@ import java.util.Objects;
|
|||||||
* <p>Messages sent using the logger are sent prefixed with the LuckPerms tag,
|
* <p>Messages sent using the logger are sent prefixed with the LuckPerms tag,
|
||||||
* and on some implementations will be colored depending on the message type.</p>
|
* and on some implementations will be colored depending on the message type.</p>
|
||||||
*/
|
*/
|
||||||
public class PluginLogger {
|
public interface PluginLogger {
|
||||||
private final LuckPermsPlugin plugin;
|
|
||||||
private final Sender console;
|
|
||||||
|
|
||||||
public PluginLogger(LuckPermsPlugin plugin, Sender console) {
|
void info(String s);
|
||||||
this.plugin = plugin;
|
void warn(String s);
|
||||||
this.console = console;
|
void severe(String s);
|
||||||
}
|
|
||||||
|
|
||||||
public void info(String s) {
|
|
||||||
msg(Message.LOG_INFO, Objects.requireNonNull(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void warn(String s) {
|
|
||||||
msg(Message.LOG_WARN, Objects.requireNonNull(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void severe(String s) {
|
|
||||||
msg(Message.LOG_ERROR, Objects.requireNonNull(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void msg(Message message, String s) {
|
|
||||||
String msg = message.asString(this.plugin.getLocaleManager(), s);
|
|
||||||
if (this.plugin.getConfiguration() != null && !this.plugin.getConfiguration().get(ConfigKeys.USE_COLORED_LOGGER)) {
|
|
||||||
msg = MessageUtils.stripColor(msg);
|
|
||||||
}
|
|
||||||
this.console.sendMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of LuckPerms, licensed under the MIT License.
|
||||||
|
*
|
||||||
|
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||||
|
* Copyright (c) contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms.common.plugin.logging;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
public class Slf4jPluginLogger implements PluginLogger {
|
||||||
|
private final Logger logger;
|
||||||
|
|
||||||
|
public Slf4jPluginLogger(Logger logger) {
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(String s) {
|
||||||
|
this.logger.info(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String s) {
|
||||||
|
this.logger.warn(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void severe(String s) {
|
||||||
|
this.logger.error(s);
|
||||||
|
}
|
||||||
|
}
|
@ -44,14 +44,18 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<minimizeJar>false</minimizeJar>
|
<minimizeJar>false</minimizeJar>
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>me.lucko.luckperms:luckperms-common</include>
|
||||||
|
<include>me.lucko.luckperms:luckperms-api</include>
|
||||||
|
</includes>
|
||||||
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
<!-- shaded dependencies -->
|
<!-- relocated dependencies -->
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>net.kyori.text</pattern>
|
<pattern>net.kyori.text</pattern>
|
||||||
<shadedPattern>me.lucko.luckperms.lib.text</shadedPattern>
|
<shadedPattern>me.lucko.luckperms.lib.text</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
|
||||||
<!-- relocated dependencies -->
|
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>com.github.benmanes.caffeine</pattern>
|
<pattern>com.github.benmanes.caffeine</pattern>
|
||||||
<shadedPattern>me.lucko.luckperms.lib.caffeine</shadedPattern>
|
<shadedPattern>me.lucko.luckperms.lib.caffeine</shadedPattern>
|
||||||
@ -117,22 +121,6 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- jsr305 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.findbugs</groupId>
|
|
||||||
<artifactId>jsr305</artifactId>
|
|
||||||
<version>3.0.2</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- caffeine -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
|
||||||
<artifactId>caffeine</artifactId>
|
|
||||||
<version>2.6.2</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Nukkit -->
|
<!-- Nukkit -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.nukkit</groupId>
|
<groupId>cn.nukkit</groupId>
|
||||||
|
@ -29,6 +29,7 @@ import me.lucko.luckperms.api.platform.PlatformType;
|
|||||||
import me.lucko.luckperms.common.dependencies.classloader.PluginClassLoader;
|
import me.lucko.luckperms.common.dependencies.classloader.PluginClassLoader;
|
||||||
import me.lucko.luckperms.common.dependencies.classloader.ReflectionClassLoader;
|
import me.lucko.luckperms.common.dependencies.classloader.ReflectionClassLoader;
|
||||||
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
||||||
|
import me.lucko.luckperms.common.plugin.logging.PluginLogger;
|
||||||
|
|
||||||
import cn.nukkit.Player;
|
import cn.nukkit.Player;
|
||||||
import cn.nukkit.plugin.PluginBase;
|
import cn.nukkit.plugin.PluginBase;
|
||||||
@ -45,6 +46,11 @@ import java.util.stream.Stream;
|
|||||||
*/
|
*/
|
||||||
public class LPNukkitBootstrap extends PluginBase implements LuckPermsBootstrap {
|
public class LPNukkitBootstrap extends PluginBase implements LuckPermsBootstrap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plugin logger
|
||||||
|
*/
|
||||||
|
private final PluginLogger logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scheduler adapter for the platform
|
* A scheduler adapter for the platform
|
||||||
*/
|
*/
|
||||||
@ -70,6 +76,7 @@ public class LPNukkitBootstrap extends PluginBase implements LuckPermsBootstrap
|
|||||||
private final CountDownLatch enableLatch = new CountDownLatch(1);
|
private final CountDownLatch enableLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
public LPNukkitBootstrap() {
|
public LPNukkitBootstrap() {
|
||||||
|
this.logger = new NukkitPluginLogger(getLogger());
|
||||||
this.schedulerAdapter = new NukkitSchedulerAdapter(this);
|
this.schedulerAdapter = new NukkitSchedulerAdapter(this);
|
||||||
this.classLoader = new ReflectionClassLoader(this);
|
this.classLoader = new ReflectionClassLoader(this);
|
||||||
this.plugin = new LPNukkitPlugin(this);
|
this.plugin = new LPNukkitPlugin(this);
|
||||||
@ -77,6 +84,11 @@ public class LPNukkitBootstrap extends PluginBase implements LuckPermsBootstrap
|
|||||||
|
|
||||||
// provide adapters
|
// provide adapters
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PluginLogger getPluginLogger() {
|
||||||
|
return this.logger;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NukkitSchedulerAdapter getScheduler() {
|
public NukkitSchedulerAdapter getScheduler() {
|
||||||
return this.schedulerAdapter;
|
return this.schedulerAdapter;
|
||||||
|
@ -111,7 +111,7 @@ public class LPNukkitPlugin extends AbstractLuckPermsPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Dependency> getGlobalDependencies() {
|
protected Set<Dependency> getGlobalDependencies() {
|
||||||
return EnumSet.of(Dependency.CAFFEINE, Dependency.OKIO, Dependency.OKHTTP);
|
return EnumSet.of(Dependency.TEXT, Dependency.CAFFEINE, Dependency.OKIO, Dependency.OKHTTP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of LuckPerms, licensed under the MIT License.
|
||||||
|
*
|
||||||
|
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||||
|
* Copyright (c) contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms.nukkit;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.common.plugin.logging.PluginLogger;
|
||||||
|
|
||||||
|
import cn.nukkit.utils.Logger;
|
||||||
|
|
||||||
|
public class NukkitPluginLogger implements PluginLogger {
|
||||||
|
private final Logger logger;
|
||||||
|
|
||||||
|
public NukkitPluginLogger(cn.nukkit.plugin.PluginLogger logger) {
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(String s) {
|
||||||
|
this.logger.info(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String s) {
|
||||||
|
this.logger.warning(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void severe(String s) {
|
||||||
|
this.logger.error(s);
|
||||||
|
}
|
||||||
|
}
|
@ -44,14 +44,18 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<minimizeJar>false</minimizeJar>
|
<minimizeJar>false</minimizeJar>
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>me.lucko.luckperms:luckperms-common</include>
|
||||||
|
<include>me.lucko.luckperms:luckperms-api</include>
|
||||||
|
</includes>
|
||||||
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
<!-- shaded dependencies -->
|
<!-- relocated dependencies -->
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>net.kyori.text</pattern>
|
<pattern>net.kyori.text</pattern>
|
||||||
<shadedPattern>me.lucko.luckperms.lib.text</shadedPattern>
|
<shadedPattern>me.lucko.luckperms.lib.text</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
|
||||||
<!-- relocated dependencies -->
|
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>com.github.benmanes.caffeine</pattern>
|
<pattern>com.github.benmanes.caffeine</pattern>
|
||||||
<shadedPattern>me.lucko.luckperms.lib.caffeine</shadedPattern>
|
<shadedPattern>me.lucko.luckperms.lib.caffeine</shadedPattern>
|
||||||
@ -177,14 +181,6 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- configurate -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>me.lucko.configurate</groupId>
|
|
||||||
<artifactId>configurate-hocon</artifactId>
|
|
||||||
<version>3.5</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
@ -31,6 +31,8 @@ import me.lucko.luckperms.api.platform.PlatformType;
|
|||||||
import me.lucko.luckperms.common.dependencies.classloader.PluginClassLoader;
|
import me.lucko.luckperms.common.dependencies.classloader.PluginClassLoader;
|
||||||
import me.lucko.luckperms.common.dependencies.classloader.ReflectionClassLoader;
|
import me.lucko.luckperms.common.dependencies.classloader.ReflectionClassLoader;
|
||||||
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
||||||
|
import me.lucko.luckperms.common.plugin.logging.PluginLogger;
|
||||||
|
import me.lucko.luckperms.common.plugin.logging.Slf4jPluginLogger;
|
||||||
import me.lucko.luckperms.common.plugin.scheduler.SchedulerAdapter;
|
import me.lucko.luckperms.common.plugin.scheduler.SchedulerAdapter;
|
||||||
import me.lucko.luckperms.common.utils.MoreFiles;
|
import me.lucko.luckperms.common.utils.MoreFiles;
|
||||||
import me.lucko.luckperms.sponge.utils.VersionData;
|
import me.lucko.luckperms.sponge.utils.VersionData;
|
||||||
@ -74,6 +76,11 @@ import java.util.stream.Stream;
|
|||||||
)
|
)
|
||||||
public class LPSpongeBootstrap implements LuckPermsBootstrap {
|
public class LPSpongeBootstrap implements LuckPermsBootstrap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plugin logger
|
||||||
|
*/
|
||||||
|
private final PluginLogger logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scheduler adapter for the platform
|
* A scheduler adapter for the platform
|
||||||
*/
|
*/
|
||||||
@ -98,12 +105,6 @@ public class LPSpongeBootstrap implements LuckPermsBootstrap {
|
|||||||
private final CountDownLatch loadLatch = new CountDownLatch(1);
|
private final CountDownLatch loadLatch = new CountDownLatch(1);
|
||||||
private final CountDownLatch enableLatch = new CountDownLatch(1);
|
private final CountDownLatch enableLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
/**
|
|
||||||
* Injected plugin logger
|
|
||||||
*/
|
|
||||||
@Inject
|
|
||||||
private Logger logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to the central {@link Game} instance in the API
|
* Reference to the central {@link Game} instance in the API
|
||||||
*/
|
*/
|
||||||
@ -129,7 +130,8 @@ public class LPSpongeBootstrap implements LuckPermsBootstrap {
|
|||||||
private PluginContainer pluginContainer;
|
private PluginContainer pluginContainer;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public LPSpongeBootstrap(@SynchronousExecutor SpongeExecutorService syncExecutor, @AsynchronousExecutor SpongeExecutorService asyncExecutor) {
|
public LPSpongeBootstrap(Logger logger, @SynchronousExecutor SpongeExecutorService syncExecutor, @AsynchronousExecutor SpongeExecutorService asyncExecutor) {
|
||||||
|
this.logger = new Slf4jPluginLogger(logger);
|
||||||
this.spongeScheduler = Sponge.getScheduler();
|
this.spongeScheduler = Sponge.getScheduler();
|
||||||
this.schedulerAdapter = new SpongeSchedulerAdapter(this, this.spongeScheduler, syncExecutor, asyncExecutor);
|
this.schedulerAdapter = new SpongeSchedulerAdapter(this, this.spongeScheduler, syncExecutor, asyncExecutor);
|
||||||
this.classLoader = new ReflectionClassLoader(this);
|
this.classLoader = new ReflectionClassLoader(this);
|
||||||
@ -138,6 +140,11 @@ public class LPSpongeBootstrap implements LuckPermsBootstrap {
|
|||||||
|
|
||||||
// provide adapters
|
// provide adapters
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PluginLogger getPluginLogger() {
|
||||||
|
return this.logger;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SchedulerAdapter getScheduler() {
|
public SchedulerAdapter getScheduler() {
|
||||||
return this.schedulerAdapter;
|
return this.schedulerAdapter;
|
||||||
@ -188,10 +195,6 @@ public class LPSpongeBootstrap implements LuckPermsBootstrap {
|
|||||||
|
|
||||||
// getters for the injected sponge instances
|
// getters for the injected sponge instances
|
||||||
|
|
||||||
public Logger getLogger() {
|
|
||||||
return this.logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Game getGame() {
|
public Game getGame() {
|
||||||
return this.game;
|
return this.game;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<Dependency> getGlobalDependencies() {
|
protected Set<Dependency> getGlobalDependencies() {
|
||||||
return EnumSet.of(Dependency.CAFFEINE, Dependency.OKIO, Dependency.OKHTTP,
|
return EnumSet.of(Dependency.TEXT, Dependency.CAFFEINE, Dependency.OKIO, Dependency.OKHTTP,
|
||||||
Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_HOCON, Dependency.HOCON_CONFIG);
|
Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_HOCON, Dependency.HOCON_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
|||||||
return new DummySender(this, CommandManager.CONSOLE_UUID, CommandManager.CONSOLE_NAME) {
|
return new DummySender(this, CommandManager.CONSOLE_UUID, CommandManager.CONSOLE_NAME) {
|
||||||
@Override
|
@Override
|
||||||
protected void consumeMessage(String s) {
|
protected void consumeMessage(String s) {
|
||||||
LPSpongePlugin.this.bootstrap.getLogger().info(s);
|
LPSpongePlugin.this.bootstrap.getPluginLogger().info(s);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user