com/hypixel/hytale/server/core/plugin/JavaPlugin.java
package com.hypixel.hytale.server.core.plugin;
import com.hypixel.hytale.assetstore.AssetPack;
import com.hypixel.hytale.common.plugin.PluginIdentifier;
import com.hypixel.hytale.server.core.asset.AssetModule;
import java.nio.file.Path;
import java.util.logging.Level;
import javax.annotation.Nonnull;
public abstract class JavaPlugin extends PluginBase {
@Nonnull
private final Path file;
@Nonnull
private final PluginClassLoader classLoader;
public JavaPlugin(@Nonnull JavaPluginInit init) {
super(init);
this.file = init.getFile();
this.classLoader = init.getClassLoader();
this.classLoader.setPlugin(this);
}
@Nonnull
public Path getFile() {
return this.file;
}
protected void start0() {
super.start0();
if (this.getManifest().includesAssetPack()) {
AssetModule assetModule = AssetModule.get();
String id = (new PluginIdentifier(this.getManifest())).toString();
AssetPack existing = assetModule.getAssetPack(id);
if (existing != null) {
this.getLogger().at(Level.WARNING).log("Asset pack %s already exists, skipping embedded pack", id);
return;
}
assetModule.registerPack(id, this.file, this.getManifest());
}
}
@Nonnull
public PluginClassLoader getClassLoader() {
return this.classLoader;
}
@Nonnull
public final PluginType getType() {
return PluginType.PLUGIN;
}
}
com/hypixel/hytale/server/core/plugin/JavaPluginInit.java
package com.hypixel.hytale.server.core.plugin;
import com.hypixel.hytale.common.plugin.PluginManifest;
import java.nio.file.Path;
import javax.annotation.Nonnull;
public class JavaPluginInit extends PluginInit {
@Nonnull
private final Path file;
@Nonnull
private final PluginClassLoader classLoader;
public JavaPluginInit(@Nonnull PluginManifest pluginManifest, @Nonnull Path dataDirectory, @Nonnull Path file, @Nonnull PluginClassLoader classLoader) {
super(pluginManifest, dataDirectory);
this.file = file;
this.classLoader = classLoader;
}
@Nonnull
public Path getFile() {
return this.file;
}
@Nonnull
public PluginClassLoader getClassLoader() {
return this.classLoader;
}
public boolean isInServerClassPath() {
return this.classLoader.isInServerClassPath();
}
}
com/hypixel/hytale/server/core/plugin/MissingPluginDependencyException.java
package com.hypixel.hytale.server.core.plugin;
import javax.annotation.Nonnull;
public class MissingPluginDependencyException extends RuntimeException {
public MissingPluginDependencyException(@Nonnull String message) {
super(message);
}
}
com/hypixel/hytale/server/core/plugin/PluginBase.java
package com.hypixel.hytale.server.core.plugin;
import com.hypixel.hytale.assetstore.JsonAsset;
import com.hypixel.hytale.assetstore.codec.AssetCodecMapCodec;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.codecs.EnumCodec;
import com.hypixel.hytale.codec.lookup.MapKeyMapCodec;
import com.hypixel.hytale.codec.lookup.StringCodecMapCodec;
import com.hypixel.hytale.common.plugin.PluginIdentifier;
import com.hypixel.hytale.common.plugin.PluginManifest;
import com.hypixel.hytale.component.ComponentRegistryProxy;
import com.hypixel.hytale.event.EventRegistry;
import com.hypixel.hytale.function.consumer.BooleanConsumer;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.metrics.MetricProvider;
import com.hypixel.hytale.metrics.MetricsRegistry;
import com.hypixel.hytale.server.core.HytaleServer;
import com.hypixel.hytale.server.core.command.system.CommandOwner;
import com.hypixel.hytale.server.core.command.system.CommandRegistry;
import com.hypixel.hytale.server.core.modules.entity.EntityRegistry;
import com.hypixel.hytale.server.core.plugin.registry.AssetRegistry;
import com.hypixel.hytale.server.core.plugin.registry.CodecMapRegistry;
import com.hypixel.hytale.server.core.plugin.registry.IRegistry;
import com.hypixel.hytale.server.core.plugin.registry.MapKeyMapRegistry;
import com.hypixel.hytale.server.core.registry.ClientFeatureRegistry;
import com.hypixel.hytale.server.core.task.TaskRegistry;
import com.hypixel.hytale.server.core.universe.world.meta.BlockStateRegistry;
import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
com.hypixel.hytale.server.core.util.Config;
java.nio.file.Path;
java.util.List;
java.util.Map;
java.util.concurrent.CompletableFuture;
java.util.concurrent.ConcurrentHashMap;
java.util.concurrent.CopyOnWriteArrayList;
java.util.function.Function;
java.util.logging.Level;
javax.annotation.Nonnull;
javax.annotation.Nullable;
{
MetricsRegistry<PluginBase> METRICS_REGISTRY;
HytaleLogger logger;
PluginIdentifier identifier;
PluginManifest manifest;
Path dataDirectory;
List<Config<?>> configs = ();
PluginState state;
String notEnabledString;
CopyOnWriteArrayList<BooleanConsumer> shutdownTasks;
ClientFeatureRegistry clientFeatureRegistry;
CommandRegistry commandRegistry;
EventRegistry eventRegistry;
BlockStateRegistry blockStateRegistry;
EntityRegistry entityRegistry;
TaskRegistry taskRegistry;
ComponentRegistryProxy<EntityStore> entityStoreRegistry;
ComponentRegistryProxy<ChunkStore> chunkStoreRegistry;
AssetRegistry assetRegistry;
Map<Codec<?>, IRegistry> codecMapRegistries;
String basePermission;
{
.state = PluginState.NONE;
String.valueOf(.getIdentifier());
.notEnabledString = + var10001 + ;
.shutdownTasks = ();
.clientFeatureRegistry = (.shutdownTasks, () -> .state != PluginState.NONE && .state != PluginState.DISABLED, .notEnabledString, );
.commandRegistry = (.shutdownTasks, () -> .state != PluginState.NONE && .state != PluginState.DISABLED, .notEnabledString, );
.eventRegistry = (.shutdownTasks, () -> .state != PluginState.NONE && .state != PluginState.DISABLED, .notEnabledString, HytaleServer.get().getEventBus());
.blockStateRegistry = (.shutdownTasks, () -> .state != PluginState.NONE && .state != PluginState.DISABLED, .notEnabledString);
.entityRegistry = (.shutdownTasks, () -> .state != PluginState.NONE && .state != PluginState.DISABLED, .notEnabledString);
.taskRegistry = (.shutdownTasks, () -> .state != PluginState.NONE && .state != PluginState.DISABLED, .notEnabledString);
.entityStoreRegistry = <EntityStore>(.shutdownTasks, EntityStore.REGISTRY);
.chunkStoreRegistry = <ChunkStore>(.shutdownTasks, ChunkStore.REGISTRY);
.assetRegistry = (.shutdownTasks);
.codecMapRegistries = ();
init.getPluginManifest();
pluginManifest.getName();
.getType() == PluginType.PLUGIN;
.logger = HytaleLogger.get(pluginName + (isPlugin ? : ));
.dataDirectory = init.getDataDirectory();
.identifier = (pluginManifest);
.manifest = pluginManifest;
(!init.isInServerClassPath()) {
.logger.setPropagatesSentryToParent();
}
var10001 = pluginManifest.getGroup();
.basePermission = (var10001 + + pluginName).toLowerCase();
}
<T> Config<T> {
.<T>withConfig(, configCodec);
}
<T> Config<T> {
(.state != PluginState.NONE) {
();
} {
Config<T> config = <T>(.dataDirectory, name, configCodec);
.configs.add(config);
config;
}
}
CompletableFuture<Void> {
(.configs.isEmpty()) {
;
} {
CompletableFuture<?>[] futures = [.configs.size()];
( ; i < .configs.size(); ++i) {
futures[i] = ((Config).configs.get(i)).load();
}
CompletableFuture.allOf(futures);
}
}
String {
.identifier.toString();
}
HytaleLogger {
.logger;
}
PluginIdentifier {
.identifier;
}
PluginManifest {
.manifest;
}
Path {
.dataDirectory;
}
PluginState {
.state;
}
ClientFeatureRegistry {
.clientFeatureRegistry;
}
CommandRegistry {
.commandRegistry;
}
EventRegistry {
.eventRegistry;
}
BlockStateRegistry {
.blockStateRegistry;
}
EntityRegistry {
.entityRegistry;
}
TaskRegistry {
.taskRegistry;
}
ComponentRegistryProxy<EntityStore> {
.entityStoreRegistry;
}
ComponentRegistryProxy<ChunkStore> {
.chunkStoreRegistry;
}
AssetRegistry {
.assetRegistry;
}
<T, C <? >> CodecMapRegistry<T, C> {
(IRegistry).codecMapRegistries.computeIfAbsent(mapCodec, (v) -> (.shutdownTasks, mapCodec));
(CodecMapRegistry)registry;
}
<K, T <K>> CodecMapRegistry.Assets<T, ?> getCodecRegistry( AssetCodecMapCodec<K, T> mapCodec) {
(IRegistry).codecMapRegistries.computeIfAbsent(mapCodec, (v) -> .Assets(.shutdownTasks, mapCodec));
(CodecMapRegistry.Assets)registry;
}
<V> MapKeyMapRegistry<V> {
(IRegistry).codecMapRegistries.computeIfAbsent(mapCodec, (v) -> (.shutdownTasks, mapCodec));
(MapKeyMapRegistry)registry;
}
String {
.basePermission;
}
{
.state == PluginState.NONE || .state == PluginState.DISABLED || .state == PluginState.SHUTDOWN;
}
{
!.isDisabled();
}
{
(.state != PluginState.NONE && .state != PluginState.DISABLED) {
(String.valueOf(.state));
} {
.state = PluginState.SETUP;
{
.setup();
} (Throwable t) {
((HytaleLogger.Api).logger.at(Level.SEVERE).withCause(t)).log(, .identifier);
.state = PluginState.DISABLED;
}
}
}
{
}
{
(.state != PluginState.SETUP) {
(String.valueOf(.state));
} {
.state = PluginState.START;
{
.start();
.state = PluginState.ENABLED;
} (Throwable t) {
((HytaleLogger.Api).logger.at(Level.SEVERE).withCause(t)).log(, .identifier);
.state = PluginState.DISABLED;
}
}
}
{
}
{
.state = PluginState.SHUTDOWN;
{
.shutdown();
.state = PluginState.DISABLED;
} (Throwable t) {
((HytaleLogger.Api).logger.at(Level.SEVERE).withCause(t)).log(, .identifier);
}
.cleanup(shutdown);
}
{
}
{
.commandRegistry.shutdown();
.eventRegistry.shutdown();
.clientFeatureRegistry.shutdown();
.blockStateRegistry.shutdown();
.taskRegistry.shutdown();
.entityStoreRegistry.shutdown();
.chunkStoreRegistry.shutdown();
.codecMapRegistries.forEach((k, v) -> v.shutdown());
.assetRegistry.shutdown();
( .shutdownTasks.size() - ; i >= ; --i) {
((BooleanConsumer).shutdownTasks.get(i)).accept(shutdown);
}
}
PluginType ;
{
METRICS_REGISTRY = ( (MetricProvider.maybe(Function.identity()))).register(, (plugin) -> plugin.identifier.toString(), Codec.STRING).register(, PluginBase::getType, (PluginType.class)).register(, (plugin) -> plugin.manifest, PluginManifest.CODEC).register(, (plugin) -> plugin.state, (PluginState.class)).register(, (plugin) -> {
var10000;
(plugin JavaPlugin jp) {
(jp.getClassLoader().isInServerClassPath()) {
var10000 = ;
var10000;
}
}
var10000 = ;
var10000;
}, Codec.BOOLEAN);
}
}
com/hypixel/hytale/server/core/plugin/PluginClassLoader.java
package com.hypixel.hytale.server.core.plugin;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collections;
import java.util.Enumeration;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class PluginClassLoader extends URLClassLoader {
public static final String THIRD_PARTY_LOADER_NAME = "ThirdPartyPlugin";
@Nonnull
private final PluginManager pluginManager;
private final boolean inServerClassPath;
@Nullable
private JavaPlugin plugin;
public PluginClassLoader(@Nonnull PluginManager pluginManager, boolean inServerClassPath, @Nonnull URL... urls) {
super(inServerClassPath ? "BuiltinPlugin" : "ThirdPartyPlugin", urls, (ClassLoader)null);
this.inServerClassPath = inServerClassPath;
this.pluginManager = pluginManager;
}
public boolean isInServerClassPath {
.inServerClassPath;
}
{
.plugin = plugin;
}
Class<?> loadClass( String name, resolve) ClassNotFoundException {
.loadClass0(name, );
}
Class<?> loadClass0( String name, useBridge) ClassNotFoundException {
{
Class<?> loadClass = PluginManager.class.getClassLoader().loadClass(name);
(loadClass != ) {
loadClass;
}
} (ClassNotFoundException var7) {
}
{
Class<?> loadClass = .loadClass(name, );
(loadClass != ) {
loadClass;
}
} (ClassNotFoundException var6) {
}
(useBridge) {
(.plugin != ) {
{
Class<?> loadClass = .pluginManager.getBridgeClassLoader().loadClass0(name, , .plugin.getManifest());
(loadClass != ) {
loadClass;
}
} (ClassNotFoundException var5) {
}
} {
{
Class<?> loadClass = .pluginManager.getBridgeClassLoader().loadClass0(name, );
(loadClass != ) {
loadClass;
}
} (ClassNotFoundException var4) {
}
}
}
(name);
}
Class<?> loadLocalClass( String name) ClassNotFoundException {
(.getClassLoadingLock(name)) {
Class<?> loadedClass = .findLoadedClass(name);
(loadedClass == ) {
{
.getParent();
(parent != ) {
loadedClass = parent.loadClass(name);
}
} (ClassNotFoundException var6) {
}
(loadedClass == ) {
loadedClass = .loadClass0(name, );
}
}
loadedClass;
}
}
URL {
PluginManager.class.getClassLoader().getResource(name);
(resource != ) {
resource;
} {
resource = .getResource(name);
(resource != ) {
resource;
} {
PluginManager. .pluginManager.getBridgeClassLoader();
(.plugin != ) {
resource = bridge.getResource0(name, , .plugin.getManifest());
} {
resource = bridge.getResource0(name, );
}
resource;
}
}
}
Enumeration<URL> IOException {
ObjectArrayList<URL> results = <URL>();
Enumeration<URL> serverResources = PluginManager.class.getClassLoader().getResources(name);
(serverResources.hasMoreElements()) {
results.add((URL)serverResources.nextElement());
}
Enumeration<URL> pluginResources = .getResources(name);
(pluginResources.hasMoreElements()) {
results.add((URL)pluginResources.nextElement());
}
PluginManager. .pluginManager.getBridgeClassLoader();
Enumeration<URL> bridgeResources;
(.plugin != ) {
bridgeResources = bridge.getResources0(name, , .plugin.getManifest());
} {
bridgeResources = bridge.getResources0(name, );
}
(bridgeResources.hasMoreElements()) {
results.add((URL)bridgeResources.nextElement());
}
Collections.enumeration(results);
}
{
() {
(throwable != ) {
(StackTraceElement element : throwable.getStackTrace()) {
(.equals(element.getClassLoaderName())) {
;
}
}
(throwable.getCause() != throwable) {
throwable = throwable.getCause();
;
}
}
;
}
}
{
registerAsParallelCapable();
}
}
com/hypixel/hytale/server/core/plugin/PluginInit.java
package com.hypixel.hytale.server.core.plugin;
import com.hypixel.hytale.common.plugin.PluginManifest;
import java.nio.file.Path;
import javax.annotation.Nonnull;
public class PluginInit {
@Nonnull
private final PluginManifest pluginManifest;
@Nonnull
private final Path dataDirectory;
public PluginInit(@Nonnull PluginManifest pluginManifest, @Nonnull Path dataDirectory) {
this.pluginManifest = pluginManifest;
this.dataDirectory = dataDirectory;
}
@Nonnull
public PluginManifest getPluginManifest() {
return this.pluginManifest;
}
@Nonnull
public Path getDataDirectory() {
return this.dataDirectory;
}
public boolean isInServerClassPath() {
return true;
}
}
com/hypixel/hytale/server/core/plugin/PluginListPageManager.java
package com.hypixel.hytale.server.core.plugin;
import com.hypixel.hytale.common.plugin.PluginIdentifier;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.server.core.plugin.pages.PluginListPage;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.annotation.Nonnull;
public class PluginListPageManager {
public static PluginListPageManager instance;
@Nonnull
private final List<PluginListPage> activePages = new CopyOnWriteArrayList();
public PluginListPageManager() {
instance = this;
}
@Nonnull
public static PluginListPageManager get() {
return instance;
}
public void registerPluginListPage(@Nonnull PluginListPage page) {
if (!this.activePages.contains(page)) {
this.activePages.add(page);
}
}
public void deregisterPluginListPage {
(.activePages.contains(page)) {
.activePages.remove(page);
}
}
{
(PluginBase)plugins.get(pluginIdentifier);
.activePages.forEach((page) -> page.handlePluginChangeEvent(pluginIdentifier, plugin != && plugin.isEnabled()));
}
<EntityStore> {
descriptiveOnly;
{
.descriptiveOnly = ;
}
{
.descriptiveOnly = descriptiveOnly;
}
ComponentType<EntityStore, SessionSettings> {
PluginManager.get().getSessionSettingsComponentType();
}
Component<EntityStore> {
(.descriptiveOnly);
}
}
}
com/hypixel/hytale/server/core/plugin/PluginManager.java
package com.hypixel.hytale.server.core.plugin;
import com.hypixel.hytale.assetstore.AssetRegistry;
import com.hypixel.hytale.assetstore.AssetStore;
import com.hypixel.hytale.codec.ExtraInfo;
import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
import com.hypixel.hytale.codec.util.RawJsonReader;
import com.hypixel.hytale.common.plugin.PluginIdentifier;
import com.hypixel.hytale.common.plugin.PluginManifest;
import com.hypixel.hytale.common.semver.Semver;
import com.hypixel.hytale.common.semver.SemverRange;
import com.hypixel.hytale.common.util.java.ManifestUtil;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.event.IEventDispatcher;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.metrics.MetricsRegistry;
import com.hypixel.hytale.server.core.HytaleServer;
import com.hypixel.hytale.server.core.HytaleServerConfig;
import com.hypixel.hytale.server.core.Options;
import com.hypixel.hytale.server.core.ShutdownReason;
import com.hypixel.hytale.server.core.asset.AssetModule;
import com.hypixel.hytale.server.core.command.system.CommandManager;
import com.hypixel.hytale.server.core.plugin.commands.PluginCommand;
import com.hypixel.hytale.server.core.plugin.event.PluginSetupEvent;
import com.hypixel.hytale.server.core.plugin.pending.PendingLoadJavaPlugin;
import com.hypixel.hytale.server.core.plugin.pending.PendingLoadPlugin;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
java.io.IOException;
java.io.InputStream;
java.io.InputStreamReader;
java.net.JarURLConnection;
java.net.MalformedURLException;
java.net.URI;
java.net.URISyntaxException;
java.net.URL;
java.net.URLClassLoader;
java.net.URLConnection;
java.nio.charset.StandardCharsets;
java.nio.file.DirectoryStream;
java.nio.file.Files;
java.nio.file.LinkOption;
java.nio.file.Path;
java.nio.file.Paths;
java.util.Collections;
java.util.Enumeration;
java.util.HashMap;
java.util.HashSet;
java.util.Iterator;
java.util.List;
java.util.Map;
java.util.concurrent.CompletableFuture;
java.util.concurrent.ConcurrentHashMap;
java.util.concurrent.locks.ReentrantReadWriteLock;
java.util.logging.Level;
javax.annotation.Nonnull;
javax.annotation.Nullable;
{
HytaleLogger.forEnclosingClass();
Path.of();
MetricsRegistry<PluginManager> METRICS_REGISTRY;
PluginManager instance;
(, , []);
List<PendingLoadPlugin> corePlugins = <PendingLoadPlugin>();
(, PluginManager.class.getClassLoader());
();
Map<PluginIdentifier, PluginBase> plugins = <PluginIdentifier, PluginBase>();
Map<Path, PluginClassLoader> classLoaders = ();
;
PluginState state;
List<PendingLoadPlugin> loadOrder;
Map<PluginIdentifier, PluginBase> loading;
Map<PluginIdentifier, PluginManifest> availablePlugins;
PluginListPageManager pluginListPageManager;
ComponentType<EntityStore, PluginListPageManager.SessionSettings> sessionSettingsComponentType;
PluginManager {
instance;
}
{
.state = PluginState.NONE;
.availablePlugins = <PluginIdentifier, PluginManifest>();
instance = ;
.pluginListPageManager = ();
}
{
.corePlugins.add( ((Path), builder, .corePluginClassLoader));
}
{
(manifest);
HytaleServerConfig. (HytaleServerConfig.ModConfig)HytaleServer.get().getConfig().getModConfig().get(identifier);
enabled;
(modConfig != && modConfig.getEnabled() != ) {
enabled = modConfig.getEnabled();
} {
enabled = !manifest.isDisabledByDefault();
}
(enabled) {
;
} {
LOGGER.at(Level.WARNING).log(, identifier);
;
}
}
{
(.state != PluginState.NONE) {
( + String.valueOf(.state));
} {
.state = PluginState.SETUP;
CommandManager.get().registerSystemCommand( ());
.sessionSettingsComponentType = EntityStore.REGISTRY.registerComponent(PluginListPageManager.SessionSettings.class, PluginListPageManager.SessionSettings::);
HashMap<PluginIdentifier, PendingLoadPlugin> pending = ();
.availablePlugins.clear();
LOGGER.at(Level.INFO).log();
( ; i < .corePlugins.size(); ++i) {
(PendingLoadPlugin).corePlugins.get(i);
LOGGER.at(Level.INFO).log(, plugin.getIdentifier());
(.canLoadOnBoot(plugin.getManifest())) {
loadPendingPlugin(pending, plugin);
} {
.availablePlugins.put(plugin.getIdentifier(), plugin.getManifest());
}
}
Path self;
{
self = Paths.get(PluginManager.class.getProtectionDomain().getCodeSource().getLocation().toURI());
} (URISyntaxException e) {
(e);
}
.loadPluginsFromDirectory(pending, self.getParent().resolve(), , .availablePlugins);
.loadPluginsInClasspath(pending, .availablePlugins);
.loadPluginsFromDirectory(pending, MODS_PATH, !Options.getOptionSet().has(Options.BARE), .availablePlugins);
(Path modsPath : Options.getOptionSet().valuesOf(Options.MODS_DIRECTORIES)) {
.loadPluginsFromDirectory(pending, modsPath, , .availablePlugins);
}
.lock.readLock().lock();
{
.plugins.keySet().forEach((key) -> {
pending.remove(key);
LOGGER.at(Level.WARNING).log(, key);
});
Iterator<PendingLoadPlugin> iterator = pending.values().iterator();
(iterator.hasNext()) {
(PendingLoadPlugin)iterator.next();
{
.validatePluginDeps(pendingLoadPlugin, pending);
} (MissingPluginDependencyException e) {
LOGGER.at(Level.SEVERE).log(e.getMessage());
iterator.remove();
}
}
} {
.lock.readLock().unlock();
}
.loadOrder = PendingLoadPlugin.calculateLoadOrder(pending);
.loading = <PluginIdentifier, PluginBase>();
pending.forEach((identifier, pendingLoad) -> .availablePlugins.put(identifier, pendingLoad.getManifest()));
();
.lock.writeLock().lock();
{
LOGGER.at(Level.FINE).log();
(PendingLoadPlugin pendingLoadPlugin : .loadOrder) {
LOGGER.at(Level.FINE).log(, pendingLoadPlugin.getIdentifier());
pendingLoadPlugin.load();
(plugin != ) {
.plugins.put(plugin.getIdentifier(), plugin);
.loading.put(plugin.getIdentifier(), plugin);
CompletableFuture<Void> future = plugin.preLoad();
(future != ) {
preLoadFutures.add(future);
}
}
}
} {
.lock.writeLock().unlock();
}
CompletableFuture.allOf((CompletableFuture[])preLoadFutures.toArray((x$) -> [x$])).join();
(PendingLoadPlugin pendingPlugin : .loadOrder) {
(PluginBase).loading.get(pendingPlugin.getIdentifier());
(plugin != && !.setup(plugin)) {
.loading.remove(pendingPlugin.getIdentifier());
}
}
}
}
{
(.state != PluginState.SETUP) {
( + String.valueOf(.state));
} {
.state = PluginState.START;
(PendingLoadPlugin pendingPlugin : .loadOrder) {
(PluginBase).loading.get(pendingPlugin.getIdentifier());
(plugin != && !.start(plugin)) {
.loading.remove(pendingPlugin.getIdentifier());
}
}
.loadOrder = ;
.loading = ;
();
(Map.Entry<PluginIdentifier, HytaleServerConfig.ModConfig> entry : HytaleServer.get().getConfig().getModConfig().entrySet()) {
(PluginIdentifier)entry.getKey();
HytaleServerConfig. (HytaleServerConfig.ModConfig)entry.getValue();
modConfig.getRequiredVersion();
(requiredVersion != && !.hasPlugin(identifier, requiredVersion)) {
sb.append(String.format(, identifier, modConfig));
;
}
}
(!sb.isEmpty()) {
+ String.valueOf(sb);
LOGGER.at(Level.SEVERE).log(msg);
HytaleServer.get().shutdownServer(ShutdownReason.MISSING_REQUIRED_PLUGIN.withMessage(msg));
}
}
}
{
.state = PluginState.SHUTDOWN;
LOGGER.at(Level.INFO).log();
.lock.writeLock().lock();
{
List<PluginBase> list = <PluginBase>(.plugins.values());
( list.size() - ; i >= ; --i) {
(PluginBase)list.get(i);
(plugin.getState() == PluginState.ENABLED) {
LOGGER.at(Level.FINE).log(, plugin.getType().getDisplayName(), plugin.getIdentifier());
plugin.shutdown0();
HytaleServer.get().doneStop(plugin);
LOGGER.at(Level.INFO).log(, plugin.getIdentifier());
}
}
.plugins.clear();
} {
.lock.writeLock().unlock();
}
}
PluginState {
.state;
}
PluginBridgeClassLoader {
.bridgeClassLoader;
}
{
ManifestUtil.getVersion();
pendingLoadPlugin.getManifest().getServerVersion();
(serverVersionRange != && serverVersion != && !serverVersionRange.satisfies(serverVersion)) {
(String.format(, pendingLoadPlugin.getIdentifier(), serverVersion));
} {
(Map.Entry<PluginIdentifier, SemverRange> entry : pendingLoadPlugin.getManifest().getDependencies().entrySet()) {
(PluginIdentifier)entry.getKey();
;
(pending != ) {
(PendingLoadPlugin)pending.get(identifier);
(pendingDependency != ) {
dependency = pendingDependency.getManifest();
}
}
(dependency == ) {
(PluginBase).plugins.get(identifier);
(loadedBase != ) {
dependency = loadedBase.getManifest();
}
}
(dependency == ) {
(String.format(, pendingLoadPlugin.getIdentifier(), identifier));
}
(SemverRange)entry.getValue();
(!dependency.getVersion().satisfies(expectedVersion)) {
(String.format(, pendingLoadPlugin.getIdentifier(), identifier, dependency.getVersion(), expectedVersion));
}
}
}
}
{
(!Files.isDirectory(path, [])) {
(create) {
{
Files.createDirectories(path);
} (IOException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log(, path);
}
}
} {
LOGGER.at(Level.INFO).log( + String.valueOf(path));
{
DirectoryStream<Path> stream = Files.newDirectoryStream(path);
{
(Path file : stream) {
(Files.isRegularFile(file, []) && file.getFileName().toString().toLowerCase().endsWith()) {
.loadPendingJavaPlugin(file);
(plugin != ) {
plugin.getPath() != ;
LOGGER.at(Level.INFO).log(, plugin.getIdentifier(), path.relativize(plugin.getPath()));
(.canLoadOnBoot(plugin.getManifest())) {
loadPendingPlugin(pending, plugin);
} {
bootRejectMap.put(plugin.getIdentifier(), plugin.getManifest());
}
}
}
}
} (Throwable var11) {
(stream != ) {
{
stream.close();
} (Throwable var10) {
var11.addSuppressed(var10);
}
}
var11;
}
(stream != ) {
stream.close();
}
} (IOException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log(, path);
}
}
}
PendingLoadJavaPlugin {
{
file.toUri().toURL();
(PluginClassLoader).classLoaders.computeIfAbsent(file, (path) -> (, , []{url}));
pluginClassLoader.findResource();
(resource == ) {
LOGGER.at(Level.SEVERE).log(, file.toString());
;
}
resource.openStream();
PendingLoadJavaPlugin var11;
{
(stream, StandardCharsets.UTF_8);
{
[] buffer = ([])RawJsonReader.READ_BUFFER.get();
(reader, buffer);
(ExtraInfo)ExtraInfo.THREAD_LOCAL.get();
PluginManifest.CODEC.decodeJson(rawJsonReader, extraInfo);
extraInfo.getValidationResults().logOrThrowValidatorExceptions(LOGGER);
var11 = (file, manifest, pluginClassLoader);
} (Throwable var14) {
{
reader.close();
} (Throwable var13) {
var14.addSuppressed(var13);
}
var14;
}
reader.close();
} (Throwable var15) {
(stream != ) {
{
stream.close();
} (Throwable var12) {
var15.addSuppressed(var12);
}
}
var15;
}
(stream != ) {
stream.close();
}
var11;
} (MalformedURLException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log(, file.toString());
} (IOException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log(, file.toString());
}
;
}
{
LOGGER.at(Level.INFO).log();
{
PluginManager.class.getProtectionDomain().getCodeSource().getLocation().toURI();
PluginManager.class.getClassLoader();
{
(URL manifestUrl : (Collections.list(classLoader.getResources()))) {
manifestUrl.openConnection();
connection.getInputStream();
{
(stream, StandardCharsets.UTF_8);
{
[] buffer = ([])RawJsonReader.READ_BUFFER.get();
(reader, buffer);
(ExtraInfo)ExtraInfo.THREAD_LOCAL.get();
PluginManifest.CODEC.decodeJson(rawJsonReader, extraInfo);
extraInfo.getValidationResults().logOrThrowValidatorExceptions(LOGGER);
PendingLoadJavaPlugin plugin;
(connection JarURLConnection jarURLConnection) {
jarURLConnection.getJarFileURL();
Path.of(classpathUrl.toURI());
(PluginClassLoader).classLoaders.computeIfAbsent(path, (f) -> (, , []{classpathUrl}));
plugin = (path, manifest, pluginClassLoader);
} {
manifestUrl.toURI().resolve();
Paths.get(pluginUri);
pluginUri.toURL();
(PluginClassLoader).classLoaders.computeIfAbsent(path, (f) -> (, , []{classpathUrl}));
plugin = (path, manifest, pluginClassLoader);
}
LOGGER.at(Level.INFO).log(, plugin.getIdentifier());
(.canLoadOnBoot(plugin.getManifest())) {
loadPendingPlugin(pending, plugin);
} {
rejectedBootList.put(plugin.getIdentifier(), plugin.getManifest());
}
} (Throwable var25) {
{
reader.close();
} (Throwable var24) {
var25.addSuppressed(var24);
}
var25;
}
reader.close();
} (Throwable var28) {
(stream != ) {
{
stream.close();
} (Throwable var23) {
var28.addSuppressed(var23);
}
}
var28;
}
(stream != ) {
stream.close();
}
}
classLoader.getResource();
(manifestsUrl != ) {
manifestsUrl.openStream();
{
(stream, StandardCharsets.UTF_8);
{
[] buffer = ([])RawJsonReader.READ_BUFFER.get();
(reader, buffer);
(ExtraInfo)ExtraInfo.THREAD_LOCAL.get();
PluginManifest[] manifests = PluginManifest.ARRAY_CODEC.decodeJson(rawJsonReader, extraInfo);
extraInfo.getValidationResults().logOrThrowValidatorExceptions(LOGGER);
uri.toURL();
Paths.get(uri);
(PluginClassLoader).classLoaders.computeIfAbsent(path, (f) -> (, , []{url}));
(PluginManifest manifest : manifests) {
(path, manifest, pluginClassLoader);
LOGGER.at(Level.INFO).log(, plugin.getIdentifier());
(.canLoadOnBoot(plugin.getManifest())) {
loadPendingPlugin(pending, plugin);
} {
rejectedBootList.put(plugin.getIdentifier(), plugin.getManifest());
}
}
} (Throwable var26) {
{
reader.close();
} (Throwable var22) {
var26.addSuppressed(var22);
}
var26;
}
reader.close();
} (Throwable var27) {
(stream != ) {
{
stream.close();
} (Throwable var21) {
var27.addSuppressed(var21);
}
}
var27;
}
(stream != ) {
stream.close();
}
}
} (IOException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log(, uri.toString());
}
} (URISyntaxException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log();
}
}
List<PluginBase> {
.lock.readLock().lock();
ObjectArrayList var1;
{
var1 = (.plugins.values());
} {
.lock.readLock().unlock();
}
var1;
}
PluginBase {
.lock.readLock().lock();
PluginBase var2;
{
var2 = (PluginBase).plugins.get(identifier);
} {
.lock.readLock().unlock();
}
var2;
}
{
.getPlugin(identifier);
plugin != && plugin.getManifest().getVersion().satisfies(range);
}
{
.unload(identifier) && .load(identifier);
.pluginListPageManager.notifyPluginChange(.plugins, identifier);
result;
}
{
.lock.writeLock().lock();
AssetRegistry.ASSET_LOCK.writeLock().lock();
var7;
{
(PluginBase).plugins.get(identifier);
(plugin.getState() != PluginState.ENABLED) {
.pluginListPageManager.notifyPluginChange(.plugins, identifier);
var7 = ;
var7;
}
plugin.shutdown0();
HytaleServer.get().doneStop(plugin);
.plugins.remove(identifier);
(plugin JavaPlugin javaPlugin) {
.unloadJavaPlugin(javaPlugin);
}
.pluginListPageManager.notifyPluginChange(.plugins, identifier);
var7 = ;
} {
AssetRegistry.ASSET_LOCK.writeLock().unlock();
.lock.writeLock().unlock();
}
var7;
}
{
plugin.getFile();
(PluginClassLoader).classLoaders.remove(path);
(classLoader != ) {
{
classLoader.close();
} (IOException var5) {
LOGGER.at(Level.SEVERE).log(, plugin.getIdentifier());
}
}
}
{
.lock.readLock().lock();
label38: {
var3;
{
(PluginBase).plugins.get(identifier);
(plugin == ) {
label38;
}
.pluginListPageManager.notifyPluginChange(.plugins, identifier);
var3 = ;
} {
.lock.readLock().unlock();
}
var3;
}
.findAndLoadPlugin(identifier);
.pluginListPageManager.notifyPluginChange(.plugins, identifier);
result;
}
{
(PendingLoadPlugin plugin : .corePlugins) {
(plugin.getIdentifier().equals(identifier)) {
.load(plugin);
}
}
{
PluginManager.class.getProtectionDomain().getCodeSource().getLocation().toURI();
PluginManager.class.getClassLoader();
(URL manifestUrl : (Collections.list(classLoader.getResources()))) {
manifestUrl.openStream();
var15;
label164: {
{
(stream, StandardCharsets.UTF_8);
label160: {
{
[] buffer = ([])RawJsonReader.READ_BUFFER.get();
(reader, buffer);
(ExtraInfo)ExtraInfo.THREAD_LOCAL.get();
PluginManifest.CODEC.decodeJson(rawJsonReader, extraInfo);
extraInfo.getValidationResults().logOrThrowValidatorExceptions(LOGGER);
(!( (manifest)).equals(identifier)) {
label160;
}
(, , []{uri.toURL()});
(Paths.get(uri), manifest, pluginClassLoader);
var15 = .load((PendingLoadPlugin)plugin);
} (Throwable var24) {
{
reader.close();
} (Throwable var22) {
var24.addSuppressed(var22);
}
var24;
}
reader.close();
label164;
}
reader.close();
} (Throwable var25) {
(stream != ) {
{
stream.close();
} (Throwable var21) {
var25.addSuppressed(var21);
}
}
var25;
}
(stream != ) {
stream.close();
}
;
}
(stream != ) {
stream.close();
}
var15;
}
classLoader.getResource();
(manifestsUrl != ) {
label233: {
manifestsUrl.openStream();
var18;
label191: {
{
InputStreamReader reader;
label229: {
reader = (stream, StandardCharsets.UTF_8);
{
[] buffer = ([])RawJsonReader.READ_BUFFER.get();
(reader, buffer);
(ExtraInfo)ExtraInfo.THREAD_LOCAL.get();
PluginManifest[] manifests = PluginManifest.ARRAY_CODEC.decodeJson(rawJsonReader, extraInfo);
extraInfo.getValidationResults().logOrThrowValidatorExceptions(LOGGER);
PluginManifest[] var50 = manifests;
manifests.length;
;
() {
(var53 >= var52) {
label229;
}
var50[var53];
(( (manifest)).equals(identifier)) {
(, , []{uri.toURL()});
(Paths.get(uri), manifest, pluginClassLoader);
var18 = .load((PendingLoadPlugin)plugin);
;
}
++var53;
}
} (Throwable var26) {
{
reader.close();
} (Throwable var20) {
var26.addSuppressed(var20);
}
var26;
}
reader.close();
label191;
}
reader.close();
} (Throwable var27) {
(stream != ) {
{
stream.close();
} (Throwable var19) {
var27.addSuppressed(var19);
}
}
var27;
}
(stream != ) {
stream.close();
}
label233;
}
(stream != ) {
stream.close();
}
var18;
}
}
Paths.get(uri).getParent().resolve();
(Files.exists(path, [])) {
{
label232: {
DirectoryStream<Path> stream = Files.newDirectoryStream(path);
var51;
label210: {
{
(Path file : stream) {
(Files.isRegularFile(file, []) && file.getFileName().toString().toLowerCase().endsWith()) {
loadManifest(file);
(manifest != && ( (manifest)).equals(identifier)) {
.loadPendingJavaPlugin(file);
(pendingLoadJavaPlugin != ) {
var51 = .load((PendingLoadPlugin)pendingLoadJavaPlugin);
label210;
}
;
}
}
}
} (Throwable var28) {
(stream != ) {
{
stream.close();
} (Throwable var23) {
var28.addSuppressed(var23);
}
}
var28;
}
(stream != ) {
stream.close();
}
label232;
}
(stream != ) {
stream.close();
}
var51;
}
} (IOException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log();
}
}
} (URISyntaxException | IOException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log();
}
.findPluginInDirectory(identifier, MODS_PATH);
(result != ) {
result;
} {
(Path modsPath : Options.getOptionSet().valuesOf(Options.MODS_DIRECTORIES)) {
result = .findPluginInDirectory(identifier, modsPath);
(result != ) {
result;
}
}
;
}
}
Boolean {
(!Files.isDirectory(modsPath, [])) {
;
} {
{
DirectoryStream<Path> stream = Files.newDirectoryStream(modsPath);
Boolean var8;
label79: {
label85: {
{
(Path file : stream) {
(Files.isRegularFile(file, []) && file.getFileName().toString().toLowerCase().endsWith()) {
loadManifest(file);
(manifest != && ( (manifest)).equals(identifier)) {
.loadPendingJavaPlugin(file);
(pendingLoadJavaPlugin != ) {
var8 = .load((PendingLoadPlugin)pendingLoadJavaPlugin);
label85;
}
var8 = ;
label79;
}
}
}
} (Throwable var10) {
(stream != ) {
{
stream.close();
} (Throwable var9) {
var10.addSuppressed(var9);
}
}
var10;
}
(stream != ) {
stream.close();
}
;
}
(stream != ) {
stream.close();
}
var8;
}
(stream != ) {
stream.close();
}
var8;
} (IOException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log(, modsPath);
;
}
}
}
PluginManifest {
{
( []{file.toUri().toURL()}, PluginManager.class.getClassLoader());
PluginManifest var8;
{
urlClassLoader.findResource().openStream();
{
(stream, StandardCharsets.UTF_8);
{
[] buffer = ([])RawJsonReader.READ_BUFFER.get();
(reader, buffer);
(ExtraInfo)ExtraInfo.THREAD_LOCAL.get();
PluginManifest.CODEC.decodeJson(rawJsonReader, extraInfo);
extraInfo.getValidationResults().logOrThrowValidatorExceptions(LOGGER);
var8 = manifest;
} (Throwable var12) {
{
reader.close();
} (Throwable var11) {
var12.addSuppressed(var11);
}
var12;
}
reader.close();
} (Throwable var13) {
(stream != ) {
{
stream.close();
} (Throwable var10) {
var13.addSuppressed(var10);
}
}
var13;
}
(stream != ) {
stream.close();
}
} (Throwable var14) {
{
urlClassLoader.close();
} (Throwable var9) {
var14.addSuppressed(var9);
}
var14;
}
urlClassLoader.close();
var8;
} (IOException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log(, file);
;
}
}
{
(pendingLoadPlugin == ) {
;
} {
.validatePluginDeps(pendingLoadPlugin, (Map));
pendingLoadPlugin.load();
(plugin != ) {
.lock.writeLock().lock();
{
.plugins.put(plugin.getIdentifier(), plugin);
} {
.lock.writeLock().unlock();
}
CompletableFuture<Void> preload = plugin.preLoad();
(preload == ) {
.setup(plugin) && .start(plugin);
.pluginListPageManager.notifyPluginChange(.plugins, plugin.getIdentifier());
result;
}
preload.thenAccept((v) -> {
.setup(plugin);
.start(plugin);
.pluginListPageManager.notifyPluginChange(.plugins, plugin.getIdentifier());
});
}
.pluginListPageManager.notifyPluginChange(.plugins, pendingLoadPlugin.getIdentifier());
;
}
}
{
(plugin.getState() == PluginState.NONE && .dependenciesMatchState(plugin, PluginState.SETUP, PluginState.SETUP)) {
LOGGER.at(Level.FINE).log(, plugin.getIdentifier());
AssetStore.DISABLE_DYNAMIC_DEPENDENCIES;
AssetStore.DISABLE_DYNAMIC_DEPENDENCIES = ;
plugin.setup0();
AssetStore.DISABLE_DYNAMIC_DEPENDENCIES = prev;
AssetModule.get().initPendingStores();
HytaleServer.get().doneSetup(plugin);
(plugin.getState() != PluginState.DISABLED) {
IEventDispatcher<PluginSetupEvent, PluginSetupEvent> dispatch = HytaleServer.get().getEventBus().dispatchFor(PluginSetupEvent.class, plugin.getClass());
(dispatch.hasListener()) {
dispatch.dispatch( (plugin));
}
;
}
plugin.shutdown0();
.plugins.remove(plugin.getIdentifier());
} {
plugin.shutdown0();
.plugins.remove(plugin.getIdentifier());
}
;
}
{
(plugin.getState() == PluginState.SETUP && .dependenciesMatchState(plugin, PluginState.ENABLED, PluginState.START)) {
LOGGER.at(Level.FINE).log(, plugin.getIdentifier());
plugin.start0();
HytaleServer.get().doneStart(plugin);
(plugin.getState() != PluginState.DISABLED) {
LOGGER.at(Level.INFO).log(, plugin.getIdentifier());
;
}
plugin.shutdown0();
.plugins.remove(plugin.getIdentifier());
} {
plugin.shutdown0();
.plugins.remove(plugin.getIdentifier());
}
;
}
{
(PluginIdentifier dependencyOnManifest : plugin.getManifest().getDependencies().keySet()) {
(PluginBase).plugins.get(dependencyOnManifest);
(dependency == || dependency.getState() != requiredState) {
HytaleLogger. LOGGER.at(Level.SEVERE);
plugin.getName();
var10000.log(var10001 + + dependencyOnManifest.getName() + + String.valueOf(stage));
LOGGER.at(Level.SEVERE).log(plugin.getName() + );
;
}
}
;
}
{
(pending.putIfAbsent(plugin.getIdentifier(), plugin) != ) {
();
} {
(PendingLoadPlugin subPlugin : plugin.createSubPendingLoadPlugins()) {
loadPendingPlugin(pending, subPlugin);
}
}
}
Map<PluginIdentifier, PluginManifest> {
.availablePlugins;
}
ComponentType<EntityStore, PluginListPageManager.SessionSettings> getSessionSettingsComponentType() {
.sessionSettingsComponentType;
}
{
METRICS_REGISTRY = ( ()).register(, (pluginManager) -> (PluginBase[])pluginManager.getPlugins().toArray((x$) -> [x$]), (PluginBase.METRICS_REGISTRY, (x$) -> [x$]));
}
{
PluginManager pluginManager;
{
(parent);
.pluginManager = pluginManager;
}
Class<?> loadClass( String name, resolve) ClassNotFoundException {
.loadClass0(name, (PluginClassLoader));
}
Class<?> loadClass0( String name, PluginClassLoader pluginClassLoader) ClassNotFoundException {
.pluginManager.lock.readLock().lock();
Class var7;
{
.pluginManager.plugins.entrySet().iterator();
Class<?> loadClass;
{
(!var3.hasNext()) {
();
}
Map.Entry<PluginIdentifier, PluginBase> entry = (Map.Entry)var3.next();
(PluginBase)entry.getValue();
loadClass = tryGetClass(name, pluginClassLoader, pluginBase);
} (loadClass == );
var7 = loadClass;
} {
.pluginManager.lock.readLock().unlock();
}
var7;
}
Class<?> loadClass0( String name, PluginClassLoader pluginClassLoader, PluginManifest manifest) ClassNotFoundException {
.pluginManager.lock.readLock().lock();
Class var8;
{
manifest.getDependencies().keySet().iterator();
Class<?> loadClass;
{
(!var4.hasNext()) {
(PluginIdentifier pluginIdentifier : manifest.getOptionalDependencies().keySet()) {
(!manifest.getDependencies().containsKey(pluginIdentifier)) {
(PluginBase).pluginManager.plugins.get(pluginIdentifier);
(pluginBase != ) {
loadClass = tryGetClass(name, pluginClassLoader, pluginBase);
(loadClass != ) {
var8 = loadClass;
var8;
}
}
}
}
(Map.Entry<PluginIdentifier, PluginBase> entry : .pluginManager.plugins.entrySet()) {
(!manifest.getDependencies().containsKey(entry.getKey()) && !manifest.getOptionalDependencies().containsKey(entry.getKey())) {
(PluginBase)entry.getValue();
loadClass = tryGetClass(name, pluginClassLoader, pluginBase);
(loadClass != ) {
var8 = loadClass;
var8;
}
}
}
();
}
(PluginIdentifier)var4.next();
(PluginBase).pluginManager.plugins.get(pluginIdentifier);
loadClass = tryGetClass(name, pluginClassLoader, pluginBase);
} (loadClass == );
var8 = loadClass;
} {
.pluginManager.lock.readLock().unlock();
}
var8;
}
Class<?> tryGetClass( String name, PluginClassLoader pluginClassLoader, PluginBase pluginBase) {
(!(pluginBase JavaPlugin)) {
;
} {
{
((JavaPlugin)pluginBase).getClassLoader();
(classLoader != pluginClassLoader) {
Class<?> loadClass = classLoader.loadLocalClass(name);
(loadClass != ) {
loadClass;
}
}
} (ClassNotFoundException var5) {
}
;
}
}
URL {
.pluginManager.lock.readLock().lock();
URL var6;
{
.pluginManager.plugins.entrySet().iterator();
URL resource;
{
(!var3.hasNext()) {
;
}
Map.Entry<PluginIdentifier, PluginBase> entry = (Map.Entry)var3.next();
resource = tryGetResource(name, pluginClassLoader, (PluginBase)entry.getValue());
} (resource == );
var6 = resource;
} {
.pluginManager.lock.readLock().unlock();
}
var6;
}
URL {
.pluginManager.lock.readLock().lock();
URL resource;
{
manifest.getDependencies().keySet().iterator();
URL resource;
{
(!var4.hasNext()) {
(PluginIdentifier pluginIdentifier : manifest.getOptionalDependencies().keySet()) {
(!manifest.getDependencies().containsKey(pluginIdentifier)) {
(PluginBase).pluginManager.plugins.get(pluginIdentifier);
(pluginBase != ) {
resource = tryGetResource(name, pluginClassLoader, pluginBase);
(resource != ) {
resource;
var8;
}
}
}
}
(Map.Entry<PluginIdentifier, PluginBase> entry : .pluginManager.plugins.entrySet()) {
(!manifest.getDependencies().containsKey(entry.getKey()) && !manifest.getOptionalDependencies().containsKey(entry.getKey())) {
resource = tryGetResource(name, pluginClassLoader, (PluginBase)entry.getValue());
(resource != ) {
resource = resource;
resource;
}
}
}
;
}
(PluginIdentifier)var4.next();
resource = tryGetResource(name, pluginClassLoader, (PluginBase).pluginManager.plugins.get(pluginIdentifier));
} (resource == );
resource = resource;
} {
.pluginManager.lock.readLock().unlock();
}
resource;
}
Enumeration<URL> {
ObjectArrayList<URL> results = <URL>();
.pluginManager.lock.readLock().lock();
{
(Map.Entry<PluginIdentifier, PluginBase> entry : .pluginManager.plugins.entrySet()) {
tryGetResource(name, pluginClassLoader, (PluginBase)entry.getValue());
(resource != ) {
results.add(resource);
}
}
} {
.pluginManager.lock.readLock().unlock();
}
Collections.enumeration(results);
}
Enumeration<URL> {
ObjectArrayList<URL> results = <URL>();
.pluginManager.lock.readLock().lock();
{
(PluginIdentifier pluginIdentifier : manifest.getDependencies().keySet()) {
tryGetResource(name, pluginClassLoader, (PluginBase).pluginManager.plugins.get(pluginIdentifier));
(resource != ) {
results.add(resource);
}
}
(PluginIdentifier pluginIdentifier : manifest.getOptionalDependencies().keySet()) {
(!manifest.getDependencies().containsKey(pluginIdentifier)) {
(PluginBase).pluginManager.plugins.get(pluginIdentifier);
(pluginBase != ) {
tryGetResource(name, pluginClassLoader, pluginBase);
(resource != ) {
results.add(resource);
}
}
}
}
(Map.Entry<PluginIdentifier, PluginBase> entry : .pluginManager.plugins.entrySet()) {
(!manifest.getDependencies().containsKey(entry.getKey()) && !manifest.getOptionalDependencies().containsKey(entry.getKey())) {
tryGetResource(name, pluginClassLoader, (PluginBase)entry.getValue());
(resource != ) {
results.add(resource);
}
}
}
} {
.pluginManager.lock.readLock().unlock();
}
Collections.enumeration(results);
}
URL {
(pluginBase JavaPlugin javaPlugin) {
javaPlugin.getClassLoader();
classLoader != pluginClassLoader ? classLoader.findResource(name) : ;
} {
;
}
}
{
registerAsParallelCapable();
}
}
}
com/hypixel/hytale/server/core/plugin/PluginState.java
package com.hypixel.hytale.server.core.plugin;
public enum PluginState {
NONE,
SETUP,
START,
ENABLED,
SHUTDOWN,
DISABLED;
private PluginState() {
}
}
com/hypixel/hytale/server/core/plugin/PluginType.java
package com.hypixel.hytale.server.core.plugin;
import javax.annotation.Nonnull;
public enum PluginType {
PLUGIN("Plugin");
@Nonnull
private final String displayName;
private PluginType(@Nonnull final String displayName) {
this.displayName = displayName;
}
@Nonnull
public String getDisplayName() {
return this.displayName;
}
}
com/hypixel/hytale/server/core/plugin/commands/PluginCommand.java
package com.hypixel.hytale.server.core.plugin.commands;
import com.hypixel.hytale.common.plugin.PluginIdentifier;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.HytaleServer;
import com.hypixel.hytale.server.core.HytaleServerConfig;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.ParseResult;
import com.hypixel.hytale.server.core.command.system.arguments.system.FlagArg;
import com.hypixel.hytale.server.core.command.system.arguments.system.RequiredArg;
import com.hypixel.hytale.server.core.command.system.arguments.types.SingleArgumentType;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractCommandCollection;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractPlayerCommand;
import com.hypixel.hytale.server.core.command.system.basecommands.CommandBase;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.plugin.PluginBase;
import com.hypixel.hytale.server.core.plugin.PluginManager;
import com.hypixel.hytale.server.core.plugin.PluginState;
import com.hypixel.hytale.server.core.plugin.pages.PluginListPage;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.server.core.util.message.MessageFormat;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
public {
SingleArgumentType<PluginIdentifier> PLUGIN_IDENTIFIER_ARG_TYPE = <PluginIdentifier>(, , []) {
PluginIdentifier {
{
PluginIdentifier.fromString(input);
} (Exception e) {
parseResult.fail(Message.translation().param(, input).param(, e.getMessage()));
;
}
}
};
{
(, );
.addAliases( []{, });
.addSubCommand( ());
.addSubCommand( ());
.addSubCommand( ());
.addSubCommand( ());
.addSubCommand( ());
}
{
{
(, );
.addAliases( []{});
}
{
PluginManager.get();
Set<Message> plugins = (Set).getPlugins().stream().map(PluginBase::getIdentifier).map(PluginIdentifier::toString).map(Message::raw).collect(Collectors.toSet());
context.sendMessage(MessageFormat.list(Message.translation(), plugins));
}
}
{
RequiredArg<PluginIdentifier> pluginNameArg;
FlagArg bootFlag;
{
(, );
.pluginNameArg = .withRequiredArg(, , PluginCommand.PLUGIN_IDENTIFIER_ARG_TYPE);
.bootFlag = .withFlagArg(, );
.addAliases( []{});
}
{
PluginManager.get();
(PluginIdentifier).pluginNameArg.get(context);
.getPlugin(identifier);
(identifier != ) {
(Boolean).bootFlag.get(context);
HytaleServer.get().getConfig();
HytaleServerConfig.ModConfig.setBoot(serverConfig, identifier, );
(serverConfig.consumeHasChanged()) {
HytaleServerConfig.save(serverConfig).join();
}
context.sendMessage(Message.translation().param(, identifier.toString()));
(onlyBootList) {
;
}
}
(plugin != && plugin.getState() != PluginState.DISABLED) {
identifier != ;
(plugin.getState()) {
NONE -> context.sendMessage(Message.translation().param(, identifier.toString()));
SETUP -> context.sendMessage(Message.translation().param(, identifier.toString()));
START -> context.sendMessage(Message.translation().param(, identifier.toString()));
ENABLED -> context.sendMessage(Message.translation().param(, identifier.toString()));
-> context.sendMessage(Message.translation().param(, plugin.getState().toString()));
}
} {
context.sendMessage(Message.translation().param(, identifier.toString()));
(.load(identifier)) {
context.sendMessage(Message.translation().param(, identifier.toString()));
} {
context.sendMessage(Message.translation().param(, identifier.toString()));
}
}
}
}
{
RequiredArg<PluginIdentifier> pluginNameArg;
FlagArg bootFlag;
{
(, );
.pluginNameArg = .withRequiredArg(, , PluginCommand.PLUGIN_IDENTIFIER_ARG_TYPE);
.bootFlag = .withFlagArg(, );
.addAliases( []{});
}
{
PluginManager.get();
(PluginIdentifier).pluginNameArg.get(context);
.getPlugin(identifier);
(identifier != ) {
(Boolean).bootFlag.get(context);
HytaleServer.get().getConfig();
HytaleServerConfig.ModConfig.setBoot(serverConfig, identifier, );
(serverConfig.consumeHasChanged()) {
HytaleServerConfig.save(serverConfig).join();
}
context.sendMessage(Message.translation().param(, identifier.toString()));
(onlyBootList) {
;
}
}
(plugin != ) {
(plugin.getState()) {
NONE:
context.sendMessage(Message.translation().param(, identifier.toString()));
;
SETUP:
context.sendMessage(Message.translation().param(, identifier.toString()));
;
START:
context.sendMessage(Message.translation().param(, identifier.toString()));
;
ENABLED:
context.sendMessage(Message.translation().param(, identifier.toString()));
(.unload(identifier)) {
context.sendMessage(Message.translation().param(, identifier.toString()));
} {
context.sendMessage(Message.translation().param(, identifier.toString()));
}
;
DISABLED:
context.sendMessage(Message.translation().param(, identifier.toString()));
;
:
context.sendMessage(Message.translation().param(, plugin.getState().toString()));
}
} {
context.sendMessage(Message.translation().param(, identifier.toString()));
}
}
}
{
RequiredArg<PluginIdentifier> pluginNameArg;
{
(, );
.pluginNameArg = .withRequiredArg(, , PluginCommand.PLUGIN_IDENTIFIER_ARG_TYPE);
.addAliases( []{});
}
{
PluginManager.get();
(PluginIdentifier).pluginNameArg.get(context);
.getPlugin(identifier);
(plugin != ) {
(plugin.getState()) {
NONE:
context.sendMessage(Message.translation().param(, identifier.toString()));
;
SETUP:
context.sendMessage(Message.translation().param(, identifier.toString()));
;
START:
context.sendMessage(Message.translation().param(, identifier.toString()));
;
ENABLED:
(.reload(identifier)) {
context.sendMessage(Message.translation().param(, identifier.toString()));
} {
context.sendMessage(Message.translation().param(, identifier.toString()));
}
;
DISABLED:
context.sendMessage(Message.translation().param(, identifier.toString()));
;
:
context.sendMessage(Message.translation().param(, plugin.getState().toString()));
}
} {
context.sendMessage(Message.translation().param(, identifier.toString()));
}
}
}
{
{
(, );
.addAliases( []{});
}
{
(Player)store.getComponent(ref, Player.getComponentType());
playerComponent != ;
playerComponent.getPageManager().openCustomPage(ref, store, (playerRef));
}
}
}
com/hypixel/hytale/server/core/plugin/event/PluginEvent.java
package com.hypixel.hytale.server.core.plugin.event;
import com.hypixel.hytale.event.IEvent;
import com.hypixel.hytale.server.core.plugin.PluginBase;
import javax.annotation.Nonnull;
public abstract class PluginEvent implements IEvent<Class<? extends PluginBase>> {
@Nonnull
private final PluginBase plugin;
public PluginEvent(@Nonnull PluginBase plugin) {
this.plugin = plugin;
}
@Nonnull
public PluginBase getPlugin() {
return this.plugin;
}
@Nonnull
public String toString() {
return "PluginEvent{}";
}
}
com/hypixel/hytale/server/core/plugin/event/PluginSetupEvent.java
package com.hypixel.hytale.server.core.plugin.event;
import com.hypixel.hytale.server.core.plugin.PluginBase;
import javax.annotation.Nonnull;
public class PluginSetupEvent extends PluginEvent {
public PluginSetupEvent(@Nonnull PluginBase plugin) {
super(plugin);
}
}
com/hypixel/hytale/server/core/plugin/pages/PluginListPage.java
package com.hypixel.hytale.server.core.plugin.pages;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.common.plugin.PluginIdentifier;
import com.hypixel.hytale.common.plugin.PluginManifest;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.protocol.packets.interface_.CustomPageLifetime;
import com.hypixel.hytale.protocol.packets.interface_.CustomUIEventBindingType;
import com.hypixel.hytale.server.core.command.system.CommandManager;
import com.hypixel.hytale.server.core.entity.entities.player.pages.InteractiveCustomUIPage;
import com.hypixel.hytale.server.core.plugin.PluginBase;
import com.hypixel.hytale.server.core.plugin.PluginListPageManager;
import com.hypixel.hytale.server.core.plugin.PluginManager;
import com.hypixel.hytale.server.core.ui.Value;
import com.hypixel.hytale.server.core.ui.builder.EventData;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectList;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class PluginListPage extends InteractiveCustomUIPage<PluginListPageEventData> {
Value<String> BUTTON_LABEL_STYLE = Value.<String>ref(, );
Value<String> BUTTON_LABEL_STYLE_SELECTED = Value.<String>ref(, );
PluginDetails selectedPlugin;
ObjectList<PluginDetails> availablePlugins = <PluginDetails>();
ObjectList<PluginDetails> visiblePlugins = <PluginDetails>();
PluginListPageManager.SessionSettings playerSessionSettings;
{
(playerRef, CustomPageLifetime.CanDismiss, PluginListPage.PluginListPageEventData.CODEC);
}
{
PluginListPageManager.get();
pageManager.registerPluginListPage();
.playerSessionSettings = (PluginListPageManager.SessionSettings)store.ensureAndGetComponent(ref, PluginListPageManager.SessionSettings.getComponentType());
commandBuilder.append();
.buildPluginList(commandBuilder, eventBuilder);
eventBuilder.addEventBinding(CustomUIEventBindingType.ValueChanged, , ( ()).append(, ));
(!.visiblePlugins.isEmpty()) {
.selectPlugin(((PluginDetails).visiblePlugins.getFirst()).identifier.toString(), commandBuilder);
}
commandBuilder.set(, .playerSessionSettings.descriptiveOnly);
}
{
.playerSessionSettings != ;
();
();
(data.plugin != ) {
(data.type) {
-> .selectPlugin(data.plugin, commandBuilder);
-> .checkBoxChanged(data.plugin, commandBuilder);
}
.sendUpdate(commandBuilder, (UIEventBuilder), );
} (data.option != ) {
(data.option) {
:
.playerSessionSettings.descriptiveOnly = !.playerSessionSettings.descriptiveOnly;
.buildPluginList(commandBuilder, eventBuilder);
(!.visiblePlugins.isEmpty()) {
.selectPlugin(((PluginDetails).visiblePlugins.getFirst()).identifier.toString(), commandBuilder);
}
:
.sendUpdate(commandBuilder, eventBuilder, );
}
}
}
{
PluginListPageManager.get().deregisterPluginListPage();
}
{
.playerSessionSettings != ;
commandBuilder.clear();
.visiblePlugins.clear();
.availablePlugins.clear();
PluginManager.get();
Map<PluginIdentifier, PluginManifest> loadedPlugins = .getAvailablePlugins();
loadedPlugins.forEach((identifierx, manifest) -> .availablePlugins.add( (manifest, identifierx)));
;
( .availablePlugins.size(); i < bound; ++i) {
(PluginDetails).availablePlugins.get(i);
plugin.manifest.getDescription();
(!.playerSessionSettings.descriptiveOnly || desc != && !desc.isEmpty()) {
.visiblePlugins.add(plugin);
}
}
i = ;
( .visiblePlugins.size(); i < bound; ++i) {
((PluginDetails).visiblePlugins.get(i)).identifier;
identifier.toString();
;
.getPlugin(identifier);
(loadedPlugin != ) {
enabled = loadedPlugin.isEnabled();
}
+ i + ;
commandBuilder.append(, );
commandBuilder.set(selector + , id);
commandBuilder.set(selector + , enabled);
eventBuilder.addEventBinding(CustomUIEventBindingType.Activating, selector + , ( ()).append(, id).append(, ), );
eventBuilder.addEventBinding(CustomUIEventBindingType.ValueChanged, selector + , ( ()).append(, id).append(, ), );
}
}
{
;
(PluginDetails plugin : .visiblePlugins) {
(playerSelectedPlugin.equals(plugin.identifier.toString())) {
nextSelectedPlugin = plugin;
;
}
}
(nextSelectedPlugin != ) {
(.selectedPlugin != && .visiblePlugins.contains(.selectedPlugin)) {
commandBuilder.set( + .visiblePlugins.indexOf(.selectedPlugin) + , BUTTON_LABEL_STYLE);
}
commandBuilder.set( + .visiblePlugins.indexOf(nextSelectedPlugin) + , BUTTON_LABEL_STYLE_SELECTED);
commandBuilder.set(, nextSelectedPlugin.manifest.getName());
commandBuilder.set(, nextSelectedPlugin.identifier.toString());
(nextSelectedPlugin.manifest.getVersion() != ) {
commandBuilder.set(, nextSelectedPlugin.manifest.getVersion().toString());
} {
commandBuilder.set(, );
}
(nextSelectedPlugin.manifest.getDescription() != ) {
commandBuilder.set(, nextSelectedPlugin.manifest.getDescription());
} {
commandBuilder.set(, );
}
.selectedPlugin = nextSelectedPlugin;
}
}
{
;
(PluginDetails plugin : .visiblePlugins) {
(pluginName.equals(plugin.identifier.toString())) {
changedPlugin = plugin;
;
}
}
(changedPlugin != ) {
PluginManager.get();
.getPlugin(changedPlugin.identifier);
CommandManager.get();
(activePlugin != && activePlugin.isEnabled()) {
commandManager.handleCommand(.playerRef, + String.valueOf(changedPlugin.identifier));
} {
commandManager.handleCommand(.playerRef, + String.valueOf(changedPlugin.identifier));
}
}
}
{
();
();
;
;
( .visiblePlugins.size(); i < bound; ++i) {
(PluginDetails).visiblePlugins.get(i);
(details.identifier.equals(plugin)) {
key = details;
;
}
}
(key != ) {
.visiblePlugins.indexOf(key);
+ var10000 + ;
commandBuilder.set(selector + , activeState);
.sendUpdate(commandBuilder, eventBuilder, );
}
}
{
;
;
;
BuilderCodec<PluginListPageEventData> CODEC;
String plugin;
String option;
String type;
{
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(PluginListPageEventData.class, PluginListPageEventData::).append( (, Codec.STRING), (entry, s) -> entry.plugin = s, (entry) -> entry.plugin).add()).append( (, Codec.STRING), (entry, s) -> entry.option = s, (entry) -> entry.option).add()).append( (, Codec.STRING), (entry, s) -> entry.type = s, (entry) -> entry.type).add()).build();
}
}
{
PluginManifest manifest;
PluginIdentifier identifier;
{
.identifier = identifier;
.manifest = manifest;
}
}
}
com/hypixel/hytale/server/core/plugin/pending/PendingLoadJavaPlugin.java
package com.hypixel.hytale.server.core.plugin.pending;
import com.hypixel.hytale.common.plugin.PluginManifest;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.server.core.plugin.JavaPlugin;
import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
import com.hypixel.hytale.server.core.plugin.PluginClassLoader;
import com.hypixel.hytale.server.core.plugin.PluginManager;
import java.lang.reflect.Constructor;
import java.nio.file.Path;
import java.util.logging.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class PendingLoadJavaPlugin extends PendingLoadPlugin {
private static final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
@Nonnull
private final PluginClassLoader urlClassLoader;
public PendingLoadJavaPlugin(@Nullable Path path, @Nonnull PluginManifest manifest, @Nonnull PluginClassLoader urlClassLoader) {
super(path, manifest);
this.urlClassLoader = urlClassLoader;
}
@Nonnull
public PendingLoadPlugin createSubPendingLoadPlugin(@Nonnull PluginManifest manifest) {
return (.getPath(), manifest, .urlClassLoader);
}
{
.urlClassLoader.isInServerClassPath();
}
JavaPlugin {
{
.getManifest();
Class<?> mainClass = .urlClassLoader.loadLocalClass(manifest.getMain());
(JavaPlugin.class.isAssignableFrom(mainClass)) {
Constructor<?> constructor = mainClass.getConstructor(JavaPluginInit.class);
PluginManager.MODS_PATH;
manifest.getGroup();
var10000.resolve(var10001 + + manifest.getName());
(manifest, dataDirectory, .getPath(), .urlClassLoader);
(JavaPlugin)constructor.newInstance(init);
}
(manifest.getMain() + );
} (ClassNotFoundException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log(, .getPath());
} (NoSuchMethodException e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log(, .getPath());
} (Throwable e) {
((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(e)).log(, .getPath());
}
;
}
String {
+ .toString() + ;
}
}
com/hypixel/hytale/server/core/plugin/pending/PendingLoadPlugin.java
package com.hypixel.hytale.server.core.plugin.pending;
import com.hypixel.hytale.common.plugin.PluginIdentifier;
import com.hypixel.hytale.common.plugin.PluginManifest;
import com.hypixel.hytale.server.core.plugin.PluginBase;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public abstract class PendingLoadPlugin {
@Nonnull
private final PluginIdentifier identifier;
@Nonnull
private final PluginManifest manifest;
@Nullable
private final Path path;
PendingLoadPlugin(@Nullable Path path, @Nonnull PluginManifest manifest) {
this.path = path;
this.identifier = new PluginIdentifier(manifest);
this.manifest = manifest;
}
@Nonnull
public PluginIdentifier getIdentifier() {
return .identifier;
}
PluginManifest {
.manifest;
}
Path {
.path;
}
PendingLoadPlugin ;
PluginBase ;
List<PendingLoadPlugin> {
List<PluginManifest> subPlugins = .manifest.getSubPlugins();
(subPlugins.isEmpty()) {
Collections.emptyList();
} {
ObjectArrayList<PendingLoadPlugin> plugins = <PendingLoadPlugin>(subPlugins.size());
(PluginManifest subManifest : subPlugins) {
subManifest.inherit(.manifest);
plugins.add(.createSubPendingLoadPlugin(subManifest));
}
plugins;
}
}
{
.manifest.getDependencies().containsKey(identifier) || .manifest.getOptionalDependencies().containsKey(identifier);
}
;
{
( == o) {
;
} (o != && .getClass() == o.getClass()) {
(PendingLoadPlugin)o;
(!.identifier.equals(that.identifier)) {
;
} {
!.manifest.equals(that.manifest) ? : Objects.equals(.path, that.path);
}
} {
;
}
}
{
.identifier.hashCode();
result = * result + .manifest.hashCode();
result = * result + (.path != ? .path.hashCode() : );
result;
}
String {
String.valueOf(.identifier);
+ var10000 + + String.valueOf(.manifest) + + String.valueOf(.path) + ;
}
List<PendingLoadPlugin> {
HashMap<PluginIdentifier, EntryNode> nodes = (pending.size());
(Map.Entry<PluginIdentifier, PendingLoadPlugin> entry : pending.entrySet()) {
nodes.put((PluginIdentifier)entry.getKey(), ((PendingLoadPlugin)entry.getValue()));
}
HashSet<PluginIdentifier> classpathPlugins = ();
(Map.Entry<PluginIdentifier, PendingLoadPlugin> entry : pending.entrySet()) {
(((PendingLoadPlugin)entry.getValue()).isInServerClassPath()) {
classpathPlugins.add((PluginIdentifier)entry.getKey());
}
}
HashMap<PluginIdentifier, Set<PluginIdentifier>> missingDependencies = ();
(EntryNode node : nodes.values()) {
node.plugin.manifest;
(PluginIdentifier depId : manifest.getDependencies().keySet()) {
(nodes.containsKey(depId)) {
node.edge.add(depId);
} {
((Set)missingDependencies.computeIfAbsent(node.plugin.identifier, (k) -> ())).add(depId);
}
}
(PluginIdentifier identifier : manifest.getOptionalDependencies().keySet()) {
(EntryNode)nodes.get(identifier);
(dep != ) {
node.edge.add(identifier);
}
}
(!node.plugin.isInServerClassPath()) {
node.edge.addAll(classpathPlugins);
}
}
HashMap<PluginIdentifier, Set<PluginIdentifier>> missingLoadBefore = ();
(Map.Entry<PluginIdentifier, PendingLoadPlugin> entry : pending.entrySet()) {
((PendingLoadPlugin)entry.getValue()).manifest;
(PluginIdentifier targetId : manifest.getLoadBefore().keySet()) {
(EntryNode)nodes.get(targetId);
(targetNode != ) {
targetNode.edge.add((PluginIdentifier)entry.getKey());
} {
((Set)missingLoadBefore.computeIfAbsent((PluginIdentifier)entry.getKey(), (k) -> ())).add(targetId);
}
}
}
(missingDependencies.isEmpty() && missingLoadBefore.isEmpty()) {
ObjectArrayList<PendingLoadPlugin> loadOrder = <PendingLoadPlugin>(nodes.size());
(!nodes.isEmpty()) {
;
Iterator<Map.Entry<PluginIdentifier, EntryNode>> iterator = nodes.entrySet().iterator();
(iterator.hasNext()) {
Map.Entry<PluginIdentifier, EntryNode> entry = (Map.Entry)iterator.next();
(EntryNode)entry.getValue();
(node.edge.isEmpty()) {
didWork = ;
iterator.remove();
loadOrder.add(node.plugin);
(PluginIdentifier)entry.getKey();
(EntryNode otherNode : nodes.values()) {
otherNode.edge.remove(identifier);
}
}
}
(!didWork) {
();
(Map.Entry<PluginIdentifier, EntryNode> entry : nodes.entrySet()) {
sb.append().append(entry.getKey()).append().append(((EntryNode)entry.getValue()).edge).append();
}
(sb.toString());
}
}
loadOrder;
} {
();
(!missingDependencies.isEmpty()) {
sb.append();
(Map.Entry<PluginIdentifier, Set<PluginIdentifier>> entry : missingDependencies.entrySet()) {
sb.append().append(entry.getKey()).append().append(entry.getValue()).append();
}
}
(!missingLoadBefore.isEmpty()) {
sb.append();
(Map.Entry<PluginIdentifier, Set<PluginIdentifier>> entry : missingLoadBefore.entrySet()) {
sb.append().append(entry.getKey()).append().append(entry.getValue()).append();
}
}
(sb.toString());
}
}
{
Set<PluginIdentifier> edge = ();
PendingLoadPlugin plugin;
{
.plugin = plugin;
}
String {
String.valueOf(.plugin);
+ var10000 + + String.valueOf(.edge) + ;
}
}
}
com/hypixel/hytale/server/core/plugin/registry/AssetRegistry.java
package com.hypixel.hytale.server.core.plugin.registry;
import com.hypixel.hytale.assetstore.AssetMap;
import com.hypixel.hytale.assetstore.AssetStore;
import com.hypixel.hytale.assetstore.map.JsonAssetWithMap;
import com.hypixel.hytale.function.consumer.BooleanConsumer;
import java.util.List;
import javax.annotation.Nonnull;
public class AssetRegistry {
protected final List<BooleanConsumer> unregister;
public AssetRegistry(List<BooleanConsumer> unregister) {
this.unregister = unregister;
}
@Nonnull
public <K, T extends JsonAssetWithMap<K, M>, M extends AssetMap<K, T>, S extends AssetStore<K, T, M>> AssetRegistry register(@Nonnull S assetStore) {
com.hypixel.hytale.assetstore.AssetRegistry.register(assetStore);
this.unregister.add((BooleanConsumer)(shutdown) -> com.hypixel.hytale.assetstore.AssetRegistry.unregister(assetStore));
return this;
}
public void shutdown() {
}
}
com/hypixel/hytale/server/core/plugin/registry/CodecMapRegistry.java
package com.hypixel.hytale.server.core.plugin.registry;
import com.hypixel.hytale.assetstore.JsonAsset;
import com.hypixel.hytale.assetstore.codec.AssetCodecMapCodec;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.lookup.Priority;
import com.hypixel.hytale.codec.lookup.StringCodecMapCodec;
import com.hypixel.hytale.function.consumer.BooleanConsumer;
import java.util.List;
import javax.annotation.Nonnull;
public class CodecMapRegistry<T, C extends Codec<? extends T>> implements IRegistry {
protected final StringCodecMapCodec<T, C> mapCodec;
protected final List<BooleanConsumer> unregister;
public CodecMapRegistry(List<BooleanConsumer> unregister, StringCodecMapCodec<T, C> mapCodec) {
this.unregister = unregister;
this.mapCodec = mapCodec;
}
@Nonnull
public CodecMapRegistry<T, C> register(String id, Class<? extends T> aClass, C codec) {
this.mapCodec.register(id, aClass, codec);
this.unregister.add((BooleanConsumer)(shutdown) -> {
com.hypixel.hytale.assetstore.AssetRegistry.ASSET_LOCK.writeLock().lock();
try {
this.mapCodec.remove(aClass);
} {
com.hypixel.hytale.assetstore.AssetRegistry.ASSET_LOCK.writeLock().unlock();
}
});
;
}
CodecMapRegistry<T, C> {
.mapCodec.register(priority, id, aClass, codec);
.unregister.add((BooleanConsumer)(shutdown) -> {
com.hypixel.hytale.assetstore.AssetRegistry.ASSET_LOCK.writeLock().lock();
{
.mapCodec.remove(aClass);
} {
com.hypixel.hytale.assetstore.AssetRegistry.ASSET_LOCK.writeLock().unlock();
}
});
;
}
{
}
<T <?>, C <? >> <T, C> {
{
(unregister, mapCodec);
}
Assets<T, C> {
((AssetCodecMapCodec).mapCodec).register(id, aClass, codec);
.unregister.add((BooleanConsumer)(shutdown) -> {
com.hypixel.hytale.assetstore.AssetRegistry.ASSET_LOCK.writeLock().lock();
{
.mapCodec.remove(aClass);
} {
com.hypixel.hytale.assetstore.AssetRegistry.ASSET_LOCK.writeLock().unlock();
}
});
;
}
Assets<T, C> {
((AssetCodecMapCodec).mapCodec).register(priority, id, aClass, codec);
.unregister.add((BooleanConsumer)(shutdown) -> {
com.hypixel.hytale.assetstore.AssetRegistry.ASSET_LOCK.writeLock().lock();
{
.mapCodec.remove(aClass);
} {
com.hypixel.hytale.assetstore.AssetRegistry.ASSET_LOCK.writeLock().unlock();
}
});
;
}
}
}
com/hypixel/hytale/server/core/plugin/registry/IRegistry.java
package com.hypixel.hytale.server.core.plugin.registry;
public interface IRegistry {
void shutdown();
}
com/hypixel/hytale/server/core/plugin/registry/MapKeyMapRegistry.java
package com.hypixel.hytale.server.core.plugin.registry;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.lookup.MapKeyMapCodec;
import com.hypixel.hytale.function.consumer.BooleanConsumer;
import java.util.List;
import javax.annotation.Nonnull;
public class MapKeyMapRegistry<V> implements IRegistry {
protected final MapKeyMapCodec<V> mapCodec;
protected final List<BooleanConsumer> unregister;
public MapKeyMapRegistry(List<BooleanConsumer> unregister, MapKeyMapCodec<V> mapCodec) {
this.unregister = unregister;
this.mapCodec = mapCodec;
}
@Nonnull
public <T extends V> MapKeyMapRegistry<V> register(@Nonnull Class<T> tClass, @Nonnull String id, @Nonnull Codec<T> codec) {
this.mapCodec.register(tClass, id, codec);
this.unregister.add((BooleanConsumer)(shutdown) -> {
if (!shutdown) {
com.hypixel.hytale.assetstore.AssetRegistry.ASSET_LOCK.writeLock().lock();
try {
this.mapCodec.unregister(tClass);
} finally {
com.hypixel.hytale.assetstore.AssetRegistry.ASSET_LOCK.writeLock().unlock();
}
}
});
return this;
}
{
}
}