mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-04 00:46:08 +00:00
Merge branch 'dev' into feat/folia
# Conflicts: # core/src/main/java/com/volmit/iris/Iris.java
This commit is contained in:
commit
0957b9baf2
@ -37,7 +37,7 @@ plugins {
|
|||||||
id("io.sentry.jvm.gradle") version "5.7.0"
|
id("io.sentry.jvm.gradle") version "5.7.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "3.6.10-1.20.1-1.21.5"
|
version = "3.6.11-1.20.1-1.21.5"
|
||||||
|
|
||||||
// ADD YOURSELF AS A NEW LINE IF YOU WANT YOUR OWN BUILD TASK GENERATED
|
// ADD YOURSELF AS A NEW LINE IF YOU WANT YOUR OWN BUILD TASK GENERATED
|
||||||
// ======================== WINDOWS =============================
|
// ======================== WINDOWS =============================
|
||||||
@ -61,6 +61,7 @@ val serverMinHeap = "2G"
|
|||||||
val serverMaxHeap = "8G"
|
val serverMaxHeap = "8G"
|
||||||
//Valid values are: none, truecolor, indexed256, indexed16, indexed8
|
//Valid values are: none, truecolor, indexed256, indexed16, indexed8
|
||||||
val color = "truecolor"
|
val color = "truecolor"
|
||||||
|
val errorReporting = false
|
||||||
|
|
||||||
val nmsBindings = mapOf(
|
val nmsBindings = mapOf(
|
||||||
"v1_21_R4" to "1.21.5-R0.1-SNAPSHOT",
|
"v1_21_R4" to "1.21.5-R0.1-SNAPSHOT",
|
||||||
@ -104,6 +105,7 @@ nmsBindings.forEach { key, value ->
|
|||||||
systemProperty("disable.watchdog", "")
|
systemProperty("disable.watchdog", "")
|
||||||
systemProperty("net.kyori.ansi.colorLevel", color)
|
systemProperty("net.kyori.ansi.colorLevel", color)
|
||||||
systemProperty("com.mojang.eula.agree", true)
|
systemProperty("com.mojang.eula.agree", true)
|
||||||
|
systemProperty("iris.errorReporting", errorReporting)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<RunServer>("runFolia-$key") {
|
tasks.register<RunServer>("runFolia-$key") {
|
||||||
|
@ -30,6 +30,7 @@ import com.volmit.iris.core.loader.IrisData;
|
|||||||
import com.volmit.iris.core.nms.INMS;
|
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.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;
|
||||||
@ -68,6 +69,7 @@ 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 com.volmit.iris.util.sentry.Attachments;
|
||||||
import com.volmit.iris.util.sentry.IrisLogger;
|
import com.volmit.iris.util.sentry.IrisLogger;
|
||||||
|
import com.volmit.iris.util.sentry.ServerID;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import io.sentry.Sentry;
|
import io.sentry.Sentry;
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
@ -956,8 +958,9 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
|
|
||||||
private static void setupSentry() {
|
private static void setupSentry() {
|
||||||
var settings = IrisSettings.get().getSentry();
|
var settings = IrisSettings.get().getSentry();
|
||||||
if (settings.disableAutoReporting || Sentry.isEnabled()) return;
|
if (settings.disableAutoReporting || Sentry.isEnabled() || !Boolean.getBoolean("iris.errorReporting")) return;
|
||||||
Iris.info("Enabling Sentry for anonymous error reporting. You can disable this in the settings.");
|
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 -> {
|
Sentry.init(options -> {
|
||||||
options.setDsn("https://b16ecc222e9c1e0c48faecacb906fd89@o4509451052646400.ingest.de.sentry.io/4509452722765904");
|
options.setDsn("https://b16ecc222e9c1e0c48faecacb906fd89@o4509451052646400.ingest.de.sentry.io/4509452722765904");
|
||||||
if (settings.debug) {
|
if (settings.debug) {
|
||||||
@ -974,10 +977,12 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
event.setTag("iris.nms", INMS.get().getClass().getCanonicalName());
|
event.setTag("iris.nms", INMS.get().getClass().getCanonicalName());
|
||||||
var context = IrisContext.get();
|
var context = IrisContext.get();
|
||||||
if (context != null) event.getContexts().set("engine", context.asContext());
|
if (context != null) event.getContexts().set("engine", context.asContext());
|
||||||
|
event.getContexts().set("safeguard", ServerBootSFG.allIncompatibilities);
|
||||||
return event;
|
return event;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Sentry.configureScope(scope -> {
|
Sentry.configureScope(scope -> {
|
||||||
|
if (settings.includeServerId) scope.setUser(ServerID.asUser());
|
||||||
scope.addAttachment(Attachments.PLUGINS);
|
scope.addAttachment(Attachments.PLUGINS);
|
||||||
scope.setTag("server", Bukkit.getVersion());
|
scope.setTag("server", Bukkit.getVersion());
|
||||||
scope.setTag("server.type", Bukkit.getName());
|
scope.setTag("server.type", Bukkit.getName());
|
||||||
|
@ -225,6 +225,7 @@ public class IrisSettings {
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class IrisSettingsSentry {
|
public static class IrisSettingsSentry {
|
||||||
|
public boolean includeServerId = true;
|
||||||
public boolean disableAutoReporting = false;
|
public boolean disableAutoReporting = false;
|
||||||
public boolean debug = false;
|
public boolean debug = false;
|
||||||
}
|
}
|
||||||
|
@ -96,8 +96,8 @@ public class IrisContext {
|
|||||||
.qput("studio", engine.isStudio())
|
.qput("studio", engine.isStudio())
|
||||||
.qput("closed", engine.isClosed())
|
.qput("closed", engine.isClosed())
|
||||||
.qput("pack", new KMap<>()
|
.qput("pack", new KMap<>()
|
||||||
.qput("key", dimension.getLoadKey())
|
.qput("key", dimension == null ? "" : dimension.getLoadKey())
|
||||||
.qput("version", dimension.getVersion())
|
.qput("version", dimension == null ? "" : dimension.getVersion())
|
||||||
.qput("hash", hash32 == null ? "" : Long.toHexString(hash32)))
|
.qput("hash", hash32 == null ? "" : Long.toHexString(hash32)))
|
||||||
.qput("mantle", new KMap<>()
|
.qput("mantle", new KMap<>()
|
||||||
.qput("idle", mantle.getAdjustedIdleDuration())
|
.qput("idle", mantle.getAdjustedIdleDuration())
|
||||||
|
@ -369,11 +369,10 @@ public class Mantle {
|
|||||||
*/
|
*/
|
||||||
public synchronized void close() {
|
public synchronized void close() {
|
||||||
Iris.debug("Closing The Mantle " + C.DARK_AQUA + dataFolder.getAbsolutePath());
|
Iris.debug("Closing The Mantle " + C.DARK_AQUA + dataFolder.getAbsolutePath());
|
||||||
if (closed.get()) {
|
if (closed.getAndSet(true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
closed.set(true);
|
|
||||||
hyperLock.disable();
|
hyperLock.disable();
|
||||||
BurstExecutor b = ioBurst.burst(toUnload.size());
|
BurstExecutor b = ioBurst.burst(toUnload.size());
|
||||||
loadedRegions.forEach((i, plate) -> b.queue(() -> {
|
loadedRegions.forEach((i, plate) -> b.queue(() -> {
|
||||||
@ -383,11 +382,11 @@ public class Mantle {
|
|||||||
oldFileForRegion(dataFolder, i).delete();
|
oldFileForRegion(dataFolder, i).delete();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.error("Failed to write Tectonic Plate " + C.DARK_GREEN + Cache.keyX(i) + " " + Cache.keyZ(i));
|
Iris.error("Failed to write Tectonic Plate " + C.DARK_GREEN + Cache.keyX(i) + " " + Cache.keyZ(i));
|
||||||
|
Iris.reportError(e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
loadedRegions.clear();
|
loadedRegions.clear();
|
||||||
IO.delete(new File(dataFolder, ".tmp"));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
b.complete();
|
b.complete();
|
||||||
@ -395,6 +394,7 @@ public class Mantle {
|
|||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IO.delete(new File(dataFolder, ".tmp"));
|
||||||
Iris.debug("The Mantle has Closed " + C.DARK_AQUA + dataFolder.getAbsolutePath());
|
Iris.debug("The Mantle has Closed " + C.DARK_AQUA + dataFolder.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
59
core/src/main/java/com/volmit/iris/util/sentry/ServerID.java
Normal file
59
core/src/main/java/com/volmit/iris/util/sentry/ServerID.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package com.volmit.iris.util.sentry;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.io.IO;
|
||||||
|
import io.sentry.protocol.User;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import oshi.SystemInfo;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
public class ServerID {
|
||||||
|
public static final String ID = calculate();
|
||||||
|
|
||||||
|
public static User asUser() {
|
||||||
|
User u = new User();
|
||||||
|
u.setId(ID);
|
||||||
|
return u;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
private static String calculate() {
|
||||||
|
Digest md = new Digest();
|
||||||
|
md.update(System.getProperty("java.vm.name"));
|
||||||
|
md.update(System.getProperty("java.vm.version"));
|
||||||
|
md.update(new SystemInfo().getHardware().getProcessor().toString());
|
||||||
|
md.update(Runtime.getRuntime().maxMemory());
|
||||||
|
for (var p : Bukkit.getPluginManager().getPlugins()) {
|
||||||
|
md.update(p.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return IO.bytesToHex(md.digest());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class Digest {
|
||||||
|
private final MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||||
|
private final byte[] buffer = new byte[8];
|
||||||
|
private final ByteBuffer wrapped = ByteBuffer.wrap(buffer);
|
||||||
|
|
||||||
|
private Digest() throws NoSuchAlgorithmException {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(String string) {
|
||||||
|
if (string == null) return;
|
||||||
|
md.update(string.getBytes(StandardCharsets.UTF_8));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(long Long) {
|
||||||
|
wrapped.putLong(0, Long);
|
||||||
|
md.update(buffer, 0, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] digest() {
|
||||||
|
return md.digest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user