mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-21 11:43:27 +00:00
Merge branch 'dev' into feat/kts
# Conflicts: # core/build.gradle.kts # core/src/main/java/com/volmit/iris/Iris.java # core/src/main/java/com/volmit/iris/engine/object/IrisDimension.java
This commit is contained in:
commit
ec5cb2d646
@ -30,10 +30,10 @@ buildscript {
|
|||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
`java-library`
|
`java-library`
|
||||||
id("com.gradleup.shadow") version "8.3.6"
|
alias(libs.plugins.shadow)
|
||||||
id("de.undercouch.download") version "5.0.1"
|
alias(libs.plugins.sentry)
|
||||||
id("xyz.jpenilla.run-paper") version "2.3.1"
|
alias(libs.plugins.download)
|
||||||
id("io.sentry.jvm.gradle") version "5.7.0"
|
alias(libs.plugins.runPaper)
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.volmit"
|
group = "com.volmit"
|
||||||
@ -94,8 +94,8 @@ nmsBindings.forEach { key, value ->
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":core"))
|
compileOnly(project(":core"))
|
||||||
compileOnly("org.jetbrains:annotations:26.0.2")
|
compileOnly(rootProject.libs.annotations)
|
||||||
compileOnly("net.bytebuddy:byte-buddy:1.17.5")
|
compileOnly(rootProject.libs.byteBuddy.core)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,23 +189,20 @@ allprojects {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
maven("https://repo.papermc.io/repository/maven-public/")
|
||||||
maven("https://repo.codemc.org/repository/maven-public/")
|
maven("https://repo.codemc.org/repository/maven-public/")
|
||||||
maven("https://mvn.lumine.io/repository/maven-public/")
|
|
||||||
maven("https://jitpack.io")
|
|
||||||
|
|
||||||
maven("https://s01.oss.sonatype.org/content/repositories/snapshots")
|
maven("https://jitpack.io") // EcoItems, score
|
||||||
maven("https://mvn.lumine.io/repository/maven/")
|
maven("https://repo.nexomc.com/releases/") // nexo
|
||||||
maven("https://repo.triumphteam.dev/snapshots")
|
maven("https://maven.devs.beer/") // itemsadder
|
||||||
maven("https://repo.mineinabyss.com/releases")
|
maven("https://repo.extendedclip.com/releases/") // placeholderapi
|
||||||
maven("https://hub.jeff-media.com/nexus/repository/jeff-media-public/")
|
maven("https://mvn.lumine.io/repository/maven-public/") // mythic
|
||||||
maven("https://repo.nexomc.com/releases/")
|
maven("https://nexus.phoenixdevt.fr/repository/maven-public/") //MMOItems
|
||||||
maven("https://nexus.phoenixdevt.fr/repository/maven-public/")
|
maven("https://repo.onarandombox.com/content/groups/public/") //Multiverse Core
|
||||||
maven("https://repo.onarandombox.com/content/groups/public/")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Provided or Classpath
|
// Provided or Classpath
|
||||||
compileOnly("org.projectlombok:lombok:1.18.36")
|
compileOnly(rootProject.libs.lombok)
|
||||||
annotationProcessor("org.projectlombok:lombok:1.18.36")
|
annotationProcessor(rootProject.libs.lombok)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
import io.github.slimjar.func.slimjar
|
||||||
|
import io.github.slimjar.resolver.data.Mirror
|
||||||
|
import java.net.URI
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||||
@ -19,15 +23,14 @@
|
|||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
`java-library`
|
`java-library`
|
||||||
id("com.gradleup.shadow")
|
alias(libs.plugins.shadow)
|
||||||
id("io.sentry.jvm.gradle")
|
alias(libs.plugins.sentry)
|
||||||
|
alias(libs.plugins.slimjar)
|
||||||
}
|
}
|
||||||
|
|
||||||
val apiVersion = "1.19"
|
val apiVersion = "1.19"
|
||||||
val main = "com.volmit.iris.Iris"
|
val main = "com.volmit.iris.Iris"
|
||||||
|
val lib = "com.volmit.iris.util"
|
||||||
val dynamic: Configuration by configurations.creating
|
|
||||||
configurations.compileOnly { extendsFrom(dynamic) }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dependencies.
|
* Dependencies.
|
||||||
@ -43,49 +46,51 @@ configurations.compileOnly { extendsFrom(dynamic) }
|
|||||||
*/
|
*/
|
||||||
dependencies {
|
dependencies {
|
||||||
// Provided or Classpath
|
// Provided or Classpath
|
||||||
compileOnly("org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT")
|
compileOnly(libs.spigot)
|
||||||
compileOnly("org.apache.logging.log4j:log4j-api:2.19.0")
|
compileOnly(libs.log4j.api)
|
||||||
compileOnly("org.apache.logging.log4j:log4j-core:2.19.0")
|
compileOnly(libs.log4j.core)
|
||||||
|
|
||||||
// Third Party Integrations
|
// Third Party Integrations
|
||||||
compileOnly("com.nexomc:nexo:1.6.0")
|
compileOnly(libs.nexo)
|
||||||
compileOnly("com.github.LoneDev6:api-itemsadder:3.4.1-r4")
|
compileOnly(libs.itemsadder)
|
||||||
compileOnly("com.github.PlaceholderAPI:placeholderapi:2.11.3")
|
compileOnly(libs.placeholderApi)
|
||||||
compileOnly("com.github.Ssomar-Developement:SCore:4.23.10.8")
|
compileOnly(libs.score)
|
||||||
compileOnly("net.Indyuce:MMOItems-API:6.9.5-SNAPSHOT")
|
compileOnly(libs.mmoitems)
|
||||||
compileOnly("com.willfp:EcoItems:5.44.0")
|
compileOnly(libs.ecoitems)
|
||||||
compileOnly("io.lumine:Mythic-Dist:5.2.1")
|
compileOnly(libs.mythic)
|
||||||
compileOnly("io.lumine:MythicCrucible-Dist:2.0.0")
|
compileOnly(libs.mythicChrucible)
|
||||||
compileOnly("me.kryniowesegryderiusz:kgenerators-core:7.3") {
|
compileOnly(libs.kgenerators) {
|
||||||
isTransitive = false
|
isTransitive = false
|
||||||
}
|
}
|
||||||
compileOnly("org.mvplugins.multiverse.core:multiverse-core:5.1.0")
|
compileOnly(libs.multiverseCore)
|
||||||
//implementation files("libs/CustomItems.jar")
|
|
||||||
|
|
||||||
// Shaded
|
// Shaded
|
||||||
implementation("com.dfsek:paralithic:0.8.1")
|
implementation(slimjar())
|
||||||
implementation("io.papermc:paperlib:1.0.5")
|
|
||||||
implementation("net.kyori:adventure-text-minimessage:4.17.0")
|
|
||||||
implementation("net.kyori:adventure-platform-bukkit:4.3.4")
|
|
||||||
implementation("net.kyori:adventure-api:4.17.0")
|
|
||||||
implementation("org.bstats:bstats-bukkit:3.1.0")
|
|
||||||
|
|
||||||
// Dynamically Loaded
|
// Dynamically Loaded
|
||||||
dynamic("commons-io:commons-io:2.13.0")
|
slim(libs.paralithic)
|
||||||
dynamic("commons-lang:commons-lang:2.6")
|
slim(libs.paperlib)
|
||||||
dynamic("com.github.oshi:oshi-core:6.6.5")
|
slim(libs.adventure.api)
|
||||||
dynamic("org.lz4:lz4-java:1.8.0")
|
slim(libs.adventure.minimessage)
|
||||||
dynamic("it.unimi.dsi:fastutil:8.5.8")
|
slim(libs.adventure.platform)
|
||||||
dynamic("com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2")
|
slim(libs.bstats)
|
||||||
dynamic("org.zeroturnaround:zt-zip:1.14")
|
slim(libs.sentry)
|
||||||
dynamic("com.google.code.gson:gson:2.10.1")
|
|
||||||
dynamic("org.ow2.asm:asm:9.8")
|
slim(libs.commons.io)
|
||||||
dynamic("com.github.ben-manes.caffeine:caffeine:3.0.6")
|
slim(libs.commons.lang)
|
||||||
dynamic("org.apache.commons:commons-lang3:3.12.0")
|
slim(libs.commons.lang3)
|
||||||
dynamic("net.bytebuddy:byte-buddy:1.17.5")
|
slim(libs.oshi)
|
||||||
dynamic("net.bytebuddy:byte-buddy-agent:1.17.5")
|
slim(libs.lz4)
|
||||||
dynamic("org.dom4j:dom4j:2.1.4")
|
slim(libs.fastutil)
|
||||||
dynamic("jaxen:jaxen:1.1.6")
|
slim(libs.lru)
|
||||||
|
slim(libs.zip)
|
||||||
|
slim(libs.gson)
|
||||||
|
slim(libs.asm)
|
||||||
|
slim(libs.caffeine)
|
||||||
|
slim(libs.byteBuddy.core)
|
||||||
|
slim(libs.byteBuddy.agent)
|
||||||
|
slim(libs.dom4j)
|
||||||
|
slim(libs.jaxen)
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
@ -93,6 +98,7 @@ java {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sentry {
|
sentry {
|
||||||
|
autoInstallation.enabled = false
|
||||||
includeSourceContext = true
|
includeSourceContext = true
|
||||||
|
|
||||||
org = "volmit-software"
|
org = "volmit-software"
|
||||||
@ -100,6 +106,19 @@ sentry {
|
|||||||
authToken = findProperty("sentry.auth.token") as String? ?: System.getenv("SENTRY_AUTH_TOKEN")
|
authToken = findProperty("sentry.auth.token") as String? ?: System.getenv("SENTRY_AUTH_TOKEN")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slimJar {
|
||||||
|
mirrors = listOf(Mirror(
|
||||||
|
URI.create("https://maven-central.storage-download.googleapis.com/maven2").toURL(),
|
||||||
|
URI.create("https://repo.maven.apache.org/maven2/").toURL()
|
||||||
|
))
|
||||||
|
|
||||||
|
relocate("com.dfsek.paralithic", "$lib.paralithic")
|
||||||
|
relocate("io.papermc.lib", "$lib.paper")
|
||||||
|
relocate("net.kyori", "$lib.kyori")
|
||||||
|
relocate("org.bstats", "$lib.metrics")
|
||||||
|
relocate("io.sentry", "$lib.sentry")
|
||||||
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
/**
|
/**
|
||||||
* We need parameter meta for the decree command system
|
* We need parameter meta for the decree command system
|
||||||
@ -118,7 +137,6 @@ tasks {
|
|||||||
"version" to rootProject.version,
|
"version" to rootProject.version,
|
||||||
"apiVersion" to apiVersion,
|
"apiVersion" to apiVersion,
|
||||||
"main" to main,
|
"main" to main,
|
||||||
"libraries" to dynamic.allDependencies.map { "\n - $it" }.sorted().joinToString("")
|
|
||||||
)
|
)
|
||||||
filesMatching("**/plugin.yml") {
|
filesMatching("**/plugin.yml") {
|
||||||
expand(inputs.properties)
|
expand(inputs.properties)
|
||||||
@ -127,17 +145,8 @@ tasks {
|
|||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
mergeServiceFiles()
|
mergeServiceFiles()
|
||||||
relocate("com.dfsek.paralithic", "com.volmit.iris.util.paralithic")
|
|
||||||
relocate("io.papermc.lib", "com.volmit.iris.util.paper")
|
|
||||||
relocate("net.kyori", "com.volmit.iris.util.kyori")
|
|
||||||
relocate("org.bstats", "com.volmit.iris.util.metrics")
|
|
||||||
relocate("io.sentry", "com.volmit.iris.util.sentry")
|
|
||||||
|
|
||||||
//minimize()
|
//minimize()
|
||||||
dependencies {
|
relocate("io.github.slimjar", "$lib.slimjar")
|
||||||
exclude(dependency("org.ow2.asm:asm:"))
|
|
||||||
exclude(dependency("org.jetbrains:"))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ import com.volmit.iris.core.nms.INMS;
|
|||||||
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
||||||
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
||||||
import com.volmit.iris.core.scripting.ExecutionEnvironment;
|
import com.volmit.iris.core.scripting.ExecutionEnvironment;
|
||||||
import com.volmit.iris.core.safeguard.ServerBootSFG;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.EnginePanic;
|
import com.volmit.iris.engine.EnginePanic;
|
||||||
@ -40,11 +39,9 @@ import com.volmit.iris.engine.object.IrisDimension;
|
|||||||
import com.volmit.iris.engine.object.IrisWorld;
|
import com.volmit.iris.engine.object.IrisWorld;
|
||||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||||
import com.volmit.iris.core.safeguard.IrisSafeguard;
|
import com.volmit.iris.core.safeguard.IrisSafeguard;
|
||||||
import com.volmit.iris.core.safeguard.UtilsSFG;
|
|
||||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.context.IrisContext;
|
|
||||||
import com.volmit.iris.util.exceptions.IrisException;
|
import com.volmit.iris.util.exceptions.IrisException;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
@ -53,30 +50,19 @@ import com.volmit.iris.util.io.FileWatcher;
|
|||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
import com.volmit.iris.util.io.InstanceState;
|
import com.volmit.iris.util.io.InstanceState;
|
||||||
import com.volmit.iris.util.io.JarScanner;
|
import com.volmit.iris.util.io.JarScanner;
|
||||||
import com.volmit.iris.util.json.JSONException;
|
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import com.volmit.iris.util.misc.Bindings;
|
||||||
import com.volmit.iris.util.misc.getHardware;
|
import com.volmit.iris.util.misc.getHardware;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.plugin.IrisService;
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import com.volmit.iris.util.plugin.VolmitPlugin;
|
import com.volmit.iris.util.plugin.VolmitPlugin;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.reflect.ShadeFix;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.Queue;
|
import com.volmit.iris.util.scheduling.Queue;
|
||||||
import com.volmit.iris.util.scheduling.ShurikenQueue;
|
import com.volmit.iris.util.scheduling.ShurikenQueue;
|
||||||
import com.volmit.iris.util.sentry.Attachments;
|
import io.github.slimjar.app.builder.ApplicationBuilder;
|
||||||
import com.volmit.iris.util.sentry.IrisLogger;
|
|
||||||
import com.volmit.iris.util.sentry.ServerID;
|
|
||||||
import io.papermc.lib.PaperLib;
|
|
||||||
import io.sentry.Sentry;
|
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
|
||||||
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
|
||||||
import org.bstats.bukkit.Metrics;
|
|
||||||
import org.bstats.charts.DrilldownPie;
|
|
||||||
import org.bstats.charts.SimplePie;
|
|
||||||
import org.bstats.charts.SingleLineChart;
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -92,17 +78,13 @@ import org.bukkit.plugin.IllegalPluginAccessException;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import oshi.SystemInfo;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.*;
|
import static com.volmit.iris.core.safeguard.IrisSafeguard.*;
|
||||||
import static com.volmit.iris.core.safeguard.ServerBootSFG.passedserversoftware;
|
import static com.volmit.iris.core.safeguard.ServerBootSFG.passedserversoftware;
|
||||||
@ -112,7 +94,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
|
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
|
||||||
|
|
||||||
public static Iris instance;
|
public static Iris instance;
|
||||||
public static BukkitAudiences audiences;
|
public static Bindings.Adventure audiences;
|
||||||
public static MultiverseCoreLink linkMultiverseCore;
|
public static MultiverseCoreLink linkMultiverseCore;
|
||||||
public static MythicMobsLink linkMythicMobs;
|
public static MythicMobsLink linkMythicMobs;
|
||||||
public static IrisCompat compat;
|
public static IrisCompat compat;
|
||||||
@ -121,7 +103,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
fixShading();
|
|
||||||
InstanceState.updateInstanceId();
|
InstanceState.updateInstanceId();
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
@ -398,7 +379,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void reportError(Throwable e) {
|
public static void reportError(Throwable e) {
|
||||||
Sentry.captureException(e);
|
Bindings.capture(e);
|
||||||
if (IrisSettings.get().getGeneral().isDebug()) {
|
if (IrisSettings.get().getGeneral().isDebug()) {
|
||||||
String n = e.getClass().getCanonicalName() + "-" + e.getStackTrace()[0].getClassName() + "-" + e.getStackTrace()[0].getLineNumber();
|
String n = e.getClass().getCanonicalName() + "-" + e.getStackTrace()[0].getClassName() + "-" + e.getStackTrace()[0].getLineNumber();
|
||||||
|
|
||||||
@ -456,14 +437,21 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
EnginePanic.add(s, v);
|
EnginePanic.add(s, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fixShading() {
|
public Iris() {
|
||||||
ShadeFix.fix(ComponentSerializer.class);
|
ApplicationBuilder.appending("Iris")
|
||||||
|
.downloadDirectoryPath(getDataFolder("cache", "libraries").toPath())
|
||||||
|
.logger((message, args) -> {
|
||||||
|
if (!message.startsWith("Loaded library ")) return;
|
||||||
|
getLogger().info(message.formatted(args));
|
||||||
|
})
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enable() {
|
private void enable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
services = new KMap<>();
|
services = new KMap<>();
|
||||||
setupAudience();
|
setupAudience();
|
||||||
setupSentry();
|
Bindings.setupSentry();
|
||||||
initialize("com.volmit.iris.core.service").forEach((i) -> services.put((Class<? extends IrisService>) i.getClass(), (IrisService) i));
|
initialize("com.volmit.iris.core.service").forEach((i) -> services.put((Class<? extends IrisService>) i.getClass(), (IrisService) i));
|
||||||
IO.delete(new File("iris"));
|
IO.delete(new File("iris"));
|
||||||
compat = IrisCompat.configured(getDataFile("compat.json"));
|
compat = IrisCompat.configured(getDataFile("compat.json"));
|
||||||
@ -478,7 +466,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
services.values().forEach(IrisService::onEnable);
|
services.values().forEach(IrisService::onEnable);
|
||||||
services.values().forEach(this::registerListener);
|
services.values().forEach(this::registerListener);
|
||||||
J.s(() -> {
|
J.s(() -> {
|
||||||
J.a(() -> PaperLib.suggestPaper(this));
|
J.a(IrisSafeguard::suggestPaper);
|
||||||
J.a(() -> IO.delete(getTemp()));
|
J.a(() -> IO.delete(getTemp()));
|
||||||
J.a(LazyPregenerator::loadLazyGenerators, 100);
|
J.a(LazyPregenerator::loadLazyGenerators, 100);
|
||||||
J.a(this::bstats);
|
J.a(this::bstats);
|
||||||
@ -558,7 +546,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
|
|
||||||
private void setupAudience() {
|
private void setupAudience() {
|
||||||
try {
|
try {
|
||||||
audiences = BukkitAudiences.create(this);
|
audiences = new Bindings.Adventure(this);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
IrisSettings.get().getGeneral().setUseConsoleCustomColors(false);
|
IrisSettings.get().getGeneral().setUseConsoleCustomColors(false);
|
||||||
@ -691,50 +679,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
|
|
||||||
private void bstats() {
|
private void bstats() {
|
||||||
if (IrisSettings.get().getGeneral().isPluginMetrics()) {
|
if (IrisSettings.get().getGeneral().isPluginMetrics()) {
|
||||||
J.s(() -> {
|
Bindings.setupBstats(this);
|
||||||
var metrics = new Metrics(Iris.instance, 24220);
|
|
||||||
metrics.addCustomChart(new SingleLineChart("custom_dimensions", () -> Bukkit.getWorlds()
|
|
||||||
.stream()
|
|
||||||
.filter(IrisToolbelt::isIrisWorld)
|
|
||||||
.mapToInt(w -> 1)
|
|
||||||
.sum()));
|
|
||||||
|
|
||||||
metrics.addCustomChart(new DrilldownPie("used_packs", () -> Bukkit.getWorlds().stream()
|
|
||||||
.map(IrisToolbelt::access)
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.map(PlatformChunkGenerator::getEngine)
|
|
||||||
.collect(Collectors.toMap(engine -> engine.getDimension().getLoadKey(), engine -> {
|
|
||||||
var hash32 = engine.getHash32().getNow(null);
|
|
||||||
if (hash32 == null) return Map.of();
|
|
||||||
int version = engine.getDimension().getVersion();
|
|
||||||
String checksum = Long.toHexString(hash32);
|
|
||||||
|
|
||||||
return Map.of("v" + version + " (" + checksum + ")", 1);
|
|
||||||
}, (a, b) -> {
|
|
||||||
Map<String, Integer> merged = new HashMap<>(a);
|
|
||||||
b.forEach((k, v) -> merged.merge(k, v, Integer::sum));
|
|
||||||
return merged;
|
|
||||||
}))));
|
|
||||||
|
|
||||||
|
|
||||||
var info = new SystemInfo().getHardware();
|
|
||||||
var cpu = info.getProcessor().getProcessorIdentifier();
|
|
||||||
var mem = info.getMemory();
|
|
||||||
metrics.addCustomChart(new SimplePie("cpu_model", cpu::getName));
|
|
||||||
|
|
||||||
var nf = NumberFormat.getInstance(Locale.ENGLISH);
|
|
||||||
nf.setMinimumFractionDigits(0);
|
|
||||||
nf.setMaximumFractionDigits(2);
|
|
||||||
nf.setRoundingMode(RoundingMode.HALF_UP);
|
|
||||||
|
|
||||||
metrics.addCustomChart(new DrilldownPie("memory", () -> {
|
|
||||||
double total = mem.getTotal() * 1E-9;
|
|
||||||
double alloc = Math.min(total, Runtime.getRuntime().maxMemory() * 1E-9);
|
|
||||||
return Map.of(nf.format(alloc), Map.of(nf.format(total), 1));
|
|
||||||
}));
|
|
||||||
|
|
||||||
postShutdown.add(metrics::shutdown);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -939,43 +884,4 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean suppress(Throwable e) {
|
|
||||||
return (e instanceof IllegalStateException ex && "zip file closed".equals(ex.getMessage())) || e instanceof JSONException;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void setupSentry() {
|
|
||||||
var settings = IrisSettings.get().getSentry();
|
|
||||||
if (settings.disableAutoReporting || Sentry.isEnabled() || Boolean.getBoolean("iris.suppressReporting")) return;
|
|
||||||
Iris.info("Enabling Sentry for anonymous error reporting. You can disable this in the settings.");
|
|
||||||
Iris.info("Your server ID is: " + ServerID.ID);
|
|
||||||
Sentry.init(options -> {
|
|
||||||
options.setDsn("https://b16ecc222e9c1e0c48faecacb906fd89@o4509451052646400.ingest.de.sentry.io/4509452722765904");
|
|
||||||
if (settings.debug) {
|
|
||||||
options.setLogger(new IrisLogger());
|
|
||||||
options.setDebug(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
options.setAttachServerName(false);
|
|
||||||
options.setEnableUncaughtExceptionHandler(false);
|
|
||||||
options.setRelease(Iris.instance.getDescription().getVersion());
|
|
||||||
options.setBeforeSend((event, hint) -> {
|
|
||||||
if (suppress(event.getThrowable())) return null;
|
|
||||||
event.setTag("iris.safeguard", IrisSafeguard.mode());
|
|
||||||
event.setTag("iris.nms", INMS.get().getClass().getCanonicalName());
|
|
||||||
var context = IrisContext.get();
|
|
||||||
if (context != null) event.getContexts().set("engine", context.asContext());
|
|
||||||
event.getContexts().set("safeguard", IrisSafeguard.asContext());
|
|
||||||
return event;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Sentry.configureScope(scope -> {
|
|
||||||
if (settings.includeServerId) scope.setUser(ServerID.asUser());
|
|
||||||
scope.addAttachment(Attachments.PLUGINS);
|
|
||||||
scope.setTag("server", Bukkit.getVersion());
|
|
||||||
scope.setTag("server.type", Bukkit.getName());
|
|
||||||
scope.setTag("server.api", Bukkit.getBukkitVersion());
|
|
||||||
});
|
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(Sentry::close));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -468,6 +468,26 @@ public class SchemaBuilder {
|
|||||||
items.put("$ref", "#/definitions/" + key);
|
items.put("$ref", "#/definitions/" + key);
|
||||||
prop.put("items", items);
|
prop.put("items", items);
|
||||||
description.add(SYMBOL_TYPE__N + " Must be a valid Enchantment Type (use ctrl+space for auto complete!)");
|
description.add(SYMBOL_TYPE__N + " Must be a valid Enchantment Type (use ctrl+space for auto complete!)");
|
||||||
|
} else if (k.isAnnotationPresent(RegistryListFunction.class)) {
|
||||||
|
var functionClass = k.getDeclaredAnnotation(RegistryListFunction.class).value();
|
||||||
|
try {
|
||||||
|
var instance = functionClass.getDeclaredConstructor().newInstance();
|
||||||
|
String key = instance.key();
|
||||||
|
fancyType = instance.fancyName();
|
||||||
|
|
||||||
|
if (!definitions.containsKey(key)) {
|
||||||
|
JSONObject j = new JSONObject();
|
||||||
|
j.put("enum", instance.apply(data));
|
||||||
|
definitions.put(key, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject items = new JSONObject();
|
||||||
|
items.put("$ref", "#/definitions/" + key);
|
||||||
|
prop.put("items", items);
|
||||||
|
description.add(SYMBOL_TYPE__N + " Must be a valid " + fancyType + " (use ctrl+space for auto complete!)");
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Iris.error("Could not execute apply method in " + functionClass.getName());
|
||||||
|
}
|
||||||
} 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";
|
||||||
String key = "enum-potion-effect-type";
|
String key = "enum-potion-effect-type";
|
||||||
|
@ -4,6 +4,7 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
@ -38,6 +39,10 @@ public class IrisSafeguard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void suggestPaper() {
|
||||||
|
PaperLib.suggestPaper(Iris.instance);
|
||||||
|
}
|
||||||
|
|
||||||
public static KMap<String, Object> asContext() {
|
public static KMap<String, Object> asContext() {
|
||||||
KMap<String, Object> m = new KMap<>();
|
KMap<String, Object> m = new KMap<>();
|
||||||
m.put("diskSpace", !ServerBootSFG.hasEnoughDiskSpace);
|
m.put("diskSpace", !ServerBootSFG.hasEnoughDiskSpace);
|
||||||
|
@ -42,6 +42,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -110,8 +111,6 @@ public class IrisComplex implements DataProvider {
|
|||||||
//@builder
|
//@builder
|
||||||
if (focusRegion != null) {
|
if (focusRegion != null) {
|
||||||
focusRegion.getAllBiomes(this).forEach(this::registerGenerators);
|
focusRegion.getAllBiomes(this).forEach(this::registerGenerators);
|
||||||
} else if (focusBiome != null) {
|
|
||||||
registerGenerators(focusBiome);
|
|
||||||
} else {
|
} else {
|
||||||
engine.getDimension()
|
engine.getDimension()
|
||||||
.getRegions()
|
.getRegions()
|
||||||
@ -252,7 +251,15 @@ public class IrisComplex implements DataProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
String key = UUID.randomUUID().toString();
|
||||||
|
IrisRegion region = new IrisRegion();
|
||||||
|
region.getLandBiomes().add(focus.getLoadKey());
|
||||||
|
region.getSeaBiomes().add(focus.getLoadKey());
|
||||||
|
region.getShoreBiomes().add(focus.getLoadKey());
|
||||||
|
region.setLoadKey(key);
|
||||||
|
region.setLoader(data);
|
||||||
|
region.setLoadFile(new File(data.getDataFolder(), data.getRegionLoader().getFolderName() + "/" + key + ".json"));
|
||||||
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IrisDecorator decorateFor(IrisBiome b, double x, double z, IrisDecorationPart part) {
|
private IrisDecorator decorateFor(IrisBiome b, double x, double z, IrisDecorationPart part) {
|
||||||
|
@ -29,7 +29,9 @@ import com.volmit.iris.engine.mantle.components.MantleJigsawComponent;
|
|||||||
import com.volmit.iris.engine.mantle.components.MantleObjectComponent;
|
import com.volmit.iris.engine.mantle.components.MantleObjectComponent;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.mantle.Mantle;
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -44,7 +46,7 @@ public class IrisEngineMantle implements EngineMantle {
|
|||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
private final KMap<Integer, KList<MantleComponent>> components;
|
private final KMap<Integer, KList<MantleComponent>> components;
|
||||||
private final AtomicCache<KList<Pair<KList<MantleComponent>, Integer>>> componentsCache = new AtomicCache<>();
|
private final AtomicCache<KList<Pair<KList<MantleComponent>, Integer>>> componentsCache = new AtomicCache<>();
|
||||||
private final AtomicCache<Integer> radCache = new AtomicCache<>();
|
private final AtomicCache<KSet<MantleFlag>> disabledFlags = new AtomicCache<>();
|
||||||
private final MantleObjectComponent object;
|
private final MantleObjectComponent object;
|
||||||
private final MantleJigsawComponent jigsaw;
|
private final MantleJigsawComponent jigsaw;
|
||||||
|
|
||||||
@ -101,10 +103,20 @@ public class IrisEngineMantle implements EngineMantle {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerComponent(MantleComponent c) {
|
public void registerComponent(MantleComponent c) {
|
||||||
|
c.setEnabled(!getDimension().getDisabledComponents().contains(c.getFlag()));
|
||||||
components.computeIfAbsent(c.getPriority(), k -> new KList<>()).add(c);
|
components.computeIfAbsent(c.getPriority(), k -> new KList<>()).add(c);
|
||||||
componentsCache.reset();
|
componentsCache.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KList<MantleFlag> getComponentFlags() {
|
||||||
|
return components.values()
|
||||||
|
.stream()
|
||||||
|
.flatMap(KList::stream)
|
||||||
|
.map(MantleComponent::getFlag)
|
||||||
|
.collect(KList.collector());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MantleJigsawComponent getJigsawComponent() {
|
public MantleJigsawComponent getJigsawComponent() {
|
||||||
return jigsaw;
|
return jigsaw;
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.volmit.iris.engine.mantle;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface ComponentFlag {
|
||||||
|
MantleFlag value();
|
||||||
|
}
|
@ -65,6 +65,8 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
|
|
||||||
void registerComponent(MantleComponent c);
|
void registerComponent(MantleComponent c);
|
||||||
|
|
||||||
|
KList<MantleFlag> getComponentFlags();
|
||||||
|
|
||||||
default int getHighest(int x, int z) {
|
default int getHighest(int x, int z) {
|
||||||
return getHighest(x, z, getData());
|
return getHighest(x, z, getData());
|
||||||
}
|
}
|
||||||
@ -227,7 +229,9 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default void generateMantleComponent(MantleWriter writer, int x, int z, MantleComponent c, MantleChunk mc, ChunkContext context) {
|
default void generateMantleComponent(MantleWriter writer, int x, int z, MantleComponent c, MantleChunk mc, ChunkContext context) {
|
||||||
mc.raiseFlag(c.getFlag(), () -> c.generateLayer(writer, x, z, context));
|
mc.raiseFlag(c.getFlag(), () -> {
|
||||||
|
if (c.isEnabled()) c.generateLayer(writer, x, z, context);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
|
@ -30,4 +30,5 @@ public abstract class IrisMantleComponent implements MantleComponent {
|
|||||||
private final EngineMantle engineMantle;
|
private final EngineMantle engineMantle;
|
||||||
private final MantleFlag flag;
|
private final MantleFlag flag;
|
||||||
private final int priority;
|
private final int priority;
|
||||||
|
private boolean enabled = true;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,10 @@ public interface MantleComponent extends Comparable<MantleComponent> {
|
|||||||
|
|
||||||
MantleFlag getFlag();
|
MantleFlag getFlag();
|
||||||
|
|
||||||
|
boolean isEnabled();
|
||||||
|
|
||||||
|
void setEnabled(boolean b);
|
||||||
|
|
||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
void generateLayer(MantleWriter writer, int x, int z, ChunkContext context);
|
void generateLayer(MantleWriter writer, int x, int z, ChunkContext context);
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.engine.mantle.components;
|
package com.volmit.iris.engine.mantle.components;
|
||||||
|
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
|
import com.volmit.iris.engine.mantle.ComponentFlag;
|
||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||||
@ -32,6 +33,7 @@ import com.volmit.iris.util.math.RNG;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ComponentFlag(MantleFlag.CARVED)
|
||||||
public class MantleCarvingComponent extends IrisMantleComponent {
|
public class MantleCarvingComponent extends IrisMantleComponent {
|
||||||
private final int radius = computeRadius();
|
private final int radius = computeRadius();
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.engine.mantle.components;
|
package com.volmit.iris.engine.mantle.components;
|
||||||
|
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
|
import com.volmit.iris.engine.mantle.ComponentFlag;
|
||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||||
@ -32,6 +33,7 @@ import com.volmit.iris.util.math.RNG;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ComponentFlag(MantleFlag.FLUID_BODIES)
|
||||||
public class MantleFluidBodyComponent extends IrisMantleComponent {
|
public class MantleFluidBodyComponent extends IrisMantleComponent {
|
||||||
private final int radius = computeRadius();
|
private final int radius = computeRadius();
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.engine.mantle.components;
|
package com.volmit.iris.engine.mantle.components;
|
||||||
|
|
||||||
import com.volmit.iris.engine.jigsaw.PlannedStructure;
|
import com.volmit.iris.engine.jigsaw.PlannedStructure;
|
||||||
|
import com.volmit.iris.engine.mantle.ComponentFlag;
|
||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||||
@ -39,6 +40,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ComponentFlag(MantleFlag.JIGSAW)
|
||||||
public class MantleJigsawComponent extends IrisMantleComponent {
|
public class MantleJigsawComponent extends IrisMantleComponent {
|
||||||
@Getter
|
@Getter
|
||||||
private final int radius = computeRadius();
|
private final int radius = computeRadius();
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.engine.mantle.components;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
|
import com.volmit.iris.engine.mantle.ComponentFlag;
|
||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||||
@ -47,6 +48,7 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ComponentFlag(MantleFlag.OBJECT)
|
||||||
public class MantleObjectComponent extends IrisMantleComponent {
|
public class MantleObjectComponent extends IrisMantleComponent {
|
||||||
private final int radius = computeRadius();
|
private final int radius = computeRadius();
|
||||||
|
|
||||||
|
@ -28,12 +28,14 @@ import com.volmit.iris.core.nms.datapack.IDataFixer;
|
|||||||
import com.volmit.iris.core.nms.datapack.IDataFixer.Dimension;
|
import com.volmit.iris.core.nms.datapack.IDataFixer.Dimension;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.*;
|
||||||
|
import com.volmit.iris.engine.object.annotations.functions.ComponentFlagFunction;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.data.DataProvider;
|
import com.volmit.iris.util.data.DataProvider;
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
import com.volmit.iris.util.math.Position2;
|
import com.volmit.iris.util.math.Position2;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.noise.CNG;
|
import com.volmit.iris.util.noise.CNG;
|
||||||
@ -240,7 +242,10 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
@MaxNumber(318)
|
@MaxNumber(318)
|
||||||
@Desc("The Subterrain Fluid Layer Height")
|
@Desc("The Subterrain Fluid Layer Height")
|
||||||
private int caveLavaHeight = 8;
|
private int caveLavaHeight = 8;
|
||||||
@MinNumber(1)
|
@RegistryListFunction(ComponentFlagFunction.class)
|
||||||
|
@ArrayType(type = MantleFlag.class)
|
||||||
|
@Desc("Collection of disabled components")
|
||||||
|
private KList<MantleFlag> disabledComponents = new KList<>();
|
||||||
@Desc("A list of globally applied pre-processors")
|
@Desc("A list of globally applied pre-processors")
|
||||||
@ArrayType(type = IrisPreProcessors.class)
|
@ArrayType(type = IrisPreProcessors.class)
|
||||||
private KList<IrisPreProcessors> globalPreProcessors = new KList<>();
|
private KList<IrisPreProcessors> globalPreProcessors = new KList<>();
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.volmit.iris.engine.object.annotations.functions;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
|
import com.volmit.iris.engine.framework.ListFunction;
|
||||||
|
import com.volmit.iris.engine.mantle.ComponentFlag;
|
||||||
|
import com.volmit.iris.engine.mantle.MantleComponent;
|
||||||
|
import com.volmit.iris.util.collection.KList;
|
||||||
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class ComponentFlagFunction implements ListFunction<KList<String>> {
|
||||||
|
@Override
|
||||||
|
public String key() {
|
||||||
|
return "component-flag";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String fancyName() {
|
||||||
|
return "Component Flag";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KList<String> apply(IrisData data) {
|
||||||
|
var engine = data.getEngine();
|
||||||
|
if (engine != null) return engine.getMantle().getComponentFlags().toStringList();
|
||||||
|
return Iris.getClasses("com.volmit.iris.engine.mantle.components", ComponentFlag.class)
|
||||||
|
.stream()
|
||||||
|
.filter(MantleComponent.class::isAssignableFrom)
|
||||||
|
.map(c -> c.getDeclaredAnnotation(ComponentFlag.class))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(ComponentFlag::value)
|
||||||
|
.map(MantleFlag::toString)
|
||||||
|
.collect(KList.collector());
|
||||||
|
}
|
||||||
|
}
|
146
core/src/main/java/com/volmit/iris/util/misc/Bindings.java
Normal file
146
core/src/main/java/com/volmit/iris/util/misc/Bindings.java
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
package com.volmit.iris.util.misc;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.nms.INMS;
|
||||||
|
import com.volmit.iris.core.safeguard.IrisSafeguard;
|
||||||
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
|
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||||
|
import com.volmit.iris.util.context.IrisContext;
|
||||||
|
import com.volmit.iris.util.json.JSONException;
|
||||||
|
import com.volmit.iris.util.reflect.ShadeFix;
|
||||||
|
import com.volmit.iris.util.scheduling.J;
|
||||||
|
import com.volmit.iris.util.sentry.Attachments;
|
||||||
|
import com.volmit.iris.util.sentry.IrisLogger;
|
||||||
|
import com.volmit.iris.util.sentry.ServerID;
|
||||||
|
import io.sentry.Sentry;
|
||||||
|
import net.kyori.adventure.audience.Audience;
|
||||||
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
|
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
||||||
|
import org.bstats.bukkit.Metrics;
|
||||||
|
import org.bstats.charts.DrilldownPie;
|
||||||
|
import org.bstats.charts.SimplePie;
|
||||||
|
import org.bstats.charts.SingleLineChart;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import oshi.SystemInfo;
|
||||||
|
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class Bindings {
|
||||||
|
|
||||||
|
public static void capture(Throwable throwable) {
|
||||||
|
Sentry.captureException(throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setupSentry() {
|
||||||
|
var settings = IrisSettings.get().getSentry();
|
||||||
|
if (settings.disableAutoReporting || Sentry.isEnabled() || Boolean.getBoolean("iris.suppressReporting")) return;
|
||||||
|
Iris.info("Enabling Sentry for anonymous error reporting. You can disable this in the settings.");
|
||||||
|
Iris.info("Your server ID is: " + ServerID.ID);
|
||||||
|
Sentry.init(options -> {
|
||||||
|
options.setDsn("https://b16ecc222e9c1e0c48faecacb906fd89@o4509451052646400.ingest.de.sentry.io/4509452722765904");
|
||||||
|
if (settings.debug) {
|
||||||
|
options.setLogger(new IrisLogger());
|
||||||
|
options.setDebug(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
options.setAttachServerName(false);
|
||||||
|
options.setEnableUncaughtExceptionHandler(false);
|
||||||
|
options.setRelease(Iris.instance.getDescription().getVersion());
|
||||||
|
options.setBeforeSend((event, hint) -> {
|
||||||
|
if (suppress(event.getThrowable())) return null;
|
||||||
|
event.setTag("iris.safeguard", IrisSafeguard.mode());
|
||||||
|
event.setTag("iris.nms", INMS.get().getClass().getCanonicalName());
|
||||||
|
var context = IrisContext.get();
|
||||||
|
if (context != null) event.getContexts().set("engine", context.asContext());
|
||||||
|
event.getContexts().set("safeguard", IrisSafeguard.asContext());
|
||||||
|
return event;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Sentry.configureScope(scope -> {
|
||||||
|
if (settings.includeServerId) scope.setUser(ServerID.asUser());
|
||||||
|
scope.addAttachment(Attachments.PLUGINS);
|
||||||
|
scope.setTag("server", Bukkit.getVersion());
|
||||||
|
scope.setTag("server.type", Bukkit.getName());
|
||||||
|
scope.setTag("server.api", Bukkit.getBukkitVersion());
|
||||||
|
});
|
||||||
|
Runtime.getRuntime().addShutdownHook(new Thread(Sentry::close));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean suppress(Throwable e) {
|
||||||
|
return (e instanceof IllegalStateException ex && "zip file closed".equals(ex.getMessage())) || e instanceof JSONException;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void setupBstats(Iris plugin) {
|
||||||
|
J.s(() -> {
|
||||||
|
var metrics = new Metrics(plugin, 24220);
|
||||||
|
metrics.addCustomChart(new SingleLineChart("custom_dimensions", () -> Bukkit.getWorlds()
|
||||||
|
.stream()
|
||||||
|
.filter(IrisToolbelt::isIrisWorld)
|
||||||
|
.mapToInt(w -> 1)
|
||||||
|
.sum()));
|
||||||
|
|
||||||
|
metrics.addCustomChart(new DrilldownPie("used_packs", () -> Bukkit.getWorlds().stream()
|
||||||
|
.map(IrisToolbelt::access)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(PlatformChunkGenerator::getEngine)
|
||||||
|
.collect(Collectors.toMap(engine -> engine.getDimension().getLoadKey(), engine -> {
|
||||||
|
var hash32 = engine.getHash32().getNow(null);
|
||||||
|
if (hash32 == null) return Map.of();
|
||||||
|
int version = engine.getDimension().getVersion();
|
||||||
|
String checksum = Long.toHexString(hash32);
|
||||||
|
|
||||||
|
return Map.of("v" + version + " (" + checksum + ")", 1);
|
||||||
|
}, (a, b) -> {
|
||||||
|
Map<String, Integer> merged = new HashMap<>(a);
|
||||||
|
b.forEach((k, v) -> merged.merge(k, v, Integer::sum));
|
||||||
|
return merged;
|
||||||
|
}))));
|
||||||
|
|
||||||
|
|
||||||
|
var info = new SystemInfo().getHardware();
|
||||||
|
var cpu = info.getProcessor().getProcessorIdentifier();
|
||||||
|
var mem = info.getMemory();
|
||||||
|
metrics.addCustomChart(new SimplePie("cpu_model", cpu::getName));
|
||||||
|
|
||||||
|
var nf = NumberFormat.getInstance(Locale.ENGLISH);
|
||||||
|
nf.setMinimumFractionDigits(0);
|
||||||
|
nf.setMaximumFractionDigits(2);
|
||||||
|
nf.setRoundingMode(RoundingMode.HALF_UP);
|
||||||
|
|
||||||
|
metrics.addCustomChart(new DrilldownPie("memory", () -> {
|
||||||
|
double total = mem.getTotal() * 1E-9;
|
||||||
|
double alloc = Math.min(total, Runtime.getRuntime().maxMemory() * 1E-9);
|
||||||
|
return Map.of(nf.format(alloc), Map.of(nf.format(total), 1));
|
||||||
|
}));
|
||||||
|
|
||||||
|
plugin.postShutdown(metrics::shutdown);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Adventure {
|
||||||
|
private final BukkitAudiences audiences;
|
||||||
|
|
||||||
|
public Adventure(Iris plugin) {
|
||||||
|
ShadeFix.fix(ComponentSerializer.class);
|
||||||
|
this.audiences = BukkitAudiences.create(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Audience player(Player player) {
|
||||||
|
return audiences.player(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Audience sender(CommandSender sender) {
|
||||||
|
return audiences.sender(sender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,9 +5,7 @@ load: STARTUP
|
|||||||
authors: [ cyberpwn, NextdoorPsycho, Vatuu ]
|
authors: [ cyberpwn, NextdoorPsycho, Vatuu ]
|
||||||
website: volmit.com
|
website: volmit.com
|
||||||
description: More than a Dimension!
|
description: More than a Dimension!
|
||||||
libraries: ${libraries}
|
|
||||||
commands:
|
commands:
|
||||||
iris:
|
iris:
|
||||||
aliases: [ ir, irs ]
|
aliases: [ ir, irs ]
|
||||||
api-version: '${apiVersion}'
|
api-version: '${apiVersion}'
|
||||||
hotload-dependencies: false
|
|
104
gradle/libs.versions.toml
Normal file
104
gradle/libs.versions.toml
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
# Version catalog is a central place for you to declare and version dependencies
|
||||||
|
# https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
|
||||||
|
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
|
||||||
|
|
||||||
|
[versions]
|
||||||
|
# Plugins
|
||||||
|
shadow = "9.0.0-rc1" # https://plugins.gradle.org/plugin/com.gradleup.shadow
|
||||||
|
slimjar = "2.0.6" # https://plugins.gradle.org/plugin/de.crazydev22.slimjar
|
||||||
|
download = "5.6.0" # https://plugins.gradle.org/plugin/de.undercouch.download
|
||||||
|
runPaper = "2.3.1" # https://plugins.gradle.org/plugin/xyz.jpenilla.run-paper
|
||||||
|
sentryPlugin = "5.8.0" # https://github.com/getsentry/sentry-android-gradle-plugin
|
||||||
|
|
||||||
|
# Core Libraries
|
||||||
|
lombok = "1.18.38"
|
||||||
|
spigot = "1.20.1-R0.1-SNAPSHOT" # https://hub.spigotmc.org/nexus/repository/snapshots/org/spigotmc/spigot-api/maven-metadata.xml
|
||||||
|
log4j = "2.19.0" # https://central.sonatype.com/artifact/org.apache.logging.log4j/log4j-api
|
||||||
|
adventure-api = "4.23.0" # https://github.com/KyoriPowered/adventure
|
||||||
|
adventure-platform = "4.4.0" # https://github.com/KyoriPowered/adventure-platform
|
||||||
|
|
||||||
|
annotations = "26.0.2" # https://central.sonatype.com/artifact/org.jetbrains/annotations
|
||||||
|
paralithic = "0.8.1" # https://github.com/PolyhedralDev/Paralithic/
|
||||||
|
paperlib = "1.0.8" # https://github.com/PaperMC/PaperLib/
|
||||||
|
bstats = "3.1.0" # https://github.com/Bastian/bstats-metrics/tree/master
|
||||||
|
sentry = "8.14.0" # https://github.com/getsentry/sentry-java
|
||||||
|
commons-io = "2.19.0" # https://central.sonatype.com/artifact/commons-io/commons-io
|
||||||
|
commons-lang = "2.6" # https://central.sonatype.com/artifact/commons-lang/commons-lang
|
||||||
|
commons-lang3 = "3.17.0" # https://central.sonatype.com/artifact/org.apache.commons/commons-lang3
|
||||||
|
oshi = "6.8.2" # https://central.sonatype.com/artifact/com.github.oshi/oshi-core
|
||||||
|
fastutil = "8.5.16" # https://central.sonatype.com/artifact/it.unimi.dsi/fastutil
|
||||||
|
lz4 = "1.8.0" # https://central.sonatype.com/artifact/org.lz4/lz4-java
|
||||||
|
lru = "1.4.2" # https://central.sonatype.com/artifact/com.googlecode.concurrentlinkedhashmap/concurrentlinkedhashmap-lru
|
||||||
|
zip = "1.17" # https://central.sonatype.com/artifact/org.zeroturnaround/zt-zip
|
||||||
|
gson = "2.13.1" # https://central.sonatype.com/artifact/com.google.code.gson/gson
|
||||||
|
asm = "9.8" # https://central.sonatype.com/artifact/org.ow2.asm/asm
|
||||||
|
bsf = "2.4.0" # https://central.sonatype.com/artifact/bsf/bsf
|
||||||
|
rhino = "1.7R2" # https://central.sonatype.com/artifact/rhino/js
|
||||||
|
caffeine = "3.2.1" # https://central.sonatype.com/artifact/com.github.ben-manes.caffeine/caffeine
|
||||||
|
byte-buddy = "1.17.6" # https://central.sonatype.com/artifact/net.bytebuddy/byte-buddy
|
||||||
|
dom4j = "2.2.0" # https://central.sonatype.com/artifact/org.dom4j/dom4j
|
||||||
|
jaxen = "2.0.0" # https://central.sonatype.com/artifact/jaxen/jaxen
|
||||||
|
|
||||||
|
# Third Party Integrations
|
||||||
|
nexo = "1.8.0" # https://repo.nexomc.com/#/releases/com/nexomc/nexo
|
||||||
|
itemsadder = "4.0.10" # https://github.com/LoneDev6/API-ItemsAdder
|
||||||
|
placeholderApi = "2.11.6" # https://repo.extendedclip.com/#/releases/me/clip/placeholderapi
|
||||||
|
score = "5.25.3.9" # https://github.com/Ssomar-Developement/SCore
|
||||||
|
mmoitems = "6.9.5-SNAPSHOT" # https://nexus.phoenixdevt.fr/repository/maven-public/net/Indyuce/MMOItems-API/maven-metadata.xml
|
||||||
|
ecoitems = "5.63.1" # https://github.com/Auxilor/EcoItems/tags
|
||||||
|
mythic = "5.9.5"
|
||||||
|
mythic-chrucible = "2.1.0"
|
||||||
|
kgenerators = "7.3" # https://repo.codemc.io/repository/maven-public/me/kryniowesegryderiusz/kgenerators-core/maven-metadata.xml
|
||||||
|
multiverseCore = "5.1.0"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
# Core Libraries
|
||||||
|
lombok = { module = "org.projectlombok:lombok", version.ref ="lombok" }
|
||||||
|
spigot = { module = "org.spigotmc:spigot-api", version.ref = "spigot" }
|
||||||
|
log4j-api = { module = "org.apache.logging.log4j:log4j-api", version.ref = "log4j" }
|
||||||
|
log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" }
|
||||||
|
annotations = { module = "org.jetbrains:annotations", version.ref = "annotations" }
|
||||||
|
|
||||||
|
# Dynamically Loaded
|
||||||
|
adventure-api = { module = "net.kyori:adventure-api", version.ref = "adventure-api" }
|
||||||
|
adventure-minimessage = { module = "net.kyori:adventure-text-minimessage", version.ref = "adventure-api" }
|
||||||
|
adventure-platform = { module = "net.kyori:adventure-platform-bukkit", version.ref = "adventure-platform" }
|
||||||
|
|
||||||
|
paralithic = { module = "com.dfsek:paralithic", version.ref = "paralithic" }
|
||||||
|
paperlib = { module = "io.papermc:paperlib", version.ref = "paperlib" }
|
||||||
|
bstats = { module = "org.bstats:bstats-bukkit", version.ref = "bstats" }
|
||||||
|
sentry = { module = "io.sentry:sentry", version.ref = "sentry" }
|
||||||
|
commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" }
|
||||||
|
commons-lang = { module = "commons-lang:commons-lang", version.ref = "commons-lang" }
|
||||||
|
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commons-lang3" }
|
||||||
|
oshi = { module = "com.github.oshi:oshi-core", version.ref = "oshi" }
|
||||||
|
lz4 = { module = "org.lz4:lz4-java", version.ref = "lz4" }
|
||||||
|
fastutil = { module = "it.unimi.dsi:fastutil", version.ref = "fastutil" }
|
||||||
|
lru = { module = "com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru", version.ref = "lru" }
|
||||||
|
zip = { module = "org.zeroturnaround:zt-zip", version.ref = "zip" }
|
||||||
|
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
|
||||||
|
asm = { module = "org.ow2.asm:asm", version.ref = "asm" }
|
||||||
|
caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" }
|
||||||
|
byteBuddy-core = { module = "net.bytebuddy:byte-buddy", version.ref = "byte-buddy" }
|
||||||
|
byteBuddy-agent = { module = "net.bytebuddy:byte-buddy-agent", version.ref = "byte-buddy" }
|
||||||
|
dom4j = { module = "org.dom4j:dom4j", version.ref = "dom4j" }
|
||||||
|
jaxen = { module = "jaxen:jaxen", version.ref = "jaxen" }
|
||||||
|
|
||||||
|
# Third Party Integrations
|
||||||
|
nexo = { module = "com.nexomc:nexo", version.ref = "nexo" }
|
||||||
|
itemsadder = { module = "dev.lone:api-itemsadder", version.ref = "itemsadder" }
|
||||||
|
placeholderApi = { module = "me.clip:placeholderapi", version.ref = "placeholderApi" }
|
||||||
|
score = { module = "com.github.Ssomar-Developement:SCore", version.ref = "score" }
|
||||||
|
mmoitems = { module = "net.Indyuce:MMOItems-API", version.ref = "mmoitems" }
|
||||||
|
ecoitems = { module = "com.willfp:EcoItems", version.ref = "ecoitems" }
|
||||||
|
mythic = { module = "io.lumine:Mythic-Dist", version.ref = "mythic" }
|
||||||
|
mythicChrucible = { module = "io.lumine:MythicCrucible-Dist", version.ref = "mythic-chrucible" }
|
||||||
|
kgenerators = { module = "me.kryniowesegryderiusz:kgenerators-core", version.ref = "kgenerators" }
|
||||||
|
multiverseCore = { module = "org.mvplugins.multiverse.core:multiverse-core", version.ref = "multiverseCore" }
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
|
||||||
|
slimjar = { id = "de.crazydev22.slimjar", version.ref = "slimjar" }
|
||||||
|
download = { id = "de.undercouch.download", version.ref = "download" }
|
||||||
|
runPaper = { id = "xyz.jpenilla.run-paper", version.ref = "runPaper" }
|
||||||
|
sentry = { id = "io.sentry.jvm.gradle", version.ref = "sentryPlugin" }
|
Loading…
x
Reference in New Issue
Block a user