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