mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-01 23:47:21 +00:00
Merge branch 'dev' into feat/byte_buddy
# Conflicts: # build.gradle.kts # core/src/main/java/com/volmit/iris/Iris.java
This commit is contained in:
commit
88360ef772
@ -36,7 +36,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 =============================
|
||||||
@ -60,6 +60,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)
|
||||||
jvmArgs("-javaagent:${tasks.jar.flatMap { it.archiveFile }.get().asFile.absolutePath}")
|
jvmArgs("-javaagent:${tasks.jar.flatMap { it.archiveFile }.get().asFile.absolutePath}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -18,20 +18,33 @@
|
|||||||
|
|
||||||
package com.volmit.iris.core.link;
|
package com.volmit.iris.core.link;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
|
import io.lumine.mythic.api.adapters.AbstractLocation;
|
||||||
|
import io.lumine.mythic.api.config.MythicLineConfig;
|
||||||
|
import io.lumine.mythic.api.skills.conditions.ILocationCondition;
|
||||||
import io.lumine.mythic.bukkit.MythicBukkit;
|
import io.lumine.mythic.bukkit.MythicBukkit;
|
||||||
|
import io.lumine.mythic.bukkit.adapters.BukkitWorld;
|
||||||
|
import io.lumine.mythic.bukkit.events.MythicConditionLoadEvent;
|
||||||
|
import io.lumine.mythic.core.skills.SkillCondition;
|
||||||
|
import io.lumine.mythic.core.utils.annotations.MythicCondition;
|
||||||
|
import io.lumine.mythic.core.utils.annotations.MythicField;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MythicMobsLink {
|
public class MythicMobsLink {
|
||||||
|
|
||||||
public MythicMobsLink() {
|
public MythicMobsLink() {
|
||||||
|
if (getPlugin() == null) return;
|
||||||
|
Iris.instance.registerListener(new ConditionListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
@ -49,12 +62,70 @@ public class MythicMobsLink {
|
|||||||
* @param location The location
|
* @param location The location
|
||||||
* @return The mob, or null if it can't be spawned
|
* @return The mob, or null if it can't be spawned
|
||||||
*/
|
*/
|
||||||
public @Nullable
|
public @Nullable Entity spawnMob(String mob, Location location) {
|
||||||
Entity spawnMob(String mob, Location location) {
|
|
||||||
return isEnabled() ? MythicBukkit.inst().getMobManager().spawnMob(mob, location).getEntity().getBukkitEntity() : null;
|
return isEnabled() ? MythicBukkit.inst().getMobManager().spawnMob(mob, location).getEntity().getBukkitEntity() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<String> getMythicMobTypes() {
|
public Collection<String> getMythicMobTypes() {
|
||||||
return isEnabled() ? MythicBukkit.inst().getMobManager().getMobNames() : List.of();
|
return isEnabled() ? MythicBukkit.inst().getMobManager().getMobNames() : List.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class ConditionListener implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void on(MythicConditionLoadEvent event) {
|
||||||
|
switch (event.getConditionName()) {
|
||||||
|
case "irisbiome" -> event.register(new IrisBiomeCondition(event.getConditionName(), event.getConfig()));
|
||||||
|
case "irisregion" -> event.register(new IrisRegionCondition(event.getConditionName(), event.getConfig()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@MythicCondition(author = "CrazyDev22", name = "irisbiome", description = "Tests if the target is within the given list of biomes")
|
||||||
|
public static class IrisBiomeCondition extends SkillCondition implements ILocationCondition {
|
||||||
|
@MythicField(name = "biome", aliases = {"b"}, description = "A list of biomes to check")
|
||||||
|
private Set<String> biomes = Sets.newConcurrentHashSet();
|
||||||
|
@MythicField(name = "surface", aliases = {"s"}, description = "If the biome check should only be performed on the surface")
|
||||||
|
private boolean surface;
|
||||||
|
|
||||||
|
public IrisBiomeCondition(String line, MythicLineConfig mlc) {
|
||||||
|
super(line);
|
||||||
|
String b = mlc.getString(new String[]{"biome", "b"}, "");
|
||||||
|
biomes.addAll(Arrays.asList(b.split(",")));
|
||||||
|
surface = mlc.getBoolean(new String[]{"surface", "s"}, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(AbstractLocation target) {
|
||||||
|
var access = IrisToolbelt.access(((BukkitWorld) target.getWorld()).getBukkitWorld());
|
||||||
|
if (access == null) return false;
|
||||||
|
var engine = access.getEngine();
|
||||||
|
if (engine == null) return false;
|
||||||
|
var biome = surface ?
|
||||||
|
engine.getSurfaceBiome(target.getBlockX(), target.getBlockZ()) :
|
||||||
|
engine.getBiomeOrMantle(target.getBlockX(), target.getBlockY() - engine.getMinHeight(), target.getBlockZ());
|
||||||
|
return biomes.contains(biome.getLoadKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@MythicCondition(author = "CrazyDev22", name = "irisbiome", description = "Tests if the target is within the given list of biomes")
|
||||||
|
public static class IrisRegionCondition extends SkillCondition implements ILocationCondition {
|
||||||
|
@MythicField(name = "region", aliases = {"r"}, description = "A list of regions to check")
|
||||||
|
private Set<String> regions = Sets.newConcurrentHashSet();
|
||||||
|
|
||||||
|
public IrisRegionCondition(String line, MythicLineConfig mlc) {
|
||||||
|
super(line);
|
||||||
|
String b = mlc.getString(new String[]{"region", "r"}, "");
|
||||||
|
regions.addAll(Arrays.asList(b.split(",")));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(AbstractLocation target) {
|
||||||
|
var access = IrisToolbelt.access(((BukkitWorld) target.getWorld()).getBukkitWorld());
|
||||||
|
if (access == null) return false;
|
||||||
|
var engine = access.getEngine();
|
||||||
|
if (engine == null) return false;
|
||||||
|
var region = engine.getRegion(target.getBlockX(), target.getBlockZ());
|
||||||
|
return regions.contains(region.getLoadKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,6 @@ public class IrisEngine implements Engine {
|
|||||||
private EngineExecutionEnvironment execution;
|
private EngineExecutionEnvironment execution;
|
||||||
private EngineWorldManager worldManager;
|
private EngineWorldManager worldManager;
|
||||||
private volatile int parallelism;
|
private volatile int parallelism;
|
||||||
private volatile int minHeight;
|
|
||||||
private boolean failing;
|
private boolean failing;
|
||||||
private boolean closed;
|
private boolean closed;
|
||||||
private int cacheId;
|
private int cacheId;
|
||||||
@ -129,7 +128,6 @@ public class IrisEngine implements Engine {
|
|||||||
getData().setEngine(this);
|
getData().setEngine(this);
|
||||||
getData().loadPrefetch(this);
|
getData().loadPrefetch(this);
|
||||||
Iris.info("Initializing Engine: " + target.getWorld().name() + "/" + target.getDimension().getLoadKey() + " (" + target.getDimension().getDimensionHeight() + " height) Seed: " + getSeedManager().getSeed());
|
Iris.info("Initializing Engine: " + target.getWorld().name() + "/" + target.getDimension().getLoadKey() + " (" + target.getDimension().getDimensionHeight() + " height) Seed: " + getSeedManager().getSeed());
|
||||||
minHeight = 0;
|
|
||||||
failing = false;
|
failing = false;
|
||||||
closed = false;
|
closed = false;
|
||||||
art = J.ar(this::tickRandomPlayer, 0);
|
art = J.ar(this::tickRandomPlayer, 0);
|
||||||
@ -475,7 +473,7 @@ public class IrisEngine implements Engine {
|
|||||||
getEngineData().getStatistics().generatedChunk();
|
getEngineData().getStatistics().generatedChunk();
|
||||||
try {
|
try {
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t));
|
Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y, z + zz, t));
|
||||||
|
|
||||||
if (getDimension().isDebugChunkCrossSections() && ((x >> 4) % getDimension().getDebugCrossSectionsMod() == 0 || (z >> 4) % getDimension().getDebugCrossSectionsMod() == 0)) {
|
if (getDimension().isDebugChunkCrossSections() && ((x >> 4) % getDimension().getDebugCrossSectionsMod() == 0 || (z >> 4) % getDimension().getDebugCrossSectionsMod() == 0)) {
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
|
@ -140,7 +140,9 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
|||||||
return getTarget().getWorld().minHeight();
|
return getTarget().getWorld().minHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMinHeight(int min);
|
default void setMinHeight(int min) {
|
||||||
|
getTarget().getWorld().minHeight(min);
|
||||||
|
}
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
default void generate(int x, int z, TerrainChunk tc, boolean multicore) throws WrongEngineBroException {
|
default void generate(int x, int z, TerrainChunk tc, boolean multicore) throws WrongEngineBroException {
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.link.Identifier;
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.core.nms.INMS;
|
import com.volmit.iris.core.nms.INMS;
|
||||||
@ -34,8 +35,8 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -202,6 +203,14 @@ public class IrisBlockData extends IrisRegistrant {
|
|||||||
public TileData tryGetTile(IrisData data) {
|
public TileData tryGetTile(IrisData data) {
|
||||||
//TODO Do like a registry thing with the tile data registry. Also update the parsing of data to include **block** entities.
|
//TODO Do like a registry thing with the tile data registry. Also update the parsing of data to include **block** entities.
|
||||||
var type = getBlockData(data).getMaterial();
|
var type = getBlockData(data).getMaterial();
|
||||||
|
if (type == Material.SPAWNER && this.data.containsKey("entitySpawn")) {
|
||||||
|
String id = (String) this.data.get("entitySpawn");
|
||||||
|
if (tileData == null) tileData = new KMap<>();
|
||||||
|
KMap<String, Object> spawnData = (KMap<String, Object>) tileData.computeIfAbsent("SpawnData", k -> new KMap<>());
|
||||||
|
KMap<String, Object> entity = (KMap<String, Object>) spawnData.computeIfAbsent("entity", k -> new KMap<>());
|
||||||
|
entity.putIfAbsent("id", Identifier.fromString(id).toString());
|
||||||
|
}
|
||||||
|
|
||||||
if (!INMS.get().hasTile(type) || tileData == null || tileData.isEmpty())
|
if (!INMS.get().hasTile(type) || tileData == null || tileData.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
return new TileData(type, this.tileData);
|
return new TileData(type, this.tileData);
|
||||||
|
@ -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