mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 16:36:00 +00:00
Formatting
This commit is contained in:
parent
ec1187923b
commit
ae2600227e
@ -30,6 +30,8 @@ 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.IrisSafeguard;
|
||||||
|
import com.volmit.iris.core.safeguard.UtilsSFG;
|
||||||
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;
|
||||||
@ -38,8 +40,6 @@ 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.engine.platform.DummyChunkGenerator;
|
import com.volmit.iris.engine.platform.DummyChunkGenerator;
|
||||||
import com.volmit.iris.core.safeguard.IrisSafeguard;
|
|
||||||
import com.volmit.iris.core.safeguard.UtilsSFG;
|
|
||||||
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.exceptions.IrisException;
|
import com.volmit.iris.util.exceptions.IrisException;
|
||||||
@ -52,7 +52,6 @@ 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.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.E;
|
|
||||||
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;
|
||||||
@ -64,16 +63,16 @@ 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 io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import lombok.Getter;
|
|
||||||
import net.bytebuddy.agent.ByteBuddyAgent;
|
import net.bytebuddy.agent.ByteBuddyAgent;
|
||||||
import net.bytebuddy.implementation.bytecode.Throw;
|
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.filefilter.IOFileFilter;
|
import org.apache.commons.io.filefilter.IOFileFilter;
|
||||||
import org.apache.commons.io.filefilter.TrueFileFilter;
|
import org.apache.commons.io.filefilter.TrueFileFilter;
|
||||||
import org.apache.commons.io.filefilter.WildcardFileFilter;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.*;
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.WorldCreator;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -93,18 +92,15 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.management.ManagementFactory;
|
|
||||||
import java.lang.management.OperatingSystemMXBean;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.*;
|
import java.util.Collection;
|
||||||
import java.util.function.Supplier;
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.*;
|
import static com.volmit.iris.core.safeguard.IrisSafeguard.InitializeSafeguard;
|
||||||
import static com.volmit.iris.core.safeguard.ServerBootSFG.passedserversoftware;
|
|
||||||
import static com.volmit.iris.util.misc.getHardware.getCPUModel;
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
|
||||||
|
|
||||||
@SuppressWarnings("CanBeFinal")
|
@SuppressWarnings("CanBeFinal")
|
||||||
public class Iris extends VolmitPlugin implements Listener {
|
public class Iris extends VolmitPlugin implements Listener {
|
||||||
@ -329,6 +325,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
public static void info(String format, Object... args) {
|
public static void info(String format, Object... args) {
|
||||||
msg(C.WHITE + String.format(format, args));
|
msg(C.WHITE + String.format(format, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void safeguard(String format, Object... args) {
|
public static void safeguard(String format, Object... args) {
|
||||||
msg(C.RESET + String.format(format, args));
|
msg(C.RESET + String.format(format, args));
|
||||||
}
|
}
|
||||||
@ -457,6 +454,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
private static void fixShading() {
|
private static void fixShading() {
|
||||||
ShadeFix.fix(ComponentSerializer.class);
|
ShadeFix.fix(ComponentSerializer.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enable() {
|
private void enable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
InitializeSafeguard();
|
InitializeSafeguard();
|
||||||
@ -469,7 +467,8 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
IrisSafeguard.instance.IrisSafeguardSystem();
|
IrisSafeguard.instance.IrisSafeguardSystem();
|
||||||
getSender().setTag(getTag());
|
getSender().setTag(getTag());
|
||||||
INMS.get().injectBukkit();
|
INMS.get().injectBukkit();
|
||||||
if (IrisSafeguard.instance.unstablemode && !IrisSafeguard.instance.acceptUnstable) IrisSafeguard.instance.earlySplash();
|
if (IrisSafeguard.instance.unstablemode && !IrisSafeguard.instance.acceptUnstable)
|
||||||
|
IrisSafeguard.instance.earlySplash();
|
||||||
compat = IrisCompat.configured(getDataFile("compat.json"));
|
compat = IrisCompat.configured(getDataFile("compat.json"));
|
||||||
linkMultiverseCore = new MultiverseCoreLink();
|
linkMultiverseCore = new MultiverseCoreLink();
|
||||||
linkMythicMobs = new MythicMobsLink();
|
linkMythicMobs = new MythicMobsLink();
|
||||||
|
@ -24,12 +24,10 @@ import com.volmit.iris.util.io.IO;
|
|||||||
import com.volmit.iris.util.json.JSONException;
|
import com.volmit.iris.util.json.JSONException;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SuppressWarnings("SynchronizeOnNonFinalField")
|
@SuppressWarnings("SynchronizeOnNonFinalField")
|
||||||
@Data
|
@Data
|
||||||
@ -196,6 +194,7 @@ public class IrisSettings {
|
|||||||
public boolean disableTimeAndWeather = true;
|
public boolean disableTimeAndWeather = true;
|
||||||
public boolean autoStartDefaultStudio = false;
|
public boolean autoStartDefaultStudio = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class IrisWorldDump {
|
public static class IrisWorldDump {
|
||||||
public int mcaCacheSize = 3;
|
public int mcaCacheSize = 3;
|
||||||
|
@ -27,10 +27,8 @@ import com.volmit.iris.util.decree.DecreeOrigin;
|
|||||||
import com.volmit.iris.util.decree.annotations.Decree;
|
import com.volmit.iris.util.decree.annotations.Decree;
|
||||||
import com.volmit.iris.util.decree.annotations.Param;
|
import com.volmit.iris.util.decree.annotations.Param;
|
||||||
import com.volmit.iris.util.decree.specialhandlers.NullableBiomeHandler;
|
import com.volmit.iris.util.decree.specialhandlers.NullableBiomeHandler;
|
||||||
import com.volmit.iris.util.decree.specialhandlers.NullablePlayerHandler;
|
|
||||||
import com.volmit.iris.util.decree.specialhandlers.NullableRegionHandler;
|
import com.volmit.iris.util.decree.specialhandlers.NullableRegionHandler;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -20,17 +20,13 @@ package com.volmit.iris.core.commands;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.ServerConfigurator;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.core.nms.datapack.DataVersion;
|
|
||||||
import com.volmit.iris.core.pregenerator.ChunkUpdater;
|
import com.volmit.iris.core.pregenerator.ChunkUpdater;
|
||||||
import com.volmit.iris.core.safeguard.IrisSafeguard;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisBenchmarking;
|
import com.volmit.iris.core.tools.IrisBenchmarking;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.IrisDimension;
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
import com.volmit.iris.core.safeguard.UtilsSFG;
|
|
||||||
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.engine.platform.DummyChunkGenerator;
|
import com.volmit.iris.engine.platform.DummyChunkGenerator;
|
||||||
@ -44,13 +40,10 @@ import com.volmit.iris.util.format.C;
|
|||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import io.lumine.mythic.bukkit.adapters.BukkitPlayer;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.filefilter.IOFileFilter;
|
import org.apache.commons.io.filefilter.IOFileFilter;
|
||||||
import org.apache.commons.io.filefilter.TrueFileFilter;
|
import org.apache.commons.io.filefilter.TrueFileFilter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Difficulty;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
@ -60,10 +53,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.io.Console;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -71,11 +62,14 @@ import java.util.List;
|
|||||||
import static com.volmit.iris.Iris.service;
|
import static com.volmit.iris.Iris.service;
|
||||||
import static com.volmit.iris.core.service.EditSVC.deletingWorld;
|
import static com.volmit.iris.core.service.EditSVC.deletingWorld;
|
||||||
import static com.volmit.iris.core.tools.IrisBenchmarking.inProgress;
|
import static com.volmit.iris.core.tools.IrisBenchmarking.inProgress;
|
||||||
import static com.volmit.iris.core.safeguard.ServerBootSFG.incompatibilities;
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
@Decree(name = "iris", aliases = {"ir", "irs"}, description = "Basic Command")
|
@Decree(name = "iris", aliases = {"ir", "irs"}, description = "Basic Command")
|
||||||
public class CommandIris implements DecreeExecutor {
|
public class CommandIris implements DecreeExecutor {
|
||||||
|
public static boolean worldCreation = false;
|
||||||
|
String WorldEngine;
|
||||||
|
String worldNameToCheck = "YourWorldName";
|
||||||
|
VolmitSender sender = Iris.getSender();
|
||||||
private CommandStudio studio;
|
private CommandStudio studio;
|
||||||
private CommandPregen pregen;
|
private CommandPregen pregen;
|
||||||
private CommandLazyPregen lazyPregen;
|
private CommandLazyPregen lazyPregen;
|
||||||
@ -87,10 +81,19 @@ public class CommandIris implements DecreeExecutor {
|
|||||||
private CommandFind find;
|
private CommandFind find;
|
||||||
private CommandSupport support;
|
private CommandSupport support;
|
||||||
private CommandDeveloper developer;
|
private CommandDeveloper developer;
|
||||||
public static boolean worldCreation = false;
|
|
||||||
String WorldEngine;
|
public static boolean deleteDirectory(File dir) {
|
||||||
String worldNameToCheck = "YourWorldName";
|
if (dir.isDirectory()) {
|
||||||
VolmitSender sender = Iris.getSender();
|
File[] children = dir.listFiles();
|
||||||
|
for (int i = 0; i < children.length; i++) {
|
||||||
|
boolean success = deleteDirectory(children[i]);
|
||||||
|
if (!success) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dir.delete();
|
||||||
|
}
|
||||||
|
|
||||||
@Decree(description = "Create a new world", aliases = {"+", "c"})
|
@Decree(description = "Create a new world", aliases = {"+", "c"})
|
||||||
public void create(
|
public void create(
|
||||||
@ -171,16 +174,6 @@ public class CommandIris implements DecreeExecutor {
|
|||||||
sender().sendMessage(C.GREEN + "Iris v" + Iris.instance.getDescription().getVersion() + " by Volmit Software");
|
sender().sendMessage(C.GREEN + "Iris v" + Iris.instance.getDescription().getVersion() + " by Volmit Software");
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo Move to React
|
|
||||||
@Decree(description = "Benchmark your server", origin = DecreeOrigin.CONSOLE)
|
|
||||||
public void serverbenchmark() throws InterruptedException {
|
|
||||||
if(!inProgress) {
|
|
||||||
IrisBenchmarking.runBenchmark();
|
|
||||||
} else {
|
|
||||||
Iris.info(C.RED + "Benchmark already is in progress.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
/todo
|
/todo
|
||||||
@Decree(description = "Benchmark a pack", origin = DecreeOrigin.CONSOLE)
|
@Decree(description = "Benchmark a pack", origin = DecreeOrigin.CONSOLE)
|
||||||
@ -194,6 +187,16 @@ public class CommandIris implements DecreeExecutor {
|
|||||||
IrisPackBenchmarking.runBenchmark();
|
IrisPackBenchmarking.runBenchmark();
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
//todo Move to React
|
||||||
|
@Decree(description = "Benchmark your server", origin = DecreeOrigin.CONSOLE)
|
||||||
|
public void serverbenchmark() throws InterruptedException {
|
||||||
|
if (!inProgress) {
|
||||||
|
IrisBenchmarking.runBenchmark();
|
||||||
|
} else {
|
||||||
|
Iris.info(C.RED + "Benchmark already is in progress.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Decree(description = "Print world height information", origin = DecreeOrigin.PLAYER)
|
@Decree(description = "Print world height information", origin = DecreeOrigin.PLAYER)
|
||||||
public void height() {
|
public void height() {
|
||||||
if (sender().isPlayer()) {
|
if (sender().isPlayer()) {
|
||||||
@ -297,19 +300,6 @@ public class CommandIris implements DecreeExecutor {
|
|||||||
deletingWorld = false;
|
deletingWorld = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean deleteDirectory(File dir) {
|
|
||||||
if (dir.isDirectory()) {
|
|
||||||
File[] children = dir.listFiles();
|
|
||||||
for (int i = 0; i < children.length; i++) {
|
|
||||||
boolean success = deleteDirectory(children[i]);
|
|
||||||
if (!success) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dir.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Decree(description = "Updates all chunk in the specified world")
|
@Decree(description = "Updates all chunk in the specified world")
|
||||||
public void updater(
|
public void updater(
|
||||||
@Param(description = "World to update chunks at")
|
@Param(description = "World to update chunks at")
|
||||||
@ -543,6 +533,7 @@ public class CommandIris implements DecreeExecutor {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Decree(description = "Evacuate an iris world", origin = DecreeOrigin.PLAYER, sync = true)
|
@Decree(description = "Evacuate an iris world", origin = DecreeOrigin.PLAYER, sync = true)
|
||||||
public void evacuate(
|
public void evacuate(
|
||||||
@Param(description = "Evacuate the world")
|
@Param(description = "Evacuate the world")
|
||||||
@ -561,6 +552,7 @@ public class CommandIris implements DecreeExecutor {
|
|||||||
File worldDirectory = new File(worldContainer, worldName);
|
File worldDirectory = new File(worldContainer, worldName);
|
||||||
return worldDirectory.exists() && worldDirectory.isDirectory();
|
return worldDirectory.exists() && worldDirectory.isDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkForBukkitWorlds(String world) {
|
private void checkForBukkitWorlds(String world) {
|
||||||
FileConfiguration fc = new YamlConfiguration();
|
FileConfiguration fc = new YamlConfiguration();
|
||||||
try {
|
try {
|
||||||
@ -603,6 +595,7 @@ public class CommandIris implements DecreeExecutor {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
||||||
Iris.debug("Default World Generator Called for " + worldName + " using ID: " + id);
|
Iris.debug("Default World Generator Called for " + worldName + " using ID: " + id);
|
||||||
if (worldName.equals("test")) {
|
if (worldName.equals("test")) {
|
||||||
|
@ -19,16 +19,11 @@
|
|||||||
package com.volmit.iris.core.commands;
|
package com.volmit.iris.core.commands;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
|
||||||
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
||||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||||
import com.volmit.iris.util.decree.annotations.Decree;
|
import com.volmit.iris.util.decree.annotations.Decree;
|
||||||
import com.volmit.iris.util.decree.annotations.Param;
|
import com.volmit.iris.util.decree.annotations.Param;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.math.Position2;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
@ -39,6 +34,7 @@ import java.io.IOException;
|
|||||||
@Decree(name = "lazypregen", aliases = "lazy", description = "Pregenerate your Iris worlds!")
|
@Decree(name = "lazypregen", aliases = "lazy", description = "Pregenerate your Iris worlds!")
|
||||||
public class CommandLazyPregen implements DecreeExecutor {
|
public class CommandLazyPregen implements DecreeExecutor {
|
||||||
public String worldName;
|
public String worldName;
|
||||||
|
|
||||||
@Decree(description = "Pregenerate a world")
|
@Decree(description = "Pregenerate a world")
|
||||||
public void start(
|
public void start(
|
||||||
@Param(description = "The radius of the pregen in blocks", aliases = "size")
|
@Param(description = "The radius of the pregen in blocks", aliases = "size")
|
||||||
|
@ -74,7 +74,8 @@ public class CommandObject implements DecreeExecutor {
|
|||||||
Block block = world.getBlockAt(x, y, z);
|
Block block = world.getBlockAt(x, y, z);
|
||||||
|
|
||||||
//Prevent blocks being set in or bellow bedrock
|
//Prevent blocks being set in or bellow bedrock
|
||||||
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK) return;
|
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK)
|
||||||
|
return;
|
||||||
|
|
||||||
futureBlockChanges.put(block, block.getBlockData());
|
futureBlockChanges.put(block, block.getBlockData());
|
||||||
|
|
||||||
|
@ -19,9 +19,7 @@
|
|||||||
package com.volmit.iris.core.commands;
|
package com.volmit.iris.core.commands;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
import com.volmit.iris.core.gui.PregeneratorJob;
|
||||||
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
|
||||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||||
@ -29,12 +27,10 @@ import com.volmit.iris.util.decree.annotations.Decree;
|
|||||||
import com.volmit.iris.util.decree.annotations.Param;
|
import com.volmit.iris.util.decree.annotations.Param;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.math.Position2;
|
import com.volmit.iris.util.math.Position2;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
@Decree(name = "pregen", aliases = "pregenerate", description = "Pregenerate your Iris worlds!")
|
@Decree(name = "pregen", aliases = "pregenerate", description = "Pregenerate your Iris worlds!")
|
||||||
public class CommandPregen implements DecreeExecutor {
|
public class CommandPregen implements DecreeExecutor {
|
||||||
|
@ -197,7 +197,8 @@ public class CommandStudio implements DecreeExecutor {
|
|||||||
while (futures.isNotEmpty()) {
|
while (futures.isNotEmpty()) {
|
||||||
try {
|
try {
|
||||||
futures.remove(0).get();
|
futures.remove(0).get();
|
||||||
} catch (InterruptedException | ExecutionException e) {
|
} catch (InterruptedException |
|
||||||
|
ExecutionException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,8 @@ public class CommandSupport implements DecreeExecutor {
|
|||||||
@Decree(description = "report")
|
@Decree(description = "report")
|
||||||
public void report() {
|
public void report() {
|
||||||
try {
|
try {
|
||||||
if (sender().isPlayer()) sender().sendMessage(C.GOLD + "Creating report..");
|
if (sender().isPlayer())
|
||||||
|
sender().sendMessage(C.GOLD + "Creating report..");
|
||||||
if (!sender().isPlayer()) Iris.info(C.GOLD + "Creating report..");
|
if (!sender().isPlayer()) Iris.info(C.GOLD + "Creating report..");
|
||||||
Hastebin.enviornment(sender());
|
Hastebin.enviornment(sender());
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
package com.volmit.iris.core.commands;
|
package com.volmit.iris.core.commands;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
|
||||||
import com.volmit.iris.core.pregenerator.TurboPregenerator;
|
|
||||||
import com.volmit.iris.core.pregenerator.TurboPregenerator;
|
import com.volmit.iris.core.pregenerator.TurboPregenerator;
|
||||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||||
import com.volmit.iris.util.decree.annotations.Decree;
|
import com.volmit.iris.util.decree.annotations.Decree;
|
||||||
@ -36,6 +34,7 @@ import java.io.IOException;
|
|||||||
@Decree(name = "turbopregen", aliases = "turbo", description = "Pregenerate your Iris worlds!")
|
@Decree(name = "turbopregen", aliases = "turbo", description = "Pregenerate your Iris worlds!")
|
||||||
public class CommandTurboPregen implements DecreeExecutor {
|
public class CommandTurboPregen implements DecreeExecutor {
|
||||||
public String worldName;
|
public String worldName;
|
||||||
|
|
||||||
@Decree(description = "Pregenerate a world")
|
@Decree(description = "Pregenerate a world")
|
||||||
public void start(
|
public void start(
|
||||||
@Param(description = "The radius of the pregen in blocks", aliases = "size")
|
@Param(description = "The radius of the pregen in blocks", aliases = "size")
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.core.commands;
|
package com.volmit.iris.core.commands;
|
||||||
|
|
||||||
import org.bukkit.World;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.pregenerator.ChunkUpdater;
|
import com.volmit.iris.core.pregenerator.ChunkUpdater;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
@ -29,6 +27,7 @@ import com.volmit.iris.util.decree.annotations.Decree;
|
|||||||
import com.volmit.iris.util.decree.annotations.Param;
|
import com.volmit.iris.util.decree.annotations.Param;
|
||||||
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;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
@Decree(name = "updater", origin = DecreeOrigin.BOTH, description = "Iris World Updater")
|
@Decree(name = "updater", origin = DecreeOrigin.BOTH, description = "Iris World Updater")
|
||||||
public class CommandUpdater implements DecreeExecutor {
|
public class CommandUpdater implements DecreeExecutor {
|
||||||
|
@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.edit.BlockSignal;
|
import com.volmit.iris.core.edit.BlockSignal;
|
||||||
import com.volmit.iris.core.nms.INMS;
|
import com.volmit.iris.core.nms.INMS;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.IrisRegion;
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
@ -39,7 +38,6 @@ 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.util.Objects;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@Decree(name = "what", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris What?")
|
@Decree(name = "what", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris What?")
|
||||||
|
@ -24,7 +24,6 @@ import com.volmit.iris.core.pregenerator.IrisPregenerator;
|
|||||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||||
import com.volmit.iris.core.tools.IrisPackBenchmarking;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
@ -45,8 +44,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static com.volmit.iris.core.tools.IrisPackBenchmarking.benchmarkInProgress;
|
|
||||||
|
|
||||||
public class PregeneratorJob implements PregenListener {
|
public class PregeneratorJob implements PregenListener {
|
||||||
private static final Color COLOR_EXISTS = parseColor("#4d7d5b");
|
private static final Color COLOR_EXISTS = parseColor("#4d7d5b");
|
||||||
private static final Color COLOR_BLACK = parseColor("#4d7d5b");
|
private static final Color COLOR_BLACK = parseColor("#4d7d5b");
|
||||||
|
@ -59,7 +59,8 @@ public class EcoItemsDataProvider extends ExternalDataProvider {
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getItemStack(Identifier itemId, KMap<String, Object> customNbt) throws MissingResourceException {
|
public ItemStack getItemStack(Identifier itemId, KMap<String, Object> customNbt) throws MissingResourceException {
|
||||||
EcoItem item = EcoItems.INSTANCE.getByID(itemId.key());
|
EcoItem item = EcoItems.INSTANCE.getByID(itemId.key());
|
||||||
if (item == null) throw new MissingResourceException("Failed to find Item!", itemId.namespace(), itemId.key());
|
if (item == null)
|
||||||
|
throw new MissingResourceException("Failed to find Item!", itemId.namespace(), itemId.key());
|
||||||
return itemStack.get(item).clone();
|
return itemStack.get(item).clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,8 @@ public abstract class ExternalDataProvider {
|
|||||||
|
|
||||||
public abstract ItemStack getItemStack(Identifier itemId, KMap<String, Object> customNbt) throws MissingResourceException;
|
public abstract ItemStack getItemStack(Identifier itemId, KMap<String, Object> customNbt) throws MissingResourceException;
|
||||||
|
|
||||||
public void processUpdate(Engine engine, Block block, Identifier blockId) {}
|
public void processUpdate(Engine engine, Block block, Identifier blockId) {
|
||||||
|
}
|
||||||
|
|
||||||
public abstract Identifier[] getBlockTypes();
|
public abstract Identifier[] getBlockTypes();
|
||||||
|
|
||||||
|
@ -49,9 +49,11 @@ public class MMOItemsDataProvider extends ExternalDataProvider {
|
|||||||
int id = -1;
|
int id = -1;
|
||||||
try {
|
try {
|
||||||
id = Integer.parseInt(blockId.key());
|
id = Integer.parseInt(blockId.key());
|
||||||
} catch (NumberFormatException ignored) {}
|
} catch (NumberFormatException ignored) {
|
||||||
|
}
|
||||||
CustomBlock block = api().getCustomBlocks().getBlock(id);
|
CustomBlock block = api().getCustomBlocks().getBlock(id);
|
||||||
if (block == null) throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
if (block == null)
|
||||||
|
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||||
return block.getState().getBlockData();
|
return block.getState().getBlockData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +90,8 @@ public class MMOItemsDataProvider extends ExternalDataProvider {
|
|||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
try {
|
try {
|
||||||
item = future.get();
|
item = future.get();
|
||||||
} catch (InterruptedException | ExecutionException ignored) {}
|
} catch (InterruptedException | ExecutionException ignored) {
|
||||||
|
}
|
||||||
if (item == null)
|
if (item == null)
|
||||||
throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
|
throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
|
||||||
return item;
|
return item;
|
||||||
|
@ -143,7 +143,8 @@ public class OraxenDataProvider extends ExternalDataProvider {
|
|||||||
BiomeColor type = null;
|
BiomeColor type = null;
|
||||||
try {
|
try {
|
||||||
type = BiomeColor.valueOf(state.get("matchBiome").toUpperCase());
|
type = BiomeColor.valueOf(state.get("matchBiome").toUpperCase());
|
||||||
} catch (NullPointerException | IllegalArgumentException ignored) {}
|
} catch (NullPointerException | IllegalArgumentException ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
var biomeColor = INMS.get().getBiomeColor(block.getLocation(), type);
|
var biomeColor = INMS.get().getBiomeColor(block.getLocation(), type);
|
||||||
|
@ -21,14 +21,11 @@ package com.volmit.iris.core.link;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
import com.volmit.iris.util.data.KCache;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class WorldEditLink {
|
public class WorldEditLink {
|
||||||
private static final AtomicCache<Boolean> active = new AtomicCache<>();
|
private static final AtomicCache<Boolean> active = new AtomicCache<>();
|
||||||
@ -49,7 +46,8 @@ public class WorldEditLink {
|
|||||||
Object region = null;
|
Object region = null;
|
||||||
try {
|
try {
|
||||||
region = localSession.getClass().getDeclaredMethod("getSelection", Class.forName("com.sk89q.worldedit.world.World")).invoke(localSession, world);
|
region = localSession.getClass().getDeclaredMethod("getSelection", Class.forName("com.sk89q.worldedit.world.World")).invoke(localSession, world);
|
||||||
} catch (InvocationTargetException ignored) {}
|
} catch (InvocationTargetException ignored) {
|
||||||
|
}
|
||||||
if (region == null) return null;
|
if (region == null) return null;
|
||||||
|
|
||||||
Object min = region.getClass().getDeclaredMethod("getMinimumPoint").invoke(region);
|
Object min = region.getClass().getDeclaredMethod("getMinimumPoint").invoke(region);
|
||||||
|
@ -75,7 +75,9 @@ public class INMS {
|
|||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException|NoClassDefFoundError classNotFoundException) {}
|
} catch (ClassNotFoundException |
|
||||||
|
NoClassDefFoundError classNotFoundException) {
|
||||||
|
}
|
||||||
|
|
||||||
Iris.info("Craftbukkit " + code + " <-> " + NMSBinding1X.class.getSimpleName() + " Successfully Bound");
|
Iris.info("Craftbukkit " + code + " <-> " + NMSBinding1X.class.getSimpleName() + " Successfully Bound");
|
||||||
Iris.warn("Note: Some features of Iris may not work the same since you are on an unsupported version of Minecraft.");
|
Iris.warn("Note: Some features of Iris may not work the same since you are on an unsupported version of Minecraft.");
|
||||||
|
@ -22,11 +22,18 @@ import java.util.Collection;
|
|||||||
|
|
||||||
public interface IPackRepository {
|
public interface IPackRepository {
|
||||||
void reload();
|
void reload();
|
||||||
|
|
||||||
void reloadWorldData();
|
void reloadWorldData();
|
||||||
|
|
||||||
void setSelected(Collection<String> packs);
|
void setSelected(Collection<String> packs);
|
||||||
|
|
||||||
boolean addPack(String packId);
|
boolean addPack(String packId);
|
||||||
|
|
||||||
boolean removePack(String packId);
|
boolean removePack(String packId);
|
||||||
|
|
||||||
Collection<String> getAvailableIds();
|
Collection<String> getAvailableIds();
|
||||||
|
|
||||||
Collection<String> getSelectedIds();
|
Collection<String> getSelectedIds();
|
||||||
|
|
||||||
boolean isAvailable(String packId);
|
boolean isAvailable(String packId);
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,6 @@ public enum DataVersion {
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDataFixer get() {
|
|
||||||
return cache.computeIfAbsent(this, k -> constructor.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IDataFixer getDefault() {
|
public static IDataFixer getDefault() {
|
||||||
return INMS.get().getDataVersion().get();
|
return INMS.get().getDataVersion().get();
|
||||||
}
|
}
|
||||||
@ -55,4 +51,8 @@ public enum DataVersion {
|
|||||||
public static DataVersion getLatest() {
|
public static DataVersion getLatest() {
|
||||||
return values()[values().length - 1];
|
return values()[values().length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IDataFixer get() {
|
||||||
|
return cache.computeIfAbsent(this, k -> constructor.get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,6 @@ import org.bukkit.generator.ChunkGenerator;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class NMSBinding1X implements INMSBinding {
|
public class NMSBinding1X implements INMSBinding {
|
||||||
|
@ -22,17 +22,19 @@ import com.volmit.iris.core.nms.container.IPackRepository;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
class PackRepository1X implements IPackRepository {
|
class PackRepository1X implements IPackRepository {
|
||||||
@Override
|
@Override
|
||||||
public void reload() {}
|
public void reload() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reloadWorldData() {}
|
public void reloadWorldData() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelected(Collection<String> packs) {}
|
public void setSelected(Collection<String> packs) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addPack(String packId) {
|
public boolean addPack(String packId) {
|
||||||
|
@ -33,7 +33,6 @@ import org.bukkit.Chunk;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@ -41,9 +40,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
public class ChunkUpdater {
|
public class ChunkUpdater {
|
||||||
private AtomicBoolean paused;
|
|
||||||
private AtomicBoolean cancelled;
|
|
||||||
private KMap<Chunk, Long> lastUse;
|
|
||||||
private final RollingSequence chunksPerSecond;
|
private final RollingSequence chunksPerSecond;
|
||||||
private final AtomicInteger worldheightsize;
|
private final AtomicInteger worldheightsize;
|
||||||
private final AtomicInteger worldwidthsize;
|
private final AtomicInteger worldwidthsize;
|
||||||
@ -51,6 +47,12 @@ public class ChunkUpdater {
|
|||||||
private final AtomicInteger totalMaxChunks;
|
private final AtomicInteger totalMaxChunks;
|
||||||
private final AtomicInteger totalMcaregions;
|
private final AtomicInteger totalMcaregions;
|
||||||
private final AtomicInteger position;
|
private final AtomicInteger position;
|
||||||
|
private final Object pauseLock;
|
||||||
|
private final Engine engine;
|
||||||
|
private final World world;
|
||||||
|
private AtomicBoolean paused;
|
||||||
|
private AtomicBoolean cancelled;
|
||||||
|
private KMap<Chunk, Long> lastUse;
|
||||||
private AtomicInteger chunksProcessed;
|
private AtomicInteger chunksProcessed;
|
||||||
private AtomicInteger chunksUpdated;
|
private AtomicInteger chunksUpdated;
|
||||||
private AtomicLong startTime;
|
private AtomicLong startTime;
|
||||||
@ -59,9 +61,6 @@ public class ChunkUpdater {
|
|||||||
private ScheduledExecutorService scheduler;
|
private ScheduledExecutorService scheduler;
|
||||||
private CompletableFuture future;
|
private CompletableFuture future;
|
||||||
private CountDownLatch latch;
|
private CountDownLatch latch;
|
||||||
private final Object pauseLock;
|
|
||||||
private final Engine engine;
|
|
||||||
private final World world;
|
|
||||||
|
|
||||||
public ChunkUpdater(World world) {
|
public ChunkUpdater(World world) {
|
||||||
this.engine = IrisToolbelt.access(world).getEngine();
|
this.engine = IrisToolbelt.access(world).getEngine();
|
||||||
@ -235,7 +234,8 @@ public class ChunkUpdater {
|
|||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
latch.await();
|
latch.await();
|
||||||
} catch (InterruptedException ignored) {}
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!c.isGenerated()) {
|
if (!c.isGenerated()) {
|
||||||
generated.set(false);
|
generated.set(false);
|
||||||
@ -248,7 +248,8 @@ public class ChunkUpdater {
|
|||||||
futures.removeIf(Future::isDone);
|
futures.removeIf(Future::isDone);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(50);
|
Thread.sleep(50);
|
||||||
} catch (InterruptedException ignored) {}
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return generated.get();
|
return generated.get();
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,8 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
|
|
||||||
public class IrisPregenerator {
|
public class IrisPregenerator {
|
||||||
|
private static AtomicInteger generated;
|
||||||
|
private static AtomicInteger totalChunks;
|
||||||
private final String saveFile = "regions.json";
|
private final String saveFile = "regions.json";
|
||||||
private final PregenTask task;
|
private final PregenTask task;
|
||||||
private final PregeneratorMethod generator;
|
private final PregeneratorMethod generator;
|
||||||
@ -66,18 +68,16 @@ public class IrisPregenerator {
|
|||||||
private final RollingSequence chunksPerMinute;
|
private final RollingSequence chunksPerMinute;
|
||||||
private final RollingSequence regionsPerMinute;
|
private final RollingSequence regionsPerMinute;
|
||||||
private final KList<Integer> chunksPerSecondHistory;
|
private final KList<Integer> chunksPerSecondHistory;
|
||||||
private static AtomicInteger generated;
|
|
||||||
private final AtomicInteger generatedLast;
|
private final AtomicInteger generatedLast;
|
||||||
private final AtomicInteger generatedLastMinute;
|
private final AtomicInteger generatedLastMinute;
|
||||||
private static AtomicInteger totalChunks;
|
|
||||||
private final AtomicLong startTime;
|
private final AtomicLong startTime;
|
||||||
private final ChronoLatch minuteLatch;
|
private final ChronoLatch minuteLatch;
|
||||||
private final AtomicReference<String> currentGeneratorMethod;
|
private final AtomicReference<String> currentGeneratorMethod;
|
||||||
private Set<Position2> generatedRegions;
|
|
||||||
private final KSet<Position2> retry;
|
private final KSet<Position2> retry;
|
||||||
private final KSet<Position2> net;
|
private final KSet<Position2> net;
|
||||||
private final ChronoLatch cl;
|
private final ChronoLatch cl;
|
||||||
private final ChronoLatch saveLatch = new ChronoLatch(30000);
|
private final ChronoLatch saveLatch = new ChronoLatch(30000);
|
||||||
|
private Set<Position2> generatedRegions;
|
||||||
|
|
||||||
public IrisPregenerator(PregenTask task, PregeneratorMethod generator, PregenListener listener) {
|
public IrisPregenerator(PregenTask task, PregeneratorMethod generator, PregenListener listener) {
|
||||||
generatedRegions = ConcurrentHashMap.newKeySet();
|
generatedRegions = ConcurrentHashMap.newKeySet();
|
||||||
@ -317,7 +317,8 @@ public class IrisPregenerator {
|
|||||||
}
|
}
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
try (Reader reader = new FileReader(generator.getWorld().getWorldFolder().getPath() + "/" + saveFile)) {
|
try (Reader reader = new FileReader(generator.getWorld().getWorldFolder().getPath() + "/" + saveFile)) {
|
||||||
Type setType = new TypeToken<HashSet<Position2>>(){}.getType();
|
Type setType = new TypeToken<HashSet<Position2>>() {
|
||||||
|
}.getType();
|
||||||
Set<Position2> loadedSet = gson.fromJson(reader, setType);
|
Set<Position2> loadedSet = gson.fromJson(reader, setType);
|
||||||
if (loadedSet != null) {
|
if (loadedSet != null) {
|
||||||
generatedRegions.clear();
|
generatedRegions.clear();
|
||||||
|
@ -42,32 +42,31 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class LazyPregenerator extends Thread implements Listener {
|
public class LazyPregenerator extends Thread implements Listener {
|
||||||
|
private static final Map<String, LazyPregenJob> jobs = new HashMap<>();
|
||||||
@Getter
|
@Getter
|
||||||
private static LazyPregenerator instance;
|
private static LazyPregenerator instance;
|
||||||
|
private static AtomicInteger lazyGeneratedChunks;
|
||||||
private final LazyPregenJob job;
|
private final LazyPregenJob job;
|
||||||
private final File destination;
|
private final File destination;
|
||||||
private final int maxPosition;
|
private final int maxPosition;
|
||||||
private World world;
|
|
||||||
private final long rate;
|
private final long rate;
|
||||||
private final ChronoLatch latch;
|
private final ChronoLatch latch;
|
||||||
private static AtomicInteger lazyGeneratedChunks;
|
|
||||||
private final AtomicInteger generatedLast;
|
private final AtomicInteger generatedLast;
|
||||||
private final AtomicInteger lazyTotalChunks;
|
private final AtomicInteger lazyTotalChunks;
|
||||||
private final AtomicLong startTime;
|
private final AtomicLong startTime;
|
||||||
private final RollingSequence chunksPerSecond;
|
private final RollingSequence chunksPerSecond;
|
||||||
private final RollingSequence chunksPerMinute;
|
private final RollingSequence chunksPerMinute;
|
||||||
|
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||||
private static final Map<String, LazyPregenJob> jobs = new HashMap<>();
|
private World world;
|
||||||
|
|
||||||
public LazyPregenerator(LazyPregenJob job, File destination) {
|
public LazyPregenerator(LazyPregenJob job, File destination) {
|
||||||
this.job = job;
|
this.job = job;
|
||||||
@ -106,6 +105,26 @@ public class LazyPregenerator extends Thread implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setPausedLazy(World world) {
|
||||||
|
LazyPregenJob job = jobs.get(world.getName());
|
||||||
|
if (isPausedLazy(world)) {
|
||||||
|
job.paused = false;
|
||||||
|
} else {
|
||||||
|
job.paused = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (job.paused) {
|
||||||
|
Iris.info(C.BLUE + "LazyGen: " + C.IRIS + world.getName() + C.BLUE + " Paused");
|
||||||
|
} else {
|
||||||
|
Iris.info(C.BLUE + "LazyGen: " + C.IRIS + world.getName() + C.BLUE + " Resumed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isPausedLazy(World world) {
|
||||||
|
LazyPregenJob job = jobs.get(world.getName());
|
||||||
|
return job != null && job.isPaused();
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void on(WorldUnloadEvent e) {
|
public void on(WorldUnloadEvent e) {
|
||||||
if (e.getWorld().equals(world)) {
|
if (e.getWorld().equals(world)) {
|
||||||
@ -164,8 +183,6 @@ public class LazyPregenerator extends Thread implements Listener {
|
|||||||
// todo broken
|
// todo broken
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
|
|
||||||
|
|
||||||
private void tickGenerate(Position2 chunk) {
|
private void tickGenerate(Position2 chunk) {
|
||||||
executorService.submit(() -> {
|
executorService.submit(() -> {
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
@ -184,7 +201,8 @@ public class LazyPregenerator extends Thread implements Listener {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
latch.await();
|
latch.await();
|
||||||
} catch (InterruptedException ignored) {}
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
lazyGeneratedChunks.addAndGet(1);
|
lazyGeneratedChunks.addAndGet(1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -220,26 +238,6 @@ public class LazyPregenerator extends Thread implements Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPausedLazy(World world) {
|
|
||||||
LazyPregenJob job = jobs.get(world.getName());
|
|
||||||
if (isPausedLazy(world)){
|
|
||||||
job.paused = false;
|
|
||||||
} else {
|
|
||||||
job.paused = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( job.paused) {
|
|
||||||
Iris.info(C.BLUE + "LazyGen: " + C.IRIS + world.getName() + C.BLUE + " Paused");
|
|
||||||
} else {
|
|
||||||
Iris.info(C.BLUE + "LazyGen: " + C.IRIS + world.getName() + C.BLUE + " Resumed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isPausedLazy(World world) {
|
|
||||||
LazyPregenJob job = jobs.get(world.getName());
|
|
||||||
return job != null && job.isPaused();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void shutdownInstance(World world) throws IOException {
|
public void shutdownInstance(World world) throws IOException {
|
||||||
Iris.info("LazyGen: " + C.IRIS + world.getName() + C.BLUE + " Shutting down..");
|
Iris.info("LazyGen: " + C.IRIS + world.getName() + C.BLUE + " Shutting down..");
|
||||||
LazyPregenJob job = jobs.get(world.getName());
|
LazyPregenJob job = jobs.get(world.getName());
|
||||||
@ -284,6 +282,10 @@ public class LazyPregenerator extends Thread implements Listener {
|
|||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
public static class LazyPregenJob {
|
public static class LazyPregenJob {
|
||||||
|
@Builder.Default
|
||||||
|
boolean silent = false;
|
||||||
|
@Builder.Default
|
||||||
|
boolean paused = false;
|
||||||
private String world;
|
private String world;
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private int healingPosition = 0;
|
private int healingPosition = 0;
|
||||||
@ -295,10 +297,6 @@ public class LazyPregenerator extends Thread implements Listener {
|
|||||||
private int radiusBlocks = 5000;
|
private int radiusBlocks = 5000;
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private int position = 0;
|
private int position = 0;
|
||||||
@Builder.Default
|
|
||||||
boolean silent = false;
|
|
||||||
@Builder.Default
|
|
||||||
boolean paused = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.core.pregenerator;
|
package com.volmit.iris.core.pregenerator;
|
||||||
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.util.mantle.Mantle;
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ package com.volmit.iris.core.pregenerator;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
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.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
@ -39,20 +38,21 @@ import io.papermc.lib.PaperLib;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.apache.logging.log4j.core.util.ExecutorServices;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.world.WorldUnloadEvent;
|
import org.bukkit.event.world.WorldUnloadEvent;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.checkerframework.checker.units.qual.N;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Array;
|
import java.util.HashMap;
|
||||||
import java.util.*;
|
import java.util.Map;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
@ -60,14 +60,14 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class TurboPregenerator extends Thread implements Listener {
|
public class TurboPregenerator extends Thread implements Listener {
|
||||||
|
private static final Map<String, TurboPregenJob> jobs = new HashMap<>();
|
||||||
@Getter
|
@Getter
|
||||||
private static TurboPregenerator instance;
|
private static TurboPregenerator instance;
|
||||||
|
private static AtomicInteger turboGeneratedChunks;
|
||||||
private final TurboPregenJob job;
|
private final TurboPregenJob job;
|
||||||
private final File destination;
|
private final File destination;
|
||||||
private final int maxPosition;
|
private final int maxPosition;
|
||||||
private World world;
|
|
||||||
private final ChronoLatch latch;
|
private final ChronoLatch latch;
|
||||||
private static AtomicInteger turboGeneratedChunks;
|
|
||||||
private final AtomicInteger generatedLast;
|
private final AtomicInteger generatedLast;
|
||||||
private final AtomicLong cachedLast;
|
private final AtomicLong cachedLast;
|
||||||
private final RollingSequence cachePerSecond;
|
private final RollingSequence cachePerSecond;
|
||||||
@ -75,14 +75,15 @@ public class TurboPregenerator extends Thread implements Listener {
|
|||||||
private final AtomicLong startTime;
|
private final AtomicLong startTime;
|
||||||
private final RollingSequence chunksPerSecond;
|
private final RollingSequence chunksPerSecond;
|
||||||
private final RollingSequence chunksPerMinute;
|
private final RollingSequence chunksPerMinute;
|
||||||
|
private final HyperLock hyperLock;
|
||||||
|
private final ExecutorService executorService = Executors.newFixedThreadPool(10);
|
||||||
|
private World world;
|
||||||
private KList<Position2> queue;
|
private KList<Position2> queue;
|
||||||
private ConcurrentHashMap<Integer, Position2> cache;
|
private ConcurrentHashMap<Integer, Position2> cache;
|
||||||
private AtomicInteger maxWaiting;
|
private AtomicInteger maxWaiting;
|
||||||
private ReentrantLock cachinglock;
|
private ReentrantLock cachinglock;
|
||||||
private AtomicBoolean caching;
|
private AtomicBoolean caching;
|
||||||
private final HyperLock hyperLock;
|
|
||||||
private MultiBurst burst;
|
private MultiBurst burst;
|
||||||
private static final Map<String, TurboPregenJob> jobs = new HashMap<>();
|
|
||||||
|
|
||||||
public TurboPregenerator(TurboPregenJob job, File destination) {
|
public TurboPregenerator(TurboPregenJob job, File destination) {
|
||||||
this.job = job;
|
this.job = job;
|
||||||
@ -129,6 +130,26 @@ public class TurboPregenerator extends Thread implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setPausedTurbo(World world) {
|
||||||
|
TurboPregenJob job = jobs.get(world.getName());
|
||||||
|
if (isPausedTurbo(world)) {
|
||||||
|
job.paused = false;
|
||||||
|
} else {
|
||||||
|
job.paused = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (job.paused) {
|
||||||
|
Iris.info(C.BLUE + "TurboGen: " + C.IRIS + world.getName() + C.BLUE + " Paused");
|
||||||
|
} else {
|
||||||
|
Iris.info(C.BLUE + "TurboGen: " + C.IRIS + world.getName() + C.BLUE + " Resumed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isPausedTurbo(World world) {
|
||||||
|
TurboPregenJob job = jobs.get(world.getName());
|
||||||
|
return job != null && job.isPaused();
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void on(WorldUnloadEvent e) {
|
public void on(WorldUnloadEvent e) {
|
||||||
if (e.getWorld().equals(world)) {
|
if (e.getWorld().equals(world)) {
|
||||||
@ -242,7 +263,6 @@ public class TurboPregenerator extends Thread implements Listener {
|
|||||||
// todo broken
|
// todo broken
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ExecutorService executorService = Executors.newFixedThreadPool(10);
|
|
||||||
private void tickGenerate(Position2 chunk) {
|
private void tickGenerate(Position2 chunk) {
|
||||||
executorService.submit(() -> {
|
executorService.submit(() -> {
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
@ -284,26 +304,6 @@ public class TurboPregenerator extends Thread implements Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPausedTurbo(World world) {
|
|
||||||
TurboPregenJob job = jobs.get(world.getName());
|
|
||||||
if (isPausedTurbo(world)) {
|
|
||||||
job.paused = false;
|
|
||||||
} else {
|
|
||||||
job.paused = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (job.paused) {
|
|
||||||
Iris.info(C.BLUE + "TurboGen: " + C.IRIS + world.getName() + C.BLUE + " Paused");
|
|
||||||
} else {
|
|
||||||
Iris.info(C.BLUE + "TurboGen: " + C.IRIS + world.getName() + C.BLUE + " Resumed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isPausedTurbo(World world) {
|
|
||||||
TurboPregenJob job = jobs.get(world.getName());
|
|
||||||
return job != null && job.isPaused();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void shutdownInstance(World world) throws IOException {
|
public void shutdownInstance(World world) throws IOException {
|
||||||
Iris.info("turboGen: " + C.IRIS + world.getName() + C.BLUE + " Shutting down..");
|
Iris.info("turboGen: " + C.IRIS + world.getName() + C.BLUE + " Shutting down..");
|
||||||
TurboPregenJob job = jobs.get(world.getName());
|
TurboPregenJob job = jobs.get(world.getName());
|
||||||
@ -348,13 +348,13 @@ public class TurboPregenerator extends Thread implements Listener {
|
|||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
public static class TurboPregenJob {
|
public static class TurboPregenJob {
|
||||||
|
@Builder.Default
|
||||||
|
boolean paused = false;
|
||||||
private String world;
|
private String world;
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private int radiusBlocks = 5000;
|
private int radiusBlocks = 5000;
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private int position = 0;
|
private int position = 0;
|
||||||
@Builder.Default
|
|
||||||
boolean paused = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
package com.volmit.iris.core.pregenerator.methods;
|
package com.volmit.iris.core.pregenerator.methods;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.nms.IHeadless;
|
|
||||||
import com.volmit.iris.core.nms.INMS;
|
|
||||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
@ -32,13 +30,12 @@ import com.volmit.iris.util.math.M;
|
|||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ForkJoinPool;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
public class AsyncPregenMethod implements PregeneratorMethod {
|
public class AsyncPregenMethod implements PregeneratorMethod {
|
||||||
|
@ -48,13 +48,15 @@ public class HeadlessPregenMethod implements PregeneratorMethod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {}
|
public void init() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
try {
|
try {
|
||||||
semaphore.acquire(max);
|
semaphore.acquire(max);
|
||||||
} catch (InterruptedException ignored) {}
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
headless.close();
|
headless.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -64,7 +66,8 @@ public class HeadlessPregenMethod implements PregeneratorMethod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save() {}
|
public void save() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsRegions(int x, int z, PregenListener listener) {
|
public boolean supportsRegions(int x, int z, PregenListener listener) {
|
||||||
@ -77,7 +80,8 @@ public class HeadlessPregenMethod implements PregeneratorMethod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateRegion(int x, int z, PregenListener listener) {}
|
public void generateRegion(int x, int z, PregenListener listener) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateChunk(int x, int z, PregenListener listener) {
|
public void generateChunk(int x, int z, PregenListener listener) {
|
||||||
|
@ -28,7 +28,6 @@ import com.volmit.iris.util.collection.KMap;
|
|||||||
import com.volmit.iris.util.mantle.Mantle;
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
|
||||||
|
|
||||||
public class ModesSFG {
|
public class ModesSFG {
|
||||||
public static void selectMode() {
|
public static void selectMode() {
|
||||||
|
@ -24,6 +24,7 @@ import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
import javax.tools.JavaCompiler;
|
import javax.tools.JavaCompiler;
|
||||||
import javax.tools.ToolProvider;
|
import javax.tools.ToolProvider;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -38,8 +39,6 @@ import java.util.Map;
|
|||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
import static com.volmit.iris.Iris.getJavaVersion;
|
import static com.volmit.iris.Iris.getJavaVersion;
|
||||||
import static com.volmit.iris.Iris.instance;
|
|
||||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.*;
|
|
||||||
|
|
||||||
public class ServerBootSFG {
|
public class ServerBootSFG {
|
||||||
public static final Map<String, Boolean> incompatibilities = new HashMap<>();
|
public static final Map<String, Boolean> incompatibilities = new HashMap<>();
|
||||||
@ -48,13 +47,13 @@ public class ServerBootSFG {
|
|||||||
public static boolean isJRE = false;
|
public static boolean isJRE = false;
|
||||||
public static boolean hasPrivileges = true;
|
public static boolean hasPrivileges = true;
|
||||||
public static boolean unsuportedversion = false;
|
public static boolean unsuportedversion = false;
|
||||||
protected static boolean safeguardPassed;
|
|
||||||
public static boolean passedserversoftware = true;
|
public static boolean passedserversoftware = true;
|
||||||
|
public static String allIncompatibilities;
|
||||||
|
protected static boolean safeguardPassed;
|
||||||
protected static int count;
|
protected static int count;
|
||||||
protected static byte severityLow;
|
protected static byte severityLow;
|
||||||
protected static byte severityMedium;
|
protected static byte severityMedium;
|
||||||
protected static byte severityHigh;
|
protected static byte severityHigh;
|
||||||
public static String allIncompatibilities;
|
|
||||||
|
|
||||||
public static void BootCheck() {
|
public static void BootCheck() {
|
||||||
Iris.info("Checking for possible conflicts..");
|
Iris.info("Checking for possible conflicts..");
|
||||||
@ -155,9 +154,11 @@ public class ServerBootSFG {
|
|||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
// If the compiler is null, it means this is a JRE environment, not a JDK.
|
// If the compiler is null, it means this is a JRE environment, not a JDK.
|
||||||
return compiler != null;
|
return compiler != null;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasPrivileges() {
|
public static boolean hasPrivileges() {
|
||||||
Path pv = Paths.get(Bukkit.getWorldContainer() + "iristest.json");
|
Path pv = Paths.get(Bukkit.getWorldContainer() + "iristest.json");
|
||||||
try (FileChannel fc = FileChannel.open(pv, StandardOpenOption.CREATE, StandardOpenOption.DELETE_ON_CLOSE, StandardOpenOption.READ, StandardOpenOption.WRITE)) {
|
try (FileChannel fc = FileChannel.open(pv, StandardOpenOption.CREATE, StandardOpenOption.DELETE_ON_CLOSE, StandardOpenOption.READ, StandardOpenOption.WRITE)) {
|
||||||
|
@ -32,8 +32,8 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.world.WorldUnloadEvent;
|
import org.bukkit.event.world.WorldUnloadEvent;
|
||||||
|
|
||||||
public class EditSVC implements IrisService {
|
public class EditSVC implements IrisService {
|
||||||
private KMap<World, BlockEditor> editors;
|
|
||||||
public static boolean deletingWorld = false;
|
public static boolean deletingWorld = false;
|
||||||
|
private KMap<World, BlockEditor> editors;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
@ -33,7 +33,9 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.server.PluginEnableEvent;
|
import org.bukkit.event.server.PluginEnableEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.MissingResourceException;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -41,6 +43,29 @@ public class ExternalDataSVC implements IrisService {
|
|||||||
|
|
||||||
private KList<ExternalDataProvider> providers = new KList<>(), activeProviders = new KList<>();
|
private KList<ExternalDataProvider> providers = new KList<>(), activeProviders = new KList<>();
|
||||||
|
|
||||||
|
public static Pair<Identifier, KMap<String, String>> parseState(Identifier key) {
|
||||||
|
if (!key.key().contains("[") || !key.key().contains("]")) {
|
||||||
|
return new Pair<>(key, new KMap<>());
|
||||||
|
}
|
||||||
|
String state = key.key().split("\\Q[\\E")[1].split("\\Q]\\E")[0];
|
||||||
|
KMap<String, String> stateMap = new KMap<>();
|
||||||
|
if (!state.isEmpty()) {
|
||||||
|
Arrays.stream(state.split(",")).forEach(s -> stateMap.put(s.split("=")[0], s.split("=")[1]));
|
||||||
|
}
|
||||||
|
return new Pair<>(new Identifier(key.namespace(), key.key().split("\\Q[\\E")[0]), stateMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Identifier buildState(Identifier key, KMap<String, String> state) {
|
||||||
|
if (state.isEmpty()) {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
String path = state.entrySet()
|
||||||
|
.stream()
|
||||||
|
.map(e -> e.getKey() + "=" + e.getValue())
|
||||||
|
.collect(Collectors.joining(",", key.key() + "[", "]"));
|
||||||
|
return new Identifier(key.namespace(), path);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Iris.info("Loading ExternalDataProvider...");
|
Iris.info("Loading ExternalDataProvider...");
|
||||||
@ -144,27 +169,4 @@ public class ExternalDataSVC implements IrisService {
|
|||||||
activeProviders.forEach(p -> names.add(p.getItemTypes()));
|
activeProviders.forEach(p -> names.add(p.getItemTypes()));
|
||||||
return names.toArray(new Identifier[0]);
|
return names.toArray(new Identifier[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Pair<Identifier, KMap<String, String>> parseState(Identifier key) {
|
|
||||||
if (!key.key().contains("[") || !key.key().contains("]")) {
|
|
||||||
return new Pair<>(key, new KMap<>());
|
|
||||||
}
|
|
||||||
String state = key.key().split("\\Q[\\E")[1].split("\\Q]\\E")[0];
|
|
||||||
KMap<String, String> stateMap = new KMap<>();
|
|
||||||
if (!state.isEmpty()) {
|
|
||||||
Arrays.stream(state.split(",")).forEach(s -> stateMap.put(s.split("=")[0], s.split("=")[1]));
|
|
||||||
}
|
|
||||||
return new Pair<>(new Identifier(key.namespace(), key.key().split("\\Q[\\E")[0]), stateMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Identifier buildState(Identifier key, KMap<String, String> state) {
|
|
||||||
if (state.isEmpty()) {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
String path = state.entrySet()
|
|
||||||
.stream()
|
|
||||||
.map(e -> e.getKey() + "=" + e.getValue())
|
|
||||||
.collect(Collectors.joining(",", key.key() + "[", "]"));
|
|
||||||
return new Identifier(key.namespace(), path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ import com.volmit.iris.util.misc.E;
|
|||||||
import com.volmit.iris.util.plugin.IrisService;
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.S;
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
@ -197,7 +196,8 @@ public class WandSVC implements IrisService {
|
|||||||
meta.setLore(new ArrayList<>()); //Reset the lore on this too so we can compare them
|
meta.setLore(new ArrayList<>()); //Reset the lore on this too so we can compare them
|
||||||
stack.setItemMeta(meta); //We dont need to clone the item as items from .get are cloned
|
stack.setItemMeta(meta); //We dont need to clone the item as items from .get are cloned
|
||||||
|
|
||||||
if (wand.isSimilar(stack)) return s; //If the name, material and NBT is the same
|
if (wand.isSimilar(stack))
|
||||||
|
return s; //If the name, material and NBT is the same
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,7 @@ package com.volmit.iris.core.tools;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import oshi.SystemInfo;
|
import oshi.SystemInfo;
|
||||||
import oshi.hardware.CentralProcessor;
|
|
||||||
import oshi.hardware.GlobalMemory;
|
import oshi.hardware.GlobalMemory;
|
||||||
import oshi.hardware.HWDiskStore;
|
|
||||||
import oshi.software.os.OperatingSystem;
|
import oshi.software.os.OperatingSystem;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@ -35,18 +33,17 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
import java.util.zip.Deflater;
|
import java.util.zip.Deflater;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
|
|
||||||
import static com.google.common.math.LongMath.isPrime;
|
import static com.google.common.math.LongMath.isPrime;
|
||||||
import static com.volmit.iris.util.misc.getHardware.getCPUModel;
|
import static com.volmit.iris.util.misc.getHardware.getCPUModel;
|
||||||
|
|
||||||
public class IrisBenchmarking {
|
public class IrisBenchmarking {
|
||||||
|
public static boolean inProgress = false;
|
||||||
static String ServerOS;
|
static String ServerOS;
|
||||||
static String filePath = "benchmark.dat";
|
static String filePath = "benchmark.dat";
|
||||||
static double avgWriteSpeedMBps;
|
static double avgWriteSpeedMBps;
|
||||||
@ -72,7 +69,6 @@ public class IrisBenchmarking {
|
|||||||
static double elapsedTimeNs;
|
static double elapsedTimeNs;
|
||||||
static boolean Winsat = false;
|
static boolean Winsat = false;
|
||||||
static boolean WindowsDiskSpeed = false;
|
static boolean WindowsDiskSpeed = false;
|
||||||
public static boolean inProgress = false;
|
|
||||||
static double startTime;
|
static double startTime;
|
||||||
// Good enough for now. . .
|
// Good enough for now. . .
|
||||||
|
|
||||||
|
@ -19,19 +19,16 @@
|
|||||||
package com.volmit.iris.core.tools;
|
package com.volmit.iris.core.tools;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
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;
|
||||||
import com.volmit.iris.util.nbt.io.NBTUtil;
|
import com.volmit.iris.util.nbt.io.NBTUtil;
|
||||||
import com.volmit.iris.util.nbt.io.NamedTag;
|
import com.volmit.iris.util.nbt.io.NamedTag;
|
||||||
import com.volmit.iris.util.nbt.tag.*;
|
import com.volmit.iris.util.nbt.tag.*;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.reflect.V;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -258,7 +255,6 @@ public class IrisConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int h = 0; h < objH; h++) {
|
for (int h = 0; h < objH; h++) {
|
||||||
for (int d = 0; d < objD; d++) {
|
for (int d = 0; d < objD; d++) {
|
||||||
for (int w = 0; w < objW; w++) {
|
for (int w = 0; w < objW; w++) {
|
||||||
|
@ -21,7 +21,6 @@ package com.volmit.iris.core.tools;
|
|||||||
import com.google.common.util.concurrent.AtomicDouble;
|
import com.google.common.util.concurrent.AtomicDouble;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.nms.INMS;
|
|
||||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.engine.object.IrisDimension;
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
@ -98,6 +97,7 @@ public class IrisCreator {
|
|||||||
yml.save(BUKKIT_YML);
|
yml.save(BUKKIT_YML);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean worldLoaded() {
|
public static boolean worldLoaded() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,6 @@ import com.volmit.iris.core.project.IrisProject;
|
|||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.*;
|
||||||
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.decree.DecreeOrigin;
|
|
||||||
import com.volmit.iris.util.decree.annotations.Decree;
|
|
||||||
import com.volmit.iris.util.decree.annotations.Param;
|
|
||||||
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;
|
||||||
import com.volmit.iris.util.function.NoiseProvider;
|
import com.volmit.iris.util.function.NoiseProvider;
|
||||||
|
@ -36,7 +36,6 @@ import com.volmit.iris.util.collection.KMap;
|
|||||||
import com.volmit.iris.util.exceptions.IrisException;
|
import com.volmit.iris.util.exceptions.IrisException;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.math.Position2;
|
import com.volmit.iris.util.math.Position2;
|
||||||
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@ -59,13 +58,13 @@ public class IrisPackBenchmarking {
|
|||||||
@Getter
|
@Getter
|
||||||
public static IrisPackBenchmarking instance;
|
public static IrisPackBenchmarking instance;
|
||||||
public static boolean benchmarkInProgress = false;
|
public static boolean benchmarkInProgress = false;
|
||||||
private IrisDimension IrisDimension;
|
|
||||||
private int radius;
|
|
||||||
private final boolean headless;
|
private final boolean headless;
|
||||||
private final boolean gui;
|
private final boolean gui;
|
||||||
|
PrecisionStopwatch stopwatch;
|
||||||
|
private IrisDimension IrisDimension;
|
||||||
|
private int radius;
|
||||||
private boolean finished = false;
|
private boolean finished = false;
|
||||||
private Engine engine;
|
private Engine engine;
|
||||||
PrecisionStopwatch stopwatch;
|
|
||||||
|
|
||||||
public IrisPackBenchmarking(IrisDimension dimension, int r, boolean headless, boolean gui) {
|
public IrisPackBenchmarking(IrisDimension dimension, int r, boolean headless, boolean gui) {
|
||||||
instance = this;
|
instance = this;
|
||||||
@ -151,6 +150,7 @@ public class IrisPackBenchmarking {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Engine createBenchmark() {
|
private Engine createBenchmark() {
|
||||||
try {
|
try {
|
||||||
if (headless) {
|
if (headless) {
|
||||||
|
@ -20,7 +20,8 @@ package com.volmit.iris.core.tools;
|
|||||||
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
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.engine.object.*;
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
|
import com.volmit.iris.engine.object.IrisWorld;
|
||||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
@ -21,7 +21,6 @@ package com.volmit.iris.core.tools;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
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.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
@ -134,21 +133,6 @@ public class IrisWorldDump {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class blockData {
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
private String block;
|
|
||||||
private int biome;
|
|
||||||
private int height;
|
|
||||||
|
|
||||||
public blockData(String b, int bm, int h) {
|
|
||||||
this.block = b;
|
|
||||||
this.height = h;
|
|
||||||
this.biome = bm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void dump() {
|
private void dump() {
|
||||||
Iris.info("Starting the dump process.");
|
Iris.info("Starting the dump process.");
|
||||||
int threads = Runtime.getRuntime().availableProcessors();
|
int threads = Runtime.getRuntime().availableProcessors();
|
||||||
@ -256,4 +240,18 @@ public class IrisWorldDump {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class blockData {
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String block;
|
||||||
|
private int biome;
|
||||||
|
private int height;
|
||||||
|
|
||||||
|
public blockData(String b, int bm, int h) {
|
||||||
|
this.block = b;
|
||||||
|
this.height = h;
|
||||||
|
this.biome = bm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,6 @@ public class IrisComplex implements DataProvider {
|
|||||||
return biome;
|
return biome;
|
||||||
}
|
}
|
||||||
|
|
||||||
private record DPair(double x, double z) {}
|
|
||||||
private double interpolateGenerators(Engine engine, IrisInterpolator interpolator, KSet<IrisGenerator> generators, double x, double z, long seed) {
|
private double interpolateGenerators(Engine engine, IrisInterpolator interpolator, KSet<IrisGenerator> generators, double x, double z, long seed) {
|
||||||
if (generators.isEmpty()) {
|
if (generators.isEmpty()) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -389,4 +388,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
public void close() {
|
public void close() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private record DPair(double x, double z) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ import com.volmit.iris.util.mantle.MantleFlag;
|
|||||||
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.matter.MatterStructurePOI;
|
import com.volmit.iris.util.matter.MatterStructurePOI;
|
||||||
import com.volmit.iris.util.misc.E;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
@ -55,7 +54,6 @@ import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
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;
|
||||||
@ -66,7 +64,10 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.*;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
@ -97,6 +98,7 @@ public class IrisEngine implements Engine {
|
|||||||
private final AtomicBoolean cleaning;
|
private final AtomicBoolean cleaning;
|
||||||
private final ChronoLatch cleanLatch;
|
private final ChronoLatch cleanLatch;
|
||||||
private final SeedManager seedManager;
|
private final SeedManager seedManager;
|
||||||
|
private final ReentrantLock dataLock;
|
||||||
private EngineMode mode;
|
private EngineMode mode;
|
||||||
private EngineExecutionEnvironment execution;
|
private EngineExecutionEnvironment execution;
|
||||||
private EngineWorldManager worldManager;
|
private EngineWorldManager worldManager;
|
||||||
@ -109,7 +111,6 @@ public class IrisEngine implements Engine {
|
|||||||
private double maxBiomeLayerDensity;
|
private double maxBiomeLayerDensity;
|
||||||
private double maxBiomeDecoratorDensity;
|
private double maxBiomeDecoratorDensity;
|
||||||
private IrisComplex complex;
|
private IrisComplex complex;
|
||||||
private final ReentrantLock dataLock;
|
|
||||||
|
|
||||||
public IrisEngine(EngineTarget target, boolean studio) {
|
public IrisEngine(EngineTarget target, boolean studio) {
|
||||||
this.studio = studio;
|
this.studio = studio;
|
||||||
@ -145,6 +146,26 @@ public class IrisEngine implements Engine {
|
|||||||
Iris.debug("Engine Initialized " + getCacheID());
|
Iris.debug("Engine Initialized " + getCacheID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private static Map<Class<? extends IrisEngineService>, Constructor<? extends IrisEngineService>> scanServices() {
|
||||||
|
JarScanner js = new JarScanner(Iris.instance.getJarFile(), "com.volmit.iris.engine.service");
|
||||||
|
J.attempt(js::scan);
|
||||||
|
KMap<Class<? extends IrisEngineService>, Constructor<? extends IrisEngineService>> map = new KMap<>();
|
||||||
|
js.getClasses()
|
||||||
|
.stream()
|
||||||
|
.filter(IrisEngineService.class::isAssignableFrom)
|
||||||
|
.map(c -> (Class<? extends IrisEngineService>) c)
|
||||||
|
.forEach(c -> {
|
||||||
|
try {
|
||||||
|
map.put(c, c.getConstructor(Engine.class));
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
Iris.warn("Failed to load service " + c.getName() + " due to missing constructor");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return Collections.unmodifiableMap(map);
|
||||||
|
}
|
||||||
|
|
||||||
private void verifySeed() {
|
private void verifySeed() {
|
||||||
if (getEngineData().getSeed() != null && getEngineData().getSeed() != target.getWorld().getRawWorldSeed()) {
|
if (getEngineData().getSeed() != null && getEngineData().getSeed() != target.getWorld().getRawWorldSeed()) {
|
||||||
target.getWorld().setRawWorldSeed(getEngineData().getSeed());
|
target.getWorld().setRawWorldSeed(getEngineData().getSeed());
|
||||||
@ -182,7 +203,8 @@ public class IrisEngine implements Engine {
|
|||||||
SERVICES.forEach((s, c) -> {
|
SERVICES.forEach((s, c) -> {
|
||||||
try {
|
try {
|
||||||
services.put(s, c.newInstance(this));
|
services.put(s, c.newInstance(this));
|
||||||
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
|
} catch (InstantiationException | IllegalAccessException |
|
||||||
|
InvocationTargetException e) {
|
||||||
Iris.error("Failed to create service " + s.getName());
|
Iris.error("Failed to create service " + s.getName());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -599,24 +621,4 @@ public class IrisEngine implements Engine {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private static Map<Class<? extends IrisEngineService>, Constructor<? extends IrisEngineService>> scanServices() {
|
|
||||||
JarScanner js = new JarScanner(Iris.instance.getJarFile(), "com.volmit.iris.engine.service");
|
|
||||||
J.attempt(js::scan);
|
|
||||||
KMap<Class<? extends IrisEngineService>, Constructor<? extends IrisEngineService>> map = new KMap<>();
|
|
||||||
js.getClasses()
|
|
||||||
.stream()
|
|
||||||
.filter(IrisEngineService.class::isAssignableFrom)
|
|
||||||
.map(c -> (Class<? extends IrisEngineService>) c)
|
|
||||||
.forEach(c -> {
|
|
||||||
try {
|
|
||||||
map.put(c, c.getConstructor(Engine.class));
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
Iris.warn("Failed to load service " + c.getName() + " due to missing constructor");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return Collections.unmodifiableMap(map);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ import com.volmit.iris.engine.object.*;
|
|||||||
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.format.C;
|
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.mantle.Mantle;
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
|
@ -552,7 +552,8 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
public void execute(Future<Chunk> chunkFuture) {
|
public void execute(Future<Chunk> chunkFuture) {
|
||||||
try {
|
try {
|
||||||
chunkFuture.get();
|
chunkFuture.get();
|
||||||
} catch (InterruptedException | ExecutionException ignored) {
|
} catch (InterruptedException |
|
||||||
|
ExecutionException ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -958,5 +958,6 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
|||||||
J.a(() -> getMantle().cleanupChunk(x, z));
|
J.a(() -> getMantle().cleanupChunk(x, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<T extends IrisEngineService> T getService(Class<T> clazz);
|
<T extends IrisEngineService> T getService(Class<T> clazz);
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,13 @@ public class IrisLootEvent extends Event {
|
|||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
this.tables = tables;
|
this.tables = tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,8 @@ public interface Locator<T> {
|
|||||||
(at.getZ() << 4) + 8, false),
|
(at.getZ() << 4) + 8, false),
|
||||||
(at.getZ() << 4) + 8));
|
(at.getZ() << 4) + 8));
|
||||||
}
|
}
|
||||||
} catch (WrongEngineBroException | InterruptedException | ExecutionException e) {
|
} catch (WrongEngineBroException | InterruptedException |
|
||||||
|
ExecutionException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
|
@ -52,7 +52,8 @@ public class WorldObjectPlacer implements IObjectPlacer {
|
|||||||
|
|
||||||
public WorldObjectPlacer(World world) {
|
public WorldObjectPlacer(World world) {
|
||||||
var a = IrisToolbelt.access(world);
|
var a = IrisToolbelt.access(world);
|
||||||
if (a == null || a.getEngine() == null) throw new IllegalStateException(world.getName() + " is not an Iris World!");
|
if (a == null || a.getEngine() == null)
|
||||||
|
throw new IllegalStateException(world.getName() + " is not an Iris World!");
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.engine = a.getEngine();
|
this.engine = a.getEngine();
|
||||||
this.mantle = engine.getMantle();
|
this.mantle = engine.getMantle();
|
||||||
@ -72,7 +73,8 @@ public class WorldObjectPlacer implements IObjectPlacer {
|
|||||||
public void set(int x, int y, int z, BlockData d) {
|
public void set(int x, int y, int z, BlockData d) {
|
||||||
Block block = world.getBlockAt(x, y + world.getMinHeight(), z);
|
Block block = world.getBlockAt(x, y + world.getMinHeight(), z);
|
||||||
|
|
||||||
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK) return;
|
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK)
|
||||||
|
return;
|
||||||
InventorySlotType slot = null;
|
InventorySlotType slot = null;
|
||||||
if (B.isStorageChest(d)) {
|
if (B.isStorageChest(d)) {
|
||||||
slot = InventorySlotType.STORAGE;
|
slot = InventorySlotType.STORAGE;
|
||||||
|
@ -195,7 +195,10 @@ public class PlannedPiece {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public record ParentConnection(PlannedPiece parent, IrisJigsawPieceConnector parentConnector, PlannedPiece self, IrisJigsawPieceConnector connector) {
|
public record ParentConnection(PlannedPiece parent,
|
||||||
|
IrisJigsawPieceConnector parentConnector,
|
||||||
|
PlannedPiece self,
|
||||||
|
IrisJigsawPieceConnector connector) {
|
||||||
public IrisPosition getTargetPosition() {
|
public IrisPosition getTargetPosition() {
|
||||||
var pos = parent.realPositions.get(parentConnector);
|
var pos = parent.realPositions.get(parentConnector);
|
||||||
if (pos == null) return null;
|
if (pos == null) return null;
|
||||||
|
@ -25,7 +25,6 @@ import com.volmit.iris.engine.framework.Engine;
|
|||||||
import com.volmit.iris.engine.framework.placer.WorldObjectPlacer;
|
import com.volmit.iris.engine.framework.placer.WorldObjectPlacer;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.*;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.IrisCustomData;
|
|
||||||
import com.volmit.iris.util.mantle.Mantle;
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
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;
|
||||||
|
@ -22,6 +22,7 @@ import com.volmit.iris.util.plugin.VolmitSender;
|
|||||||
|
|
||||||
public class VMJavaFX {
|
public class VMJavaFX {
|
||||||
private VolmitSender sender;
|
private VolmitSender sender;
|
||||||
|
|
||||||
public VMJavaFX(VolmitSender user) {
|
public VMJavaFX(VolmitSender user) {
|
||||||
this.sender = user;
|
this.sender = user;
|
||||||
|
|
||||||
@ -46,5 +47,4 @@ public class VMJavaFX {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ import com.volmit.iris.core.loader.IrisData;
|
|||||||
import com.volmit.iris.engine.IrisComplex;
|
import com.volmit.iris.engine.IrisComplex;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineTarget;
|
import com.volmit.iris.engine.framework.EngineTarget;
|
||||||
import com.volmit.iris.engine.framework.SeedManager;
|
|
||||||
import com.volmit.iris.engine.mantle.components.MantleJigsawComponent;
|
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.engine.object.IObjectPlacer;
|
import com.volmit.iris.engine.object.IObjectPlacer;
|
||||||
@ -179,6 +178,7 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
default void trim(int limit) {
|
default void trim(int limit) {
|
||||||
getMantle().trim(TimeUnit.SECONDS.toMillis(IrisSettings.get().getPerformance().getMantleKeepAlive()), limit);
|
getMantle().trim(TimeUnit.SECONDS.toMillis(IrisSettings.get().getPerformance().getMantleKeepAlive()), limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
default int unloadTectonicPlate(int tectonicLimit) {
|
default int unloadTectonicPlate(int tectonicLimit) {
|
||||||
return getMantle().unloadTectonicPlate(tectonicLimit);
|
return getMantle().unloadTectonicPlate(tectonicLimit);
|
||||||
}
|
}
|
||||||
@ -261,6 +261,7 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
default int getLoadedRegionCount() {
|
default int getLoadedRegionCount() {
|
||||||
return getMantle().getLoadedRegionCount();
|
return getMantle().getLoadedRegionCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
default long getLastUseMapMemoryUsage() {
|
default long getLastUseMapMemoryUsage() {
|
||||||
return getMantle().LastUseMapMemoryUsage();
|
return getMantle().LastUseMapMemoryUsage();
|
||||||
}
|
}
|
||||||
@ -299,9 +300,11 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
default long getToUnload() {
|
default long getToUnload() {
|
||||||
return getMantle().getToUnload().size();
|
return getMantle().getToUnload().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
default long getNotQueuedLoadedRegions() {
|
default long getNotQueuedLoadedRegions() {
|
||||||
return getMantle().getLoadedRegions().size() - getMantle().getToUnload().size();
|
return getMantle().getLoadedRegions().size() - getMantle().getToUnload().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getTectonicDuration() {
|
default double getTectonicDuration() {
|
||||||
return getMantle().getAdjustedIdleDuration().get();
|
return getMantle().getAdjustedIdleDuration().get();
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,8 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
|||||||
|
|
||||||
IrisJigsawStructurePlacement i = pick(biome.getJigsawStructures(), seed, x, z);
|
IrisJigsawStructurePlacement i = pick(biome.getJigsawStructures(), seed, x, z);
|
||||||
if (i == null) i = pick(region.getJigsawStructures(), seed, x, z);
|
if (i == null) i = pick(region.getJigsawStructures(), seed, x, z);
|
||||||
if (i == null) i = pick(getDimension().getJigsawStructures(), seed, x, z);
|
if (i == null)
|
||||||
|
i = pick(getDimension().getJigsawStructures(), seed, x, z);
|
||||||
return i != null ? getData().getJigsawStructureLoader().load(i.getStructure()) : null;
|
return i != null ? getData().getJigsawStructureLoader().load(i.getStructure()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,10 @@ import com.volmit.iris.engine.data.cache.Cache;
|
|||||||
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;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.context.ChunkContext;
|
import com.volmit.iris.util.context.ChunkContext;
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
|
@ -170,6 +170,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
@Desc("Collection of ores to be generated")
|
@Desc("Collection of ores to be generated")
|
||||||
@ArrayType(type = IrisOreGenerator.class, min = 1)
|
@ArrayType(type = IrisOreGenerator.class, min = 1)
|
||||||
private KList<IrisOreGenerator> ores = new KList<>();
|
private KList<IrisOreGenerator> ores = new KList<>();
|
||||||
|
|
||||||
public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data) {
|
public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||||
if (ores.isEmpty()) {
|
if (ores.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -70,9 +70,11 @@ public enum IrisDirection {
|
|||||||
return switch (f) {
|
return switch (f) {
|
||||||
case DOWN -> DOWN_NEGATIVE_Y;
|
case DOWN -> DOWN_NEGATIVE_Y;
|
||||||
case EAST, EAST_NORTH_EAST, EAST_SOUTH_EAST -> EAST_POSITIVE_X;
|
case EAST, EAST_NORTH_EAST, EAST_SOUTH_EAST -> EAST_POSITIVE_X;
|
||||||
case NORTH, NORTH_NORTH_WEST, NORTH_EAST, NORTH_NORTH_EAST, NORTH_WEST -> NORTH_NEGATIVE_Z;
|
case NORTH, NORTH_NORTH_WEST, NORTH_EAST, NORTH_NORTH_EAST,
|
||||||
|
NORTH_WEST -> NORTH_NEGATIVE_Z;
|
||||||
case SELF, UP -> UP_POSITIVE_Y;
|
case SELF, UP -> UP_POSITIVE_Y;
|
||||||
case SOUTH, SOUTH_EAST, SOUTH_SOUTH_EAST, SOUTH_SOUTH_WEST, SOUTH_WEST -> SOUTH_POSITIVE_Z;
|
case SOUTH, SOUTH_EAST, SOUTH_SOUTH_EAST, SOUTH_SOUTH_WEST,
|
||||||
|
SOUTH_WEST -> SOUTH_POSITIVE_Z;
|
||||||
case WEST, WEST_NORTH_WEST, WEST_SOUTH_WEST -> WEST_NEGATIVE_X;
|
case WEST, WEST_NORTH_WEST, WEST_SOUTH_WEST -> WEST_NEGATIVE_X;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import com.volmit.iris.engine.framework.Engine;
|
|||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@ package com.volmit.iris.engine.object;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class IrisEngineStatistics {
|
public class IrisEngineStatistics {
|
||||||
private int unsafeShutdown = 0;
|
private int unsafeShutdown = 0;
|
||||||
|
@ -468,7 +468,6 @@ public class IrisEntity extends IrisRegistrant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return INMS.get().spawnEntity(at, getType(), getReason());
|
return INMS.get().spawnEntity(at, getType(), getReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ import com.volmit.iris.util.math.RNG;
|
|||||||
import com.volmit.iris.util.math.Vector3d;
|
import com.volmit.iris.util.math.Vector3d;
|
||||||
import com.volmit.iris.util.matter.MatterMarker;
|
import com.volmit.iris.util.matter.MatterMarker;
|
||||||
import com.volmit.iris.util.matter.slices.MarkerMatter;
|
import com.volmit.iris.util.matter.slices.MarkerMatter;
|
||||||
import io.lumine.mythic.bukkit.adapters.BukkitEntity;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@ -38,9 +37,6 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.util.BoundingBox;
|
|
||||||
|
|
||||||
@Snippet("entity-spawn")
|
@Snippet("entity-spawn")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
@ -18,11 +18,7 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.annotations.Desc;
|
import com.volmit.iris.engine.object.annotations.*;
|
||||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
|
||||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
|
||||||
import com.volmit.iris.engine.object.annotations.Required;
|
|
||||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -19,13 +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.engine.object.annotations.ArrayType;
|
import com.volmit.iris.engine.object.annotations.*;
|
||||||
import com.volmit.iris.engine.object.annotations.Desc;
|
|
||||||
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
|
||||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
|
||||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
|
||||||
import com.volmit.iris.engine.object.annotations.Required;
|
|
||||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
|
||||||
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.documentation.ChunkCoordinates;
|
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||||
|
@ -105,7 +105,8 @@ public class IrisObjectRotation {
|
|||||||
var translate = piece.getPlacementOptions().getTranslate();
|
var translate = piece.getPlacementOptions().getTranslate();
|
||||||
var pos = rotate(new IrisPosition(translate.getX(), translate.getY(), translate.getZ()));
|
var pos = rotate(new IrisPosition(translate.getX(), translate.getY(), translate.getZ()));
|
||||||
translate.setX(pos.getX()).setY(pos.getY()).setZ(pos.getZ());
|
translate.setX(pos.getX()).setY(pos.getY()).setZ(pos.getZ());
|
||||||
} catch (NullPointerException ignored) {}
|
} catch (NullPointerException ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
return piece;
|
return piece;
|
||||||
}
|
}
|
||||||
|
@ -112,8 +112,17 @@ public class TileBanner implements TileData<Banner> {
|
|||||||
|
|
||||||
public boolean isBanner(Material material) {
|
public boolean isBanner(Material material) {
|
||||||
return switch (material) {
|
return switch (material) {
|
||||||
case RED_BANNER, RED_WALL_BANNER, ORANGE_BANNER, ORANGE_WALL_BANNER, YELLOW_BANNER, YELLOW_WALL_BANNER, LIME_BANNER, LIME_WALL_BANNER, GREEN_BANNER, GREEN_WALL_BANNER, CYAN_BANNER, CYAN_WALL_BANNER, LIGHT_BLUE_BANNER, LIGHT_BLUE_WALL_BANNER, BLUE_BANNER, BLUE_WALL_BANNER, PURPLE_BANNER, PURPLE_WALL_BANNER, MAGENTA_BANNER, MAGENTA_WALL_BANNER, PINK_BANNER, PINK_WALL_BANNER, WHITE_BANNER, WHITE_WALL_BANNER, LIGHT_GRAY_BANNER, LIGHT_GRAY_WALL_BANNER, GRAY_BANNER, GRAY_WALL_BANNER, BLACK_BANNER, BLACK_WALL_BANNER, BROWN_BANNER, BROWN_WALL_BANNER ->
|
case RED_BANNER, RED_WALL_BANNER, ORANGE_BANNER, ORANGE_WALL_BANNER,
|
||||||
true;
|
YELLOW_BANNER, YELLOW_WALL_BANNER, LIME_BANNER,
|
||||||
|
LIME_WALL_BANNER, GREEN_BANNER, GREEN_WALL_BANNER, CYAN_BANNER,
|
||||||
|
CYAN_WALL_BANNER, LIGHT_BLUE_BANNER, LIGHT_BLUE_WALL_BANNER,
|
||||||
|
BLUE_BANNER, BLUE_WALL_BANNER, PURPLE_BANNER,
|
||||||
|
PURPLE_WALL_BANNER, MAGENTA_BANNER, MAGENTA_WALL_BANNER,
|
||||||
|
PINK_BANNER, PINK_WALL_BANNER, WHITE_BANNER, WHITE_WALL_BANNER,
|
||||||
|
LIGHT_GRAY_BANNER, LIGHT_GRAY_WALL_BANNER, GRAY_BANNER,
|
||||||
|
GRAY_WALL_BANNER,
|
||||||
|
BLACK_BANNER, BLACK_WALL_BANNER, BROWN_BANNER,
|
||||||
|
BROWN_WALL_BANNER -> true;
|
||||||
default -> false;
|
default -> false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,8 @@ public interface TileData<T extends TileState> extends Cloneable {
|
|||||||
@SuppressWarnings("unchecked") TileData<? extends TileState> d = registry.get(id).getClass().getConstructor().newInstance();
|
@SuppressWarnings("unchecked") TileData<? extends TileState> d = registry.get(id).getClass().getConstructor().newInstance();
|
||||||
d.fromBinary(s);
|
d.fromBinary(s);
|
||||||
return d;
|
return d;
|
||||||
} catch (InvocationTargetException | InstantiationException | IllegalAccessException |
|
} catch (InvocationTargetException | InstantiationException |
|
||||||
|
IllegalAccessException |
|
||||||
NoSuchMethodException e) {
|
NoSuchMethodException e) {
|
||||||
throw new IOException("Failed to create TileData instance due to missing type registrar!");
|
throw new IOException("Failed to create TileData instance due to missing type registrar!");
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ package com.volmit.iris.engine.platform;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
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.safeguard.IrisSafeguard;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.engine.IrisEngine;
|
import com.volmit.iris.engine.IrisEngine;
|
||||||
import com.volmit.iris.engine.data.chunk.TerrainChunk;
|
import com.volmit.iris.engine.data.chunk.TerrainChunk;
|
||||||
@ -33,7 +32,6 @@ import com.volmit.iris.engine.object.StudioMode;
|
|||||||
import com.volmit.iris.engine.platform.studio.StudioGenerator;
|
import com.volmit.iris.engine.platform.studio.StudioGenerator;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.IrisBiomeStorage;
|
import com.volmit.iris.util.data.IrisBiomeStorage;
|
||||||
import com.volmit.iris.util.format.C;
|
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import com.volmit.iris.util.hunk.view.BiomeGridHunkHolder;
|
import com.volmit.iris.util.hunk.view.BiomeGridHunkHolder;
|
||||||
import com.volmit.iris.util.hunk.view.ChunkDataHunkHolder;
|
import com.volmit.iris.util.hunk.view.ChunkDataHunkHolder;
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package com.volmit.iris.engine.platform;
|
package com.volmit.iris.engine.platform;
|
||||||
|
|
||||||
import com.volmit.iris.core.nms.INMS;
|
import com.volmit.iris.core.nms.INMS;
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.generator.BiomeProvider;
|
import org.bukkit.generator.BiomeProvider;
|
||||||
import org.bukkit.generator.WorldInfo;
|
import org.bukkit.generator.WorldInfo;
|
||||||
|
@ -31,6 +31,36 @@ public class EngineStatusSVC extends IrisEngineService {
|
|||||||
super(engine);
|
super(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getEngineCount() {
|
||||||
|
return Math.max(INSTANCES.size(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Status getStatus() {
|
||||||
|
synchronized (INSTANCES) {
|
||||||
|
long loadedChunks = 0;
|
||||||
|
long tectonicPlates = 0;
|
||||||
|
long activeTectonicPlates = 0;
|
||||||
|
long queuedTectonicPlates = 0;
|
||||||
|
long minTectonicUnloadDuration = Long.MAX_VALUE;
|
||||||
|
long maxTectonicUnloadDuration = Long.MIN_VALUE;
|
||||||
|
|
||||||
|
for (var service : INSTANCES) {
|
||||||
|
var world = service.engine.getWorld();
|
||||||
|
if (world.hasRealWorld())
|
||||||
|
loadedChunks += world.realWorld().getLoadedChunks().length;
|
||||||
|
if (world.hasHeadless())
|
||||||
|
loadedChunks += world.headless().getLoadedChunks();
|
||||||
|
|
||||||
|
tectonicPlates += service.engine.getMantle().getLoadedRegionCount();
|
||||||
|
activeTectonicPlates += service.engine.getMantle().getNotQueuedLoadedRegions();
|
||||||
|
queuedTectonicPlates += service.engine.getMantle().getToUnload();
|
||||||
|
minTectonicUnloadDuration = Math.min(minTectonicUnloadDuration, (long) service.engine.getMantle().getTectonicDuration());
|
||||||
|
maxTectonicUnloadDuration = Math.max(maxTectonicUnloadDuration, (long) service.engine.getMantle().getTectonicDuration());
|
||||||
|
}
|
||||||
|
return new Status(INSTANCES.size(), loadedChunks, MantleCleanerSVC.getTectonicLimit(), tectonicPlates, activeTectonicPlates, queuedTectonicPlates, minTectonicUnloadDuration, maxTectonicUnloadDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable(boolean hotload) {
|
public void onEnable(boolean hotload) {
|
||||||
if (hotload) return;
|
if (hotload) return;
|
||||||
@ -48,33 +78,10 @@ public class EngineStatusSVC extends IrisEngineService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getEngineCount() {
|
public record Status(int engineCount, long loadedChunks, int tectonicLimit,
|
||||||
return Math.max(INSTANCES.size(), 1);
|
long tectonicPlates, long activeTectonicPlates,
|
||||||
}
|
long queuedTectonicPlates,
|
||||||
|
long minTectonicUnloadDuration,
|
||||||
public static Status getStatus() {
|
long maxTectonicUnloadDuration) {
|
||||||
synchronized (INSTANCES) {
|
|
||||||
long loadedChunks = 0;
|
|
||||||
long tectonicPlates = 0;
|
|
||||||
long activeTectonicPlates = 0;
|
|
||||||
long queuedTectonicPlates = 0;
|
|
||||||
long minTectonicUnloadDuration = Long.MAX_VALUE;
|
|
||||||
long maxTectonicUnloadDuration = Long.MIN_VALUE;
|
|
||||||
|
|
||||||
for (var service : INSTANCES) {
|
|
||||||
var world = service.engine.getWorld();
|
|
||||||
if (world.hasRealWorld()) loadedChunks += world.realWorld().getLoadedChunks().length;
|
|
||||||
if (world.hasHeadless()) loadedChunks += world.headless().getLoadedChunks();
|
|
||||||
|
|
||||||
tectonicPlates += service.engine.getMantle().getLoadedRegionCount();
|
|
||||||
activeTectonicPlates += service.engine.getMantle().getNotQueuedLoadedRegions();
|
|
||||||
queuedTectonicPlates += service.engine.getMantle().getToUnload();
|
|
||||||
minTectonicUnloadDuration = Math.min(minTectonicUnloadDuration, (long) service.engine.getMantle().getTectonicDuration());
|
|
||||||
maxTectonicUnloadDuration = Math.max(maxTectonicUnloadDuration, (long) service.engine.getMantle().getTectonicDuration());
|
|
||||||
}
|
|
||||||
return new Status(INSTANCES.size(), loadedChunks, MantleCleanerSVC.getTectonicLimit(), tectonicPlates, activeTectonicPlates, queuedTectonicPlates, minTectonicUnloadDuration, maxTectonicUnloadDuration);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public record Status(int engineCount, long loadedChunks, int tectonicLimit, long tectonicPlates, long activeTectonicPlates, long queuedTectonicPlates, long minTectonicUnloadDuration, long maxTectonicUnloadDuration) {}
|
|
||||||
}
|
|
||||||
|
@ -35,29 +35,6 @@ import static com.volmit.iris.engine.service.EngineStatusSVC.getEngineCount;
|
|||||||
|
|
||||||
public class MantleCleanerSVC extends IrisEngineService {
|
public class MantleCleanerSVC extends IrisEngineService {
|
||||||
private static final AtomicInteger tectonicLimit = new AtomicInteger(30);
|
private static final AtomicInteger tectonicLimit = new AtomicInteger(30);
|
||||||
private Ticker trimmer;
|
|
||||||
private Ticker unloader;
|
|
||||||
|
|
||||||
public MantleCleanerSVC(Engine engine) {
|
|
||||||
super(engine);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable(boolean hotload) {
|
|
||||||
if (engine.isStudio() && !IrisSettings.get().getPerformance().trimMantleInStudio)
|
|
||||||
return;
|
|
||||||
if (trimmer == null || !trimmer.isAlive())
|
|
||||||
trimmer = createTrimmer(engine);
|
|
||||||
if (unloader == null || !unloader.isAlive())
|
|
||||||
unloader = createUnloader(engine);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisable(boolean hotload) {
|
|
||||||
if (hotload) return;
|
|
||||||
if (trimmer != null) trimmer.await();
|
|
||||||
if (unloader != null) unloader.await();
|
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
tectonicLimit.set(2);
|
tectonicLimit.set(2);
|
||||||
@ -68,6 +45,13 @@ public class MantleCleanerSVC extends IrisEngineService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Ticker trimmer;
|
||||||
|
private Ticker unloader;
|
||||||
|
|
||||||
|
public MantleCleanerSVC(Engine engine) {
|
||||||
|
super(engine);
|
||||||
|
}
|
||||||
|
|
||||||
public static int getTectonicLimit() {
|
public static int getTectonicLimit() {
|
||||||
return tectonicLimit.get();
|
return tectonicLimit.get();
|
||||||
}
|
}
|
||||||
@ -108,6 +92,23 @@ public class MantleCleanerSVC extends IrisEngineService {
|
|||||||
}, "Iris Mantle Unloader - " + engine.getWorld().name());
|
}, "Iris Mantle Unloader - " + engine.getWorld().name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable(boolean hotload) {
|
||||||
|
if (engine.isStudio() && !IrisSettings.get().getPerformance().trimMantleInStudio)
|
||||||
|
return;
|
||||||
|
if (trimmer == null || !trimmer.isAlive())
|
||||||
|
trimmer = createTrimmer(engine);
|
||||||
|
if (unloader == null || !unloader.isAlive())
|
||||||
|
unloader = createUnloader(engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable(boolean hotload) {
|
||||||
|
if (hotload) return;
|
||||||
|
if (trimmer != null) trimmer.await();
|
||||||
|
if (unloader != null) unloader.await();
|
||||||
|
}
|
||||||
|
|
||||||
private static class Ticker extends Looper {
|
private static class Ticker extends Looper {
|
||||||
private final LongSupplier supplier;
|
private final LongSupplier supplier;
|
||||||
private final CountDownLatch exit = new CountDownLatch(1);
|
private final CountDownLatch exit = new CountDownLatch(1);
|
||||||
@ -124,7 +125,8 @@ public class MantleCleanerSVC extends IrisEngineService {
|
|||||||
long wait = -1;
|
long wait = -1;
|
||||||
try {
|
try {
|
||||||
wait = supplier.getAsLong();
|
wait = supplier.getAsLong();
|
||||||
} catch (Throwable ignored) {}
|
} catch (Throwable ignored) {
|
||||||
|
}
|
||||||
if (wait < 0) exit.countDown();
|
if (wait < 0) exit.countDown();
|
||||||
return wait;
|
return wait;
|
||||||
}
|
}
|
||||||
@ -132,7 +134,8 @@ public class MantleCleanerSVC extends IrisEngineService {
|
|||||||
public void await() {
|
public void await() {
|
||||||
try {
|
try {
|
||||||
exit.await();
|
exit.await();
|
||||||
} catch (InterruptedException ignored) {}
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.link.Identifier;
|
import com.volmit.iris.core.link.Identifier;
|
||||||
import com.volmit.iris.core.service.ExternalDataSVC;
|
import com.volmit.iris.core.service.ExternalDataSVC;
|
||||||
import com.volmit.iris.engine.object.IrisCompat;
|
|
||||||
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.misc.E;
|
import com.volmit.iris.util.misc.E;
|
||||||
@ -50,10 +49,10 @@ public class B {
|
|||||||
private static final Material SHORT_GRASS = E.getOrDefault(Material.class, "GRASS", "SHORT_GRASS");
|
private static final Material SHORT_GRASS = E.getOrDefault(Material.class, "GRASS", "SHORT_GRASS");
|
||||||
private static final BlockData AIR = AIR_MATERIAL.createBlockData();
|
private static final BlockData AIR = AIR_MATERIAL.createBlockData();
|
||||||
private static final IntSet foliageCache = buildFoliageCache();
|
private static final IntSet foliageCache = buildFoliageCache();
|
||||||
|
private static final IntSet decorantCache = buildDecorantCache();
|
||||||
private static final IntSet deepslateCache = buildDeepslateCache();
|
private static final IntSet deepslateCache = buildDeepslateCache();
|
||||||
private static final Int2IntMap normal2DeepslateCache = buildNormal2DeepslateCache();
|
private static final Int2IntMap normal2DeepslateCache = buildNormal2DeepslateCache();
|
||||||
private static final Int2IntMap deepslate2NormalCache = buildDeepslate2NormalCache();
|
private static final Int2IntMap deepslate2NormalCache = buildDeepslate2NormalCache();
|
||||||
private static final IntSet decorantCache = buildDecorantCache();
|
|
||||||
private static final IntSet storageCache = buildStorageCache();
|
private static final IntSet storageCache = buildStorageCache();
|
||||||
private static final IntSet storageChestCache = buildStorageChestCache();
|
private static final IntSet storageChestCache = buildStorageChestCache();
|
||||||
private static final IntSet litCache = buildLitCache();
|
private static final IntSet litCache = buildLitCache();
|
||||||
|
@ -25,7 +25,8 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
public class DoubleArrayUtils {
|
public class DoubleArrayUtils {
|
||||||
public static void shiftRight(double[] values, double push) {
|
public static void shiftRight(double[] values, double push) {
|
||||||
if (values.length - 2 + 1 >= 0) System.arraycopy(values, 0, values, 1, values.length - 2 + 1);
|
if (values.length - 2 + 1 >= 0)
|
||||||
|
System.arraycopy(values, 0, values, 1, values.length - 2 + 1);
|
||||||
|
|
||||||
values[0] = push;
|
values[0] = push;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,6 @@ package com.volmit.iris.util.decree.specialhandlers;
|
|||||||
import com.volmit.iris.engine.object.IrisBiome;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||||
import com.volmit.iris.util.decree.handlers.BiomeHandler;
|
import com.volmit.iris.util.decree.handlers.BiomeHandler;
|
||||||
import com.volmit.iris.util.decree.handlers.PlayerHandler;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class NullableBiomeHandler extends BiomeHandler {
|
public class NullableBiomeHandler extends BiomeHandler {
|
||||||
|
|
||||||
|
@ -18,14 +18,10 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.decree.specialhandlers;
|
package com.volmit.iris.util.decree.specialhandlers;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
|
||||||
import com.volmit.iris.engine.object.IrisRegion;
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||||
import com.volmit.iris.util.decree.handlers.BiomeHandler;
|
|
||||||
import com.volmit.iris.util.decree.handlers.RegionHandler;
|
import com.volmit.iris.util.decree.handlers.RegionHandler;
|
||||||
|
|
||||||
import javax.swing.plaf.synth.Region;
|
|
||||||
|
|
||||||
public class NullableRegionHandler extends RegionHandler {
|
public class NullableRegionHandler extends RegionHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,15 +40,17 @@ import com.volmit.iris.util.matter.MatterSlice;
|
|||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.parallel.HyperLock;
|
import com.volmit.iris.util.parallel.HyperLock;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.scheduling.Looper;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
|
||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.*;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
@ -73,6 +75,15 @@ public class Mantle {
|
|||||||
private final MultiBurst ioBurst;
|
private final MultiBurst ioBurst;
|
||||||
private final AtomicBoolean ioTrim;
|
private final AtomicBoolean ioTrim;
|
||||||
private final AtomicBoolean ioTectonicUnload;
|
private final AtomicBoolean ioTectonicUnload;
|
||||||
|
@Getter
|
||||||
|
private final AtomicDouble adjustedIdleDuration = new AtomicDouble(0);
|
||||||
|
@Getter
|
||||||
|
private final AtomicInteger forceAggressiveThreshold = new AtomicInteger(30);
|
||||||
|
@Getter
|
||||||
|
private final AtomicLong oldestTectonicPlate = new AtomicLong(0);
|
||||||
|
private final ReentrantLock unloadLock = new ReentrantLock();
|
||||||
|
@Getter
|
||||||
|
private final KList<Long> toUnload = new KList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new mantle
|
* Create a new mantle
|
||||||
@ -393,16 +404,6 @@ public class Mantle {
|
|||||||
return numberOfEntries * bytesPerEntry;
|
return numberOfEntries * bytesPerEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final AtomicDouble adjustedIdleDuration = new AtomicDouble(0);
|
|
||||||
@Getter
|
|
||||||
private final AtomicInteger forceAggressiveThreshold = new AtomicInteger(30);
|
|
||||||
@Getter
|
|
||||||
private final AtomicLong oldestTectonicPlate = new AtomicLong(0);
|
|
||||||
private final ReentrantLock unloadLock = new ReentrantLock();
|
|
||||||
@Getter
|
|
||||||
private final KList<Long> toUnload = new KList<>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save & unload regions that have not been used for more than the
|
* Save & unload regions that have not been used for more than the
|
||||||
* specified amount of milliseconds
|
* specified amount of milliseconds
|
||||||
|
@ -28,8 +28,6 @@ import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||||
import net.jpountz.lz4.LZ4BlockOutputStream;
|
import net.jpountz.lz4.LZ4BlockOutputStream;
|
||||||
import net.jpountz.lz4.LZ4FrameInputStream;
|
|
||||||
import net.jpountz.lz4.LZ4FrameOutputStream;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||||
|
@ -59,9 +59,11 @@ public enum Direction {
|
|||||||
return switch (f) {
|
return switch (f) {
|
||||||
case DOWN -> D;
|
case DOWN -> D;
|
||||||
case EAST, EAST_SOUTH_EAST, EAST_NORTH_EAST -> E;
|
case EAST, EAST_SOUTH_EAST, EAST_NORTH_EAST -> E;
|
||||||
case NORTH, NORTH_WEST, NORTH_NORTH_WEST, NORTH_NORTH_EAST, NORTH_EAST -> N;
|
case NORTH, NORTH_WEST, NORTH_NORTH_WEST, NORTH_NORTH_EAST,
|
||||||
|
NORTH_EAST -> N;
|
||||||
case SELF, UP -> U;
|
case SELF, UP -> U;
|
||||||
case SOUTH, SOUTH_WEST, SOUTH_SOUTH_WEST, SOUTH_SOUTH_EAST, SOUTH_EAST -> S;
|
case SOUTH, SOUTH_WEST, SOUTH_SOUTH_WEST, SOUTH_SOUTH_EAST,
|
||||||
|
SOUTH_EAST -> S;
|
||||||
case WEST, WEST_SOUTH_WEST, WEST_NORTH_WEST -> W;
|
case WEST, WEST_SOUTH_WEST, WEST_NORTH_WEST -> W;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,14 +19,9 @@
|
|||||||
package com.volmit.iris.util.math;
|
package com.volmit.iris.util.math;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
public class RNGV2 extends SecureRandom {
|
public class RNGV2 extends SecureRandom {
|
||||||
private static final long serialVersionUID = 5222938581174415179L;
|
private static final long serialVersionUID = 5222938581174415179L;
|
||||||
|
@ -36,7 +36,8 @@ import java.util.Set;
|
|||||||
public class JigsawStructuresContainer {
|
public class JigsawStructuresContainer {
|
||||||
private final Map<String, List<Position2>> map = new KMap<>();
|
private final Map<String, List<Position2>> map = new KMap<>();
|
||||||
|
|
||||||
public JigsawStructuresContainer() {}
|
public JigsawStructuresContainer() {
|
||||||
|
}
|
||||||
|
|
||||||
public JigsawStructuresContainer(DataInputStream din) throws IOException {
|
public JigsawStructuresContainer(DataInputStream din) throws IOException {
|
||||||
int s0 = din.readInt();
|
int s0 = din.readInt();
|
||||||
|
@ -33,12 +33,9 @@ import oshi.SystemInfo;
|
|||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.File;
|
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Hastebin {
|
public class Hastebin {
|
||||||
|
|
||||||
|
@ -22,13 +22,10 @@ package com.volmit.iris.util.misc;
|
|||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
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;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import oshi.SystemInfo;
|
import oshi.SystemInfo;
|
||||||
import oshi.hardware.*;
|
import oshi.hardware.*;
|
||||||
import oshi.software.os.FileSystem;
|
|
||||||
import oshi.software.os.OSFileStore;
|
import oshi.software.os.OSFileStore;
|
||||||
import oshi.software.os.OperatingSystem;
|
import oshi.software.os.OperatingSystem;
|
||||||
import oshi.util.EdidUtil;
|
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.NetworkInterface;
|
import java.net.NetworkInterface;
|
||||||
@ -36,7 +33,6 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class getHardware {
|
public class getHardware {
|
||||||
public static String getServerOS() {
|
public static String getServerOS() {
|
||||||
@ -44,10 +40,12 @@ public class getHardware {
|
|||||||
OperatingSystem os = systemInfo.getOperatingSystem();
|
OperatingSystem os = systemInfo.getOperatingSystem();
|
||||||
return os.toString();
|
return os.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getProcessMemory() {
|
public static long getProcessMemory() {
|
||||||
long maxMemory = Runtime.getRuntime().maxMemory() / (1024 * 1024);
|
long maxMemory = Runtime.getRuntime().maxMemory() / (1024 * 1024);
|
||||||
return maxMemory;
|
return maxMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getProcessUsedMemory() {
|
public static long getProcessUsedMemory() {
|
||||||
Runtime runtime = Runtime.getRuntime();
|
Runtime runtime = Runtime.getRuntime();
|
||||||
|
|
||||||
|
@ -20,9 +20,7 @@ package com.volmit.iris.util.nbt.mca;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.nms.INMS;
|
import com.volmit.iris.core.nms.INMS;
|
||||||
import com.volmit.iris.core.tools.IrisWorldDump;
|
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.format.Form;
|
|
||||||
import com.volmit.iris.util.nbt.io.NBTDeserializer;
|
import com.volmit.iris.util.nbt.io.NBTDeserializer;
|
||||||
import com.volmit.iris.util.nbt.io.NBTSerializer;
|
import com.volmit.iris.util.nbt.io.NBTSerializer;
|
||||||
import com.volmit.iris.util.nbt.io.NamedTag;
|
import com.volmit.iris.util.nbt.io.NamedTag;
|
||||||
@ -605,7 +603,8 @@ public class Chunk {
|
|||||||
if (tileTicks != null) level.put("TileTicks", tileTicks);
|
if (tileTicks != null) level.put("TileTicks", tileTicks);
|
||||||
if (liquidTicks != null) level.put("LiquidTicks", liquidTicks);
|
if (liquidTicks != null) level.put("LiquidTicks", liquidTicks);
|
||||||
if (lights != null) level.put("Lights", lights);
|
if (lights != null) level.put("Lights", lights);
|
||||||
if (liquidsToBeTicked != null) level.put("LiquidsToBeTicked", liquidsToBeTicked);
|
if (liquidsToBeTicked != null)
|
||||||
|
level.put("LiquidsToBeTicked", liquidsToBeTicked);
|
||||||
if (toBeTicked != null) level.put("ToBeTicked", toBeTicked);
|
if (toBeTicked != null) level.put("ToBeTicked", toBeTicked);
|
||||||
if (postProcessing != null) level.put("PostProcessing", postProcessing);
|
if (postProcessing != null) level.put("PostProcessing", postProcessing);
|
||||||
level.putString("Status", status);
|
level.putString("Status", status);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.util.nbt.mca.palette;
|
package com.volmit.iris.util.nbt.mca.palette;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
// todo Cool idea but im way to dumb for this for now
|
// todo Cool idea but im way to dumb for this for now
|
||||||
public class MCABitStorageByteArray {
|
public class MCABitStorageByteArray {
|
||||||
private final byte[] data;
|
private final byte[] data;
|
||||||
|
@ -20,7 +20,6 @@ package com.volmit.iris.util.nbt.mca.palette;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
import java.util.BitSet;
|
|
||||||
import java.util.function.IntConsumer;
|
import java.util.function.IntConsumer;
|
||||||
|
|
||||||
public class MCABitStorageLongArray {
|
public class MCABitStorageLongArray {
|
||||||
|
@ -122,9 +122,11 @@ public class MCAPalettedContainer<T> implements MCAPaletteResize<T> {
|
|||||||
T var1 = this.palette.valueFor(this.storage.get(var0));
|
T var1 = this.palette.valueFor(this.storage.get(var0));
|
||||||
return (var1 == null) ? this.defaultValue : var1;
|
return (var1 == null) ? this.defaultValue : var1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
/**
|
* /**
|
||||||
* Reads and processes block data from encoded byte arrays.
|
* Reads and processes block data from encoded byte arrays.
|
||||||
|
*
|
||||||
* @param var0 BlockID Strings - List of block types identified by strings.
|
* @param var0 BlockID Strings - List of block types identified by strings.
|
||||||
* @param var1 Encoded Locations - Long array containing compactly encoded block IDs, representing sequential block positions within a chunk.
|
* @param var1 Encoded Locations - Long array containing compactly encoded block IDs, representing sequential block positions within a chunk.
|
||||||
*/
|
*/
|
||||||
@ -152,6 +154,7 @@ public class MCAPalettedContainer<T> implements MCAPaletteResize<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads and processes block data from encoded byte arrays.
|
* Reads and processes block data from encoded byte arrays.
|
||||||
|
*
|
||||||
* @param var0 BlockID Strings - List of block types identified by strings.
|
* @param var0 BlockID Strings - List of block types identified by strings.
|
||||||
* @param var1 Encoded Locations - Byte array containing compactly encoded block IDs, representing sequential block positions within a chunk.
|
* @param var1 Encoded Locations - Byte array containing compactly encoded block IDs, representing sequential block positions within a chunk.
|
||||||
* Currently, Minecraft doesn't use ByteArray storage.
|
* Currently, Minecraft doesn't use ByteArray storage.
|
||||||
@ -184,6 +187,7 @@ public class MCAPalettedContainer<T> implements MCAPaletteResize<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads and processes block data from encoded byte arrays.
|
* Reads and processes block data from encoded byte arrays.
|
||||||
|
*
|
||||||
* @param var0 BlockID Strings - List of block types identified by strings.
|
* @param var0 BlockID Strings - List of block types identified by strings.
|
||||||
* This method is primarily used to read air sections.
|
* This method is primarily used to read air sections.
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.nbt.mca.palette;
|
package com.volmit.iris.util.nbt.mca.palette;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.util.nbt.tag.ByteArrayTag;
|
import com.volmit.iris.util.nbt.tag.ByteArrayTag;
|
||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||||
import com.volmit.iris.util.nbt.tag.LongArrayTag;
|
import com.volmit.iris.util.nbt.tag.LongArrayTag;
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.plugin;
|
package com.volmit.iris.util.plugin;
|
||||||
|
|
||||||
import com.volmit.iris.util.format.C;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@ -387,7 +387,8 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NullPointerException | NoSuchMethodException | IllegalAccessException |
|
} catch (NullPointerException | NoSuchMethodException |
|
||||||
|
IllegalAccessException |
|
||||||
InvocationTargetException ignored) {
|
InvocationTargetException ignored) {
|
||||||
Iris.reportError(ignored);
|
Iris.reportError(ignored);
|
||||||
}
|
}
|
||||||
|
@ -363,7 +363,8 @@ public class MetricsLite {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NullPointerException | NoSuchMethodException | IllegalAccessException |
|
} catch (NullPointerException | NoSuchMethodException |
|
||||||
|
IllegalAccessException |
|
||||||
InvocationTargetException ignored) {
|
InvocationTargetException ignored) {
|
||||||
Iris.reportError(ignored);
|
Iris.reportError(ignored);
|
||||||
}
|
}
|
||||||
|
@ -191,8 +191,10 @@ public abstract class MortarCommand implements ICommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
p.add(pc);
|
p.add(pc);
|
||||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException |
|
} catch (IllegalArgumentException | IllegalAccessException |
|
||||||
InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
InstantiationException |
|
||||||
|
InvocationTargetException | NoSuchMethodException |
|
||||||
|
SecurityException e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,10 @@ public abstract class MortarPermission {
|
|||||||
MortarPermission px = (MortarPermission) i.getType().getConstructor().newInstance();
|
MortarPermission px = (MortarPermission) i.getType().getConstructor().newInstance();
|
||||||
px.setParent(this);
|
px.setParent(this);
|
||||||
i.set(Modifier.isStatic(i.getModifiers()) ? null : this, px);
|
i.set(Modifier.isStatic(i.getModifiers()) ? null : this, px);
|
||||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException |
|
} catch (IllegalArgumentException | IllegalAccessException |
|
||||||
InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
InstantiationException |
|
||||||
|
InvocationTargetException | NoSuchMethodException |
|
||||||
|
SecurityException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
}
|
}
|
||||||
@ -52,7 +54,8 @@ public abstract class MortarPermission {
|
|||||||
if (i.isAnnotationPresent(Permission.class)) {
|
if (i.isAnnotationPresent(Permission.class)) {
|
||||||
try {
|
try {
|
||||||
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);
|
Iris.reportError(e);
|
||||||
}
|
}
|
||||||
|
@ -166,8 +166,10 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
|||||||
registerPermission(pc);
|
registerPermission(pc);
|
||||||
permissionCache.add(pc);
|
permissionCache.add(pc);
|
||||||
v("Registered Permissions " + pc.getFullNode() + " (" + i.getName() + ")");
|
v("Registered Permissions " + pc.getFullNode() + " (" + i.getName() + ")");
|
||||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException |
|
} catch (IllegalArgumentException | IllegalAccessException |
|
||||||
InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
InstantiationException |
|
||||||
|
InvocationTargetException | NoSuchMethodException |
|
||||||
|
SecurityException e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
w("Failed to register permission (field " + i.getName() + ")");
|
w("Failed to register permission (field " + i.getName() + ")");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -193,7 +195,8 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
|||||||
MortarPermission x = (MortarPermission) i.get(Modifier.isStatic(i.getModifiers()) ? null : this);
|
MortarPermission x = (MortarPermission) i.get(Modifier.isStatic(i.getModifiers()) ? null : this);
|
||||||
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);
|
Iris.reportError(e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -281,7 +284,8 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
|||||||
i.setAccessible(true);
|
i.setAccessible(true);
|
||||||
i.set(Modifier.isStatic(i.getModifiers()) ? null : this, this);
|
i.set(Modifier.isStatic(i.getModifiers()) ? null : this, this);
|
||||||
v("Registered Instance " + i.getName());
|
v("Registered Instance " + i.getName());
|
||||||
} 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);
|
Iris.reportError(e);
|
||||||
@ -300,7 +304,8 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
|||||||
i.setAccessible(true);
|
i.setAccessible(true);
|
||||||
i.set(Modifier.isStatic(i.getModifiers()) ? null : this, null);
|
i.set(Modifier.isStatic(i.getModifiers()) ? null : this, null);
|
||||||
v("Unregistered Instance " + i.getName());
|
v("Unregistered Instance " + i.getName());
|
||||||
} 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);
|
Iris.reportError(e);
|
||||||
@ -325,8 +330,10 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
|||||||
registerCommand(pc, c.value());
|
registerCommand(pc, c.value());
|
||||||
commandCache.add(pc);
|
commandCache.add(pc);
|
||||||
v("Registered Commands /" + pc.getNode() + " (" + i.getName() + ")");
|
v("Registered Commands /" + pc.getNode() + " (" + i.getName() + ")");
|
||||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException |
|
} catch (IllegalArgumentException | IllegalAccessException |
|
||||||
InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
InstantiationException |
|
||||||
|
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);
|
Iris.reportError(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user