Periphery Facades

This commit is contained in:
Brian Neumann-Fopiano
2026-06-11 17:45:59 -04:00
parent b5d08b6203
commit 704c94aab4
85 changed files with 950 additions and 774 deletions
+6 -6
View File
@@ -129,7 +129,6 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
}
}
private final KList<Runnable> postShutdown = new KList<>();
private final AtomicBoolean alreadyDrained = new AtomicBoolean(false);
private KMap<Class<? extends IrisService>, IrisService> services;
@@ -546,6 +545,8 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
public Iris() {
instance = this;
BukkitPlatform.hostPlugin(this);
BukkitPlatform.hostConsoleSender(Iris::getSender);
SlimJar.load();
}
@@ -561,6 +562,7 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
});
IO.delete(new File("iris"));
compat = IrisCompat.configured(getDataFile("compat.json"));
IrisServices.register(IrisCompat.class, compat);
ServerConfigurator.configure();
validateAllPacks();
IrisSafeguard.execute();
@@ -568,6 +570,7 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
IrisSafeguard.splash();
tickets = new ChunkTickets();
linkMultiverseCore = new MultiverseCoreLink();
IrisServices.register(MultiverseCoreLink.class, linkMultiverseCore);
settingsFile = getDataFile("settings.json");
configHotloadEngine = new ConfigHotloadEngine(
Iris::isSettingsFile,
@@ -904,6 +907,7 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
private void setupAudience() {
try {
audiences = new Bindings.Adventure(this);
BukkitPlatform.hostAudiences(audiences);
} catch (Throwable e) {
e.printStackTrace();
IrisSettings.get().getGeneral().setUseConsoleCustomColors(false);
@@ -912,10 +916,6 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
}
}
public void postShutdown(Runnable r) {
postShutdown.add(r);
}
public void onEnable() {
IrisPlatforms.bind(new BukkitPlatform());
enable();
@@ -938,7 +938,7 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
}
J.cancelPluginTasks();
HandlerList.unregisterAll((Plugin) this);
postShutdown.forEach(Runnable::run);
runPostShutdown();
super.onDisable();
J.attempt(new JarScanner(instance.getJarFile(), "", false)::scanAll);
@@ -19,7 +19,8 @@
package art.arcane.iris.core;
import com.google.gson.Gson;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.volmlib.util.io.IO;
import art.arcane.volmlib.util.json.JSONException;
import art.arcane.volmlib.util.json.JSONObject;
@@ -59,14 +60,14 @@ public class IrisSettings {
settings = new IrisSettings();
File s = Iris.instance.getDataFile("settings.json");
File s = IrisPlatforms.get().dataFile("settings.json");
if (!s.exists()) {
try {
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
} catch (JSONException | IOException e) {
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
}
} else {
try {
@@ -78,8 +79,8 @@ public class IrisSettings {
e.printStackTrace();
}
} catch (Throwable ee) {
// Iris.reportError(ee); causes a self-reference & stackoverflow
Iris.error("Configuration Error in settings.json! " + ee.getClass().getSimpleName() + ": " + ee.getMessage());
// IrisLogging.reportError(ee); causes a self-reference & stackoverflow
IrisLogging.error("Configuration Error in settings.json! " + ee.getClass().getSimpleName() + ": " + ee.getMessage());
}
}
@@ -93,13 +94,13 @@ public class IrisSettings {
}
public void forceSave() {
File s = Iris.instance.getDataFile("settings.json");
File s = IrisPlatforms.get().dataFile("settings.json");
try {
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
} catch (JSONException | IOException e) {
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -18,7 +18,9 @@
package art.arcane.iris.core.datapack;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.ServerConfigurator;
import art.arcane.iris.core.datapack.ModrinthResolver.ResolvedDatapack;
@@ -76,7 +78,7 @@ public final class DatapackIngestService {
if (IrisSettings.get().getGeneral().autoIngestDatapacks) {
KList<String> urls = collectConfiguredImports();
if (!urls.isEmpty()) {
Iris.info("Auto-ingesting " + urls.size() + " external datapack import(s) from pack datapackImports...");
IrisLogging.info("Auto-ingesting " + urls.size() + " external datapack import(s) from pack datapackImports...");
Report report = ingest(null, urls, true);
restarting = report.changed();
}
@@ -100,7 +102,7 @@ public final class DatapackIngestService {
try {
new IrisProject(data.getDataFolder()).updateWorkspace();
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -111,7 +113,7 @@ public final class DatapackIngestService {
return report;
}
File root = Iris.instance.getDataFolder("datapacks");
File root = IrisPlatforms.get().dataFolder("datapacks");
File cacheDir = new File(root, "cache");
File stagingDir = new File(root, "staging");
cacheDir.mkdirs();
@@ -130,7 +132,7 @@ public final class DatapackIngestService {
} catch (Exception e) {
report.failed.add(url + " - " + e.getMessage());
message(sender, C.RED + " Failed: " + C.WHITE + url + C.RED + " - " + e.getMessage());
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -152,7 +154,7 @@ public final class DatapackIngestService {
}
public static void reapplyFromStaging(KList<File> worldFolders) {
File stagingDir = Iris.instance.getDataFolderNoCreate("datapacks", "staging");
File stagingDir = IrisPlatforms.get().dataFolderNoCreate("datapacks", "staging");
if (stagingDir == null || !stagingDir.isDirectory()) {
return;
}
@@ -168,14 +170,14 @@ public final class DatapackIngestService {
try {
install(stagedDir, worldFolders, stagedDir.getName(), false, stripOverrides);
} catch (IOException e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
}
public static boolean remove(VolmitSender sender, String id) {
String cleaned = sanitizeId(id);
File root = Iris.instance.getDataFolder("datapacks");
File root = IrisPlatforms.get().dataFolder("datapacks");
Manifest manifest = readManifest(root);
boolean removed = false;
@@ -215,7 +217,7 @@ public final class DatapackIngestService {
}
public static List<Entry> installed() {
return readManifest(Iris.instance.getDataFolder("datapacks")).entries;
return readManifest(IrisPlatforms.get().dataFolder("datapacks")).entries;
}
private static void ingestSingle(VolmitSender sender, String url, String mcVersion, File cacheDir, File stagingDir, KList<File> worldFolders, Manifest manifest, Report report, boolean stripOverrides) throws IOException {
@@ -374,7 +376,7 @@ public final class DatapackIngestService {
try {
Files.writeString(marker.toPath(), "stripped", StandardCharsets.UTF_8);
} catch (IOException e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -382,7 +384,7 @@ public final class DatapackIngestService {
if (!IrisSettings.get().getGeneral().autoImportDatapackStructures) {
return;
}
File root = Iris.instance.getDataFolder("datapacks");
File root = IrisPlatforms.get().dataFolder("datapacks");
Manifest manifest = readManifest(root);
if (manifest.entries.isEmpty()) {
return;
@@ -398,7 +400,7 @@ public final class DatapackIngestService {
return;
}
Iris.info("Importing datapack structures (jigsaw pools, pieces & objects) into packs that declare datapackImports...");
IrisLogging.info("Importing datapack structures (jigsaw pools, pieces & objects) into packs that declare datapackImports...");
AtomicInteger packs = new AtomicInteger();
try (Stream<IrisData> stream = ServerConfigurator.allPacks()) {
stream.forEach(data -> {
@@ -406,10 +408,10 @@ public final class DatapackIngestService {
return;
}
try {
BulkStructureImporter.importDatapackStructures(data, StructureImporter.Mode.ADD_ONLY, Iris.getSender());
BulkStructureImporter.importDatapackStructures(data, StructureImporter.Mode.ADD_ONLY, BukkitPlatform.console());
packs.incrementAndGet();
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
});
}
@@ -419,7 +421,7 @@ public final class DatapackIngestService {
}
writeManifest(root, manifest);
if (packs.get() > 0) {
Iris.info("Datapack structure import finished for " + packs.get() + " pack(s). Reference the imported keys from a 'structures' placement to position them manually.");
IrisLogging.info("Datapack structure import finished for " + packs.get() + " pack(s). Reference the imported keys from a 'structures' placement to position them manually.");
}
}
@@ -583,7 +585,7 @@ public final class DatapackIngestService {
sender.sendMessage(text);
return;
}
Iris.info(text);
IrisLogging.info(text);
}
private static Manifest readManifest(File root) {
@@ -602,7 +604,7 @@ public final class DatapackIngestService {
}
return manifest;
} catch (Exception e) {
Iris.reportError(e);
IrisLogging.reportError(e);
return new Manifest();
}
}
@@ -616,7 +618,7 @@ public final class DatapackIngestService {
}
Files.writeString(file.toPath(), GSON.toJson(manifest), StandardCharsets.UTF_8);
} catch (IOException e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -1,6 +1,6 @@
package art.arcane.iris.core.link;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.volmlib.util.data.Cuboid;
import art.arcane.volmlib.util.data.KCache;
@@ -45,9 +45,9 @@ public class WorldEditLink {
(int) min.getClass().getDeclaredMethod("z").invoke(max)
);
} catch (Throwable e) {
Iris.error("Could not get selection");
IrisLogging.error("Could not get selection");
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
active.reset();
active.aquire(() -> false);
}
@@ -1,6 +1,6 @@
package art.arcane.iris.core.link.data;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.link.ExternalDataProvider;
import art.arcane.iris.core.link.Identifier;
import art.arcane.volmlib.util.collection.KMap;
@@ -25,14 +25,14 @@ public class EcoItemsDataProvider extends ExternalDataProvider {
@Override
public void init() {
Iris.info("Setting up EcoItems Link...");
IrisLogging.info("Setting up EcoItems Link...");
itemStack = new WrappedField<>(EcoItem.class, "_itemStack");
if (this.itemStack.hasFailed()) {
Iris.error("Failed to set up EcoItems Link: Unable to fetch ItemStack field!");
IrisLogging.error("Failed to set up EcoItems Link: Unable to fetch ItemStack field!");
}
id = new WrappedField<>(EcoItem.class, "id");
if (this.id.hasFailed()) {
Iris.error("Failed to set up EcoItems Link: Unable to fetch id field!");
IrisLogging.error("Failed to set up EcoItems Link: Unable to fetch id field!");
}
}
@@ -1,7 +1,7 @@
package art.arcane.iris.core.link.data;
import com.ssomar.score.api.executableitems.ExecutableItemsAPI;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.link.ExternalDataProvider;
import art.arcane.iris.core.link.Identifier;
import art.arcane.volmlib.util.collection.KMap;
@@ -20,7 +20,7 @@ public class ExecutableItemsDataProvider extends ExternalDataProvider {
@Override
public void init() {
Iris.info("Setting up ExecutableItems Link...");
IrisLogging.info("Setting up ExecutableItems Link...");
}
@NotNull
@@ -1,6 +1,6 @@
package art.arcane.iris.core.link.data;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.link.ExternalDataProvider;
import art.arcane.iris.core.link.Identifier;
@@ -51,7 +51,7 @@ public class HMCLeavesDataProvider extends ExternalDataProvider {
blockDataMap = getMap(config, "blockDataMap");
itemDataField = getMap(config, "itemSupplierMap");
} catch (Throwable e) {
Iris.error("Failed to initialize HMCLeavesDataProvider: " + e.getMessage());
IrisLogging.error("Failed to initialize HMCLeavesDataProvider: " + e.getMessage());
}
}
@@ -84,7 +84,7 @@ public class HMCLeavesDataProvider extends ExternalDataProvider {
blockId = pair.getA();
Boolean result = setCustomBlock.invoke(apiInstance, new Object[]{block.getLocation(), blockId.key(), false});
if (result == null || !result)
Iris.warn("Failed to set custom block! " + blockId.key() + " " + block.getX() + " " + block.getY() + " " + block.getZ());
IrisLogging.warn("Failed to set custom block! " + blockId.key() + " " + block.getX() + " " + block.getY() + " " + block.getZ());
else if (IrisSettings.get().getGenerator().preventLeafDecay) {
BlockData blockData = block.getBlockData();
if (blockData instanceof Leaves leaves)
@@ -1,6 +1,6 @@
package art.arcane.iris.core.link.data;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.link.ExternalDataProvider;
import art.arcane.iris.core.link.Identifier;
import art.arcane.iris.engine.framework.Engine;
@@ -88,7 +88,7 @@ public class ItemAdderDataProvider extends ExternalDataProvider {
updateNamespaces(DataType.ITEM);
updateNamespaces(DataType.BLOCK);
} catch (Throwable e) {
Iris.warn("Failed to update ItemAdder namespaces: " + e.getMessage());
IrisLogging.warn("Failed to update ItemAdder namespaces: " + e.getMessage());
}
}
@@ -96,7 +96,7 @@ public class ItemAdderDataProvider extends ExternalDataProvider {
var namespaces = getTypes(dataType).stream().map(Identifier::namespace).collect(Collectors.toSet());
if (dataType == DataType.ITEM) itemNamespaces = namespaces;
else blockNamespaces = namespaces;
Iris.debug("Updated ItemAdder namespaces: " + dataType + " - " + namespaces);
IrisLogging.debug("Updated ItemAdder namespaces: " + dataType + " - " + namespaces);
}
@Override
@@ -1,6 +1,6 @@
package art.arcane.iris.core.link.data;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.link.ExternalDataProvider;
import art.arcane.iris.core.link.Identifier;
import art.arcane.volmlib.util.collection.KMap;
@@ -28,7 +28,7 @@ public class MMOItemsDataProvider extends ExternalDataProvider {
@Override
public void init() {
Iris.info("Setting up MMOItems Link...");
IrisLogging.info("Setting up MMOItems Link...");
}
@NotNull
@@ -18,7 +18,7 @@
package art.arcane.iris.core.link.data;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.link.ExternalDataProvider;
import art.arcane.iris.core.link.Identifier;
import art.arcane.iris.core.nms.INMS;
@@ -56,11 +56,11 @@ public class MythicCrucibleDataProvider extends ExternalDataProvider {
@Override
public void init() {
Iris.info("Setting up MythicCrucible Link...");
IrisLogging.info("Setting up MythicCrucible Link...");
try {
this.itemManager = MythicCrucible.inst().getItemManager();
} catch (Exception e) {
Iris.error("Failed to set up MythicCrucible Link: Unable to fetch MythicCrucible instance!");
IrisLogging.error("Failed to set up MythicCrucible Link: Unable to fetch MythicCrucible instance!");
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.core.loader;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.engine.object.IrisImage;
import art.arcane.volmlib.util.collection.KList;
@@ -63,8 +63,8 @@ public class ImageResourceLoader extends ResourceLoader<IrisImage> {
tlt.addAndGet(p.getMilliseconds());
return img;
} catch (Throwable e) {
Iris.reportError(e);
Iris.warn("Couldn't read " + resourceTypeName + " file: " + j.getPath() + ": " + e.getMessage());
IrisLogging.reportError(e);
IrisLogging.warn("Couldn't read " + resourceTypeName + " file: " + j.getPath() + ": " + e.getMessage());
return null;
}
}
@@ -101,7 +101,7 @@ public class ImageResourceLoader extends ResourceLoader<IrisImage> {
return possibleKeys;
}
Iris.debug("Building " + resourceTypeName + " Possibility Lists");
IrisLogging.debug("Building " + resourceTypeName + " Possibility Lists");
KSet<String> m = new KSet<>();
HashSet<String> visitedDirectories = new HashSet<>();
@@ -148,7 +148,7 @@ public class ImageResourceLoader extends ResourceLoader<IrisImage> {
return null;
}
if (name.equals("null")) {
Iris.warn("Refusing " + resourceTypeName + " lookup for literal string \"null\" (called by " + callerHint() + ")");
IrisLogging.warn("Refusing " + resourceTypeName + " lookup for literal string \"null\" (called by " + callerHint() + ")");
return null;
}
@@ -166,7 +166,7 @@ public class ImageResourceLoader extends ResourceLoader<IrisImage> {
}
}
Iris.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
IrisLogging.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
return null;
}
@@ -190,7 +190,7 @@ public class ImageResourceLoader extends ResourceLoader<IrisImage> {
}
}
Iris.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
IrisLogging.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
return null;
}
@@ -200,7 +200,7 @@ public class ImageResourceLoader extends ResourceLoader<IrisImage> {
return null;
}
if (name.equals("null") && warn) {
Iris.warn("Refusing " + resourceTypeName + " load for literal string \"null\" (called by " + callerHint() + ")");
IrisLogging.warn("Refusing " + resourceTypeName + " load for literal string \"null\" (called by " + callerHint() + ")");
return null;
}
return loadCache.get(name);
@@ -23,7 +23,8 @@ import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.object.*;
@@ -111,7 +112,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
}
private static void printData(ResourceLoader<?> rl) {
Iris.warn(" " + rl.getResourceTypeName() + " @ /" + rl.getFolderName() + ": Cache=" + rl.getLoadCache().getSize() + " Folders=" + rl.getFolders().size());
IrisLogging.warn(" " + rl.getResourceTypeName() + " @ /" + rl.getFolderName() + ": Cache=" + rl.getLoadCache().getSize() + " Folders=" + rl.getFolders().size());
}
public static IrisObject loadAnyObject(String key, @Nullable IrisData nearest) {
@@ -191,7 +192,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
}
}
for (File i : Objects.requireNonNull(Iris.instance.getDataFolder("packs").listFiles())) {
for (File i : Objects.requireNonNull(IrisPlatforms.get().dataFolder("packs").listFiles())) {
if (i.isDirectory()) {
IrisData dm = get(i);
if (dm == nearest) continue;
@@ -203,7 +204,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
}
}
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
}
@@ -238,7 +239,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
public void cleanupEngine() {
if (engine != null && engine.isClosed()) {
engine = null;
Iris.debug("Dereferenced Data<Engine> " + getId() + " " + getDataFolder());
IrisLogging.debug("Dereferenced Data<Engine> " + getId() + " " + getDataFolder());
}
}
@@ -277,9 +278,9 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
return r;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
Iris.error("Failed to create loader! " + registrant.getCanonicalName());
IrisLogging.error("Failed to create loader! " + registrant.getCanonicalName());
}
return null;
@@ -382,10 +383,10 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
return g.substring(1).split("\\Q.\\E")[0];
} else {
Iris.error("Forign file from loader " + f.getPath() + " (loader realm: " + getDataFolder().getPath() + ")");
IrisLogging.error("Forign file from loader " + f.getPath() + " (loader realm: " + getDataFolder().getPath() + ")");
}
Iris.error("Failed to load " + f.getPath() + " (loader realm: " + getDataFolder().getPath() + ")");
IrisLogging.error("Failed to load " + f.getPath() + " (loader realm: " + getDataFolder().getPath() + ")");
return null;
}
@@ -433,10 +434,10 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
try (JsonReader snippetReader = new JsonReader(new FileReader(f))){
return adapter.read(snippetReader);
} catch (Throwable e) {
Iris.error("Couldn't read snippet " + r + " in " + reader.getPath() + " (" + e.getMessage() + ")");
IrisLogging.error("Couldn't read snippet " + r + " in " + reader.getPath() + " (" + e.getMessage() + ")");
}
} else {
Iris.error("Couldn't find snippet " + r + " in " + reader.getPath());
IrisLogging.error("Couldn't find snippet " + r + " in " + reader.getPath());
}
return null;
@@ -445,8 +446,8 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
try {
return adapter.read(reader);
} catch (Throwable e) {
Iris.error("Failed to read " + typeToken.getRawType().getCanonicalName() + "... faking objects a little to load the file at least.");
Iris.reportError(e);
IrisLogging.error("Failed to read " + typeToken.getRawType().getCanonicalName() + "... faking objects a little to load the file at least.");
IrisLogging.reportError(e);
try {
return (T) typeToken.getRawType().getConstructor().newInstance();
} catch (Throwable ignored) {
@@ -501,7 +502,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
}
b.complete();
Iris.info("Saved Prefetch Cache to speed up future world startups");
IrisLogging.info("Saved Prefetch Cache to speed up future world startups");
}
public void loadPrefetch(Engine engine) {
@@ -518,6 +519,6 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
}
b.complete();
Iris.debug("Loaded Prefetch Cache to reduce generation disk use.");
IrisLogging.debug("Loaded Prefetch Cache to reduce generation disk use.");
}
}
@@ -19,7 +19,7 @@
package art.arcane.iris.core.loader;
import com.google.gson.GsonBuilder;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.json.JSONObject;
import art.arcane.iris.util.common.plugin.VolmitSender;
import lombok.Data;
@@ -49,7 +49,7 @@ public abstract class IrisRegistrant {
try {
Desktop.getDesktop().open(getLoadFile());
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
return getLoadFile();
@@ -1,6 +1,6 @@
package art.arcane.iris.core.loader;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.util.common.format.C;
import art.arcane.volmlib.util.json.JSONObject;
import com.google.gson.annotations.SerializedName;
@@ -53,7 +53,7 @@ final class JsonSchemaValidator {
if (snippet != null) {
out.append('\n').append(snippet);
}
Iris.warn(out.toString());
IrisLogging.warn(out.toString());
}
private static void reportUnknownKey(String key, String rawText, File file, String resourceTypeName, Set<String> known) {
@@ -74,7 +74,7 @@ final class JsonSchemaValidator {
if (snippet != null) {
out.append('\n').append(snippet);
}
Iris.warn(out.toString());
IrisLogging.warn(out.toString());
}
private static Set<String> collectFieldNames(Class<?> cls) {
@@ -18,7 +18,7 @@
package art.arcane.iris.core.loader;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.engine.object.matter.IrisMatterObject;
import art.arcane.volmlib.util.collection.KList;
@@ -61,8 +61,8 @@ public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject>
tlt.addAndGet(p.getMilliseconds());
return t;
} catch (Throwable e) {
Iris.reportError(e);
Iris.warn("Couldn't read " + resourceTypeName + " file: " + j.getPath() + ": " + e.getMessage());
IrisLogging.reportError(e);
IrisLogging.warn("Couldn't read " + resourceTypeName + " file: " + j.getPath() + ": " + e.getMessage());
return null;
}
}
@@ -98,7 +98,7 @@ public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject>
return possibleKeys;
}
Iris.debug("Building " + resourceTypeName + " Possibility Lists");
IrisLogging.debug("Building " + resourceTypeName + " Possibility Lists");
KSet<String> m = new KSet<>();
HashSet<String> visitedDirectories = new HashSet<>();
@@ -125,7 +125,7 @@ public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject>
// return possibleKeys;
// }
//
// Iris.debug("Building " + resourceTypeName + " Possibility Lists");
// IrisLogging.debug("Building " + resourceTypeName + " Possibility Lists");
// KSet<String> m = new KSet<>();
//
// for (File i : getFolders()) {
@@ -158,7 +158,7 @@ public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject>
return null;
}
if (name.equals("null")) {
Iris.warn("Refusing " + resourceTypeName + " lookup for literal string \"null\" (called by " + callerHint() + ")");
IrisLogging.warn("Refusing " + resourceTypeName + " lookup for literal string \"null\" (called by " + callerHint() + ")");
return null;
}
@@ -176,7 +176,7 @@ public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject>
}
}
Iris.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
IrisLogging.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
return null;
}
@@ -200,7 +200,7 @@ public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject>
}
}
Iris.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
IrisLogging.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
return null;
}
@@ -210,7 +210,7 @@ public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject>
return null;
}
if (name.equals("null") && warn) {
Iris.warn("Refusing " + resourceTypeName + " load for literal string \"null\" (called by " + callerHint() + ")");
IrisLogging.warn("Refusing " + resourceTypeName + " load for literal string \"null\" (called by " + callerHint() + ")");
return null;
}
return loadCache.get(name);
@@ -18,7 +18,7 @@
package art.arcane.iris.core.loader;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.engine.object.IrisObject;
import art.arcane.volmlib.util.collection.KList;
@@ -60,13 +60,13 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject> {
tlt.addAndGet(p.getMilliseconds());
return t;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
String message = e.getMessage();
String reason = e.getClass().getSimpleName();
if (message != null && !message.isBlank()) {
reason = reason + ": " + message;
}
Iris.warn("Couldn't read " + resourceTypeName + " file: " + j.getPath() + " (" + reason + ")");
IrisLogging.warn("Couldn't read " + resourceTypeName + " file: " + j.getPath() + " (" + reason + ")");
return null;
}
}
@@ -75,7 +75,7 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject> {
if (possibleKeys != null) {
return possibleKeys;
}
Iris.debug("Building " + resourceTypeName + " Possibility Lists");
IrisLogging.debug("Building " + resourceTypeName + " Possibility Lists");
KSet<String> m = new KSet<>();
HashSet<String> visitedDirectories = new HashSet<>();
for (File i : getFolders()) {
@@ -127,7 +127,7 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject> {
return null;
}
if (name.equals("null")) {
Iris.warn("Refusing " + resourceTypeName + " lookup for literal string \"null\" (called by " + callerHint() + ")");
IrisLogging.warn("Refusing " + resourceTypeName + " lookup for literal string \"null\" (called by " + callerHint() + ")");
return null;
}
@@ -145,7 +145,7 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject> {
}
}
Iris.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
IrisLogging.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
return null;
}
@@ -177,12 +177,12 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject> {
return null;
}
if (name.equals("null") && warn) {
Iris.warn("Refusing " + resourceTypeName + " load for literal string \"null\" (called by " + callerHint() + ")");
IrisLogging.warn("Refusing " + resourceTypeName + " load for literal string \"null\" (called by " + callerHint() + ")");
return null;
}
IrisObject result = loadCache.get(name);
if (result == null && warn) {
Iris.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
IrisLogging.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
}
return result;
}
@@ -19,7 +19,9 @@
package art.arcane.iris.core.loader;
import com.google.common.util.concurrent.AtomicDouble;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.project.SchemaBuilder;
import art.arcane.iris.core.service.PreservationSVC;
@@ -97,12 +99,12 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
this.root = root;
this.folderName = folderName;
loadCache = new KCache<>(this::loadRaw, IrisSettings.get().getPerformance().getResourceLoaderCacheSize());
Iris.debug("Loader<" + C.GREEN + resourceTypeName + C.LIGHT_PURPLE + "> created in " + C.RED + "IDM/" + manager.getId() + C.LIGHT_PURPLE + " on " + C.GRAY + manager.getDataFolder().getPath());
Iris.service(PreservationSVC.class).registerCache(this);
IrisLogging.debug("Loader<" + C.GREEN + resourceTypeName + C.LIGHT_PURPLE + "> created in " + C.RED + "IDM/" + manager.getId() + C.LIGHT_PURPLE + " on " + C.GRAY + manager.getDataFolder().getPath());
IrisServices.get(PreservationSVC.class).registerCache(this);
}
public JSONObject buildSchema() {
Iris.debug("Building Schema " + objectClass.getSimpleName() + " " + root.getPath());
IrisLogging.debug("Building Schema " + objectClass.getSimpleName() + " " + root.getPath());
JSONObject o = new JSONObject();
KList<String> fm = new KList<>();
@@ -119,7 +121,7 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
try {
IO.writeAll(a, new SchemaBuilder(objectClass, manager).construct().toString(4));
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
} finally {
schemaBuildQueue.remove(schemaPath);
}
@@ -134,7 +136,7 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
return null;
}
if (name.equals("null")) {
Iris.warn("Refusing " + resourceTypeName + " lookup for literal string \"null\" (called by " + callerHint() + ")");
IrisLogging.warn("Refusing " + resourceTypeName + " lookup for literal string \"null\" (called by " + callerHint() + ")");
return null;
}
@@ -152,7 +154,7 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
}
}
Iris.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
IrisLogging.warn("Couldn't find " + resourceTypeName + ": " + name + " (called by " + callerHint() + ")");
return null;
}
@@ -189,12 +191,12 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
if (sec.flip()) {
J.a(() -> {
Iris.verbose("Loaded " + C.WHITE + loads.get() + " " + resourceTypeName + (loads.get() == 1 ? "" : "s") + C.GRAY + " (" + Form.f(getLoadCache().getSize()) + " " + resourceTypeName + (loadCache.getSize() == 1 ? "" : "s") + " Loaded)");
IrisLogging.debug("Loaded " + C.WHITE + loads.get() + " " + resourceTypeName + (loads.get() == 1 ? "" : "s") + C.GRAY + " (" + Form.f(getLoadCache().getSize()) + " " + resourceTypeName + (loadCache.getSize() == 1 ? "" : "s") + " Loaded)");
loads.set(0);
});
}
Iris.debug("Loader<" + C.GREEN + resourceTypeName + C.LIGHT_PURPLE + "> iload " + C.YELLOW + t.getLoadKey() + C.LIGHT_PURPLE + " in " + C.GRAY + t.getLoadFile().getPath() + C.LIGHT_PURPLE + " TLT: " + C.RED + Form.duration(tlt.get(), 2));
IrisLogging.debug("Loader<" + C.GREEN + resourceTypeName + C.LIGHT_PURPLE + "> iload " + C.YELLOW + t.getLoadKey() + C.LIGHT_PURPLE + " in " + C.GRAY + t.getLoadFile().getPath() + C.LIGHT_PURPLE + " TLT: " + C.RED + Form.duration(tlt.get(), 2));
}
public void failLoad(File path, Throwable e) {
@@ -292,7 +294,7 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
tlt.addAndGet(p.getMilliseconds());
return t;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
failLoad(j, rawText, e);
return null;
}
@@ -401,7 +403,7 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
return null;
}
if (name.equals("null") && warn) {
Iris.warn("Refusing " + resourceTypeName + " load for literal string \"null\" (called by " + callerHint() + ")");
IrisLogging.warn("Refusing " + resourceTypeName + " load for literal string \"null\" (called by " + callerHint() + ")");
return null;
}
@@ -412,7 +414,7 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
public void loadFirstAccess(Engine engine) throws IOException {
String id = "DIM" + Math.abs(engine.getSeedManager().getSeed() + engine.getDimension().getVersion() + engine.getDimension().getLoadKey().hashCode());
File file = Iris.instance.getDataFile("prefetch/" + id + "/" + Math.abs(getFolderName().hashCode()) + ".ipfch");
File file = IrisPlatforms.get().dataFile("prefetch/" + id + "/" + Math.abs(getFolderName().hashCode()) + ".ipfch");
if (!file.exists()) {
return;
@@ -429,7 +431,7 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
}
din.close();
Iris.info("Loading " + s.size() + " prefetch " + getFolderName());
IrisLogging.info("Loading " + s.size() + " prefetch " + getFolderName());
firstAccess = null;
loadAllParallel(s);
}
@@ -437,7 +439,7 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
public void saveFirstAccess(Engine engine) throws IOException {
if (firstAccess == null) return;
String id = "DIM" + Math.abs(engine.getSeedManager().getSeed() + engine.getDimension().getVersion() + engine.getDimension().getLoadKey().hashCode());
File file = Iris.instance.getDataFile("prefetch/" + id + "/" + Math.abs(getFolderName().hashCode()) + ".ipfch");
File file = IrisPlatforms.get().dataFile("prefetch/" + id + "/" + Math.abs(getFolderName().hashCode()) + ".ipfch");
file.getParentFile().mkdirs();
FileOutputStream fos = new FileOutputStream(file);
GZIPOutputStream gzo = new CustomOutputStream(fos, 9);
@@ -18,7 +18,7 @@
package art.arcane.iris.core.nms;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.nms.v1X.NMSBinding1X;
import org.bukkit.Bukkit;
@@ -57,8 +57,8 @@ public class INMS {
return name.split("\\Q.\\E")[3];
}
} catch (Throwable e) {
Iris.reportError(e);
Iris.error("Failed to determine server nms version!");
IrisLogging.reportError(e);
IrisLogging.error("Failed to determine server nms version!");
e.printStackTrace();
}
@@ -70,7 +70,7 @@ public class INMS {
boolean disableNms = IrisSettings.get().getGeneral().isDisableNMS();
List<String> probeCodes = NmsBindingProbeSupport.getBindingProbeCodes(code, disableNms, getFallbackBindingCodes());
if ("BUKKIT".equals(code) && !disableNms) {
Iris.info("NMS tag resolution fell back to Bukkit; probing supported revision bindings.");
IrisLogging.info("NMS tag resolution fell back to Bukkit; probing supported revision bindings.");
}
for (int i = 0; i < probeCodes.size(); i++) {
@@ -81,8 +81,8 @@ public class INMS {
}
if (disableNms) {
Iris.info("Craftbukkit " + code + " <-> " + NMSBinding1X.class.getSimpleName() + " Successfully Bound");
Iris.warn("Note: NMS support is disabled. Iris is running in limited Bukkit fallback mode.");
IrisLogging.info("Craftbukkit " + code + " <-> " + NMSBinding1X.class.getSimpleName() + " Successfully Bound");
IrisLogging.warn("Note: NMS support is disabled. Iris is running in limited Bukkit fallback mode.");
return new NMSBinding1X();
}
@@ -114,8 +114,8 @@ public class INMS {
try {
return MinecraftVersion.detect(Bukkit.getServer());
} catch (Throwable e) {
Iris.reportError(e);
Iris.error("Failed to determine server minecraft version!");
IrisLogging.reportError(e);
IrisLogging.error("Failed to determine server minecraft version!");
e.printStackTrace();
return null;
}
@@ -123,22 +123,22 @@ public class INMS {
private static INMSBinding tryBind(String code, boolean announce) {
if (announce) {
Iris.info("Locating NMS Binding for " + code);
IrisLogging.info("Locating NMS Binding for " + code);
} else {
Iris.info("Probing NMS Binding for " + code);
IrisLogging.info("Probing NMS Binding for " + code);
}
try {
Class<?> clazz = Class.forName("art.arcane.iris.core.nms." + code + ".NMSBinding");
Object candidate = clazz.getConstructor().newInstance();
if (candidate instanceof INMSBinding binding) {
Iris.info("Craftbukkit " + code + " <-> " + candidate.getClass().getSimpleName() + " Successfully Bound");
IrisLogging.info("Craftbukkit " + code + " <-> " + candidate.getClass().getSimpleName() + " Successfully Bound");
return binding;
}
} catch (ClassNotFoundException | NoClassDefFoundError classNotFoundException) {
Iris.warn("Failed to load NMS binding class for " + code + ": " + classNotFoundException.getMessage());
IrisLogging.warn("Failed to load NMS binding class for " + code + ": " + classNotFoundException.getMessage());
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
}
@@ -1,6 +1,6 @@
package art.arcane.iris.core.nms.datapack;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.nms.INMS;
import art.arcane.iris.core.nms.datapack.v1192.DataFixerV1192;
import art.arcane.iris.core.nms.datapack.v1206.DataFixerV1206;
@@ -41,14 +41,14 @@ public enum DataVersion {
DataVersion version = INMS.get().getDataVersion();
if (version == null || version == UNSUPPORTED) {
DataVersion fallback = getLatest();
Iris.warn("Unsupported datapack version mapping detected, falling back to latest fixer: " + fallback.getVersion());
IrisLogging.warn("Unsupported datapack version mapping detected, falling back to latest fixer: " + fallback.getVersion());
return fallback.get();
}
IDataFixer fixer = version.get();
if (fixer == null) {
DataVersion fallback = getLatest();
Iris.warn("Null datapack fixer for " + version.getVersion() + ", falling back to latest fixer: " + fallback.getVersion());
IrisLogging.warn("Null datapack fixer for " + version.getVersion() + ", falling back to latest fixer: " + fallback.getVersion());
return fallback.get();
}
@@ -1,6 +1,6 @@
package art.arcane.iris.core.nms.datapack.v1206;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.nms.datapack.v1192.DataFixerV1192;
import art.arcane.iris.engine.object.IrisBiomeCustom;
import art.arcane.iris.engine.object.IrisBiomeCustomSpawn;
@@ -34,7 +34,7 @@ public class DataFixerV1206 extends DataFixerV1192 {
}
EntityType type = i.getType();
if (type == null) {
Iris.warn("Skipping custom biome spawn with null entity type in biome " + biome.getId());
IrisLogging.warn("Skipping custom biome spawn with null entity type in biome " + biome.getId());
continue;
}
IrisBiomeCustomSpawnType group = i.getGroup() == null ? IrisBiomeCustomSpawnType.MISC : i.getGroup();
@@ -42,7 +42,7 @@ public class DataFixerV1206 extends DataFixerV1192 {
JSONObject o = new JSONObject();
NamespacedKey key = type.getKey();
if (key == null) {
Iris.warn("Skipping custom biome spawn with unresolved entity key in biome " + biome.getId());
IrisLogging.warn("Skipping custom biome spawn with unresolved entity key in biome " + biome.getId());
continue;
}
o.put("type", key.toString());
@@ -18,7 +18,7 @@
package art.arcane.iris.core.nms.v1X;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.nms.INMSBinding;
import art.arcane.iris.core.nms.container.BiomeColor;
import art.arcane.iris.core.nms.container.BlockProperty;
@@ -223,14 +223,14 @@ public class NMSBinding1X implements INMSBinding {
@Override
public MCABiomeContainer newBiomeContainer(int min, int max) {
Iris.error("Cannot use the custom biome data! Iris is incapable of using MCA generation on this version of minecraft!");
IrisLogging.error("Cannot use the custom biome data! Iris is incapable of using MCA generation on this version of minecraft!");
return null;
}
@Override
public MCABiomeContainer newBiomeContainer(int min, int max, int[] v) {
Iris.error("Cannot use the custom biome data! Iris is incapable of using MCA generation on this version of minecraft!");
IrisLogging.error("Cannot use the custom biome data! Iris is incapable of using MCA generation on this version of minecraft!");
return null;
}
@@ -247,7 +247,7 @@ public class NMSBinding1X implements INMSBinding {
@Override
public MCAPaletteAccess createPalette() {
Iris.error("Cannot use the global data palette! Iris is incapable of using MCA generation on this version of minecraft!");
IrisLogging.error("Cannot use the global data palette! Iris is incapable of using MCA generation on this version of minecraft!");
return null;
}
}
@@ -18,7 +18,8 @@
package art.arcane.iris.core.pack;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.loader.ResourceLoader;
import art.arcane.iris.core.service.StudioSVC;
@@ -153,7 +154,7 @@ public class IrisPack {
* @return the file path
*/
public static File packsPack(String name) {
return Iris.instance.getDataFolderNoCreate(StudioSVC.WORKSPACE_NAME, name);
return IrisPlatforms.get().dataFolderNoCreate(StudioSVC.WORKSPACE_NAME, name);
}
private static KList<File> collectFiles(File f, String fileExtension) {
@@ -208,20 +209,20 @@ public class IrisPack {
try {
PrecisionStopwatch p = PrecisionStopwatch.start();
Iris.debug("Building Workspace: " + ws.getPath());
IrisLogging.debug("Building Workspace: " + ws.getPath());
JSONObject j = generateWorkspaceConfig();
IO.writeAll(ws, j.toString(4));
p.end();
Iris.debug("Building Workspace: " + ws.getPath() + " took " + Form.duration(p.getMilliseconds(), 2));
IrisLogging.debug("Building Workspace: " + ws.getPath() + " took " + Form.duration(p.getMilliseconds(), 2));
return true;
} catch (Throwable e) {
Iris.reportError(e);
Iris.warn("Pack invalid: " + ws.getAbsolutePath() + " Re-creating. You may loose some vs-code workspace settings! But not your actual project!");
IrisLogging.reportError(e);
IrisLogging.warn("Pack invalid: " + ws.getAbsolutePath() + " Re-creating. You may loose some vs-code workspace settings! But not your actual project!");
ws.delete();
try {
IO.writeAll(ws, generateWorkspaceConfig());
} catch (IOException e1) {
Iris.reportError(e1);
IrisLogging.reportError(e1);
e1.printStackTrace();
}
}
@@ -265,7 +266,7 @@ public class IrisPack {
try {
FileUtils.copyDirectory(getFolder(), folder);
} catch (IOException e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
return new IrisPack(folder);
@@ -288,7 +289,7 @@ public class IrisPack {
try {
FileUtils.copyDirectory(getFolder(), newPack);
} catch (IOException e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
IrisData data = IrisData.get(newPack);
@@ -18,7 +18,7 @@
package art.arcane.iris.core.pack;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.core.service.StudioSVC;
import art.arcane.volmlib.util.format.Form;
import art.arcane.iris.util.common.plugin.VolmitSender;
@@ -110,11 +110,11 @@ public class IrisPackRepository {
}
public void install(VolmitSender sender, Runnable whenComplete) throws MalformedURLException {
File pack = Iris.instance.getDataFolderNoCreate(StudioSVC.WORKSPACE_NAME, getRepo());
File pack = IrisPlatforms.get().dataFolderNoCreate(StudioSVC.WORKSPACE_NAME, getRepo());
if (!pack.exists()) {
File dl = new File(Iris.getTemp(), "dltk-" + UUID.randomUUID() + ".zip");
File work = new File(Iris.getTemp(), "extk-" + UUID.randomUUID());
File dl = new File(IrisPlatforms.get().dataFolder("cache", "temp"), "dltk-" + UUID.randomUUID() + ".zip");
File work = new File(IrisPlatforms.get().dataFolder("cache", "temp"), "extk-" + UUID.randomUUID());
new JobCollection(Form.capitalize(getRepo()),
new DownloadJob(toURL(), pack),
new SingleJob("Extracting", () -> ZipUtil.unpack(dl, work)),
@@ -18,7 +18,7 @@
package art.arcane.iris.core.pack;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.json.JSONArray;
import art.arcane.volmlib.util.json.JSONObject;
@@ -94,7 +94,7 @@ public final class PackValidator {
String packTextCorpus = buildPackTextCorpus(packFolder);
runUnusedResourceGc(packFolder, packTextCorpus, removedUnusedFiles, warnings);
} catch (Throwable e) {
Iris.reportError("PackValidator GC pass failed for pack '" + packName + "'", e);
IrisLogging.reportError("PackValidator GC pass failed for pack '" + packName + "'", e);
warnings.add("Unused-resource GC pass failed: " + e.getMessage());
}
@@ -192,7 +192,7 @@ public final class PackValidator {
}
});
} catch (Throwable e) {
Iris.reportError("PackValidator failed to walk pack folder for corpus scan", e);
IrisLogging.reportError("PackValidator failed to walk pack folder for corpus scan", e);
}
return sb.toString();
}
@@ -269,7 +269,7 @@ public final class PackValidator {
Files.move(src, dest, StandardCopyOption.REPLACE_EXISTING);
removedUnusedFiles.add(relative.toString().replace(File.separatorChar, '/'));
} catch (Throwable e) {
Iris.reportError("PackValidator failed to move unused file " + file.getPath() + " to trash", e);
IrisLogging.reportError("PackValidator failed to move unused file " + file.getPath() + " to trash", e);
warnings.add("Failed to quarantine unused file " + file.getName() + ": " + e.getMessage());
}
}
@@ -340,7 +340,7 @@ public final class PackValidator {
restored++;
}
} catch (Throwable e) {
Iris.reportError("PackValidator failed to restore trash for pack " + packFolder.getName(), e);
IrisLogging.reportError("PackValidator failed to restore trash for pack " + packFolder.getName(), e);
}
deleteFolderQuiet(latestDump);
return restored;
@@ -1,7 +1,7 @@
package art.arcane.iris.core.pregenerator;
import com.google.gson.Gson;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.tools.IrisToolbelt;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.object.IrisBiome;
@@ -109,7 +109,7 @@ public class DeepSearchPregenerator extends Thread implements Listener {
// chunkCache(); //todo finish this
if (latch.flip() && !job.paused) {
if (cacheLock.isLocked()) {
Iris.info("DeepFinder: Caching: " + chunkCachePos.get() + " Of " + chunkCacheSize.get());
IrisLogging.info("DeepFinder: Caching: " + chunkCachePos.get() + " Of " + chunkCacheSize.get());
} else {
long eta = computeETA();
save();
@@ -118,12 +118,12 @@ public class DeepSearchPregenerator extends Thread implements Listener {
secondGenerated = secondGenerated / 3;
chunksPerSecond.put(secondGenerated);
chunksPerMinute.put(secondGenerated * 60);
Iris.info("DeepFinder: " + C.IRIS + world.getName() + C.RESET + " Searching: " + Form.f(foundChunks.get()) + " of " + Form.f(foundTotalChunks.get()) + " " + Form.f((int) chunksPerSecond.getAverage()) + "/s ETA: " + Form.duration((double) eta, 2));
IrisLogging.info("DeepFinder: " + C.IRIS + world.getName() + C.RESET + " Searching: " + Form.f(foundChunks.get()) + " of " + Form.f(foundTotalChunks.get()) + " " + Form.f((int) chunksPerSecond.getAverage()) + "/s ETA: " + Form.duration((double) eta, 2));
}
}
if (foundChunks.get() >= foundTotalChunks.get()) {
Iris.info("Completed DeepSearch!");
IrisLogging.info("Completed DeepSearch!");
interrupt();
}
}
@@ -160,7 +160,7 @@ public class DeepSearchPregenerator extends Thread implements Listener {
File found = new File("plugins", "iris" + File.separator + "found.txt");
found.getParentFile().mkdirs();
IrisBiome biome = engine.getBiome(xx, engine.getHeight(), zz);
Iris.info("Found at! " + xx + ", " + zz + " Biome ID: " + biome.getName());
IrisLogging.info("Found at! " + xx + ", " + zz + " Biome ID: " + biome.getName());
try (FileWriter writer = new FileWriter(found, true)) {
writer.write("Biome at: X: " + xx + " Z: " + zz + " Biome ID: " + biome.getName() + "\n");
}
@@ -205,9 +205,9 @@ public class DeepSearchPregenerator extends Thread implements Listener {
}
if ( job.paused) {
Iris.info(C.BLUE + "DeepSearch: " + C.IRIS + world.getName() + C.BLUE + " Paused");
IrisLogging.info(C.BLUE + "DeepSearch: " + C.IRIS + world.getName() + C.BLUE + " Paused");
} else {
Iris.info(C.BLUE + "DeepSearch: " + C.IRIS + world.getName() + C.BLUE + " Resumed");
IrisLogging.info(C.BLUE + "DeepSearch: " + C.IRIS + world.getName() + C.BLUE + " Resumed");
}
}
@@ -217,13 +217,13 @@ public class DeepSearchPregenerator extends Thread implements Listener {
}
public void shutdownInstance(World world) throws IOException {
Iris.info("DeepSearch: " + C.IRIS + world.getName() + C.BLUE + " Shutting down..");
IrisLogging.info("DeepSearch: " + C.IRIS + world.getName() + C.BLUE + " Shutting down..");
DeepSearchJob job = jobs.get(world.getName());
File worldDirectory = new File(Bukkit.getWorldContainer(), world.getName());
File deepFile = new File(worldDirectory, "DeepSearch.json");
if (job == null) {
Iris.error("No DeepSearch job found for world: " + world.getName());
IrisLogging.error("No DeepSearch job found for world: " + world.getName());
return;
}
@@ -238,10 +238,10 @@ public class DeepSearchPregenerator extends Thread implements Listener {
deepFile.delete();
J.sleep(1000);
}
Iris.info("DeepSearch: " + C.IRIS + world.getName() + C.BLUE + " File deleted and instance closed.");
IrisLogging.info("DeepSearch: " + C.IRIS + world.getName() + C.BLUE + " File deleted and instance closed.");
}, 20);
} catch (Exception e) {
Iris.error("Failed to shutdown DeepSearch for " + world.getName());
IrisLogging.error("Failed to shutdown DeepSearch for " + world.getName());
e.printStackTrace();
} finally {
saveNow();
@@ -18,7 +18,7 @@
package art.arcane.iris.core.pregenerator;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.tools.IrisPackBenchmarking;
import art.arcane.volmlib.util.collection.KList;
@@ -139,7 +139,7 @@ public class IrisPregenerator {
if (cl.flip()) {
double percentage = ((double) generated.get() / (double) totalChunks.get()) * 100;
Iris.info("%s: %s of %s (%.0f%%), %s/s ETA: %s",
IrisLogging.info("%s: %s of %s (%.0f%%), %s/s ETA: %s",
benchmarking != null ? "Benchmarking" : "Pregen",
Form.f(generated.get()),
Form.f(totalChunks.get()),
@@ -181,10 +181,10 @@ public class IrisPregenerator {
PrecisionStopwatch p = PrecisionStopwatch.start();
task.iterateRegions((x, z) -> visitRegion(x, z, true));
task.iterateRegions((x, z) -> visitRegion(x, z, false));
Iris.info("Pregen took " + Form.duration((long) p.getMilliseconds()));
IrisLogging.info("Pregen took " + Form.duration((long) p.getMilliseconds()));
shutdown();
if (benchmarking == null) {
Iris.info(C.IRIS + "Pregen stopped.");
IrisLogging.info(C.IRIS + "Pregen stopped.");
} else {
benchmarking.finishedBenchmark(chunksPerSecondHistory);
}
@@ -237,7 +237,7 @@ public class IrisPregenerator {
int loadedAfter = mantle.getLoadedRegionCount();
if (loadedAfter < loadedBefore) {
Iris.info("Pregen reclaimed " + (loadedBefore - loadedAfter) + " tectonic plate(s) from the mantle");
IrisLogging.info("Pregen reclaimed " + (loadedBefore - loadedAfter) + " tectonic plate(s) from the mantle");
}
}
@@ -1,6 +1,6 @@
package art.arcane.iris.core.pregenerator.cache;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.data.Varint;
import art.arcane.volmlib.util.documentation.ChunkCoordinates;
import art.arcane.volmlib.util.documentation.RegionCoordinates;
@@ -157,9 +157,9 @@ public class PregenCacheImpl implements PregenCache {
try (DataInputStream input = new DataInputStream(new LZ4BlockInputStream(new FileInputStream(file)))) {
return readPlate(x, z, input);
} catch (IOException e) {
Iris.error("Failed to read pregen cache " + file);
IrisLogging.error("Failed to read pregen cache " + file);
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
}
return new Plate(x, z);
@@ -175,9 +175,9 @@ public class PregenCacheImpl implements PregenCache {
IO.write(file, output -> new DataOutputStream(new LZ4BlockOutputStream(output)), plate::write);
plate.dirty = false;
} catch (IOException e) {
Iris.error("Failed to write preen cache " + file);
IrisLogging.error("Failed to write preen cache " + file);
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.core.pregenerator.methods;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisPaperLikeBackendMode;
import art.arcane.iris.core.IrisRuntimeSchedulerMode;
import art.arcane.iris.core.IrisSettings;
@@ -182,7 +182,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
try {
J.sfut(() -> {
if (world == null) {
Iris.warn("World was null somehow...");
IrisLogging.warn("World was null somehow...");
return;
}
@@ -224,7 +224,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
int sizeBefore = lastUse.size();
if (sizeBefore > 0) {
lastUse.clear();
Iris.info("Periodic chunk cleanup: cleared " + sizeBefore + " Folia chunk references");
IrisLogging.info("Periodic chunk cleanup: cleared " + sizeBefore + " Folia chunk references");
}
return;
}
@@ -247,7 +247,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
int removedCount = removed.get();
if (removedCount > 0) {
Iris.info("Periodic chunk cleanup: removed " + removedCount + "/" + sizeBefore + " stale chunk references");
IrisLogging.info("Periodic chunk cleanup: removed " + removedCount + "/" + sizeBefore + " stale chunk references");
}
}
@@ -260,10 +260,10 @@ public class AsyncPregenMethod implements PregeneratorMethod {
if (root instanceof java.util.concurrent.TimeoutException) {
onTimeout(x, z);
} else {
Iris.warn("Failed async pregen chunk load at " + x + "," + z + ". " + metricsSnapshot());
IrisLogging.warn("Failed async pregen chunk load at " + x + "," + z + ". " + metricsSnapshot());
}
Iris.reportError(throwable);
IrisLogging.reportError(throwable);
return null;
}
@@ -282,7 +282,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
int suppressed = suppressedTimeoutLogs.getAndSet(0);
String suppressedText = suppressed <= 0 ? "" : " suppressed=" + suppressed;
Iris.warn("Timed out async pregen chunk load at " + x + "," + z
IrisLogging.warn("Timed out async pregen chunk load at " + x + "," + z
+ " after " + timeoutSeconds + "s."
+ " adaptiveLimit=" + adaptiveInFlightLimit.get()
+ suppressedText + " " + metricsSnapshot());
@@ -345,7 +345,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
}
if (lastAdaptiveLogAt.compareAndSet(last, now)) {
Iris.info("Async pregen adaptive limit " + mode + " -> " + value + " " + metricsSnapshot());
IrisLogging.info("Async pregen adaptive limit " + mode + " -> " + value + " " + metricsSnapshot());
}
}
@@ -515,7 +515,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
long elapsed = M.ms() - waitStart;
if (elapsed >= mantleBackpressureTimeoutMs) {
Iris.warn("Pregen mantle backpressure exceeded " + mantleBackpressureTimeoutMs + "ms with " + resident
IrisLogging.warn("Pregen mantle backpressure exceeded " + mantleBackpressureTimeoutMs + "ms with " + resident
+ " tectonic plates resident (hard cap " + hardCap + "); proceeding to avoid deadlock. "
+ "Raise pregen.maxResidentTectonicPlates if this persists. " + metricsSnapshot());
return;
@@ -524,7 +524,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
long logNow = M.ms();
if (logNow - lastLog >= 5_000L) {
lastLog = logNow;
Iris.warn("Pregen mantle backpressure: " + resident + " tectonic plates resident (hard cap " + hardCap
IrisLogging.warn("Pregen mantle backpressure: " + resident + " tectonic plates resident (hard cap " + hardCap
+ "), freed " + freed + " last pass, waited " + elapsed + "ms.");
}
@@ -539,7 +539,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
@Override
public void init() {
Iris.info("Async pregen init: world=" + world.getName()
IrisLogging.info("Async pregen init: world=" + world.getName()
+ ", mode=" + runtimeSchedulerMode.name().toLowerCase(Locale.ROOT)
+ ", backend=" + backendMode
+ ", chunkAccess=" + chunkAccessMode
@@ -733,10 +733,10 @@ public class AsyncPregenMethod implements PregeneratorMethod {
pool.getClass().getDeclaredMethod("adjustThreadCount", int.class).invoke(pool, adjusted);
return threads;
} catch (Throwable e) {
Iris.warn("Failed to increase worker threads, if you are on paper or a fork of it please increase it manually to " + adjusted);
Iris.warn("For more information see https://docs.papermc.io/paper/reference/global-configuration#chunk_system_worker_threads");
IrisLogging.warn("Failed to increase worker threads, if you are on paper or a fork of it please increase it manually to " + adjusted);
IrisLogging.warn("For more information see https://docs.papermc.io/paper/reference/global-configuration#chunk_system_worker_threads");
if (e instanceof InvocationTargetException) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
}
}
@@ -754,8 +754,8 @@ public class AsyncPregenMethod implements PregeneratorMethod {
method.invoke(pool, i);
return 0;
} catch (Throwable e) {
Iris.reportError(e);
Iris.error("Failed to reset worker threads");
IrisLogging.reportError(e);
IrisLogging.error("Failed to reset worker threads");
e.printStackTrace();
}
return i;
@@ -783,7 +783,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
.whenComplete((chunk, throwable) -> completeFoliaChunk(x, z, listener, chunk, throwable)))) {
markFinished(false);
semaphore.release();
Iris.warn("Failed to schedule Folia region pregen task at " + x + "," + z + ". " + metricsSnapshot());
IrisLogging.warn("Failed to schedule Folia region pregen task at " + x + "," + z + ". " + metricsSnapshot());
}
}
@@ -805,7 +805,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
lastUse.put(chunk, M.ms());
success = true;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
} finally {
markFinished(success);
@@ -838,7 +838,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
} finally {
markFinished(success);
@@ -1,6 +1,7 @@
package art.arcane.iris.core.pregenerator.methods;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.core.pregenerator.PregenListener;
import art.arcane.iris.core.pregenerator.PregeneratorMethod;
import art.arcane.iris.core.pregenerator.cache.PregenCache;
@@ -16,9 +17,9 @@ public class CachedPregenMethod implements PregeneratorMethod {
public CachedPregenMethod(PregeneratorMethod method, String worldName) {
this.method = method;
var cache = Iris.service(GlobalCacheSVC.class).get(worldName);
var cache = IrisServices.get(GlobalCacheSVC.class).get(worldName);
if (cache == null) {
Iris.debug("Could not find existing cache for " + worldName + " creating fallback");
IrisLogging.debug("Could not find existing cache for " + worldName + " creating fallback");
cache = GlobalCacheSVC.createDefault(worldName);
}
this.cache = cache;
@@ -18,7 +18,7 @@
package art.arcane.iris.core.pregenerator.methods;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.pregenerator.PregenListener;
import art.arcane.iris.core.pregenerator.PregeneratorMethod;
@@ -70,7 +70,7 @@ public class MedievalPregenMethod implements PregeneratorMethod {
try {
J.sfut(() -> {
if (world == null) {
Iris.warn("World was null somehow...");
IrisLogging.warn("World was null somehow...");
return;
}
@@ -19,7 +19,8 @@
package art.arcane.iris.core.project;
import com.google.gson.Gson;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.lifecycle.WorldLifecycleService;
import art.arcane.iris.core.loader.IrisData;
@@ -91,8 +92,8 @@ public class IrisProject {
try {
clean(clean);
} catch (Throwable e) {
Iris.reportError(e);
Iris.error("Failed to beautify " + clean.getAbsolutePath() + " You may have errors in your json!");
IrisLogging.reportError(e);
IrisLogging.error("Failed to beautify " + clean.getAbsolutePath() + " You may have errors in your json!");
}
c++;
@@ -114,7 +115,7 @@ public class IrisProject {
if (i.equals("block") && o instanceof String && !o.toString().trim().isEmpty() && !o.toString().contains(":")) {
obj.put(i, "minecraft:" + o);
Iris.debug("Updated Block Key: " + o + " to " + obj.getString(i) + " in " + f.getPath());
IrisLogging.debug("Updated Block Key: " + o + " to " + obj.getString(i) + " in " + f.getPath());
}
if (o instanceof JSONObject) {
@@ -184,20 +185,20 @@ public class IrisProject {
if (!doOpenVSCode(f)) {
File ff = new File(d.getLoader().getDataFolder(), d.getLoadKey() + ".code-workspace");
Iris.warn("Project missing code-workspace: " + ff.getAbsolutePath() + " Re-creating code workspace.");
IrisLogging.warn("Project missing code-workspace: " + ff.getAbsolutePath() + " Re-creating code workspace.");
try {
IO.writeAll(ff, createCodeWorkspaceConfig(false));
} catch (IOException e1) {
Iris.reportError(e1);
IrisLogging.reportError(e1);
e1.printStackTrace();
}
if (!doOpenVSCode(f)) {
Iris.warn("Tried creating code workspace but failed a second time. Your project is likely corrupt.");
IrisLogging.warn("Tried creating code workspace but failed a second time. Your project is likely corrupt.");
}
}
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
}
});
@@ -211,13 +212,13 @@ public class IrisProject {
if (IrisSettings.get().getStudio().isOpenVSCode()) {
if (!GraphicsEnvironment.isHeadless()) {
Iris.msg("Opening VSCode. You may see the output from VSCode.");
Iris.msg("VSCode output always starts with: '(node:#####) electron'");
IrisLogging.msg("Opening VSCode. You may see the output from VSCode.");
IrisLogging.msg("VSCode output always starts with: '(node:#####) electron'");
Thread launcherThread = new Thread(() -> {
try {
Desktop.getDesktop().open(i);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}, "Iris-VSCode-Launcher");
launcherThread.setDaemon(true);
@@ -268,7 +269,7 @@ public class IrisProject {
Throwable error = throwable instanceof java.util.concurrent.CompletionException completionException && completionException.getCause() != null
? completionException.getCause()
: throwable;
Iris.reportError("Studio open failed for project \"" + getName() + "\".", error);
IrisLogging.reportError("Studio open failed for project \"" + getName() + "\".", error);
sender.sendMessage(C.RED + "Studio open failed: " + error.getMessage());
return;
}
@@ -448,13 +449,13 @@ public class IrisProject {
p.end();
return true;
} catch (Throwable e) {
Iris.reportError(e);
Iris.warn("Project invalid: " + ws.getAbsolutePath() + " Re-creating. You may loose some vs-code workspace settings! But not your actual project!");
IrisLogging.reportError(e);
IrisLogging.warn("Project invalid: " + ws.getAbsolutePath() + " Re-creating. You may loose some vs-code workspace settings! But not your actual project!");
ws.delete();
try {
IO.writeAll(ws, createCodeWorkspaceConfig());
} catch (IOException e1) {
Iris.reportError(e1);
IrisLogging.reportError(e1);
e1.printStackTrace();
}
}
@@ -613,9 +614,9 @@ public class IrisProject {
String dimm = getName();
IrisData dm = IrisData.get(path);
IrisDimension dimension = dm.getDimensionLoader().load(dimm);
File folder = new File(Iris.instance.getDataFolder(), "exports/" + dimension.getLoadKey());
File folder = new File(IrisPlatforms.get().dataFolder(), "exports/" + dimension.getLoadKey());
folder.mkdirs();
Iris.info("Packaging Dimension " + dimension.getName() + " " + (obfuscate ? "(Obfuscated)" : ""));
IrisLogging.info("Packaging Dimension " + dimension.getName() + " " + (obfuscate ? "(Obfuscated)" : ""));
KSet<IrisRegion> regions = new KSet<>();
KSet<IrisBiome> biomes = new KSet<>();
KSet<IrisEntity> entities = new KSet<>();
@@ -684,7 +685,7 @@ public class IrisProject {
sender.sendMessage("Wrote another " + g + " Objects");
}
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
})));
@@ -692,7 +693,7 @@ public class IrisProject {
c.append(IO.hash(b.toString()));
b = new StringBuilder();
Iris.info("Writing Dimensional Scaffold");
IrisLogging.info("Writing Dimensional Scaffold");
try {
a = new JSONObject(new Gson().toJson(dimension)).toString(minify ? 0 : 4);
@@ -745,15 +746,15 @@ public class IrisProject {
meta.put("time", M.ms());
meta.put("version", dimension.getVersion());
IO.writeAll(new File(folder, "package.json"), meta.toString(minify ? 0 : 4));
File p = new File(Iris.instance.getDataFolder(), "exports/" + dimension.getLoadKey() + ".iris");
Iris.info("Compressing Package");
File p = new File(IrisPlatforms.get().dataFolder(), "exports/" + dimension.getLoadKey() + ".iris");
IrisLogging.info("Compressing Package");
ZipUtil.pack(folder, p, 9);
IO.delete(folder);
sender.sendMessage("Package Compiled!");
return p;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
}
sender.sendMessage("Failed!");
@@ -854,7 +855,7 @@ public class IrisProject {
try {
files.add(clean);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
}
@@ -868,7 +869,7 @@ public class IrisProject {
try {
files.add(clean);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
}
@@ -18,7 +18,8 @@
package art.arcane.iris.core.project;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.core.link.Identifier;
import art.arcane.iris.core.link.data.DataType;
import art.arcane.iris.core.loader.IrisData;
@@ -114,7 +115,7 @@ public class SchemaBuilder {
schema.put("definitions", defs);
for (String i : warnings) {
Iris.warn(root.getSimpleName() + ": " + i);
IrisLogging.warn(root.getSimpleName() + ": " + i);
}
return schema;
@@ -245,7 +246,7 @@ public class SchemaBuilder {
prop.put("$ref", "#/definitions/" + key);
description.add(SYMBOL_TYPE__N + " Must be a valid " + loader.getFolderName() + " (use ctrl+space for auto complete!)");
} else {
Iris.error("Cannot find Registry Loader for type " + rr.value() + " used in " + k.getDeclaringClass().getCanonicalName() + " in field " + k.getName());
IrisLogging.error("Cannot find Registry Loader for type " + rr.value() + " used in " + k.getDeclaringClass().getCanonicalName() + " in field " + k.getName());
}
} else if (k.isAnnotationPresent(RegistryListStructure.class)) {
String key = "enum-iris-structure-placement";
@@ -342,7 +343,7 @@ public class SchemaBuilder {
if (!definitions.containsKey(key)) {
JSONObject j = new JSONObject();
KList<String> list = Iris.service(ExternalDataSVC.class)
KList<String> list = IrisServices.get(ExternalDataSVC.class)
.getAllIdentifiers(DataType.ENTITY)
.stream()
.map(Identifier::toString)
@@ -407,7 +408,7 @@ public class SchemaBuilder {
prop.put("$ref", "#/definitions/" + key);
description.add(SYMBOL_TYPE__N + " Must be a valid " + fancyType + " (use ctrl+space for auto complete!)");
} catch (Throwable e) {
Iris.error("Could not execute apply method in " + functionClass.getName());
IrisLogging.error("Could not execute apply method in " + functionClass.getName());
}
} else if (k.getType().equals(PotionEffectType.class)) {
String key = "enum-potion-effect-type";
@@ -538,7 +539,7 @@ public class SchemaBuilder {
prop.put("items", items);
description.add(SYMBOL_TYPE__N + " Must be a valid " + loader.getResourceTypeName() + " (use ctrl+space for auto complete!)");
} else {
Iris.error("Cannot find Registry Loader for type (list schema) " + rr.value() + " used in " + k.getDeclaringClass().getCanonicalName() + " in field " + k.getName());
IrisLogging.error("Cannot find Registry Loader for type (list schema) " + rr.value() + " used in " + k.getDeclaringClass().getCanonicalName() + " in field " + k.getName());
}
} else if (k.isAnnotationPresent(RegistryListStructure.class)) {
fancyType = "List<Structure>";
@@ -655,7 +656,7 @@ public class SchemaBuilder {
prop.put("items", items);
description.add(SYMBOL_TYPE__N + " Must be a valid " + fancyType + " (use ctrl+space for auto complete!)");
} catch (Throwable e) {
Iris.error("Could not execute apply method in " + functionClass.getName());
IrisLogging.error("Could not execute apply method in " + functionClass.getName());
}
} else if (t.type().equals(PotionEffectType.class)) {
fancyType = "List of Potion Effect Types";
@@ -803,7 +804,7 @@ public class SchemaBuilder {
j.put("x-intellij-html-description", desc.replace("\n", "<br>"));
a.put(j);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
}
} else {
@@ -18,7 +18,7 @@
package art.arcane.iris.core.runtime;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.nms.INMS;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.util.common.plugin.VolmitSender;
@@ -69,7 +69,7 @@ public final class ChunkClearer {
reporter.setStage("Clearing");
clear(targets);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
error = true;
} finally {
reporter.finish(error);
@@ -92,7 +92,7 @@ public final class ChunkClearer {
clearChunk(chunkX, chunkZ, mantle);
ok = true;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
} finally {
reporter.countApplied(ok);
inFlight.release();
@@ -101,7 +101,7 @@ public final class ChunkClearer {
});
if (!scheduled) {
Iris.warn("Delete could not schedule chunk clear at " + chunkX + "," + chunkZ + " in " + world.getName() + ".");
IrisLogging.warn("Delete could not schedule chunk clear at " + chunkX + "," + chunkZ + " in " + world.getName() + ".");
reporter.countApplied(false);
inFlight.release();
allCleared.countDown();
@@ -18,7 +18,7 @@
package art.arcane.iris.core.runtime;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.util.common.format.C;
import art.arcane.iris.util.common.plugin.VolmitSender;
import art.arcane.iris.util.common.scheduling.J;
@@ -172,7 +172,7 @@ public final class ChunkJobReporter {
+ C.GRAY + " | " + C.WHITE + summary);
}
sender.sendMessage((ok ? C.GREEN + title + " complete: " : C.RED + title + " finished with errors: ") + summary);
Iris.info(title + " done: world=" + worldName + " " + summary);
IrisLogging.info(title + " done: world=" + worldName + " " + summary);
}
private String progressBar(double value) {
@@ -18,7 +18,8 @@
package art.arcane.iris.core.runtime;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.engine.data.chunk.TerrainChunk;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.mantle.EngineMantle;
@@ -82,7 +83,7 @@ public final class GoldenHashScanner {
this.resetMantle = resetMantle;
this.threads = Math.max(1, threads);
this.deep = deep;
this.goldenFile = Iris.instance.getDataFile("golden", engine.getDimension().getLoadKey()
this.goldenFile = IrisPlatforms.get().dataFile("golden", engine.getDimension().getLoadKey()
+ "-s" + world.getSeed()
+ "-c" + centerChunkX + "x" + centerChunkZ
+ "-r" + this.radius + ".hashes");
@@ -123,7 +124,7 @@ public final class GoldenHashScanner {
capture(lines);
}
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
error = true;
} finally {
ACTIVE_SCANS.decrementAndGet();
@@ -166,7 +167,7 @@ public final class GoldenHashScanner {
}
ok = true;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
} finally {
reporter.countApplied(ok);
inFlight.release();
@@ -232,7 +233,7 @@ public final class GoldenHashScanner {
sender.sendMessage(C.GREEN + "Golden captured: " + C.GOLD + body.size() + " chunks" + C.GREEN + " combined=" + C.GOLD + shortHash(combined));
sender.sendMessage(C.GRAY + goldenFile.getAbsolutePath());
Iris.info("goldenhash captured: " + goldenFile.getAbsolutePath() + " combined=" + combined);
IrisLogging.info("goldenhash captured: " + goldenFile.getAbsolutePath() + " combined=" + combined);
}
private boolean verify(Map<Long, String> lines) throws IOException {
@@ -278,7 +279,7 @@ public final class GoldenHashScanner {
if (mismatches.isEmpty()) {
sender.sendMessage(C.GREEN + "GOLDEN MATCH: " + C.GOLD + body.size() + "/" + goldenChunks.size() + C.GREEN
+ " chunks, combined=" + C.GOLD + shortHash(combined));
Iris.info("goldenhash MATCH: " + goldenFile.getName() + " combined=" + combined);
IrisLogging.info("goldenhash MATCH: " + goldenFile.getName() + " combined=" + combined);
return true;
}
@@ -295,7 +296,7 @@ public final class GoldenHashScanner {
out.add("#combined=" + combined);
Files.write(current.toPath(), out, StandardCharsets.UTF_8);
sender.sendMessage(C.YELLOW + "Current hashes written to " + current.getName());
Iris.info("goldenhash MISMATCH: " + mismatches.size() + "/" + body.size() + " -> " + current.getAbsolutePath());
IrisLogging.info("goldenhash MISMATCH: " + mismatches.size() + "/" + body.size() + " -> " + current.getAbsolutePath());
reporter.setStage("Diagnosing");
diagnose(mismatches.getFirst());
@@ -373,9 +374,9 @@ public final class GoldenHashScanner {
sender.sendMessage((diffs.isEmpty() ? C.YELLOW + "Repeat-gen STABLE" : C.RED + "Repeat-gen UNSTABLE (" + diffs.size() + "+ block diffs)")
+ C.GRAY + ", " + (mantleDiffs.isEmpty() ? C.YELLOW + "mantle-reset STABLE" : C.RED + "mantle-reset DIVERGED (" + mantleDiffs.size() + "+ diffs)")
+ C.GRAY + " -> " + diag.getName());
Iris.info("goldenhash diag: chunk=" + chunkX + "," + chunkZ + " repeatStable=" + diffs.isEmpty() + " -> " + diag.getAbsolutePath());
IrisLogging.info("goldenhash diag: chunk=" + chunkX + "," + chunkZ + " repeatStable=" + diffs.isEmpty() + " -> " + diag.getAbsolutePath());
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
sender.sendMessage(C.RED + "Diagnosis failed: " + e.getMessage());
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.core.runtime;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.nms.INMS;
import art.arcane.iris.engine.data.chunk.TerrainChunk;
import art.arcane.iris.engine.framework.Engine;
@@ -80,7 +80,7 @@ public final class InPlaceChunkRegenerator {
reporter.setStage("Regenerating");
regenerate(targets);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
error = true;
} finally {
reporter.finish(error);
@@ -112,7 +112,7 @@ public final class InPlaceChunkRegenerator {
try {
engine.generate(chunkX << 4, chunkZ << 4, buffer, false);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
reporter.countApplied(false);
inFlight.release();
allApplied.countDown();
@@ -125,7 +125,7 @@ public final class InPlaceChunkRegenerator {
applyToLiveChunk(chunkX, chunkZ, buffer);
ok = true;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
} finally {
reporter.countApplied(ok);
inFlight.release();
@@ -134,7 +134,7 @@ public final class InPlaceChunkRegenerator {
});
if (!scheduled) {
Iris.warn("Regen could not schedule chunk apply at " + chunkX + "," + chunkZ + " in " + world.getName() + ".");
IrisLogging.warn("Regen could not schedule chunk apply at " + chunkX + "," + chunkZ + " in " + world.getName() + ".");
reporter.countApplied(false);
inFlight.release();
allApplied.countDown();
@@ -18,7 +18,7 @@
package art.arcane.iris.core.runtime;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.IrisObject;
import art.arcane.volmlib.util.json.JSONArray;
@@ -100,7 +100,7 @@ public final class ObjectStudioLayout {
try {
size = IrisObject.sampleSize(file);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
continue;
}
@@ -177,7 +177,7 @@ public final class ObjectStudioLayout {
}
return null;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
return null;
}
}
@@ -209,7 +209,7 @@ public final class ObjectStudioLayout {
root.put("cells", arr);
Files.writeString(file.toPath(), root.toString(2));
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -18,7 +18,9 @@
package art.arcane.iris.core.service;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.link.*;
import art.arcane.iris.core.link.data.DataType;
import art.arcane.iris.core.nms.container.BlockProperty;
@@ -50,16 +52,16 @@ public class ExternalDataSVC implements IrisService {
@Override
public void onEnable() {
Iris.info("Loading ExternalDataProvider...");
Bukkit.getPluginManager().registerEvents(this, Iris.instance);
IrisLogging.info("Loading ExternalDataProvider...");
Bukkit.getPluginManager().registerEvents(this, BukkitPlatform.plugin());
providers.addAll(createProviders());
for (ExternalDataProvider p : providers) {
if (p.isReady()) {
activeProviders.add(p);
p.init();
Iris.instance.registerListener(p);
Iris.info("Enabled ExternalDataProvider for %s.", p.getPluginId());
BukkitPlatform.volmitPlugin().registerListener(p);
IrisLogging.info("Enabled ExternalDataProvider for %s.", p.getPluginId());
}
}
}
@@ -74,8 +76,8 @@ public class ExternalDataSVC implements IrisService {
providers.stream().filter(p -> p.isReady() && e.getPlugin().equals(p.getPlugin())).findFirst().ifPresent(edp -> {
activeProviders.add(edp);
edp.init();
Iris.instance.registerListener(edp);
Iris.info("Enabled ExternalDataProvider for %s.", edp.getPluginId());
BukkitPlatform.volmitPlugin().registerListener(edp);
IrisLogging.info("Enabled ExternalDataProvider for %s.", edp.getPluginId());
});
}
}
@@ -89,7 +91,7 @@ public class ExternalDataSVC implements IrisService {
if (provider.isReady()) {
activeProviders.add(provider);
provider.init();
Iris.instance.registerListener(provider);
BukkitPlatform.volmitPlugin().registerListener(provider);
}
}
@@ -103,7 +105,7 @@ public class ExternalDataSVC implements IrisService {
try {
return Optional.of(provider.get().getBlockData(mod, pair.getB()));
} catch (MissingResourceException e) {
Iris.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
IrisLogging.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
return Optional.empty();
}
}
@@ -115,7 +117,7 @@ public class ExternalDataSVC implements IrisService {
try {
return Optional.of(provider.get().getBlockProperties(key));
} catch (MissingResourceException e) {
Iris.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
IrisLogging.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
return Optional.empty();
}
}
@@ -123,13 +125,13 @@ public class ExternalDataSVC implements IrisService {
public Optional<ItemStack> getItemStack(Identifier key, KMap<String, Object> customNbt) {
Optional<ExternalDataProvider> provider = activeProviders.stream().filter(p -> p.isValidProvider(key, DataType.ITEM)).findFirst();
if (provider.isEmpty()) {
Iris.warn("No matching Provider found for modded material \"%s\"!", key);
IrisLogging.warn("No matching Provider found for modded material \"%s\"!", key);
return Optional.empty();
}
try {
return Optional.of(provider.get().getItemStack(key, customNbt));
} catch (MissingResourceException e) {
Iris.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
IrisLogging.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
return Optional.empty();
}
}
@@ -137,7 +139,7 @@ public class ExternalDataSVC implements IrisService {
public void processUpdate(Engine engine, Block block, Identifier blockId) {
Optional<ExternalDataProvider> provider = activeProviders.stream().filter(p -> p.isValidProvider(blockId, DataType.BLOCK)).findFirst();
if (provider.isEmpty()) {
Iris.warn("No matching Provider found for modded material \"%s\"!", blockId);
IrisLogging.warn("No matching Provider found for modded material \"%s\"!", blockId);
return;
}
provider.get().processUpdate(engine, block, blockId);
@@ -146,13 +148,13 @@ public class ExternalDataSVC implements IrisService {
public Entity spawnMob(Location location, Identifier mobId) {
Optional<ExternalDataProvider> provider = activeProviders.stream().filter(p -> p.isValidProvider(mobId, DataType.ENTITY)).findFirst();
if (provider.isEmpty()) {
Iris.warn("No matching Provider found for modded mob \"%s\"!", mobId);
IrisLogging.warn("No matching Provider found for modded mob \"%s\"!", mobId);
return null;
}
try {
return provider.get().spawnMob(location, mobId);
} catch (MissingResourceException e) {
Iris.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
IrisLogging.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
return null;
}
}
@@ -195,7 +197,7 @@ public class ExternalDataSVC implements IrisService {
}
private static KList<ExternalDataProvider> createProviders() {
JarScanner jar = new JarScanner(Iris.instance.getJarFile(), "art.arcane.iris.core.link.data", false);
JarScanner jar = new JarScanner(IrisPlatforms.get().pluginJar(), "art.arcane.iris.core.link.data", false);
J.attempt(jar::scan);
KList<ExternalDataProvider> providers = new KList<>();
@@ -203,7 +205,7 @@ public class ExternalDataSVC implements IrisService {
if (ExternalDataProvider.class.isAssignableFrom(c)) {
try {
ExternalDataProvider p = (ExternalDataProvider) c.getDeclaredConstructor().newInstance();
if (p.getPlugin() != null) Iris.info(p.getPluginId() + " found, loading " + c.getSimpleName() + "...");
if (p.getPlugin() != null) IrisLogging.info(p.getPluginId() + " found, loading " + c.getSimpleName() + "...");
providers.add(p);
} catch (Throwable ignored) {}
}
@@ -1,7 +1,8 @@
package art.arcane.iris.core.service;
import com.google.common.util.concurrent.AtomicDouble;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.loader.ResourceLoader;
import art.arcane.iris.core.runtime.GoldenHashScanner;
@@ -70,7 +71,7 @@ public class IrisEngineSVC implements IrisService {
try {
gen.close();
} catch (Throwable t) {
Iris.reportError(t);
IrisLogging.reportError(t);
}
}
if (service != null) {
@@ -102,7 +103,7 @@ public class IrisEngineSVC implements IrisService {
}
public double getBiomeCacheUsageRatio() {
PreservationSVC preservation = Iris.service(PreservationSVC.class);
PreservationSVC preservation = IrisServices.get(PreservationSVC.class);
if (preservation == null) {
return 0D;
}
@@ -134,7 +135,7 @@ public class IrisEngineSVC implements IrisService {
long[] sizes = new long[4];
long[] count = new long[4];
for (var cache : Iris.service(PreservationSVC.class).getCaches()) {
for (var cache : IrisServices.get(PreservationSVC.class).getCaches()) {
var type = switch (cache) {
case ResourceLoader<?> ignored -> 0;
case CachedStream2D<?> ignored -> 1;
@@ -322,8 +323,8 @@ public class IrisEngineSVC implements IrisService {
close();
return;
}
Iris.reportError(e);
Iris.error("EngineSVC: Failed to trim for " + name);
IrisLogging.reportError(e);
IrisLogging.error("EngineSVC: Failed to trim for " + name);
e.printStackTrace();
}
}, offset, TRIM_PERIOD, TimeUnit.MILLISECONDS);
@@ -350,15 +351,15 @@ public class IrisEngineSVC implements IrisService {
long unloadStart = System.currentTimeMillis();
int count = engine.getMantle().unloadTectonicPlate(IrisSettings.get().getPerformance().getEngineSVC().forceMulticoreWrite ? 0 : activeTectonicLimit(engine));
if (count > 0) {
Iris.debug(C.GOLD + "Unloaded " + C.YELLOW + count + " TectonicPlates in " + C.RED + Form.duration(System.currentTimeMillis() - unloadStart, 2));
IrisLogging.debug(C.GOLD + "Unloaded " + C.YELLOW + count + " TectonicPlates in " + C.RED + Form.duration(System.currentTimeMillis() - unloadStart, 2));
}
} catch (Throwable e) {
if (isMantleClosed(e)) {
close();
return;
}
Iris.reportError(e);
Iris.error("EngineSVC: Failed to unload for " + name);
IrisLogging.reportError(e);
IrisLogging.error("EngineSVC: Failed to unload for " + name);
e.printStackTrace();
}
}, offset + TRIM_PERIOD / 2, TRIM_PERIOD, TimeUnit.MILLISECONDS);
@@ -18,7 +18,6 @@
package art.arcane.iris.core.service;
import art.arcane.iris.Iris;
import art.arcane.iris.util.common.plugin.IrisService;
import art.arcane.iris.util.common.scheduling.J;
import lombok.Getter;
@@ -18,7 +18,8 @@
package art.arcane.iris.core.service;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.runtime.ObjectStudioActivation;
import art.arcane.iris.core.runtime.ObjectStudioLayout;
@@ -58,7 +59,7 @@ public class ObjectStudioSaveService implements IrisService {
public static ObjectStudioSaveService get() {
ObjectStudioSaveService svc = INSTANCE;
if (svc != null) return svc;
svc = Iris.service(ObjectStudioSaveService.class);
svc = IrisServices.get(ObjectStudioSaveService.class);
return svc;
}
@@ -81,7 +82,7 @@ public class ObjectStudioSaveService implements IrisService {
Map<String, IrisData> sources = generator.getPackData();
if (sources == null || sources.isEmpty()) {
Iris.warn("Object Studio save disabled: no pack data sources available for world %s", world.getName());
IrisLogging.warn("Object Studio save disabled: no pack data sources available for world %s", world.getName());
return;
}
@@ -93,7 +94,7 @@ public class ObjectStudioSaveService implements IrisService {
}
}
if (objectsDirs.isEmpty()) {
Iris.warn("Object Studio save disabled: no resolvable objects folders for world %s", world.getName());
IrisLogging.warn("Object Studio save disabled: no resolvable objects folders for world %s", world.getName());
return;
}
@@ -104,7 +105,7 @@ public class ObjectStudioSaveService implements IrisService {
String packKey = engine.getDimension() == null ? null : engine.getDimension().getLoadKey();
studios.put(world.getUID(), new ActiveStudio(world.getUID(), layout, objectsDirs, packKey));
Iris.info("Object Studio live-save registered: world=%s cells=%d packs=%d",
IrisLogging.info("Object Studio live-save registered: world=%s cells=%d packs=%d",
world.getName(), layout.cells().size(), objectsDirs.size());
}
@@ -115,7 +116,7 @@ public class ObjectStudioSaveService implements IrisService {
if (removed.packKey != null) {
ObjectStudioActivation.deactivate(removed.packKey);
}
Iris.info("Object Studio live-save unregistered: world=%s", world.getName());
IrisLogging.info("Object Studio live-save unregistered: world=%s", world.getName());
}
}
@@ -164,12 +165,12 @@ public class ObjectStudioSaveService implements IrisService {
}
player.sendMessage(C.AQUA + "Object Studio: saving " + C.WHITE + cell.pack() + "/" + cell.key() + C.GRAY + " (" + cell.w() + "x" + cell.h() + "x" + cell.d() + ")");
Iris.info("Object Studio save triggered by %s for %s/%s", player.getName(), cell.pack(), cell.key());
IrisLogging.info("Object Studio save triggered by %s for %s/%s", player.getName(), cell.pack(), cell.key());
J.runRegion(world, cell.chunkMinX(), cell.chunkMinZ(), () -> {
try {
captureAndSave(studio, world, cell, player);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
});
}
@@ -209,7 +210,7 @@ public class ObjectStudioSaveService implements IrisService {
double targetY = cell.originY() + cell.h() + 2.0D;
Location location = new Location(world, targetX, targetY, targetZ);
J.runEntity(player, () -> PaperLib.teleportAsync(player, location));
Iris.info("Object Studio goto: %s -> %s at %.0f,%.0f,%.0f",
IrisLogging.info("Object Studio goto: %s -> %s at %.0f,%.0f,%.0f",
player.getName(), objectKey, location.getX(), location.getY(), location.getZ());
return true;
}
@@ -283,13 +284,13 @@ public class ObjectStudioSaveService implements IrisService {
parent.mkdirs();
}
snapshot.write(targetFile);
Iris.info("Object Studio saved: %s/%s (%dx%dx%d)",
IrisLogging.info("Object Studio saved: %s/%s (%dx%dx%d)",
cell.pack(), cell.key(), cell.w(), cell.h(), cell.d());
if (notify != null) {
J.runEntity(notify, () -> notify.sendMessage(C.GREEN + "Object Studio: saved " + C.WHITE + cell.pack() + "/" + cell.key()));
}
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
if (notify != null) {
J.runEntity(notify, () -> notify.sendMessage(C.RED + "Object Studio: save failed for " + cell.pack() + "/" + cell.key() + " (" + e.getMessage() + ")"));
}
@@ -318,7 +319,7 @@ public class ObjectStudioSaveService implements IrisService {
}
return h;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
return System.nanoTime();
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.core.service;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.framework.MeteredCache;
import art.arcane.iris.util.project.context.IrisContext;
@@ -63,7 +63,7 @@ public class PreservationSVC implements IrisService {
p += i.getUsage();
}
Iris.info("Cached " + Form.f(s) + " / " + Form.f(m) + " (" + Form.pc(p / mf) + ") from " + caches.size() + " Caches");
IrisLogging.info("Cached " + Form.f(s) + " / " + Form.f(m) + " (" + Form.pc(p / mf) + ") from " + caches.size() + " Caches");
}
public void dereference() {
@@ -101,9 +101,9 @@ public class PreservationSVC implements IrisService {
if (i.isAlive()) {
try {
i.interrupt();
Iris.info("Shutdown Thread " + i.getName());
IrisLogging.info("Shutdown Thread " + i.getName());
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
}
@@ -111,9 +111,9 @@ public class PreservationSVC implements IrisService {
for (ExecutorService i : services) {
try {
i.shutdownNow();
Iris.info("Shutdown Executor Service " + i);
IrisLogging.info("Shutdown Executor Service " + i);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
});
@@ -18,7 +18,8 @@
package art.arcane.iris.core.service;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.tools.IrisToolbelt;
import art.arcane.iris.engine.framework.Engine;
@@ -75,50 +76,50 @@ public class TreeSVC implements IrisService {
if (block || event.isCancelled()) {
return;
}
Iris.debug(this.getClass().getName() + " received a structure grow event");
IrisLogging.debug(this.getClass().getName() + " received a structure grow event");
if (!IrisToolbelt.isIrisWorld(event.getWorld())) {
Iris.debug(this.getClass().getName() + " passed grow event off to vanilla since not an Iris world");
IrisLogging.debug(this.getClass().getName() + " passed grow event off to vanilla since not an Iris world");
return;
}
PlatformChunkGenerator worldAccess = IrisToolbelt.access(event.getWorld());
if (worldAccess == null) {
Iris.debug(this.getClass().getName() + " passed it off to vanilla because could not get IrisAccess for this world");
Iris.reportError(new NullPointerException(event.getWorld().getName() + " could not be accessed despite being an Iris world"));
IrisLogging.debug(this.getClass().getName() + " passed it off to vanilla because could not get IrisAccess for this world");
IrisLogging.reportError(new NullPointerException(event.getWorld().getName() + " could not be accessed despite being an Iris world"));
return;
}
Engine engine = worldAccess.getEngine();
if (engine == null) {
Iris.debug(this.getClass().getName() + " passed it off to vanilla because could not get Engine for this world");
Iris.reportError(new NullPointerException(event.getWorld().getName() + " could not be accessed despite being an Iris world"));
IrisLogging.debug(this.getClass().getName() + " passed it off to vanilla because could not get Engine for this world");
IrisLogging.reportError(new NullPointerException(event.getWorld().getName() + " could not be accessed despite being an Iris world"));
return;
}
IrisDimension dimension = engine.getDimension();
if (dimension == null) {
Iris.debug(this.getClass().getName() + " passed it off to vanilla because could not get Dimension for this world");
Iris.reportError(new NullPointerException(event.getWorld().getName() + " could not be accessed despite being an Iris world"));
IrisLogging.debug(this.getClass().getName() + " passed it off to vanilla because could not get Dimension for this world");
IrisLogging.reportError(new NullPointerException(event.getWorld().getName() + " could not be accessed despite being an Iris world"));
return;
}
if (!dimension.getTreeSettings().isEnabled()) {
Iris.debug(this.getClass().getName() + " cancelled because tree overrides are disabled");
IrisLogging.debug(this.getClass().getName() + " cancelled because tree overrides are disabled");
return;
}
BlockData first = event.getLocation().getBlock().getBlockData().clone();
Cuboid saplingPlane = getSaplings(event.getLocation(), blockData -> blockData instanceof Sapling && blockData.getMaterial().equals(first.getMaterial()), event.getWorld());
Iris.debug("Sapling grew @ " + event.getLocation() + " for " + event.getSpecies().name() + " usedBoneMeal is " + event.isFromBonemeal());
Iris.debug("Sapling plane is: " + saplingPlane.getSizeX() + " by " + saplingPlane.getSizeZ());
IrisLogging.debug("Sapling grew @ " + event.getLocation() + " for " + event.getSpecies().name() + " usedBoneMeal is " + event.isFromBonemeal());
IrisLogging.debug("Sapling plane is: " + saplingPlane.getSizeX() + " by " + saplingPlane.getSizeZ());
IrisObjectPlacement placement = getObjectPlacement(worldAccess, event.getLocation(), event.getSpecies(), new IrisTreeSize(1, 1));
if (placement == null) {
Iris.debug(this.getClass().getName() + " had options but did not manage to find objectPlacements for them");
IrisLogging.debug(this.getClass().getName() + " had options but did not manage to find objectPlacements for them");
return;
}
@@ -237,7 +238,7 @@ public class TreeSVC implements IrisService {
if (d instanceof IrisCustomData data) {
block.setBlockData(data.getBase(), false);
Iris.service(ExternalDataSVC.class).processUpdate(engine, block, data.getCustom());
IrisServices.get(ExternalDataSVC.class).processUpdate(engine, block, data.getCustom());
} else block.setBlockData(d, false);
}
}
@@ -314,8 +315,8 @@ public class TreeSVC implements IrisService {
b.min(blockPosition);
}
Iris.debug("Blocks: " + blockPositions.size());
Iris.debug("Min: " + a + " Max: " + b);
IrisLogging.debug("Blocks: " + blockPositions.size());
IrisLogging.debug("Min: " + a + " Max: " + b);
// Create a cuboid with the size calculated before
Cuboid cuboid = new Cuboid(a.toBlock(world).getLocation(), b.toBlock(world).getLocation());
@@ -18,7 +18,7 @@
package art.arcane.iris.core.structure;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.nms.INMS;
import art.arcane.iris.core.tools.PlausibilizeMode;
@@ -106,7 +106,7 @@ public final class FeatureImporter {
try {
TreePlausibilizer.apply(object, PlausibilizeMode.NORMALIZE, TreePlausibilizer.DEFAULT_SHELL_RADIUS);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
long hash = hashOf(object);
@@ -127,7 +127,7 @@ public final class FeatureImporter {
} catch (Throwable e) {
failed++;
sender.sendMessage(C.RED + "[fail] " + row.key() + ": " + e.getMessage());
Iris.reportError(e);
IrisLogging.reportError(e);
}
int processed = imported + skipped + failed;
@@ -252,7 +252,7 @@ public final class FeatureImporter {
}
if (errorRef.get() != null) {
Iris.reportError(errorRef.get());
IrisLogging.reportError(errorRef.get());
return null;
}
return new CaptureResult(placedRef.get(), objectRef.get());
@@ -305,7 +305,7 @@ public final class FeatureImporter {
.thenCompose(Function.identity())
.get();
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
sender.sendMessage(C.RED + "Could not create the scratch world for feature import (" + e.getMessage() + "); skipping the tree/object pass.");
return null;
}
@@ -322,14 +322,14 @@ public final class FeatureImporter {
return Boolean.TRUE;
}).get();
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
try {
if (folder != null && folder.exists()) {
IO.delete(folder);
}
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.core.structure;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.nms.INMS;
import art.arcane.iris.engine.object.IrisObject;
@@ -110,7 +110,7 @@ public final class StructureCaptureImporter {
} catch (Throwable e) {
failed++;
sender.sendMessage(C.RED + "[fail] " + key + ": " + e.getMessage());
Iris.reportError(e);
IrisLogging.reportError(e);
}
int processed = imported + skipped + failed;
@@ -200,7 +200,7 @@ public final class StructureCaptureImporter {
}
if (errorRef.get() != null) {
Iris.reportError(errorRef.get());
IrisLogging.reportError(errorRef.get());
return null;
}
return objectRef.get();
@@ -18,7 +18,7 @@
package art.arcane.iris.core.structure;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.nms.INMS;
import art.arcane.volmlib.util.collection.KList;
@@ -56,7 +56,7 @@ public final class StructureIndexService {
return write(data);
} catch (Throwable e) {
GENERATED.remove(key);
Iris.reportError(e);
IrisLogging.reportError(e);
return null;
}
}
@@ -123,7 +123,7 @@ public final class StructureIndexService {
String json = new GsonBuilder().setPrettyPrinting().create().toJson(root);
Files.writeString(file.toPath(), json, StandardCharsets.UTF_8);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
return file;
}
@@ -1,6 +1,7 @@
package art.arcane.iris.core.tools;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.engine.object.*;
import art.arcane.volmlib.util.data.Varint;
import art.arcane.iris.util.common.format.C;
@@ -23,7 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger;
public class IrisConverter {
public static void convertSchematics(VolmitSender sender) {
File folder = Iris.instance.getDataFolder("convert");
File folder = IrisPlatforms.get().dataFolder("convert");
FilenameFilter filter = (dir, name) -> name.endsWith(".schem");
File[] fileList = folder.listFiles(filter);
@@ -45,7 +46,7 @@ public class IrisConverter {
try {
tag = NBTUtil.read(schem);
} catch (IOException e) {
Iris.info(C.RED + "Failed to read: " + schem.getName());
IrisLogging.info(C.RED + "Failed to read: " + schem.getName());
throw new RuntimeException(e);
}
CompoundTag compound = (CompoundTag) tag.getTag();
@@ -62,8 +63,8 @@ public class IrisConverter {
AtomicInteger v = new AtomicInteger(0);
if (mv > 2_000_000) {
largeObject = true;
Iris.info(C.GRAY + "Converting.. " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob"));
Iris.info(C.GRAY + "- It may take a while");
IrisLogging.info(C.GRAY + "Converting.. " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob"));
IrisLogging.info(C.GRAY + "- It may take a while");
if (sender.isPlayer()) {
i = J.ar(() -> {
sender.sendProgress((double) v.get() / mv, "Converting");
@@ -113,9 +114,9 @@ public class IrisConverter {
}
}
if (largeObject) {
Iris.info(C.GRAY + "Converted " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob") + " in " + Form.duration(p.getMillis()));
IrisLogging.info(C.GRAY + "Converted " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob") + " in " + Form.duration(p.getMillis()));
} else {
Iris.info(C.GRAY + "Converted " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob"));
IrisLogging.info(C.GRAY + "Converted " + schem.getName() + " -> " + schem.getName().replace(".schem", ".iob"));
}
FileUtils.delete(schem);
} catch (IOException e) {
@@ -20,7 +20,10 @@ package art.arcane.iris.core.tools;
import art.arcane.iris.core.runtime.TransientWorldCleanupSupport;
import com.google.common.util.concurrent.AtomicDouble;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.link.MultiverseCoreLink;
import art.arcane.iris.core.IrisRuntimeSchedulerMode;
import art.arcane.iris.core.IrisWorlds;
import art.arcane.iris.core.IrisSettings;
@@ -174,15 +177,15 @@ public class IrisCreator {
}
if (sender == null)
sender = Iris.getSender();
sender = BukkitPlatform.console();
reportStudioProgress(0.16D, "prepare_world_pack");
if (!studio() || benchmark) {
Iris.service(StudioSVC.class).installIntoWorld(sender, d.getLoadKey(), new File(Bukkit.getWorldContainer(), name()));
IrisServices.get(StudioSVC.class).installIntoWorld(sender, d.getLoadKey(), new File(Bukkit.getWorldContainer(), name()));
}
if (studio()) {
IrisRuntimeSchedulerMode runtimeSchedulerMode = IrisRuntimeSchedulerMode.resolve(IrisSettings.get().getPregen());
Iris.debug("Studio create scheduling: mode=" + runtimeSchedulerMode.name().toLowerCase(Locale.ROOT)
IrisLogging.debug("Studio create scheduling: mode=" + runtimeSchedulerMode.name().toLowerCase(Locale.ROOT)
+ ", regionizedRuntime=" + FoliaScheduler.isRegionizedRuntime(Bukkit.getServer()));
}
@@ -199,7 +202,7 @@ public class IrisCreator {
IrisWorlds.get().put(name(), dimension());
}
ServerConfigurator.installDataPacksIfChanged(!studio());
Iris.debug("[Studio timing] create.packPrep + datapacks = " + (System.currentTimeMillis() - createStart) + "ms (cumulative in create)");
IrisLogging.debug("[Studio timing] create.packPrep + datapacks = " + (System.currentTimeMillis() - createStart) + "ms (cumulative in create)");
reportStudioProgress(0.40D, "install_datapacks");
PlatformChunkGenerator access = (PlatformChunkGenerator) wc.generator();
@@ -216,7 +219,7 @@ public class IrisCreator {
world = J.sfut(() -> INMS.get().createWorldAsync(wc, request))
.thenCompose(Function.identity())
.get();
Iris.debug("[Studio timing] create.createWorldAsync (NMS bukkit world load + spawn prep) = " + (System.currentTimeMillis() - nmsStart) + "ms");
IrisLogging.debug("[Studio timing] create.createWorldAsync (NMS bukkit world load + spawn prep) = " + (System.currentTimeMillis() - nmsStart) + "ms");
} catch (Throwable e) {
done.set(true);
cancelRepeatingTask(createProgressTask);
@@ -236,7 +239,7 @@ public class IrisCreator {
if (!studio && !benchmark) {
addToBukkitYml();
J.s(() -> Iris.linkMultiverseCore.updateWorld(world, dimension));
J.s(() -> IrisServices.get(MultiverseCoreLink.class).updateWorld(world, dimension));
}
if (pregen != null) {
@@ -271,7 +274,7 @@ public class IrisCreator {
try {
consumer.accept(clamped, stage);
} catch (Throwable e) {
Iris.reportError("Studio progress consumer failed for world \"" + name() + "\".", e);
IrisLogging.reportError("Studio progress consumer failed for world \"" + name() + "\".", e);
}
}
@@ -289,7 +292,7 @@ public class IrisCreator {
};
access.getSpawnChunks().whenComplete((required, throwable) -> {
if (throwable != null) {
Iris.reportError("Failed to resolve studio spawn chunk target for world \"" + name() + "\".", throwable);
IrisLogging.reportError("Failed to resolve studio spawn chunk target for world \"" + name() + "\".", throwable);
return;
}
@@ -412,9 +415,9 @@ public class IrisCreator {
section.createSection(name).set("generator", gen);
try {
yml.save(BUKKIT_YML);
Iris.info("Registered \"" + name + "\" in bukkit.yml");
IrisLogging.info("Registered \"" + name + "\" in bukkit.yml");
} catch (IOException e) {
Iris.error("Failed to update bukkit.yml!");
IrisLogging.error("Failed to update bukkit.yml!");
e.printStackTrace();
}
}
@@ -1,7 +1,8 @@
package art.arcane.iris.core.tools;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.core.lifecycle.WorldLifecycleService;
import art.arcane.iris.core.pregenerator.PregenTask;
import art.arcane.iris.engine.framework.Engine;
@@ -45,14 +46,14 @@ public class IrisPackBenchmarking {
Thread.ofVirtual()
.name("PackBenchmarking")
.start(() -> {
Iris.info("Setting up benchmark environment ");
IrisLogging.info("Setting up benchmark environment ");
IO.delete(new File(Bukkit.getWorldContainer(), "benchmark"));
createBenchmark();
while (!IrisToolbelt.isIrisWorld(Bukkit.getWorld("benchmark"))) {
J.sleep(1000);
Iris.debug("Iris PackBenchmark: Waiting...");
IrisLogging.debug("Iris PackBenchmark: Waiting...");
}
Iris.info("Starting Benchmark!");
IrisLogging.info("Starting Benchmark!");
stopwatch.begin();
startBenchmark();
});
@@ -63,16 +64,16 @@ public class IrisPackBenchmarking {
try {
String time = Form.duration((long) stopwatch.getMilliseconds());
Engine engine = IrisToolbelt.access(Bukkit.getWorld("benchmark")).getEngine();
Iris.info("-----------------");
Iris.info("Results:");
Iris.info("- Total time: " + time);
Iris.info("- Average CPS: " + calculateAverage(cps));
Iris.info(" - Median CPS: " + calculateMedian(cps));
Iris.info(" - Highest CPS: " + findHighest(cps));
Iris.info(" - Lowest CPS: " + findLowest(cps));
Iris.info("-----------------");
Iris.info("Creating a report..");
File results = Iris.instance.getDataFile("packbenchmarks", dimension.getName() + " " + LocalDateTime.now(Clock.systemDefaultZone()).toString().replace(':', '-') + ".txt");
IrisLogging.info("-----------------");
IrisLogging.info("Results:");
IrisLogging.info("- Total time: " + time);
IrisLogging.info("- Average CPS: " + calculateAverage(cps));
IrisLogging.info(" - Median CPS: " + calculateMedian(cps));
IrisLogging.info(" - Highest CPS: " + findHighest(cps));
IrisLogging.info(" - Lowest CPS: " + findLowest(cps));
IrisLogging.info("-----------------");
IrisLogging.info("Creating a report..");
File results = IrisPlatforms.get().dataFile("packbenchmarks", dimension.getName() + " " + LocalDateTime.now(Clock.systemDefaultZone()).toString().replace(':', '-') + ".txt");
KMap<String, Double> metrics = engine.getMetrics().pull();
try (FileWriter writer = new FileWriter(results)) {
writer.write("-----------------\n");
@@ -93,9 +94,9 @@ public class IrisPackBenchmarking {
writer.write(" - Highest CPS: " + findHighest(cps) + "\n");
writer.write(" - Lowest CPS: " + findLowest(cps) + "\n");
writer.write("-----------------\n");
Iris.info("Finished generating a report!");
IrisLogging.info("Finished generating a report!");
} catch (IOException e) {
Iris.error("An error occurred writing to the file.");
IrisLogging.error("An error occurred writing to the file.");
e.printStackTrace();
}
@@ -108,7 +109,7 @@ public class IrisPackBenchmarking {
stopwatch.end();
} catch (Exception e) {
Iris.error("Something has gone wrong!");
IrisLogging.error("Something has gone wrong!");
e.printStackTrace();
}
}
@@ -18,7 +18,10 @@
package art.arcane.iris.core.tools;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.IrisRuntimeSchedulerMode;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.gui.PregeneratorJob;
@@ -86,7 +89,7 @@ public class IrisToolbelt {
return null;
}
File packsFolder = Iris.instance.getDataFolder("packs");
File packsFolder = IrisPlatforms.get().dataFolder("packs");
File pack = new File(packsFolder, requested);
if (!pack.exists()) {
File found = findCaseInsensitivePack(packsFolder, requested);
@@ -96,7 +99,7 @@ public class IrisToolbelt {
}
if (!pack.exists()) {
Iris.service(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), requested, false);
IrisServices.get(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender(), BukkitPlatform.volmitPlugin().getTag()), requested, false);
File found = findCaseInsensitivePack(packsFolder, requested);
if (found != null) {
pack = found;
@@ -199,7 +202,7 @@ public class IrisToolbelt {
return ((PlatformChunkGenerator) world.getGenerator());
}
StudioSVC studioService = Iris.service(StudioSVC.class);
StudioSVC studioService = IrisServices.get(StudioSVC.class);
if (studioService != null && studioService.isProjectOpen()) {
IrisProject activeProject = studioService.getActiveProject();
if (activeProject != null) {
@@ -265,7 +268,7 @@ public class IrisToolbelt {
}
if (PREGEN_PROFILE_JVM_HINT_LOGGED.compareAndSet(false, true) && !fastCacheEnabledBefore) {
Iris.info("For startup-wide cache-fast coverage, set JVM argument: -Diris.cache.fast=true");
IrisLogging.info("For startup-wide cache-fast coverage, set JVM argument: -Diris.cache.fast=true");
}
return changed;
@@ -275,7 +278,7 @@ public class IrisToolbelt {
boolean changed = applyPregenPerformanceProfile();
if (changed && engine != null) {
engine.hotloadComplex();
Iris.info("Pregen profile applied: noiseCacheSize=" + IrisSettings.get().getPerformance().getNoiseCacheSize() + " iris.cache.fast=" + Boolean.getBoolean("iris.cache.fast"));
IrisLogging.info("Pregen profile applied: noiseCacheSize=" + IrisSettings.get().getPerformance().getNoiseCacheSize() + " iris.cache.fast=" + Boolean.getBoolean("iris.cache.fast"));
}
}
@@ -322,7 +325,7 @@ public class IrisToolbelt {
for (World i : Bukkit.getWorlds()) {
if (!i.getName().equals(world.getName())) {
for (Player j : new ArrayList<>(world.getPlayers())) {
new VolmitSender(j, Iris.instance.getTag()).sendMessage("You have been evacuated from this world.");
new VolmitSender(j, BukkitPlatform.volmitPlugin().getTag()).sendMessage("You have been evacuated from this world.");
Location target = i.getSpawnLocation();
Runnable teleportTask = () -> teleportAsyncSafely(j, target);
if (!J.runEntity(j, teleportTask)) {
@@ -352,7 +355,7 @@ public class IrisToolbelt {
for (World i : Bukkit.getWorlds()) {
if (!i.getName().equals(world.getName())) {
for (Player j : new ArrayList<>(world.getPlayers())) {
new VolmitSender(j, Iris.instance.getTag()).sendMessage("You have been evacuated from this world. " + m);
new VolmitSender(j, BukkitPlatform.volmitPlugin().getTag()).sendMessage("You have been evacuated from this world. " + m);
Location target = i.getSpawnLocation();
Runnable teleportTask = () -> teleportAsyncSafely(j, target);
if (!J.runEntity(j, teleportTask)) {
@@ -385,14 +388,14 @@ public class IrisToolbelt {
if (teleportFuture != null) {
teleportFuture.exceptionally(throwable -> {
if (!isServerStopping()) {
Iris.reportError(throwable);
IrisLogging.reportError(throwable);
}
return false;
});
}
} catch (Throwable throwable) {
if (!isServerStopping()) {
Iris.reportError(throwable);
IrisLogging.reportError(throwable);
}
}
}
@@ -409,8 +412,7 @@ public class IrisToolbelt {
}
}
Iris iris = Iris.instance;
return iris == null || !iris.isEnabled();
return !BukkitPlatform.hasPlugin() || !BukkitPlatform.plugin().isEnabled();
}
private static Method resolveBukkitIsStoppingMethod() {
@@ -436,9 +438,9 @@ public class IrisToolbelt {
worldMaintenanceMantleBypassDepth.computeIfAbsent(name, k -> new AtomicInteger()).incrementAndGet();
}
if (IrisSettings.get().getGeneral().isDebug()) {
Iris.info("World maintenance enter: " + name + " reason=" + reason + " depth=" + depth + " bypassMantle=" + bypassMantleStages);
IrisLogging.info("World maintenance enter: " + name + " reason=" + reason + " depth=" + depth + " bypassMantle=" + bypassMantleStages);
} else {
Iris.verbose("World maintenance enter: " + name + " reason=" + reason + " depth=" + depth + " bypassMantle=" + bypassMantleStages);
IrisLogging.debug("World maintenance enter: " + name + " reason=" + reason + " depth=" + depth + " bypassMantle=" + bypassMantleStages);
}
}
@@ -470,9 +472,9 @@ public class IrisToolbelt {
}
if (IrisSettings.get().getGeneral().isDebug()) {
Iris.info("World maintenance exit: " + name + " reason=" + reason + " depth=" + depth + " bypassMantleDepth=" + bypassDepth);
IrisLogging.info("World maintenance exit: " + name + " reason=" + reason + " depth=" + depth + " bypassMantleDepth=" + bypassDepth);
} else {
Iris.verbose("World maintenance exit: " + name + " reason=" + reason + " depth=" + depth + " bypassMantleDepth=" + bypassDepth);
IrisLogging.debug("World maintenance exit: " + name + " reason=" + reason + " depth=" + depth + " bypassMantleDepth=" + bypassDepth);
}
}
@@ -1,145 +1,145 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.framework;
import art.arcane.iris.Iris;
import art.arcane.iris.core.events.IrisEngineHotloadEvent;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.iris.util.common.format.C;
import art.arcane.volmlib.util.math.Position2;
import art.arcane.iris.util.common.plugin.VolmitSender;
import art.arcane.iris.util.common.scheduling.J;
import org.bukkit.*;
import org.bukkit.entity.EnderSignal;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.event.world.WorldSaveEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.inventory.EquipmentSlot;
import java.util.concurrent.atomic.AtomicBoolean;
public abstract class EngineAssignedWorldManager extends EngineAssignedComponent implements EngineWorldManager, Listener {
private final int taskId;
protected AtomicBoolean ignoreTP = new AtomicBoolean(false);
public EngineAssignedWorldManager() {
super(null, null);
taskId = -1;
}
public EngineAssignedWorldManager(Engine engine) {
super(engine, "World");
Iris.instance.registerListener(this);
taskId = J.sr(this::onTick, 1);
}
@EventHandler
public void on(IrisEngineHotloadEvent e) {
for (Player i : e.getEngine().getWorld().getPlayers()) {
i.playSound(i.getLocation(), Sound.BLOCK_AMETHYST_BLOCK_BREAK, 1f, 1.8f);
VolmitSender s = new VolmitSender(i);
s.sendTitle(C.IRIS + "Engine " + C.AQUA + "<font:minecraft:uniform>Hotloaded", 70, 60, 410);
}
}
// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
// public void on(PlayerTeleportEvent e) {
// if(ignoreTP.get()) {
// System.out.println("IgTP1");
// return;
// }
//
// if(!PaperLib.isPaper() || e.getTo() == null) {
// System.out.println("IgTP2");
//
//// return;
// }
//
//// try {
//// System.out.println("IgTP3");
////
//// if(e.getTo().getWorld().equals(getTarget().getWorld().realWorld())) {
//// System.out.println("IgTP4");
////
//// getEngine().getWorldManager().teleportAsync(e);
//// }
//// } catch(Throwable ex) {
////
//// }
// }
@EventHandler
public void on(WorldSaveEvent e) {
if (e.getWorld().equals(getTarget().getWorld().realWorld())) {
getEngine().save();
}
}
@EventHandler
public void on(WorldUnloadEvent e) {
if (e.getWorld().equals(getTarget().getWorld().realWorld())) {
getEngine().close();
}
}
@EventHandler
public void on(BlockBreakEvent e) {
if (e.getPlayer().getWorld().equals(getTarget().getWorld().realWorld())) {
onBlockBreak(e);
}
}
@EventHandler
public void on(BlockPlaceEvent e) {
if (e.getPlayer().getWorld().equals(getTarget().getWorld().realWorld())) {
onBlockPlace(e);
}
}
@EventHandler
public void on(ChunkLoadEvent e) {
if (e.getChunk().getWorld().equals(getTarget().getWorld().realWorld())) {
onChunkLoad(e.getChunk(), e.isNewChunk());
}
}
@EventHandler
public void on(ChunkUnloadEvent e) {
if (e.getChunk().getWorld().equals(getTarget().getWorld().realWorld())) {
onChunkUnload(e.getChunk());
}
}
@Override
public void close() {
super.close();
Iris.instance.unregisterListener(this);
if (taskId != -1) {
J.csr(taskId);
}
}
}
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.framework;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.events.IrisEngineHotloadEvent;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.iris.util.common.format.C;
import art.arcane.volmlib.util.math.Position2;
import art.arcane.iris.util.common.plugin.VolmitSender;
import art.arcane.iris.util.common.scheduling.J;
import org.bukkit.*;
import org.bukkit.entity.EnderSignal;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.event.world.WorldSaveEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.inventory.EquipmentSlot;
import java.util.concurrent.atomic.AtomicBoolean;
public abstract class EngineAssignedWorldManager extends EngineAssignedComponent implements EngineWorldManager, Listener {
private final int taskId;
protected AtomicBoolean ignoreTP = new AtomicBoolean(false);
public EngineAssignedWorldManager() {
super(null, null);
taskId = -1;
}
public EngineAssignedWorldManager(Engine engine) {
super(engine, "World");
BukkitPlatform.volmitPlugin().registerListener(this);
taskId = J.sr(this::onTick, 1);
}
@EventHandler
public void on(IrisEngineHotloadEvent e) {
for (Player i : e.getEngine().getWorld().getPlayers()) {
i.playSound(i.getLocation(), Sound.BLOCK_AMETHYST_BLOCK_BREAK, 1f, 1.8f);
VolmitSender s = new VolmitSender(i);
s.sendTitle(C.IRIS + "Engine " + C.AQUA + "<font:minecraft:uniform>Hotloaded", 70, 60, 410);
}
}
// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
// public void on(PlayerTeleportEvent e) {
// if(ignoreTP.get()) {
// System.out.println("IgTP1");
// return;
// }
//
// if(!PaperLib.isPaper() || e.getTo() == null) {
// System.out.println("IgTP2");
//
//// return;
// }
//
//// try {
//// System.out.println("IgTP3");
////
//// if(e.getTo().getWorld().equals(getTarget().getWorld().realWorld())) {
//// System.out.println("IgTP4");
////
//// getEngine().getWorldManager().teleportAsync(e);
//// }
//// } catch(Throwable ex) {
////
//// }
// }
@EventHandler
public void on(WorldSaveEvent e) {
if (e.getWorld().equals(getTarget().getWorld().realWorld())) {
getEngine().save();
}
}
@EventHandler
public void on(WorldUnloadEvent e) {
if (e.getWorld().equals(getTarget().getWorld().realWorld())) {
getEngine().close();
}
}
@EventHandler
public void on(BlockBreakEvent e) {
if (e.getPlayer().getWorld().equals(getTarget().getWorld().realWorld())) {
onBlockBreak(e);
}
}
@EventHandler
public void on(BlockPlaceEvent e) {
if (e.getPlayer().getWorld().equals(getTarget().getWorld().realWorld())) {
onBlockPlace(e);
}
}
@EventHandler
public void on(ChunkLoadEvent e) {
if (e.getChunk().getWorld().equals(getTarget().getWorld().realWorld())) {
onChunkLoad(e.getChunk(), e.isNewChunk());
}
}
@EventHandler
public void on(ChunkUnloadEvent e) {
if (e.getChunk().getWorld().equals(getTarget().getWorld().realWorld())) {
onChunkUnload(e.getChunk());
}
}
@Override
public void close() {
super.close();
BukkitPlatform.volmitPlugin().unregisterListener(this);
if (taskId != -1) {
J.csr(taskId);
}
}
}
@@ -18,7 +18,8 @@
package art.arcane.iris.engine.platform;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.IrisWorlds;
import art.arcane.iris.core.gui.PregeneratorJob;
@@ -38,8 +39,11 @@ import art.arcane.iris.engine.object.IrisWorld;
import art.arcane.iris.engine.object.StudioMode;
import art.arcane.iris.engine.platform.studio.StudioGenerator;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBiome;
import art.arcane.iris.util.common.format.C;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.M;
import art.arcane.iris.util.project.hunk.Hunk;
import art.arcane.iris.util.project.hunk.view.ChunkDataHunkHolder;
import art.arcane.volmlib.util.io.ReactiveFolder;
@@ -63,6 +67,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Random;
@@ -121,13 +127,13 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
new KList<>()
);
this.closing = false;
Bukkit.getServer().getPluginManager().registerEvents(this, Iris.instance);
Bukkit.getServer().getPluginManager().registerEvents(this, BukkitPlatform.plugin());
}
@EventHandler(priority = EventPriority.LOWEST)
public void onWorldInit(WorldInitEvent event) {
if (!world.name().equals(event.getWorld().getName())) return;
Iris.instance.unregisterListener(this);
BukkitPlatform.volmitPlugin().unregisterListener(this);
world.setRawWorldSeed(event.getWorld().getSeed());
if (initialize(event.getWorld())) return;
@@ -154,7 +160,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
e.printStackTrace();
}
spawnChunks.complete(INMS.get().getSpawnChunkCount(world));
Iris.instance.unregisterListener(this);
BukkitPlatform.volmitPlugin().unregisterListener(this);
IrisWorlds.get().put(world.getName(), dimensionKey);
return true;
}
@@ -246,11 +252,11 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
if (test != null) {
IrisLogging.warn("Looks like " + dimensionKey + " exists in " + test.getLoadFile().getPath() + " ");
test = Iris.service(StudioSVC.class).installInto(Iris.getSender(), dimensionKey, dataLocation);
test = IrisServices.get(StudioSVC.class).installInto(BukkitPlatform.console(), dimensionKey, dataLocation);
IrisLogging.warn("Attempted to install into " + data.getDataFolder().getPath());
if (test != null) {
Iris.success("Woo! Patched the Engine!");
IrisLogging.msg(C.IRIS + "Woo! Patched the Engine!");
dimension = test;
} else {
IrisLogging.error("Failed to patch dimension!");
@@ -431,7 +437,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
IrisLogging.error("======================================");
e.printStackTrace();
Iris.reportErrorChunk(x, z, e, "CHUNK");
reportErrorChunk(x, z, e);
IrisLogging.error("======================================");
for (int i = 0; i < 16; i++) {
@@ -442,7 +448,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
} catch (Throwable e) {
IrisLogging.error("======================================");
e.printStackTrace();
Iris.reportErrorChunk(x, z, e, "CHUNK");
reportErrorChunk(x, z, e);
IrisLogging.error("======================================");
for (int i = 0; i < 16; i++) {
@@ -470,6 +476,24 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
return realWorld != null && IrisToolbelt.isWorldMaintenanceActive(realWorld);
}
private static void reportErrorChunk(int x, int z, Throwable e) {
if (IrisSettings.get().getGeneral().isDebug()) {
File f = IrisPlatforms.get().dataFile("debug", "chunk-errors", "chunk." + x + "." + z + ".txt");
if (!f.exists()) {
J.attempt(() -> {
PrintWriter pw = new PrintWriter(f);
pw.println("Thread: " + Thread.currentThread().getName());
pw.println("First: " + new Date(M.ms()));
e.printStackTrace(pw);
pw.close();
});
}
IrisLogging.debug("Chunk " + x + "," + z + " Exception Logged: " + e.getClass().getSimpleName() + ": " + C.RESET + "" + C.LIGHT_PURPLE + e.getMessage());
}
}
private boolean shouldThrottleHotload() {
if (isMaintenanceActive()) {
return true;
@@ -30,6 +30,9 @@ import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.spi.PlatformScheduler;
import art.arcane.iris.spi.PlatformStructureHooks;
import art.arcane.iris.spi.PlatformWorld;
import art.arcane.iris.util.common.misc.Bindings;
import art.arcane.iris.util.common.plugin.VolmitPlugin;
import art.arcane.iris.util.common.plugin.VolmitSender;
import art.arcane.iris.util.common.scheduling.J;
import art.arcane.volmlib.util.collection.KMap;
import art.arcane.volmlib.util.math.Vector3d;
@@ -45,20 +48,74 @@ import org.bukkit.event.Event;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
import java.io.File;
import java.util.function.Supplier;
/**
* Bukkit implementation of the root Iris platform service.
*/
public final class BukkitPlatform implements IrisPlatform {
private static volatile Plugin PLUGIN;
private static volatile Bindings.Adventure AUDIENCES;
private static volatile Supplier<VolmitSender> CONSOLE;
private final BukkitRegistries registries = new BukkitRegistries();
private final BukkitScheduler scheduler = new BukkitScheduler();
private final PlatformCapabilities capabilities = new BukkitCapabilities();
private final BukkitStructureHooks structureHooks = new BukkitStructureHooks();
private final BukkitBiomeWriter biomeWriter = new BukkitBiomeWriter();
public static void hostPlugin(Plugin plugin) {
PLUGIN = plugin;
}
public static Plugin plugin() {
Plugin plugin = PLUGIN;
if (plugin == null) {
throw new IllegalStateException("No Iris plugin is hosted");
}
return plugin;
}
public static boolean hasPlugin() {
return PLUGIN != null;
}
public static VolmitPlugin volmitPlugin() {
Plugin plugin = plugin();
if (plugin instanceof VolmitPlugin host) {
return host;
}
throw new IllegalStateException("Hosted Iris plugin is not a VolmitPlugin");
}
public static void hostAudiences(Bindings.Adventure adventure) {
AUDIENCES = adventure;
}
public static Bindings.Adventure audiences() {
Bindings.Adventure adventure = AUDIENCES;
if (adventure == null) {
throw new IllegalStateException("No Iris adventure audiences are hosted");
}
return adventure;
}
public static void hostConsoleSender(Supplier<VolmitSender> supplier) {
CONSOLE = supplier;
}
public static VolmitSender console() {
Supplier<VolmitSender> supplier = CONSOLE;
if (supplier == null) {
throw new IllegalStateException("No Iris console sender is hosted");
}
return supplier.get();
}
public static World unwrapWorld(PlatformWorld world) {
return (World) world.nativeHandle();
}
@@ -3,7 +3,9 @@ package art.arcane.iris.util.common.data;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.collection.KMap;
import art.arcane.volmlib.util.data.BSupport;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.engine.object.IrisCompat;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.link.Identifier;
import art.arcane.iris.core.link.data.DataType;
@@ -27,22 +29,22 @@ public class B {
private static final class BSupportImpl extends BSupport<BlockProperty> {
@Override
protected void warn(String message) {
Iris.warn(message);
IrisLogging.warn(message);
}
@Override
protected void debug(String message) {
Iris.debug(message);
IrisLogging.debug(message);
}
@Override
protected void reportError(Throwable throwable) {
Iris.reportError(throwable);
IrisLogging.reportError(throwable);
}
@Override
protected void error(String message) {
Iris.error(message);
IrisLogging.error(message);
}
@Override
@@ -64,11 +66,11 @@ public class B {
protected BlockData resolveCompatBlock(String bdxf) {
if (bdxf.contains(":")) {
if (bdxf.startsWith("minecraft:")) {
return Iris.compat.getBlock(bdxf);
return IrisServices.get(IrisCompat.class).getBlock(bdxf);
}
return null;
}
return Iris.compat.getBlock(bdxf);
return IrisServices.get(IrisCompat.class).getBlock(bdxf);
}
@Override
@@ -78,7 +80,7 @@ public class B {
}
Identifier key = Identifier.fromString(ix);
Optional<BlockData> bd = Iris.service(ExternalDataSVC.class).getBlockData(key);
Optional<BlockData> bd = IrisServices.get(ExternalDataSVC.class).getBlockData(key);
debug("Loading block data " + key);
return bd.orElse(null);
}
@@ -90,14 +92,14 @@ public class B {
@Override
protected void appendExternalBlockTypes(KList<String> blockTypes) {
for (Identifier id : Iris.service(ExternalDataSVC.class).getAllIdentifiers(DataType.BLOCK)) {
for (Identifier id : IrisServices.get(ExternalDataSVC.class).getAllIdentifiers(DataType.BLOCK)) {
blockTypes.add(id.toString());
}
}
@Override
protected void appendExternalItemTypes(KList<String> itemTypes) {
for (Identifier id : Iris.service(ExternalDataSVC.class).getAllIdentifiers(DataType.ITEM)) {
for (Identifier id : IrisServices.get(ExternalDataSVC.class).getAllIdentifiers(DataType.ITEM)) {
itemTypes.add(id.toString());
}
}
@@ -112,7 +114,7 @@ public class B {
});
var emptyStates = flipped.computeIfAbsent(new KList<>(0), $ -> new KList<>());
for (var pair : Iris.service(ExternalDataSVC.class).getAllBlockProperties()) {
for (var pair : IrisServices.get(ExternalDataSVC.class).getAllBlockProperties()) {
if (pair.getB().isEmpty()) {
emptyStates.add(pair.getA().toString());
} else {
@@ -18,7 +18,7 @@
package art.arcane.iris.util.common.data.palette;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.collection.KMap;
import java.util.List;
@@ -45,9 +45,9 @@ public class HashMapPalette<T> implements Palette<T> {
int newId = id++;
if (newId >= 1 << this.bits) {
Iris.info(newId + " to...");
IrisLogging.info(newId + " to...");
newId = this.resizeHandler.onResize(this.bits + 1, var0);
Iris.info(newId + "..");
IrisLogging.info(newId + "..");
}
return newId;
@@ -18,7 +18,7 @@
package art.arcane.iris.util.common.data.palette;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.math.M;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
@@ -93,7 +93,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
int var2 = this.palette.idFor(var1);
if (M.r(0.003)) {
Iris.info("ID for " + var1 + " is " + var2 + " Palette: " + palette.getSize());
IrisLogging.info("ID for " + var1 + " is " + var2 + " Palette: " + palette.getSize());
}
this.storage.set(var0, var2);
@@ -2,7 +2,7 @@ package art.arcane.iris.util.common.director;
import art.arcane.volmlib.util.director.context.DirectorContextHandlers;
import art.arcane.volmlib.util.director.context.DirectorContextHandlerType;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.util.common.plugin.VolmitSender;
import java.util.Map;
@@ -12,11 +12,11 @@ public interface DirectorContextHandler<T> extends DirectorContextHandlerType<T,
static Map<Class<?>, DirectorContextHandler<?>> buildContextHandlers() {
return DirectorContextHandlers.buildOrEmpty(
Iris.initialize("art.arcane.iris.util.common.director.context"),
DirectorSystem.initializePackage("art.arcane.iris.util.common.director.context"),
DirectorContextHandler.class,
h -> ((DirectorContextHandler<?>) h).getType(),
e -> {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
});
}
@@ -18,15 +18,37 @@
package art.arcane.iris.util.common.director;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.util.common.scheduling.J;
import art.arcane.volmlib.util.director.DirectorSystemSupport;
import art.arcane.iris.Iris;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.io.JarScanner;
public final class DirectorSystem {
public static final KList<art.arcane.volmlib.util.director.DirectorParameterHandler<?>> handlers = Iris.initialize("art.arcane.iris.util.common.director.handlers", null).convert((i) -> (art.arcane.volmlib.util.director.DirectorParameterHandler<?>) i);
public static final KList<art.arcane.volmlib.util.director.DirectorParameterHandler<?>> handlers = initializePackage("art.arcane.iris.util.common.director.handlers").convert((i) -> (art.arcane.volmlib.util.director.DirectorParameterHandler<?>) i);
private DirectorSystem() {
}
public static KList<Object> initializePackage(String packageName) {
JarScanner js = new JarScanner(IrisPlatforms.get().pluginJar(), packageName);
KList<Object> v = new KList<>();
J.attempt(js::scan);
for (Class<?> i : js.getClasses()) {
try {
v.add(i.getDeclaredConstructor().newInstance());
} catch (Throwable ex) {
IrisLogging.warn("Skipped class initialization for %s: %s%s",
i.getName(),
ex.getClass().getSimpleName(),
ex.getMessage() == null ? "" : " - " + ex.getMessage());
IrisLogging.reportError(ex);
}
}
return v;
}
/**
* Get the handler for the specified type
*
@@ -39,7 +61,7 @@ public final class DirectorSystem {
return handler;
}
Iris.error("Unhandled type in Director Parameter: " + type.getName() + ". This is bad!");
IrisLogging.error("Unhandled type in Director Parameter: " + type.getName() + ". This is bad!");
return null;
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.util.common.director.specialhandlers;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.iris.util.common.director.DirectorParameterHandler;
@@ -37,7 +37,7 @@ public class ObjectHandler implements DirectorParameterHandler<String> {
}
//noinspection ConstantConditions
for (File i : Iris.instance.getDataFolder("packs").listFiles()) {
for (File i : IrisPlatforms.get().dataFolder("packs").listFiles()) {
if (i.isDirectory()) {
data = IrisData.get(i);
p.add(data.getObjectLoader().getPossibleKeys());
@@ -18,7 +18,7 @@
package art.arcane.iris.util.common.director.specialhandlers;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.iris.util.common.director.DirectorParameterHandler;
@@ -41,7 +41,7 @@ public class ObjectTargetHandler implements DirectorParameterHandler<String> {
collectPrefixes(k, prefixes);
}
} else {
File packsFolder = Iris.instance.getDataFolder("packs");
File packsFolder = IrisPlatforms.get().dataFolder("packs");
File[] packs = packsFolder.listFiles();
if (packs != null) {
for (File pack : packs) {
@@ -1,6 +1,6 @@
package art.arcane.iris.util.common.director.specialhandlers;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.loader.IrisRegistrant;
import art.arcane.volmlib.util.collection.KList;
@@ -35,7 +35,7 @@ public abstract class RegistrantHandler<T extends IrisRegistrant> implements Dir
}
//noinspection ConstantConditions
for (File i : Iris.instance.getDataFolder("packs").listFiles()) {
for (File i : IrisPlatforms.get().dataFolder("packs").listFiles()) {
if (i.isDirectory()) {
data = IrisData.get(i);
for (T j : data.getLoader(type).loadAll(data.getLoader(type).getPossibleKeys())) {
@@ -18,7 +18,7 @@
package art.arcane.iris.util.common.format;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.util.common.plugin.VolmitSender;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.md_5.bungee.api.chat.BaseComponent;
@@ -458,7 +458,7 @@ public enum C {
C c = BY_CHAR.get(code);
return c == null ? C.WHITE : c;
} catch (Exception e) {
Iris.reportError(e);
IrisLogging.reportError(e);
return C.WHITE;
}
}
@@ -477,7 +477,7 @@ public enum C {
return BY_CHAR.get(code.charAt(0));
} catch (Exception e) {
Iris.reportError(e);
IrisLogging.reportError(e);
return C.WHITE;
}
}
@@ -5,7 +5,8 @@ import art.arcane.iris.util.project.sentry.IrisLogger;
import art.arcane.iris.util.project.sentry.ServerID;
import com.google.gson.JsonSyntaxException;
import art.arcane.iris.BuildConstants;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.nms.INMS;
import art.arcane.iris.core.safeguard.IrisSafeguard;
@@ -14,6 +15,7 @@ import art.arcane.iris.engine.platform.PlatformChunkGenerator;
import art.arcane.iris.util.project.context.IrisContext;
import art.arcane.volmlib.util.json.JSONException;
import art.arcane.volmlib.util.reflect.ShadeFix;
import art.arcane.iris.util.common.plugin.VolmitPlugin;
import art.arcane.iris.util.common.scheduling.J;
import io.sentry.Sentry;
@@ -26,6 +28,7 @@ import org.bstats.charts.SingleLineChart;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import java.util.HashMap;
import java.util.Map;
@@ -41,8 +44,8 @@ public class Bindings {
public static void setupSentry() {
var settings = IrisSettings.get().getSentry();
if (settings.disableAutoReporting || Sentry.isEnabled() || Boolean.getBoolean("iris.suppressReporting")) return;
Iris.info("Enabling Sentry for anonymous error reporting. You can disable this in the settings.");
Iris.info("Your server ID is: " + ServerID.ID);
IrisLogging.info("Enabling Sentry for anonymous error reporting. You can disable this in the settings.");
IrisLogging.info("Your server ID is: " + ServerID.ID);
Sentry.init(options -> {
options.setDsn("http://4cdbb9ac953306529947f4ca1e8e6b26@sentry.volmit.com:8080/2");
@@ -53,7 +56,7 @@ public class Bindings {
options.setAttachServerName(false);
options.setEnableUncaughtExceptionHandler(false);
options.setRelease(Iris.instance.getDescription().getVersion());
options.setRelease(BukkitPlatform.plugin().getDescription().getVersion());
options.setEnvironment(BuildConstants.ENVIRONMENT);
options.setBeforeSend((event, hint) -> {
if (suppress(event.getThrowable())) return null;
@@ -83,7 +86,7 @@ public class Bindings {
}
public static void setupBstats(Iris plugin) {
public static void setupBstats(VolmitPlugin plugin) {
J.s(() -> {
var metrics = new Metrics(plugin, 24220);
metrics.addCustomChart(new SingleLineChart("custom_dimensions", () -> Bukkit.getWorlds()
@@ -118,7 +121,7 @@ public class Bindings {
public static class Adventure {
private final BukkitAudiences audiences;
public Adventure(Iris plugin) {
public Adventure(Plugin plugin) {
ShadeFix.fix(ComponentSerializer.class);
this.audiences = BukkitAudiences.create(plugin);
}
@@ -1,6 +1,8 @@
package art.arcane.iris.util.common.misc;
import art.arcane.iris.Iris;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.util.common.plugin.VolmitPlugin;
import io.github.slimjar.app.builder.ApplicationBuilder;
import io.github.slimjar.app.builder.SpigotApplicationBuilder;
import io.github.slimjar.injector.loader.factory.InjectableFactory;
@@ -11,8 +13,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantLock;
import static art.arcane.iris.Iris.instance;
public class SlimJar {
private static final boolean DEBUG = Boolean.getBoolean("iris.debug-slimjar");
private static final boolean DISABLE_REMAPPER = Boolean.getBoolean("iris.disable-remapper");
@@ -26,37 +26,38 @@ public class SlimJar {
try {
if (loaded.getAndSet(true)) return;
final var downloadPath = instance.getDataFolder("cache", "libraries").toPath();
final var logger = instance.getLogger();
final VolmitPlugin plugin = BukkitPlatform.volmitPlugin();
final var downloadPath = plugin.getDataFolder("cache", "libraries").toPath();
final var logger = plugin.getLogger();
logger.info("Loading libraries...");
try {
new SpigotApplicationBuilder(instance)
new SpigotApplicationBuilder(plugin)
.downloadDirectoryPath(downloadPath)
.debug(DEBUG)
.remap(!DISABLE_REMAPPER)
.build();
} catch (Throwable e) {
Iris.warn("Failed to inject the library loader, falling back to application builder");
ApplicationBuilder.appending(instance.getName())
IrisLogging.warn("Failed to inject the library loader, falling back to application builder");
ApplicationBuilder.appending(plugin.getName())
.injectableFactory(InjectableFactory.selecting(InjectableFactory.ERROR, InjectableFactory.INJECTABLE, InjectableFactory.WRAPPED, InjectableFactory.UNSAFE))
.downloadDirectoryPath(downloadPath)
.logger(new ProcessLogger() {
@Override
public void info(@NotNull String message, @Nullable Object... args) {
if (!DEBUG) return;
instance.getLogger().info(message.formatted(args));
plugin.getLogger().info(message.formatted(args));
}
@Override
public void error(@NotNull String message, @Nullable Object... args) {
instance.getLogger().severe(message.formatted(args));
plugin.getLogger().severe(message.formatted(args));
}
@Override
public void debug(@NotNull String message, @Nullable Object... args) {
if (!DEBUG) return;
instance.getLogger().info(message.formatted(args));
plugin.getLogger().info(message.formatted(args));
}
})
.build();
@@ -20,7 +20,7 @@ package art.arcane.iris.util.nbt.common.mca;
import art.arcane.volmlib.util.nbt.mca.MCAChunkSupport;
import art.arcane.volmlib.util.nbt.tag.CompoundTag;
import art.arcane.iris.Iris;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.nms.INMS;
import static org.bukkit.Bukkit.getServer;
@@ -36,8 +36,8 @@ public class Chunk extends MCAChunkSupport<Section> {
(min, max, data) -> INMS.get().newBiomeContainer(min, max, data),
(sectionRoot, dataVersion, loadFlags) -> new Section(sectionRoot, dataVersion, loadFlags),
Section::newSection,
() -> "Iris Headless " + Iris.instance.getDescription().getVersion(),
() -> "Iris " + Iris.instance.getDescription().getVersion()
() -> "Iris Headless " + BukkitPlatform.plugin().getDescription().getVersion(),
() -> "Iris " + BukkitPlatform.plugin().getDescription().getVersion()
);
Chunk(int lastMCAUpdate) {
@@ -18,7 +18,7 @@
package art.arcane.iris.util.nbt.common.mca;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.nms.INMS;
import art.arcane.iris.engine.data.cache.Cache;
import art.arcane.volmlib.util.collection.KMap;
@@ -71,10 +71,10 @@ public class NBTWorld {
NBTWorldSupport.regionFileResolver(worldFolder, "region"),
MCAUtil::write,
NBTWorldSupport.logger(
Iris::info,
Iris::debug,
IrisLogging::info,
IrisLogging::debug,
(message, error) -> {
Iris.error(message);
IrisLogging.error(message);
if (error != null) {
error.printStackTrace();
}
@@ -197,7 +197,7 @@ public class NBTWorld {
return getBlockData(tag);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
return AIR;
@@ -1,11 +1,11 @@
package art.arcane.iris.util.common.parallel;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.parallel.BurstExecutorSupport;
import java.util.concurrent.ExecutorService;
public class BurstExecutor extends BurstExecutorSupport {
public BurstExecutor(ExecutorService executor, int burstSizeEstimate) {
super(executor, burstSizeEstimate, Iris::reportError);
super(executor, burstSizeEstimate, IrisLogging::reportError);
}
}
@@ -1,10 +1,10 @@
package art.arcane.iris.util.common.parallel;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.parallel.GridLockSupport;
public class GridLock extends GridLockSupport {
public GridLock(int x, int z) {
super(x, z, Iris::reportError);
super(x, z, IrisLogging::reportError);
}
}
@@ -1,6 +1,6 @@
package art.arcane.iris.util.common.parallel;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.parallel.HyperLockSupport;
public class HyperLock extends HyperLockSupport {
@@ -13,6 +13,6 @@ public class HyperLock extends HyperLockSupport {
}
public HyperLock(int capacity, boolean fair) {
super(capacity, fair, Iris::warn, Iris::reportError);
super(capacity, fair, IrisLogging::warn, IrisLogging::reportError);
}
}
@@ -1,6 +1,6 @@
package art.arcane.iris.util.common.parallel;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisSettings;
import art.arcane.volmlib.util.parallel.MultiBurstSupport;
import art.arcane.volmlib.util.math.M;
@@ -29,7 +29,7 @@ public class MultiBurst extends MultiBurstSupport {
}
public MultiBurst(String name, int priority, IntSupplier parallelism) {
super(name, priority, parallelism, IrisSettings::getThreadCount, M::ms, Iris::reportError, Iris::info, Iris::warn, TIMEOUT);
super(name, priority, parallelism, IrisSettings::getThreadCount, M::ms, IrisLogging::reportError, IrisLogging::info, IrisLogging::warn, TIMEOUT);
}
public CoroutineDispatcher getDispatcher() {
@@ -64,6 +64,6 @@ public class MultiBurst extends MultiBurstSupport {
}
public static void close(ExecutorService service) {
MultiBurstSupport.close(service, M::ms, Iris::info, Iris::warn, Iris::reportError, TIMEOUT);
MultiBurstSupport.close(service, M::ms, IrisLogging::info, IrisLogging::warn, IrisLogging::reportError, TIMEOUT);
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.util.common.plugin;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
public abstract class Controller implements IController {
private final String name;
@@ -39,22 +39,22 @@ public abstract class Controller implements IController {
@Override
public void l(Object l) {
Iris.info("[" + getName() + "]: " + l);
IrisLogging.info("[" + getName() + "]: " + l);
}
@Override
public void w(Object l) {
Iris.warn("[" + getName() + "]: " + l);
IrisLogging.warn("[" + getName() + "]: " + l);
}
@Override
public void f(Object l) {
Iris.error("[" + getName() + "]: " + l);
IrisLogging.error("[" + getName() + "]: " + l);
}
@Override
public void v(Object l) {
Iris.verbose("[" + getName() + "]: " + l);
IrisLogging.debug("[" + getName() + "]: " + l);
}
@Override
@@ -18,7 +18,7 @@
package art.arcane.iris.util.common.plugin;
import art.arcane.iris.Iris;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import org.bukkit.event.Listener;
public interface IrisService extends Listener {
@@ -27,6 +27,6 @@ public interface IrisService extends Listener {
void onDisable();
default void postShutdown(Runnable r) {
Iris.instance.postShutdown(r);
BukkitPlatform.volmitPlugin().postShutdown(r);
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.util.common.plugin;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisSettings;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.iris.util.common.format.C;
@@ -193,7 +193,7 @@ public abstract class MortarCommand implements ICommand {
p.add(pc);
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException |
InvocationTargetException | NoSuchMethodException | SecurityException e) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.util.common.plugin;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.collection.KList;
import org.bukkit.command.CommandSender;
@@ -39,7 +39,7 @@ public abstract class MortarPermission {
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException |
InvocationTargetException | NoSuchMethodException | SecurityException e) {
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
}
@@ -54,7 +54,7 @@ public abstract class MortarPermission {
p.add((MortarPermission) i.get(Modifier.isStatic(i.getModifiers()) ? null : this));
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.util.common.plugin;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisSettings;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.collection.KMap;
@@ -59,7 +59,7 @@ public class VirtualCommand {
new V(command, true, true).set(i.getName(), cmd);
children.put(cmd.getAllNodes(), new VirtualCommand(cmd, cc.value().trim().isEmpty() ? tag : cc.value().trim()));
} catch (Exception e) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.util.common.plugin;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.collection.KMap;
import art.arcane.volmlib.util.io.IO;
@@ -47,6 +47,7 @@ import java.util.Map;
@SuppressWarnings("EmptyMethod")
public abstract class VolmitPlugin extends JavaPlugin implements Listener {
public static final boolean bad = false;
private final KList<Runnable> postShutdown = new KList<>();
private KMap<KList<String>, VirtualCommand> commands;
private KList<MortarCommand> commandCache;
private KList<MortarPermission> permissionCache;
@@ -55,20 +56,28 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
return getFile();
}
public void postShutdown(Runnable r) {
postShutdown.add(r);
}
protected void runPostShutdown() {
postShutdown.forEach(Runnable::run);
}
public void l(Object l) {
Iris.info("[" + getName() + "]: " + l);
IrisLogging.info("[" + getName() + "]: " + l);
}
public void w(Object l) {
Iris.warn("[" + getName() + "]: " + l);
IrisLogging.warn("[" + getName() + "]: " + l);
}
public void f(Object l) {
Iris.error("[" + getName() + "]: " + l);
IrisLogging.error("[" + getName() + "]: " + l);
}
public void v(Object l) {
Iris.verbose("[" + getName() + "]: " + l);
IrisLogging.debug("[" + getName() + "]: " + l);
}
public void onEnable() {
@@ -95,7 +104,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
outputCommandInfo();
outputPermissionInfo();
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -168,7 +177,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
v("Registered Permissions " + pc.getFullNode() + " (" + i.getName() + ")");
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException |
InvocationTargetException | NoSuchMethodException | SecurityException e) {
Iris.reportError(e);
IrisLogging.reportError(e);
w("Failed to register permission (field " + i.getName() + ")");
e.printStackTrace();
}
@@ -179,7 +188,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
try {
Bukkit.getPluginManager().addPermission(i);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -194,7 +203,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
g.add(toPermission(x));
g.addAll(computePermissions(x));
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
}
}
@@ -266,7 +275,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
} catch (Throwable e) {
w("Failed to tick controller " + i.getName());
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
}
@@ -284,7 +293,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
w("Failed to register instance (field " + i.getName() + ")");
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
}
@@ -303,7 +312,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
w("Failed to unregister instance (field " + i.getName() + ")");
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
}
@@ -329,7 +338,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
InvocationTargetException | NoSuchMethodException | SecurityException e) {
w("Failed to register command (field " + i.getName() + ")");
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
}
@@ -445,7 +454,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
}
} catch (Throwable e) {
e.printStackTrace();
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -457,12 +466,12 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
}
public void registerListener(Listener l) {
Iris.debug("Register Listener " + l.getClass().getSimpleName());
IrisLogging.debug("Register Listener " + l.getClass().getSimpleName());
Bukkit.getPluginManager().registerEvents(l, this);
}
public void unregisterListener(Listener l) {
Iris.debug("Register Listener " + l.getClass().getSimpleName());
IrisLogging.debug("Register Listener " + l.getClass().getSimpleName());
HandlerList.unregisterAll(l);
}
@@ -484,7 +493,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
try {
unregisterCommand(i.getCommand());
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -502,7 +511,7 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
Bukkit.getPluginManager().removePermission(i);
v("Unregistered Permission " + i.getName());
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
}
@@ -18,7 +18,8 @@
package art.arcane.iris.util.common.plugin;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.IrisSettings;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.collection.KMap;
@@ -225,7 +226,7 @@ public class VolmitSender implements CommandSender {
}
public void sendTitle(String title, String subtitle, int i, int s, int o) {
Iris.audiences.player(player()).showTitle(Title.title(
BukkitPlatform.audiences().player(player()).showTitle(Title.title(
createComponent(title),
createComponent(subtitle),
Title.Times.times(Duration.ofMillis(i), Duration.ofMillis(s), Duration.ofMillis(o))));
@@ -247,15 +248,15 @@ public class VolmitSender implements CommandSender {
}
public void sendAction(String action) {
Iris.audiences.player(player()).sendActionBar(createNoPrefixComponent(action));
BukkitPlatform.audiences().player(player()).sendActionBar(createNoPrefixComponent(action));
}
public void sendActionNoProcessing(String action) {
Iris.audiences.player(player()).sendActionBar(createNoPrefixComponentNoProcessing(action));
BukkitPlatform.audiences().player(player()).sendActionBar(createNoPrefixComponentNoProcessing(action));
}
public void sendTitle(String subtitle, int i, int s, int o) {
Iris.audiences.player(player()).showTitle(Title.title(
BukkitPlatform.audiences().player(player()).showTitle(Title.title(
createNoPrefixComponent(" "),
createNoPrefixComponent(subtitle),
Title.Times.times(Duration.ofMillis(i), Duration.ofMillis(s), Duration.ofMillis(o))));
@@ -338,12 +339,12 @@ public class VolmitSender implements CommandSender {
}
try {
Iris.audiences.sender(s).sendMessage(createComponent(message));
BukkitPlatform.audiences().sender(s).sendMessage(createComponent(message));
} catch (Throwable e) {
String t = C.translateAlternateColorCodes('&', getTag() + message);
String a = C.aura(t, IrisSettings.get().getGeneral().getSpinh(), IrisSettings.get().getGeneral().getSpins(), IrisSettings.get().getGeneral().getSpinb());
Iris.debug("<NOMINI>Failure to parse " + a);
IrisLogging.debug("<NOMINI>Failure to parse " + a);
s.sendMessage(C.translateAlternateColorCodes('&', getTag() + message));
}
}
@@ -368,12 +369,12 @@ public class VolmitSender implements CommandSender {
}
try {
Iris.audiences.sender(s).sendMessage(createComponentRaw(message));
BukkitPlatform.audiences().sender(s).sendMessage(createComponentRaw(message));
} catch (Throwable e) {
String t = C.translateAlternateColorCodes('&', getTag() + message);
String a = C.aura(t, IrisSettings.get().getGeneral().getSpinh(), IrisSettings.get().getGeneral().getSpins(), IrisSettings.get().getGeneral().getSpinb());
Iris.debug("<NOMINI>Failure to parse " + a);
IrisLogging.debug("<NOMINI>Failure to parse " + a);
s.sendMessage(C.translateAlternateColorCodes('&', getTag() + message));
}
}
@@ -542,7 +543,7 @@ public class VolmitSender implements CommandSender {
String nDescription = "<#3fe05a>✎ <#6ad97d><font:minecraft:uniform>" + p.getDescription();
String nUsage;
String fullTitle;
Iris.debug("Contextual: " + p.isContextual() + " / player: " + isPlayer());
IrisLogging.debug("Contextual: " + p.isContextual() + " / player: " + isPlayer());
if (p.isContextual() && (isPlayer() || s instanceof CommandDummy)) {
fullTitle = "<#ffcc00>[" + nTitle + "<#ffcc00>] ";
nUsage = "<#ff9900>➱ <#ffcc00><font:minecraft:uniform>The value may be derived from environment context.";
@@ -1,6 +1,6 @@
package art.arcane.iris.util.common.plugin.chunk;
import art.arcane.iris.Iris;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import lombok.NonNull;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
@@ -18,7 +18,7 @@ public class ChunkTickets implements Listener {
private final Map<World, TicketHolder> holders = new HashMap<>();
public ChunkTickets() {
Iris.instance.registerListener(this);
BukkitPlatform.volmitPlugin().registerListener(this);
Bukkit.getWorlds().forEach(w -> holders.put(w, new TicketHolder(w)));
}
@@ -1,6 +1,6 @@
package art.arcane.iris.util.common.plugin.chunk;
import art.arcane.iris.Iris;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.engine.data.cache.Cache;
import art.arcane.volmlib.util.collection.KMap;
import lombok.NonNull;
@@ -23,7 +23,7 @@ public class TicketHolder {
public void addTicket(int x, int z) {
tickets.compute(Cache.key(x, z), ($, ref) -> {
if (ref == null) {
world.addPluginChunkTicket(x, z, Iris.instance);
world.addPluginChunkTicket(x, z, BukkitPlatform.plugin());
return 1L;
}
return ++ref;
@@ -39,7 +39,7 @@ public class TicketHolder {
return tickets.compute(Cache.key(x, z), ($, ref) -> {
if (ref == null) return null;
if (--ref <= 0) {
world.removePluginChunkTicket(x, z, Iris.instance);
world.removePluginChunkTicket(x, z, BukkitPlatform.plugin());
return null;
}
return ref;
@@ -1,54 +1,54 @@
package art.arcane.iris.util.common.reflect;
import art.arcane.iris.Iris;
import java.lang.reflect.Field;
public class WrappedField<C, T> {
private final Field field;
public WrappedField(Class<C> origin, String methodName) {
Field f = null;
try {
f = origin.getDeclaredField(methodName);
f.setAccessible(true);
} catch (NoSuchFieldException e) {
Iris.error("Failed to created WrappedField %s#%s: %s%s", origin.getSimpleName(), methodName, e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
}
this.field = f;
}
public T get() {
return get(null);
}
public T get(C instance) {
if (field == null) {
return null;
}
try {
return (T) field.get(instance);
} catch (IllegalAccessException e) {
Iris.error("Failed to get WrappedField %s#%s: %s%s", field.getDeclaringClass().getSimpleName(), field.getName(), e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
return null;
}
}
public void set(T value) throws IllegalAccessException {
set(null, value);
}
public void set(C instance, T value) throws IllegalAccessException {
if (field == null) {
return;
}
field.set(instance, value);
}
public boolean hasFailed() {
return field == null;
}
}
package art.arcane.iris.util.common.reflect;
import art.arcane.iris.spi.IrisLogging;
import java.lang.reflect.Field;
public class WrappedField<C, T> {
private final Field field;
public WrappedField(Class<C> origin, String methodName) {
Field f = null;
try {
f = origin.getDeclaredField(methodName);
f.setAccessible(true);
} catch (NoSuchFieldException e) {
IrisLogging.error("Failed to created WrappedField %s#%s: %s%s", origin.getSimpleName(), methodName, e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
}
this.field = f;
}
public T get() {
return get(null);
}
public T get(C instance) {
if (field == null) {
return null;
}
try {
return (T) field.get(instance);
} catch (IllegalAccessException e) {
IrisLogging.error("Failed to get WrappedField %s#%s: %s%s", field.getDeclaringClass().getSimpleName(), field.getName(), e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
return null;
}
}
public void set(T value) throws IllegalAccessException {
set(null, value);
}
public void set(C instance, T value) throws IllegalAccessException {
if (field == null) {
return;
}
field.set(instance, value);
}
public boolean hasFailed() {
return field == null;
}
}
@@ -1,39 +1,39 @@
package art.arcane.iris.util.common.reflect;
import art.arcane.iris.Iris;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public final class WrappedReturningMethod<C, R> {
private final Method method;
public WrappedReturningMethod(Class<C> origin, String methodName, Class<?>... paramTypes) {
Method m = null;
try {
m = origin.getDeclaredMethod(methodName, paramTypes);
m.setAccessible(true);
} catch (NoSuchMethodException e) {
Iris.error("Failed to created WrappedMethod %s#%s: %s%s", origin.getSimpleName(), methodName, e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
}
this.method = m;
}
public R invoke(Object... args) {
return invoke(null, args);
}
public R invoke(C instance, Object... args) {
if (method == null) {
return null;
}
try {
return (R) method.invoke(instance, args);
} catch (InvocationTargetException | IllegalAccessException e) {
Iris.error("Failed to invoke WrappedMethod %s#%s: %s%s", method.getDeclaringClass().getSimpleName(), method.getName(), e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
return null;
}
}
}
package art.arcane.iris.util.common.reflect;
import art.arcane.iris.spi.IrisLogging;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public final class WrappedReturningMethod<C, R> {
private final Method method;
public WrappedReturningMethod(Class<C> origin, String methodName, Class<?>... paramTypes) {
Method m = null;
try {
m = origin.getDeclaredMethod(methodName, paramTypes);
m.setAccessible(true);
} catch (NoSuchMethodException e) {
IrisLogging.error("Failed to created WrappedMethod %s#%s: %s%s", origin.getSimpleName(), methodName, e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
}
this.method = m;
}
public R invoke(Object... args) {
return invoke(null, args);
}
public R invoke(C instance, Object... args) {
if (method == null) {
return null;
}
try {
return (R) method.invoke(instance, args);
} catch (InvocationTargetException | IllegalAccessException e) {
IrisLogging.error("Failed to invoke WrappedMethod %s#%s: %s%s", method.getDeclaringClass().getSimpleName(), method.getName(), e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
return null;
}
}
}
@@ -18,7 +18,9 @@
package art.arcane.iris.util.common.scheduling;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.service.PreservationSVC;
import art.arcane.iris.util.common.parallel.MultiBurst;
import art.arcane.volmlib.util.function.NastyFunction;
@@ -64,15 +66,15 @@ public class J {
SchedulerBridge.setAsyncRepeatingScheduler(J::ar);
SchedulerBridge.setCancelScheduler(J::car);
SchedulerBridge.setErrorHandler(e -> {
Iris.reportError(e);
IrisLogging.reportError(e);
e.printStackTrace();
});
SchedulerBridge.setInfoLogger(Iris::debug);
SchedulerBridge.setInfoLogger(IrisLogging::debug);
SchedulerBridge.setThreadRegistrar(thread -> {
try {
Iris.service(PreservationSVC.class).register(thread);
IrisServices.get(PreservationSVC.class).register(thread);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
});
}
@@ -82,7 +84,7 @@ public class J {
}
public static boolean doif(Supplier<Boolean> c, Runnable g) {
return JSupport.doif(c, g, Iris::reportError);
return JSupport.doif(c, g, IrisLogging::reportError);
}
public static void arun(Runnable a) {
@@ -90,8 +92,8 @@ public class J {
try {
a.run();
} catch (Throwable e) {
Iris.reportError(e);
Iris.error("Failed to run async task");
IrisLogging.reportError(e);
IrisLogging.error("Failed to run async task");
e.printStackTrace();
}
});
@@ -102,8 +104,8 @@ public class J {
try {
a.run();
} catch (Throwable e) {
Iris.reportError(e);
Iris.error("Failed to run async task");
IrisLogging.reportError(e);
IrisLogging.error("Failed to run async task");
e.printStackTrace();
}
});
@@ -128,11 +130,11 @@ public class J {
}
public static <R> R attemptResult(NastyFuture<R> r, R onError) {
return JSupport.attemptResult(r::run, onError, Iris::reportError);
return JSupport.attemptResult(r::run, onError, IrisLogging::reportError);
}
public static <T, R> R attemptFunction(NastyFunction<T, R> r, T param, R onError) {
return JSupport.attemptFunction(r::run, param, onError, Iris::reportError);
return JSupport.attemptFunction(r::run, param, onError, IrisLogging::reportError);
}
public static boolean sleep(long ms) {
@@ -152,7 +154,7 @@ public class J {
}
public static <T> T attempt(Supplier<T> t, T i) {
return JSupport.attempt(t::get, i, Iris::reportError);
return JSupport.attempt(t::get, i, IrisLogging::reportError);
}
public static void executeAfterStartupQueue() {
@@ -254,7 +256,7 @@ public class J {
}
if (isFolia()) {
Iris.verbose("Failed to schedule immediate region task for " + world.getName() + "@" + chunkX + "," + chunkZ + " on Folia.");
IrisLogging.debug("Failed to schedule immediate region task for " + world.getName() + "@" + chunkX + "," + chunkZ + " on Folia.");
return false;
}
@@ -276,7 +278,7 @@ public class J {
}
if (isFolia()) {
Iris.verbose("Failed to schedule delayed region task for " + world.getName() + "@" + chunkX + "," + chunkZ
IrisLogging.debug("Failed to schedule delayed region task for " + world.getName() + "@" + chunkX + "," + chunkZ
+ " (" + delayTicks + "t) on Folia.");
return false;
}
@@ -302,17 +304,17 @@ public class J {
}
public static void cancelPluginTasks() {
if (Iris.instance == null) {
if (!BukkitPlatform.hasPlugin()) {
return;
}
FoliaScheduler.cancelTasks(Iris.instance);
FoliaScheduler.cancelTasks(BukkitPlatform.plugin());
try {
Bukkit.getScheduler().cancelTasks(Iris.instance);
Bukkit.getScheduler().cancelTasks(BukkitPlatform.plugin());
} catch (UnsupportedOperationException ex) {
// Folia blocks BukkitScheduler usage.
Iris.verbose("Skipping BukkitScheduler#cancelTasks for Iris on this server.");
IrisLogging.debug("Skipping BukkitScheduler#cancelTasks for Iris on this server.");
}
}
@@ -330,7 +332,7 @@ public class J {
}
try {
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, r);
Bukkit.getScheduler().scheduleSyncDelayedTask(BukkitPlatform.plugin(), r);
} catch (UnsupportedOperationException e) {
FoliaScheduler.forceFoliaThreading(Bukkit.getServer());
if (runGlobalImmediate(r)) {
@@ -422,7 +424,7 @@ public class J {
}
try {
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, r, delay);
Bukkit.getScheduler().scheduleSyncDelayedTask(BukkitPlatform.plugin(), r, delay);
} catch (UnsupportedOperationException e) {
FoliaScheduler.forceFoliaThreading(Bukkit.getServer());
if (runGlobalDelayed(r, delay)) {
@@ -431,7 +433,7 @@ public class J {
throw new IllegalStateException("Failed to schedule delayed sync task (Folia scheduler unavailable, BukkitScheduler unsupported).", e);
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
}
}
@@ -568,7 +570,7 @@ public class J {
}
private static boolean isPluginEnabled() {
return Iris.instance != null && Bukkit.getPluginManager().isPluginEnabled(Iris.instance);
return BukkitPlatform.hasPlugin() && Bukkit.getPluginManager().isPluginEnabled(BukkitPlatform.plugin());
}
private static long ticksToMilliseconds(int ticks) {
@@ -585,7 +587,7 @@ public class J {
return true;
}
return FoliaScheduler.runGlobal(Iris.instance, runnable);
return FoliaScheduler.runGlobal(BukkitPlatform.plugin(), runnable);
}
private static boolean runGlobalDelayed(Runnable runnable, int delayTicks) {
@@ -597,7 +599,7 @@ public class J {
return runGlobalImmediate(runnable);
}
return FoliaScheduler.runGlobal(Iris.instance, runnable, Math.max(0, delayTicks));
return FoliaScheduler.runGlobal(BukkitPlatform.plugin(), runnable, Math.max(0, delayTicks));
}
private static boolean runRegionImmediate(World world, int chunkX, int chunkZ, Runnable runnable) {
@@ -605,7 +607,7 @@ public class J {
return false;
}
return FoliaScheduler.runRegion(Iris.instance, world, chunkX, chunkZ, runnable);
return FoliaScheduler.runRegion(BukkitPlatform.plugin(), world, chunkX, chunkZ, runnable);
}
private static boolean runRegionDelayed(World world, int chunkX, int chunkZ, Runnable runnable, int delayTicks) {
@@ -613,7 +615,7 @@ public class J {
return false;
}
return FoliaScheduler.runRegion(Iris.instance, world, chunkX, chunkZ, runnable, Math.max(0, delayTicks));
return FoliaScheduler.runRegion(BukkitPlatform.plugin(), world, chunkX, chunkZ, runnable, Math.max(0, delayTicks));
}
private static boolean runAsyncImmediate(Runnable runnable) {
@@ -623,15 +625,15 @@ public class J {
if (!isFolia()) {
try {
Bukkit.getScheduler().runTaskAsynchronously(Iris.instance, runnable);
Bukkit.getScheduler().runTaskAsynchronously(BukkitPlatform.plugin(), runnable);
return true;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
return false;
}
}
return FoliaScheduler.runAsync(Iris.instance, runnable);
return FoliaScheduler.runAsync(BukkitPlatform.plugin(), runnable);
}
private static boolean runAsyncDelayed(Runnable runnable, int delayTicks) {
@@ -641,15 +643,15 @@ public class J {
if (!isFolia()) {
try {
Bukkit.getScheduler().runTaskLaterAsynchronously(Iris.instance, runnable, Math.max(0, delayTicks));
Bukkit.getScheduler().runTaskLaterAsynchronously(BukkitPlatform.plugin(), runnable, Math.max(0, delayTicks));
return true;
} catch (Throwable e) {
Iris.reportError(e);
IrisLogging.reportError(e);
return false;
}
}
return FoliaScheduler.runAsync(Iris.instance, runnable, Math.max(0, delayTicks));
return FoliaScheduler.runAsync(BukkitPlatform.plugin(), runnable, Math.max(0, delayTicks));
}
private static boolean runEntityImmediate(Entity entity, Runnable runnable) {
@@ -657,7 +659,7 @@ public class J {
return false;
}
return FoliaScheduler.runEntity(Iris.instance, entity, runnable);
return FoliaScheduler.runEntity(BukkitPlatform.plugin(), entity, runnable);
}
private static boolean runEntityDelayed(Entity entity, Runnable runnable, int delayTicks) {
@@ -665,7 +667,7 @@ public class J {
return false;
}
return FoliaScheduler.runEntity(Iris.instance, entity, runnable, Math.max(0, delayTicks));
return FoliaScheduler.runEntity(BukkitPlatform.plugin(), entity, runnable, Math.max(0, delayTicks));
}
private static final class RepeatingState {
@@ -1,6 +1,6 @@
package art.arcane.iris.util.simd;
import art.arcane.iris.Iris;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.IrisSettings;
public final class SimdSupport {
@@ -25,11 +25,11 @@ public final class SimdSupport {
public static void install() {
if (isVectorized()) {
Iris.info("SIMD: vector kernels enabled (" + KERNELS.describe() + ")");
IrisLogging.info("SIMD: vector kernels enabled (" + KERNELS.describe() + ")");
} else if (!MODULE_PRESENT) {
Iris.info("SIMD: scalar kernels active; add --add-modules " + VECTOR_MODULE + " to JVM flags to enable vectorized generation kernels");
IrisLogging.info("SIMD: scalar kernels active; add --add-modules " + VECTOR_MODULE + " to JVM flags to enable vectorized generation kernels");
} else {
Iris.info("SIMD: vector kernels disabled (performance.simdKernels=false)");
IrisLogging.info("SIMD: vector kernels disabled (performance.simdKernels=false)");
}
}
@@ -49,6 +49,21 @@ public final class IrisLogging {
System.out.println("[Iris] " + message);
}
public static void reportError(String context, Throwable error) {
Throwable cause = error == null ? new IllegalStateException("Unknown Iris failure") : error;
String message = context == null || context.isBlank() ? "Unhandled Iris failure." : context;
try {
error(message);
} catch (Throwable inner) {
System.err.println("[Iris] " + message);
inner.printStackTrace(System.err);
}
reportError(cause);
cause.printStackTrace(System.err);
}
public static void reportError(Throwable error) {
if (IrisPlatforms.isBound()) {
IrisPlatforms.get().reportError(error);
@@ -40,6 +40,24 @@ public interface IrisPlatform {
File dataFolder();
default File dataFolder(String... path) {
if (path == null || path.length == 0) {
return dataFolder();
}
File folder = new File(dataFolder(), String.join(File.separator, path));
folder.mkdirs();
return folder;
}
default File dataFolderNoCreate(String... path) {
if (path == null || path.length == 0) {
return dataFolder();
}
return new File(dataFolder(), String.join(File.separator, path));
}
File dataFile(String... path);
File pluginJar();