mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-02-16 10:30:53 +00:00
Merge pull request #1050 from RePixelatedMC/Pixeldev
Mem leak Fix + more
This commit is contained in:
@@ -30,7 +30,7 @@ import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
||||
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
||||
import com.volmit.iris.core.service.ChunkHandlerSVC;
|
||||
import com.volmit.iris.core.safeguard.ServerBootSFG;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.EnginePanic;
|
||||
@@ -39,8 +39,8 @@ 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.DummyChunkGenerator;
|
||||
import com.volmit.iris.engine.safeguard.IrisSafeguard;
|
||||
import com.volmit.iris.engine.safeguard.UtilsSFG;
|
||||
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.KMap;
|
||||
import com.volmit.iris.util.exceptions.IrisException;
|
||||
@@ -95,8 +95,8 @@ import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.volmit.iris.engine.safeguard.IrisSafeguard.unstablemode;
|
||||
import static com.volmit.iris.engine.safeguard.ServerBootSFG.passedserversoftware;
|
||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.unstablemode;
|
||||
import static com.volmit.iris.core.safeguard.ServerBootSFG.passedserversoftware;
|
||||
import static com.volmit.iris.util.misc.getHardware.getCPUModel;
|
||||
import static com.volmit.iris.util.misc.getHardware.getCPUThreads;
|
||||
|
||||
@@ -442,7 +442,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
private static void fixShading() {
|
||||
ShadeFix.fix(ComponentSerializer.class);
|
||||
}
|
||||
private ChunkHandlerSVC chunkHandlerSVC;
|
||||
private void enable() {
|
||||
instance = this;
|
||||
services = new KMap<>();
|
||||
@@ -474,11 +473,9 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
UtilsSFG.SupportedServerSoftware();
|
||||
UtilsSFG.printIncompatibleWarnings();
|
||||
UtilsSFG.unstablePrompt();
|
||||
if(IrisSettings.get().getGeneral().useIntegratedChunkHandler) {
|
||||
chunkHandlerSVC = new ChunkHandlerSVC(this);
|
||||
Iris.info(C.LIGHT_PURPLE + "Started Intergrated ChunkHandlerSVC");
|
||||
}
|
||||
|
||||
autoStartStudio();
|
||||
ServerBootSFG.CheckIrisWorlds();
|
||||
checkForBukkitWorlds();
|
||||
IrisToolbelt.retainMantleDataForSlice(String.class.getCanonicalName());
|
||||
IrisToolbelt.retainMantleDataForSlice(BlockData.class.getCanonicalName());
|
||||
|
||||
@@ -141,6 +141,7 @@ public class IrisSettings {
|
||||
public int resourceLoaderCacheSize = 1_024;
|
||||
public int objectLoaderCacheSize = 4_096;
|
||||
public int scriptLoaderCacheSize = 512;
|
||||
public boolean dynamicPerformanceMode = true;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.core.commands;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||
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.Form;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
@Decree(name = "Developer", origin = DecreeOrigin.BOTH, description = "Iris World Manager", aliases = {"dev"})
|
||||
public class CommandDeveloper implements DecreeExecutor {
|
||||
|
||||
@Decree(description = "Get Loaded TectonicPlates Count", origin = DecreeOrigin.BOTH, sync = true)
|
||||
public void EngineStatus(
|
||||
@Param(description = "World")
|
||||
World world
|
||||
) {
|
||||
if (!IrisToolbelt.isIrisWorld(world)) {
|
||||
sender().sendMessage(C.RED + "This is not an Iris world. Iris worlds: " + String.join(", ", Bukkit.getServer().getWorlds().stream().filter(IrisToolbelt::isIrisWorld).map(World::getName).toList()));
|
||||
return;
|
||||
}
|
||||
|
||||
Engine engine = IrisToolbelt.access(world).getEngine();
|
||||
if(engine != null) {
|
||||
long lastUseSize = engine.getMantle().getLastUseMapMemoryUsage();
|
||||
long outputToUnload = engine.getMantle().getToUnload();
|
||||
|
||||
Iris.info("-------------------------");
|
||||
Iris.info(C.DARK_PURPLE + "Engine Status");
|
||||
Iris.info(C.DARK_PURPLE + "Tectonic Limit: " + C.LIGHT_PURPLE + engine.getMantle().getTectonicLimit());
|
||||
Iris.info(C.DARK_PURPLE + "Tectonic Plates: " + C.LIGHT_PURPLE + engine.getMantle().getLoadedRegionCount());
|
||||
Iris.info(C.DARK_PURPLE + "Tectonic ToUnload: " + C.LIGHT_PURPLE + outputToUnload);
|
||||
Iris.info(C.DARK_PURPLE + "Tectonic Unload Duration: " + C.LIGHT_PURPLE + Form.duration((long) engine.getMantle().getTectonicDuration()));
|
||||
Iris.info(C.DARK_PURPLE + "Cache Size: " + C.LIGHT_PURPLE + Form.f(IrisData.cacheSize()));
|
||||
Iris.info(C.DARK_PURPLE + "LastUse Size: " + C.LIGHT_PURPLE + Form.mem(lastUseSize));
|
||||
Iris.info("-------------------------");
|
||||
} else {
|
||||
Iris.info(C.RED + "Engine is null!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,13 +22,11 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.core.tools.IrisBenchmarking;
|
||||
import com.volmit.iris.core.tools.IrisCreator;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.IrisDimension;
|
||||
import com.volmit.iris.engine.object.IrisWorld;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.engine.safeguard.UtilsSFG;
|
||||
import com.volmit.iris.core.safeguard.UtilsSFG;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.decree.DecreeContext;
|
||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||
@@ -38,7 +36,6 @@ import com.volmit.iris.util.decree.annotations.Param;
|
||||
import com.volmit.iris.util.decree.specialhandlers.NullablePlayerHandler;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.mantle.MantleChunk;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
@@ -58,8 +55,8 @@ import java.util.concurrent.Future;
|
||||
|
||||
import static com.volmit.iris.core.service.EditSVC.deletingWorld;
|
||||
import static com.volmit.iris.core.tools.IrisBenchmarking.inProgress;
|
||||
import static com.volmit.iris.engine.safeguard.IrisSafeguard.unstablemode;
|
||||
import static com.volmit.iris.engine.safeguard.ServerBootSFG.incompatiblePlugins;
|
||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.unstablemode;
|
||||
import static com.volmit.iris.core.safeguard.ServerBootSFG.incompatiblePlugins;
|
||||
|
||||
@Decree(name = "iris", aliases = {"ir", "irs"}, description = "Basic Command")
|
||||
public class CommandIris implements DecreeExecutor {
|
||||
@@ -72,6 +69,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
private CommandEdit edit;
|
||||
private CommandFind find;
|
||||
private CommandWorldManager manager;
|
||||
private CommandDeveloper developer;
|
||||
|
||||
public static @Getter String BenchDimension;
|
||||
|
||||
|
||||
@@ -111,7 +111,6 @@ public class CommandPregen implements DecreeExecutor {
|
||||
public void stop() {
|
||||
if (PregeneratorJob.shutdownInstance()) {
|
||||
Iris.info( C.BLUE + "Finishing up mca region...");
|
||||
sender().sendMessage(C.DARK_BLUE + "Stopped pregeneration task");
|
||||
} else {
|
||||
sender().sendMessage(C.YELLOW + "No active pregeneration tasks to stop");
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class CommandWorldManager implements DecreeExecutor {
|
||||
@Param(description = "The name of the world to load")
|
||||
String world
|
||||
) {
|
||||
World worldloaded = Bukkit.getWorld(world);
|
||||
World worldloaded = Bukkit.getWorld(world);
|
||||
worldNameToCheck = world;
|
||||
boolean worldExists = doesWorldExist(worldNameToCheck);
|
||||
WorldEngine = world;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.volmit.iris.engine.safeguard;
|
||||
package com.volmit.iris.core.safeguard;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.format.C;
|
||||
|
||||
public class IrisSafeguard {
|
||||
// more planned and WIP
|
||||
public static boolean unstablemode = false;
|
||||
public static void IrisSafeguardSystem() {
|
||||
Iris.info("Enabled Iris SafeGuard");
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.engine.safeguard;
|
||||
package com.volmit.iris.core.safeguard;
|
||||
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import oshi.SystemInfo;
|
||||
@@ -7,7 +7,6 @@ import oshi.hardware.GlobalMemory;
|
||||
import static com.volmit.iris.util.misc.getHardware.*;
|
||||
|
||||
public class PerformanceSFG {
|
||||
public static boolean lowPerformance = false;
|
||||
public static void calculatePerformance(){
|
||||
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
package com.volmit.iris.engine.safeguard;
|
||||
package com.volmit.iris.core.safeguard;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import lombok.Getter;
|
||||
import com.volmit.iris.util.SFG.WorldHandlerSFG;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static com.volmit.iris.Iris.dump;
|
||||
import static com.volmit.iris.Iris.instance;
|
||||
import static com.volmit.iris.engine.safeguard.IrisSafeguard.unstablemode;
|
||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.unstablemode;
|
||||
import static com.volmit.iris.core.tools.IrisToolbelt.access;
|
||||
|
||||
public class ServerBootSFG {
|
||||
public static final Map<String, Boolean> incompatiblePlugins = new HashMap<>();
|
||||
@@ -73,6 +75,37 @@ public class ServerBootSFG {
|
||||
unstablemode = true;
|
||||
Iris.safeguard("Unstable mode has been activated.");
|
||||
}
|
||||
}
|
||||
public static void CheckIrisWorlds() {
|
||||
StringJoiner joiner = new StringJoiner(", ");
|
||||
|
||||
// Get the main server folder
|
||||
File serverFolder = Bukkit.getWorldContainer();
|
||||
|
||||
// List all files in the server folder
|
||||
File[] listOfFiles = serverFolder.listFiles();
|
||||
|
||||
if (listOfFiles != null) {
|
||||
for (File file : listOfFiles) {
|
||||
// Check if it is a directory (world folders are directories)
|
||||
if (file.isDirectory()) {
|
||||
// Check for an "iris" folder inside the world directory
|
||||
File irisFolder = new File(file, "iris");
|
||||
if (irisFolder.exists() && irisFolder.isDirectory()) {
|
||||
String worldName = file.getName();
|
||||
joiner.add(worldName);
|
||||
|
||||
// Check if the world is already loaded
|
||||
if (Bukkit.getWorld(worldName) == null) {
|
||||
WorldHandlerSFG.LoadWorld(worldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Bukkit.getLogger().warning("No files found in the server folder.");
|
||||
}
|
||||
// No Idea what I should do with this
|
||||
String worldsList = joiner.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,19 @@
|
||||
package com.volmit.iris.engine.safeguard;
|
||||
package com.volmit.iris.core.safeguard;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.format.C;
|
||||
|
||||
import static com.volmit.iris.engine.safeguard.IrisSafeguard.unstablemode;
|
||||
import static com.volmit.iris.engine.safeguard.ServerBootSFG.*;
|
||||
|
||||
public class UtilsSFG {
|
||||
public static void UnstableMode(){
|
||||
if (unstablemode) {
|
||||
if (IrisSafeguard.unstablemode) {
|
||||
Iris.safeguard(C.DARK_RED + "Iris is running in Unstable Mode");
|
||||
} else {
|
||||
Iris.safeguard(C.BLUE + "Iris is running Stable");
|
||||
}
|
||||
}
|
||||
public static void SupportedServerSoftware(){
|
||||
if (!passedserversoftware) {
|
||||
if (!ServerBootSFG.passedserversoftware) {
|
||||
Iris.safeguard(C.DARK_RED + "Server is running unsupported server software");
|
||||
Iris.safeguard(C.RED + "Supported: Purpur, Pufferfish, Paper, Spigot, Bukkit");
|
||||
}
|
||||
@@ -24,31 +21,31 @@ public class UtilsSFG {
|
||||
public static void printIncompatibleWarnings(){
|
||||
// String SupportedIrisVersion = getDescription().getVersion(); //todo Automatic version
|
||||
|
||||
if (safeguardPassed) {
|
||||
if (ServerBootSFG.safeguardPassed) {
|
||||
Iris.safeguard(C.BLUE + "0 Conflicts found");
|
||||
} else {
|
||||
Iris.safeguard(C.DARK_RED + "" + count + " Conflicts found");
|
||||
unstablemode = true;
|
||||
Iris.safeguard(C.DARK_RED + "" + ServerBootSFG.count + " Conflicts found");
|
||||
IrisSafeguard.unstablemode = true;
|
||||
|
||||
if (incompatiblePlugins.get("Multiverse-Core")) {
|
||||
if (ServerBootSFG.incompatiblePlugins.get("Multiverse-Core")) {
|
||||
Iris.safeguard(C.RED + "Multiverse");
|
||||
Iris.safeguard(C.RED + "- The plugin Multiverse is not compatible with the server.");
|
||||
Iris.safeguard(C.RED + "- If you want to have a world manager, consider using PhantomWorlds or MyWorlds instead.");
|
||||
}
|
||||
if (incompatiblePlugins.get("Dynmap")) {
|
||||
if (ServerBootSFG.incompatiblePlugins.get("Dynmap")) {
|
||||
Iris.safeguard(C.RED + "Dynmap");
|
||||
Iris.safeguard(C.RED + "- The plugin Dynmap is not compatible with the server.");
|
||||
Iris.safeguard(C.RED + "- If you want to have a map plugin like Dynmap, consider Bluemap.");
|
||||
}
|
||||
if (incompatiblePlugins.get("TerraformGenerator") || incompatiblePlugins.get("Stratos")) {
|
||||
if (ServerBootSFG.incompatiblePlugins.get("TerraformGenerator") || ServerBootSFG.incompatiblePlugins.get("Stratos")) {
|
||||
Iris.safeguard(C.YELLOW + "Terraform Generator / Stratos");
|
||||
Iris.safeguard(C.YELLOW + "- Iris is not compatible with other worldgen plugins.");
|
||||
}
|
||||
if (unsuportedversion) {
|
||||
if (ServerBootSFG.unsuportedversion) {
|
||||
Iris.safeguard(C.RED + "Server Version");
|
||||
Iris.safeguard(C.RED + "- Iris only supports 1.19.2 > 1.20.2");
|
||||
}
|
||||
if (!passedserversoftware) {
|
||||
if (!ServerBootSFG.passedserversoftware) {
|
||||
Iris.safeguard(C.RED + "Unsupported Server Software");
|
||||
Iris.safeguard(C.RED + "- Please consider using Paper or Purpur instead.");
|
||||
|
||||
@@ -57,12 +54,12 @@ public class UtilsSFG {
|
||||
}
|
||||
|
||||
public static String MSGIncompatibleWarnings() {
|
||||
return allIncompatiblePlugins;
|
||||
return ServerBootSFG.allIncompatiblePlugins;
|
||||
}
|
||||
|
||||
|
||||
public static void unstablePrompt() {
|
||||
if (unstablemode) {
|
||||
if (IrisSafeguard.unstablemode) {
|
||||
Iris.info("");
|
||||
Iris.info(C.DARK_GRAY + "--==<" + C.RED + " IMPORTANT " + C.DARK_GRAY + ">==--");
|
||||
Iris.info(C.RED + "Iris is running in unstable mode what may cause the following issues.");
|
||||
@@ -22,7 +22,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
public class ChunkHandlerSVC implements Listener {
|
||||
// Idk how it works but it works lol
|
||||
// Does nothing for now
|
||||
private final JavaPlugin plugin;
|
||||
private static BukkitTask task;
|
||||
private final Map<World, ChunkUnloader> worlds = new ConcurrentHashMap<>();
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.volmit.iris.core.service;
|
||||
|
||||
import java.nio.file.*;
|
||||
import static java.nio.file.StandardWatchEventKinds.*;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.SFG.WorldHandlerSFG;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.plugin.IrisService;
|
||||
import com.volmit.iris.util.scheduling.Looper;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class HotDropWorldSVC extends Looper implements IrisService {
|
||||
private WatchService watchService;
|
||||
private JavaPlugin plugin;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
this.plugin = Iris.instance; // Assuming Iris.instance is your plugin instance
|
||||
initializeWatchService();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
|
||||
}
|
||||
|
||||
private void initializeWatchService() {
|
||||
try {
|
||||
this.watchService = FileSystems.getDefault().newWatchService();
|
||||
Path path = Paths.get(Bukkit.getWorldContainer().getAbsolutePath());
|
||||
path.register(watchService, ENTRY_CREATE);
|
||||
} catch (Exception e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected long loop() {
|
||||
WatchKey key;
|
||||
try {
|
||||
key = watchService.poll();
|
||||
if (key != null) {
|
||||
for (WatchEvent<?> event : key.pollEvents()) {
|
||||
WatchEvent.Kind<?> kind = event.kind();
|
||||
|
||||
if (kind == ENTRY_CREATE) {
|
||||
WatchEvent<Path> ev = (WatchEvent<Path>) event;
|
||||
Path filename = ev.context();
|
||||
|
||||
File newDir = new File(Bukkit.getWorldContainer(), filename.toString());
|
||||
File irisFolder = new File(newDir, "iris");
|
||||
if (irisFolder.exists() && irisFolder.isDirectory()) {
|
||||
Iris.info("World HotDrop Detected!");
|
||||
String worldName = newDir.getName();
|
||||
String version = getVersionFromIrisFolder(irisFolder);
|
||||
|
||||
if (Bukkit.getWorld(worldName) == null && isPackValid(worldName, version)) {
|
||||
Bukkit.getScheduler().runTask(this.plugin, () -> WorldHandlerSFG.LoadWorld(worldName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
key.reset();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1000;
|
||||
}
|
||||
|
||||
private String getVersionFromIrisFolder(File irisFolder) {
|
||||
File versionFile = new File(irisFolder, "some_version_file.json");
|
||||
|
||||
if (versionFile.exists() && versionFile.isFile()) {
|
||||
try (FileReader reader = new FileReader(versionFile)) {
|
||||
JsonObject jsonObject = JsonParser.parseReader(reader).getAsJsonObject();
|
||||
if (jsonObject.has("version")) {
|
||||
return jsonObject.get("version").getAsString();
|
||||
}
|
||||
} catch (IOException | JsonParseException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return "???";
|
||||
}
|
||||
|
||||
private boolean isPackValid(String worldPackName, String version) {
|
||||
try {
|
||||
File packFolder = Iris.service(StudioSVC.class).getWorkspaceFolder();
|
||||
File[] serverPacks = packFolder.listFiles(File::isDirectory);
|
||||
if (serverPacks != null) {
|
||||
for (File serverPack : serverPacks) {
|
||||
String serverPackName = serverPack.getName();
|
||||
String serverPackVersion = getPackVersion(serverPack);
|
||||
|
||||
if (serverPackName.equals(worldPackName)) {
|
||||
if (serverPackVersion.equals(version)) {
|
||||
return true;
|
||||
} else {
|
||||
Iris.info("Version mismatch for pack '" + worldPackName + "'. Expected: " + serverPackVersion + ", Found: " + version);
|
||||
Iris.info(C.GOLD + "Cant load the world!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Iris.info("Pack '" + worldPackName + "' not found on the server.");
|
||||
Iris.info(C.GOLD + "Cant load the world!");
|
||||
} else {
|
||||
Iris.info("No packs found in the server's workspace folder.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
Iris.info("Error checking if pack is valid: " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getPackVersion(File pack) {
|
||||
String version = "???";
|
||||
File dimensionFile = new File(pack, "dimensions/" + pack.getName() + ".json");
|
||||
if (dimensionFile.isFile()) {
|
||||
try (FileReader reader = new FileReader(dimensionFile)) {
|
||||
JsonObject json = JsonParser.parseReader(reader).getAsJsonObject();
|
||||
if (json.has("version")) {
|
||||
version = json.get("version").getAsString();
|
||||
}
|
||||
} catch (IOException | JsonParseException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.volmit.iris.core.pregenerator.PregenTask;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.engine.object.IrisDimension;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.engine.safeguard.UtilsSFG;
|
||||
import com.volmit.iris.core.safeguard.UtilsSFG;
|
||||
import com.volmit.iris.util.exceptions.IrisException;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
@@ -47,7 +47,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.volmit.iris.core.tools.IrisPackBenchmarking.benchmark;
|
||||
import static com.volmit.iris.engine.safeguard.IrisSafeguard.unstablemode;
|
||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.unstablemode;
|
||||
|
||||
/**
|
||||
* Makes it a lot easier to setup an engine, world, studio or whatever
|
||||
|
||||
@@ -46,7 +46,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.volmit.iris.core.tools.IrisPackBenchmarking.benchmark;
|
||||
import static com.volmit.iris.engine.safeguard.PerformanceSFG.lowPerformance;
|
||||
import static com.volmit.iris.core.safeguard.PerformanceSFG.*;
|
||||
|
||||
@Data
|
||||
public class IrisEngineMantle implements EngineMantle {
|
||||
@@ -290,15 +290,10 @@ public class IrisEngineMantle implements EngineMantle {
|
||||
x = 4;
|
||||
Iris.info("Mantle Size: " + x + " Chunks " + C.BLUE + "BENCHMARK MODE");
|
||||
} else {
|
||||
if(lowPerformance){
|
||||
x = 4;
|
||||
Iris.info("Mantle Size: " + x + " Chunks" + C.GOLD + "LOW PERFORMANCE MODE");
|
||||
} else {
|
||||
Iris.info("Mantle Size: " + x + " Chunks");
|
||||
Iris.info(" Object Mantle Size: " + u + " (" + ((Math.max(u, 16) + 16) >> 4) + ")");
|
||||
Iris.info(" Jigsaw Mantle Size: " + jig + " (" + ((Math.max(jig, 16) + 16) >> 4) + ")");
|
||||
Iris.info(" Carving Mantle Size: " + c + " (" + ((Math.max(c, 16) + 16) >> 4) + ")");
|
||||
}
|
||||
Iris.info("Mantle Size: " + x + " Chunks");
|
||||
Iris.info(" Object Mantle Size: " + u + " (" + ((Math.max(u, 16) + 16) >> 4) + ")");
|
||||
Iris.info(" Jigsaw Mantle Size: " + jig + " (" + ((Math.max(jig, 16) + 16) >> 4) + ")");
|
||||
Iris.info(" Carving Mantle Size: " + c + " (" + ((Math.max(c, 16) + 16) >> 4) + ")");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -257,6 +257,9 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
default int getLoadedRegionCount() {
|
||||
return getMantle().getLoadedRegionCount();
|
||||
}
|
||||
default long getLastUseMapMemoryUsage(){
|
||||
return getMantle().LastUseMapMemoryUsage();
|
||||
}
|
||||
|
||||
MantleJigsawComponent getJigsawComponent();
|
||||
|
||||
@@ -288,4 +291,14 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
default long getToUnload(){
|
||||
return getMantle().ToUnloadTectonic();
|
||||
}
|
||||
default double getTectonicLimit(){
|
||||
return getMantle().getTectonicLimit();
|
||||
}
|
||||
default double getTectonicDuration(){
|
||||
return getMantle().getTectonicUnloadDuration();
|
||||
}
|
||||
}
|
||||
|
||||
179
core/src/main/java/com/volmit/iris/util/SFG/WorldHandlerSFG.java
Normal file
179
core/src/main/java/com/volmit/iris/util/SFG/WorldHandlerSFG.java
Normal file
@@ -0,0 +1,179 @@
|
||||
package com.volmit.iris.util.SFG;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
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.DummyChunkGenerator;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.volmit.iris.Iris.service;
|
||||
|
||||
public class WorldHandlerSFG {
|
||||
static String WorldToLoad;
|
||||
static String WorldEngine;
|
||||
static String worldNameToCheck = "YourWorldName";
|
||||
private static VolmitSender sender;
|
||||
public static void LoadWorld(String selectedWorld){
|
||||
if(Objects.equals(selectedWorld, "Benchmark")){
|
||||
return;
|
||||
}
|
||||
worldNameToCheck = selectedWorld;
|
||||
boolean worldExists = doesWorldExist(worldNameToCheck);
|
||||
WorldEngine = selectedWorld;
|
||||
|
||||
if (!worldExists) {
|
||||
return;
|
||||
}
|
||||
WorldToLoad = selectedWorld;
|
||||
File BUKKIT_YML = new File("bukkit.yml");
|
||||
String pathtodim = selectedWorld + "\\iris\\pack\\dimensions\\";
|
||||
File directory = new File(Bukkit.getWorldContainer(), pathtodim);
|
||||
|
||||
String dimension = null;
|
||||
if (directory.exists() && directory.isDirectory()) {
|
||||
File[] files = directory.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (file.isFile()) {
|
||||
String fileName = file.getName();
|
||||
if (fileName.endsWith(".json")) {
|
||||
dimension = fileName.substring(0, fileName.length() - 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(BUKKIT_YML);
|
||||
String gen = "Iris:" + dimension;
|
||||
ConfigurationSection section = yml.contains("worlds") ? yml.getConfigurationSection("worlds") : yml.createSection("worlds");
|
||||
if (!section.contains(selectedWorld)) {
|
||||
section.createSection(selectedWorld).set("generator", gen);
|
||||
try {
|
||||
yml.save(BUKKIT_YML);
|
||||
Iris.info("Registered \"" + selectedWorld + "\" in bukkit.yml");
|
||||
} catch (IOException e) {
|
||||
Iris.error("Failed to update bukkit.yml!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
checkForBukkitWorlds();
|
||||
}
|
||||
static boolean doesWorldExist(String worldName) {
|
||||
File worldContainer = Bukkit.getWorldContainer();
|
||||
File worldDirectory = new File(worldContainer, worldName);
|
||||
return worldDirectory.exists() && worldDirectory.isDirectory();
|
||||
}
|
||||
private static void checkForBukkitWorlds() {
|
||||
FileConfiguration fc = new YamlConfiguration();
|
||||
try {
|
||||
fc.load(new File("bukkit.yml"));
|
||||
ConfigurationSection section = fc.getConfigurationSection("worlds");
|
||||
if (section == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> worldsToLoad = Collections.singletonList(WorldToLoad);
|
||||
|
||||
for (String s : section.getKeys(false)) {
|
||||
if (!worldsToLoad.contains(s)) {
|
||||
continue;
|
||||
}
|
||||
ConfigurationSection entry = section.getConfigurationSection(s);
|
||||
if (!entry.contains("generator", true)) {
|
||||
continue;
|
||||
}
|
||||
String generator = entry.getString("generator");
|
||||
if (generator.startsWith("Iris:")) {
|
||||
generator = generator.split("\\Q:\\E")[1];
|
||||
} else if (generator.equalsIgnoreCase("Iris")) {
|
||||
generator = IrisSettings.get().getGenerator().getDefaultWorldType();
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
Iris.info("2 World: %s | Generator: %s", s, generator);
|
||||
if (Bukkit.getWorlds().stream().anyMatch(w -> w.getName().equals(s))) {
|
||||
continue;
|
||||
}
|
||||
Iris.info(C.LIGHT_PURPLE + "Preparing Spawn for " + s + "' using Iris:" + generator + "...");
|
||||
new WorldCreator(s)
|
||||
.generator(getDefaultWorldGenerator(s, generator))
|
||||
.environment(IrisData.loadAnyDimension(generator).getEnvironment())
|
||||
.createWorld();
|
||||
Iris.info(C.LIGHT_PURPLE + "Loaded " + s + "!");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
||||
Iris.debug("Default World Generator Called for " + worldName + " using ID: " + id);
|
||||
if (worldName.equals("test")) {
|
||||
try {
|
||||
throw new RuntimeException();
|
||||
} catch (Throwable e) {
|
||||
Iris.info(e.getStackTrace()[1].getClassName());
|
||||
if (e.getStackTrace()[1].getClassName().contains("com.onarandombox.MultiverseCore")) {
|
||||
Iris.debug("MVC Test detected, Quick! Send them the dummy!");
|
||||
return new DummyChunkGenerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
IrisDimension dim;
|
||||
if (id == null || id.isEmpty()) {
|
||||
dim = IrisData.loadAnyDimension(IrisSettings.get().getGenerator().getDefaultWorldType());
|
||||
} else {
|
||||
dim = IrisData.loadAnyDimension(id);
|
||||
}
|
||||
Iris.debug("Generator ID: " + id + " requested by bukkit/plugin");
|
||||
|
||||
if (dim == null) {
|
||||
Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
|
||||
|
||||
service(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), id, true);
|
||||
dim = IrisData.loadAnyDimension(id);
|
||||
|
||||
if (dim == null) {
|
||||
throw new RuntimeException("Can't find dimension " + id + "!");
|
||||
} else {
|
||||
Iris.info("Resolved missing dimension, proceeding with generation.");
|
||||
}
|
||||
}
|
||||
Iris.debug("Assuming IrisDimension: " + dim.getName());
|
||||
IrisWorld w = IrisWorld.builder()
|
||||
.name(worldName)
|
||||
.seed(1337)
|
||||
.environment(dim.getEnvironment())
|
||||
.worldFolder(new File(Bukkit.getWorldContainer(), worldName))
|
||||
.minHeight(dim.getMinHeight())
|
||||
.maxHeight(dim.getMaxHeight())
|
||||
.build();
|
||||
Iris.debug("Generator Config: " + w.toString());
|
||||
File ff = new File(w.worldFolder(), "iris/pack");
|
||||
if (!ff.exists() || ff.listFiles().length == 0) {
|
||||
ff.mkdirs();
|
||||
service(StudioSVC.class).installIntoWorld(sender, dim.getLoadKey(), ff.getParentFile());
|
||||
}
|
||||
return new BukkitChunkGenerator(w, false, ff, dim.getLoadKey());
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util.mantle;
|
||||
|
||||
import com.google.common.util.concurrent.AtomicDouble;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
@@ -36,6 +37,7 @@ import com.volmit.iris.util.function.Consumer4;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.matter.Matter;
|
||||
import com.volmit.iris.util.matter.MatterSlice;
|
||||
import com.volmit.iris.util.misc.getHardware;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
import com.volmit.iris.util.parallel.HyperLock;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
@@ -45,16 +47,18 @@ import org.bukkit.Chunk;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* The mantle can store any type of data slice anywhere and manage regions & IO on it's own.
|
||||
* This class is fully thread safe read & writeNodeData
|
||||
*/
|
||||
|
||||
public class Mantle {
|
||||
private final File dataFolder;
|
||||
private final int worldHeight;
|
||||
@@ -66,6 +70,10 @@ public class Mantle {
|
||||
private final AtomicBoolean closed;
|
||||
private final MultiBurst ioBurst;
|
||||
private final AtomicBoolean io;
|
||||
private final Object gcMonitor = new Object();
|
||||
long apm = getHardware.getAvailableProcessMemory();
|
||||
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
int tectonicLimitBeforeOutMemory;
|
||||
|
||||
/**
|
||||
* Create a new mantle
|
||||
@@ -374,44 +382,104 @@ public class Mantle {
|
||||
Iris.debug("The Mantle has Closed " + C.DARK_AQUA + dataFolder.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Estimates the memory usage of the lastUse map.
|
||||
*
|
||||
* @return Estimated memory usage in bytes.
|
||||
*/
|
||||
|
||||
public long LastUseMapMemoryUsage() {
|
||||
long numberOfEntries = lastUse.size();
|
||||
long bytesPerEntry = Long.BYTES * 2;
|
||||
return numberOfEntries * bytesPerEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save & unload regions that have not been used for more than the
|
||||
* specified amount of milliseconds
|
||||
*
|
||||
* @param idleDuration the duration
|
||||
* @param baseIdleDuration the duration
|
||||
*/
|
||||
public synchronized void trim(long idleDuration) {
|
||||
@Getter
|
||||
AtomicInteger FakeToUnload = new AtomicInteger(0);
|
||||
AtomicDouble adjustedIdleDuration = new AtomicDouble(0);
|
||||
@Getter
|
||||
double tectonicLimit = 30;
|
||||
|
||||
|
||||
public synchronized void trim(long baseIdleDuration) {
|
||||
if (closed.get()) {
|
||||
throw new RuntimeException("The Mantle is closed");
|
||||
}
|
||||
if (IrisSettings.get().getPerformance().dynamicPerformanceMode){
|
||||
tectonicLimit = 2;
|
||||
long t = getHardware.getProcessMemory();
|
||||
for (; t > 250;){
|
||||
tectonicLimit++;
|
||||
t = t - 250;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
adjustedIdleDuration.set(baseIdleDuration);
|
||||
|
||||
if (loadedRegions.size() > tectonicLimit) {
|
||||
adjustedIdleDuration.set(Math.max(adjustedIdleDuration.get() - (1000 * (loadedRegions.size() - tectonicLimit) * 1.35), 4000));
|
||||
if (getHardware.getProcessMemory() < 5000 && IrisSettings.get().getPerformance().dynamicPerformanceMode) {
|
||||
adjustedIdleDuration.set(Math.max(adjustedIdleDuration.get() - (1000 * (loadedRegions.size() - tectonicLimit) * 2.65), 4000));
|
||||
}
|
||||
}
|
||||
|
||||
io.set(true);
|
||||
Iris.debug("Trimming Tectonic Plates older than " + Form.duration((double) idleDuration, 0));
|
||||
unload.clear();
|
||||
|
||||
for (Long i : lastUse.keySet()) {
|
||||
hyperLock.withLong(i, () -> {
|
||||
if (M.ms() - lastUse.get(i) >= idleDuration) {
|
||||
unload.add(i);
|
||||
}
|
||||
});
|
||||
try {
|
||||
Iris.debug("Trimming Tectonic Plates older than " + Form.duration(adjustedIdleDuration.get(), 0));
|
||||
Set<Long> toUnload = new HashSet<>();
|
||||
|
||||
for (Long i : lastUse.keySet()) {
|
||||
double finalAdjustedIdleDuration = adjustedIdleDuration.get();
|
||||
hyperLock.withLong(i, () -> {
|
||||
if (M.ms() - lastUse.get(i) >= finalAdjustedIdleDuration) {
|
||||
toUnload.add(i);
|
||||
FakeToUnload.addAndGet(1);
|
||||
Iris.debug("Tectonic Region added to unload");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
BurstExecutor burstExecutor = new BurstExecutor(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()), toUnload.size());
|
||||
|
||||
for (Long i : toUnload) {
|
||||
burstExecutor.queue(() -> {
|
||||
hyperLock.withLong(i, () -> {
|
||||
TectonicPlate m = loadedRegions.get(i);
|
||||
if (m != null) {
|
||||
try {
|
||||
m.write(fileForRegion(dataFolder, i));
|
||||
loadedRegions.remove(i);
|
||||
lastUse.remove(i);
|
||||
Iris.debug("Unloaded Tectonic Plate " + C.DARK_GREEN + Cache.keyX(i) + " " + Cache.keyZ(i));
|
||||
FakeToUnload.addAndGet(-1);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
burstExecutor.complete();
|
||||
|
||||
} finally {
|
||||
io.set(false);
|
||||
}
|
||||
}
|
||||
|
||||
for (Long i : unload) {
|
||||
hyperLock.withLong(i, () -> {
|
||||
TectonicPlate m = loadedRegions.remove(i);
|
||||
lastUse.remove(i);
|
||||
|
||||
try {
|
||||
m.write(fileForRegion(dataFolder, i));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Iris.debug("Unloaded Tectonic Plate " + C.DARK_GREEN + Cache.keyX(i) + " " + Cache.keyZ(i));
|
||||
});
|
||||
}
|
||||
io.set(false);
|
||||
public long ToUnloadTectonic(){
|
||||
return FakeToUnload.get();
|
||||
}
|
||||
public double getTectonicUnloadDuration(){
|
||||
return adjustedIdleDuration.get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,20 @@ public class getHardware {
|
||||
long maxMemory = Runtime.getRuntime().maxMemory() / (1024 * 1024);
|
||||
return maxMemory;
|
||||
}
|
||||
public static long getProcessUsedMemory() {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
|
||||
long totalMemory = runtime.totalMemory();
|
||||
long freeMemory = runtime.freeMemory();
|
||||
long usedMemory = totalMemory - freeMemory;
|
||||
|
||||
return usedMemory / (1024 * 1024);
|
||||
}
|
||||
|
||||
public static long getAvailableProcessMemory(){
|
||||
long availableMemory = getHardware.getProcessMemory() - getHardware.getProcessUsedMemory();
|
||||
return availableMemory;
|
||||
}
|
||||
|
||||
public static String getCPUModel() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user