mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-25 02:27:56 +01:00
Optimize event generation & other misc improvements
This commit is contained in:
parent
c59f2ab37a
commit
502d57e744
@ -50,7 +50,6 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.function.Supplier;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -332,12 +331,4 @@ public class Importer implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> List<T> nInstances(int count, Supplier<T> supplier) {
|
|
||||||
List<T> ret = new ArrayList<>(count);
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
ret.add(supplier.get());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,21 +26,17 @@
|
|||||||
package me.lucko.luckperms.common.config.adapter;
|
package me.lucko.luckperms.common.config.adapter;
|
||||||
|
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
|
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
|
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
import ninja.leaping.configurate.loader.AbstractConfigurationLoader;
|
|
||||||
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
||||||
import ninja.leaping.configurate.yaml.YAMLConfigurationLoader;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public abstract class ConfigurateConfigAdapter extends AbstractConfigurationAdapter implements ConfigurationAdapter {
|
public abstract class ConfigurateConfigAdapter extends AbstractConfigurationAdapter implements ConfigurationAdapter {
|
||||||
|
@ -36,7 +36,6 @@ import java.net.URL;
|
|||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public enum Dependency {
|
public enum Dependency {
|
||||||
@ -280,14 +279,6 @@ public enum Dependency {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dependency(String url, String version, String checksum) {
|
|
||||||
this(url, version, checksum, Collections.emptyList());
|
|
||||||
}
|
|
||||||
|
|
||||||
Dependency(String url, String version, String checksum, Relocation relocation) {
|
|
||||||
this(url, version, checksum, Collections.singletonList(relocation));
|
|
||||||
}
|
|
||||||
|
|
||||||
Dependency(String url, String version, String checksum, List<Relocation> relocations) {
|
Dependency(String url, String version, String checksum, List<Relocation> relocations) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
package me.lucko.luckperms.common.dependencies;
|
package me.lucko.luckperms.common.dependencies;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableListMultimap;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ListMultimap;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.platform.PlatformType;
|
import me.lucko.luckperms.api.platform.PlatformType;
|
||||||
@ -38,27 +38,25 @@ import me.lucko.luckperms.common.storage.StorageType;
|
|||||||
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class DependencyRegistry {
|
public class DependencyRegistry {
|
||||||
|
|
||||||
private static final Map<StorageType, List<Dependency>> STORAGE_DEPENDENCIES = ImmutableMap.<StorageType, List<Dependency>>builder()
|
private static final ListMultimap<StorageType, Dependency> STORAGE_DEPENDENCIES = ImmutableListMultimap.<StorageType, Dependency>builder()
|
||||||
.put(StorageType.YAML, ImmutableList.of(Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_YAML))
|
.putAll(StorageType.YAML, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_YAML)
|
||||||
.put(StorageType.JSON, ImmutableList.of(Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_GSON))
|
.putAll(StorageType.JSON, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_GSON)
|
||||||
.put(StorageType.HOCON, ImmutableList.of(Dependency.HOCON_CONFIG, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_HOCON))
|
.putAll(StorageType.HOCON, Dependency.HOCON_CONFIG, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_HOCON)
|
||||||
.put(StorageType.TOML, ImmutableList.of(Dependency.TOML4J, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_TOML))
|
.putAll(StorageType.TOML, Dependency.TOML4J, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_TOML)
|
||||||
.put(StorageType.YAML_COMBINED, ImmutableList.of(Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_YAML))
|
.putAll(StorageType.YAML_COMBINED, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_YAML)
|
||||||
.put(StorageType.JSON_COMBINED, ImmutableList.of(Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_GSON))
|
.putAll(StorageType.JSON_COMBINED, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_GSON)
|
||||||
.put(StorageType.HOCON_COMBINED, ImmutableList.of(Dependency.HOCON_CONFIG, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_HOCON))
|
.putAll(StorageType.HOCON_COMBINED, Dependency.HOCON_CONFIG, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_HOCON)
|
||||||
.put(StorageType.TOML_COMBINED, ImmutableList.of(Dependency.TOML4J, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_TOML))
|
.putAll(StorageType.TOML_COMBINED, Dependency.TOML4J, Dependency.CONFIGURATE_CORE, Dependency.CONFIGURATE_TOML)
|
||||||
.put(StorageType.MONGODB, ImmutableList.of(Dependency.MONGODB_DRIVER))
|
.putAll(StorageType.MONGODB, Dependency.MONGODB_DRIVER)
|
||||||
.put(StorageType.MARIADB, ImmutableList.of(Dependency.MARIADB_DRIVER, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, Dependency.HIKARI))
|
.putAll(StorageType.MARIADB, Dependency.MARIADB_DRIVER, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, Dependency.HIKARI)
|
||||||
.put(StorageType.MYSQL, ImmutableList.of(Dependency.MYSQL_DRIVER, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, Dependency.HIKARI))
|
.putAll(StorageType.MYSQL, Dependency.MYSQL_DRIVER, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, Dependency.HIKARI)
|
||||||
.put(StorageType.POSTGRESQL, ImmutableList.of(Dependency.POSTGRESQL_DRIVER, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, Dependency.HIKARI))
|
.putAll(StorageType.POSTGRESQL, Dependency.POSTGRESQL_DRIVER, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, Dependency.HIKARI)
|
||||||
.put(StorageType.SQLITE, ImmutableList.of(Dependency.SQLITE_DRIVER))
|
.putAll(StorageType.SQLITE, Dependency.SQLITE_DRIVER)
|
||||||
.put(StorageType.H2, ImmutableList.of(Dependency.H2_DRIVER))
|
.putAll(StorageType.H2, Dependency.H2_DRIVER)
|
||||||
.put(StorageType.CUSTOM, ImmutableList.of())
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
private final LuckPermsPlugin plugin;
|
private final LuckPermsPlugin plugin;
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
package me.lucko.luckperms.common.dependencies.classloader;
|
package me.lucko.luckperms.common.dependencies.classloader;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,8 +129,8 @@ public class GeneratedEventSpec {
|
|||||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||||
if (TO_STRING_METHOD.equals(method)) {
|
if (TO_STRING_METHOD.equals(method)) {
|
||||||
return "GeneratedEvent(" +
|
return "GeneratedEvent(" +
|
||||||
"proxy=" + proxy + ", " +
|
"proxy=" + proxy.getClass().getName() + "@" + Integer.toHexString(proxy.hashCode()) + ", " +
|
||||||
"class=" + GeneratedEventSpec.this.eventClass.toString() + ", " +
|
"class=" + GeneratedEventSpec.this.eventClass.getName() + ", " +
|
||||||
"fields=" + Arrays.toString(this.fields) + ")";
|
"fields=" + Arrays.toString(this.fields) + ")";
|
||||||
}
|
}
|
||||||
if (EQUALS_METHOD.equals(method)) {
|
if (EQUALS_METHOD.equals(method)) {
|
||||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.velocity.calculators;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.Contexts;
|
import me.lucko.luckperms.api.Contexts;
|
||||||
import me.lucko.luckperms.velocity.LPVelocityPlugin;
|
|
||||||
import me.lucko.luckperms.common.calculators.CalculatorFactory;
|
import me.lucko.luckperms.common.calculators.CalculatorFactory;
|
||||||
import me.lucko.luckperms.common.calculators.PermissionCalculator;
|
import me.lucko.luckperms.common.calculators.PermissionCalculator;
|
||||||
import me.lucko.luckperms.common.calculators.PermissionCalculatorMetadata;
|
import me.lucko.luckperms.common.calculators.PermissionCalculatorMetadata;
|
||||||
@ -37,6 +36,7 @@ import me.lucko.luckperms.common.processors.MapProcessor;
|
|||||||
import me.lucko.luckperms.common.processors.PermissionProcessor;
|
import me.lucko.luckperms.common.processors.PermissionProcessor;
|
||||||
import me.lucko.luckperms.common.processors.RegexProcessor;
|
import me.lucko.luckperms.common.processors.RegexProcessor;
|
||||||
import me.lucko.luckperms.common.processors.WildcardProcessor;
|
import me.lucko.luckperms.common.processors.WildcardProcessor;
|
||||||
|
import me.lucko.luckperms.velocity.LPVelocityPlugin;
|
||||||
|
|
||||||
public class VelocityCalculatorFactory implements CalculatorFactory {
|
public class VelocityCalculatorFactory implements CalculatorFactory {
|
||||||
private final LPVelocityPlugin plugin;
|
private final LPVelocityPlugin plugin;
|
||||||
|
@ -33,11 +33,11 @@ import com.velocitypowered.api.event.connection.LoginEvent;
|
|||||||
import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
|
import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
|
|
||||||
import me.lucko.luckperms.velocity.LPVelocityPlugin;
|
|
||||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||||
import me.lucko.luckperms.common.locale.message.Message;
|
import me.lucko.luckperms.common.locale.message.Message;
|
||||||
import me.lucko.luckperms.common.model.User;
|
import me.lucko.luckperms.common.model.User;
|
||||||
import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
|
import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
|
||||||
|
import me.lucko.luckperms.velocity.LPVelocityPlugin;
|
||||||
import me.lucko.luckperms.velocity.service.PlayerPermissionProvider;
|
import me.lucko.luckperms.velocity.service.PlayerPermissionProvider;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -28,10 +28,10 @@ package me.lucko.luckperms.velocity.messaging;
|
|||||||
import me.lucko.luckperms.api.messenger.IncomingMessageConsumer;
|
import me.lucko.luckperms.api.messenger.IncomingMessageConsumer;
|
||||||
import me.lucko.luckperms.api.messenger.Messenger;
|
import me.lucko.luckperms.api.messenger.Messenger;
|
||||||
import me.lucko.luckperms.api.messenger.MessengerProvider;
|
import me.lucko.luckperms.api.messenger.MessengerProvider;
|
||||||
import me.lucko.luckperms.velocity.LPVelocityPlugin;
|
|
||||||
import me.lucko.luckperms.common.messaging.InternalMessagingService;
|
import me.lucko.luckperms.common.messaging.InternalMessagingService;
|
||||||
import me.lucko.luckperms.common.messaging.LuckPermsMessagingService;
|
import me.lucko.luckperms.common.messaging.LuckPermsMessagingService;
|
||||||
import me.lucko.luckperms.common.messaging.MessagingFactory;
|
import me.lucko.luckperms.common.messaging.MessagingFactory;
|
||||||
|
import me.lucko.luckperms.velocity.LPVelocityPlugin;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user