mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-18 14:50:57 +00:00
Merge remote-tracking branch 'pixeldev/Pixeldev' into Pixeldev
This commit is contained in:
@@ -788,6 +788,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@"
|
padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@"
|
||||||
};
|
};
|
||||||
String[] splash;
|
String[] splash;
|
||||||
|
File freeSpace = new File(Bukkit.getWorldContainer() + ".");
|
||||||
if (unstablemode) {
|
if (unstablemode) {
|
||||||
splash = splashunstable;
|
splash = splashunstable;
|
||||||
} else if (warningmode) {
|
} else if (warningmode) {
|
||||||
@@ -835,6 +836,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
|
|
||||||
Iris.info("Process Threads: " + getCPUThreads());
|
Iris.info("Process Threads: " + getCPUThreads());
|
||||||
Iris.info("Process Memory: " + getHardware.getProcessMemory() + " MB");
|
Iris.info("Process Memory: " + getHardware.getProcessMemory() + " MB");
|
||||||
|
Iris.info("Free DiskSpace: " + Form.ofSize(freeSpace.getFreeSpace(), 1024));
|
||||||
if (getHardware.getProcessMemory() < 5999) {
|
if (getHardware.getProcessMemory() < 5999) {
|
||||||
Iris.warn("6GB+ Ram is recommended");
|
Iris.warn("6GB+ Ram is recommended");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,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 javax.print.attribute.standard.Severity;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -18,7 +19,9 @@ 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<>();
|
||||||
public static boolean isJDK17 = true;
|
public static boolean isJDK17 = true;
|
||||||
|
public static boolean hasEnoughDiskSpace = false;
|
||||||
public static boolean isJRE = false;
|
public static boolean isJRE = false;
|
||||||
|
public static boolean hasPrivileges = false;
|
||||||
public static boolean unsuportedversion = false;
|
public static boolean unsuportedversion = false;
|
||||||
protected static boolean safeguardPassed;
|
protected static boolean safeguardPassed;
|
||||||
public static boolean passedserversoftware = true;
|
public static boolean passedserversoftware = true;
|
||||||
@@ -82,6 +85,16 @@ public class ServerBootSFG {
|
|||||||
joiner.add("Unsupported JDK");
|
joiner.add("Unsupported JDK");
|
||||||
severityMedium++;
|
severityMedium++;
|
||||||
}
|
}
|
||||||
|
if (!hasPrivileges()){
|
||||||
|
hasPrivileges = true;
|
||||||
|
joiner.add("Insufficient Privileges");
|
||||||
|
severityHigh++;
|
||||||
|
}
|
||||||
|
if (!enoughDiskSpace()){
|
||||||
|
hasEnoughDiskSpace = false;
|
||||||
|
joiner.add("Insufficient Disk Space");
|
||||||
|
severityHigh++;
|
||||||
|
}
|
||||||
|
|
||||||
allIncompatibilities = joiner.toString();
|
allIncompatibilities = joiner.toString();
|
||||||
|
|
||||||
@@ -122,6 +135,34 @@ public class ServerBootSFG {
|
|||||||
return path != null && checkJavac(path + File.separator + "bin");
|
return path != null && checkJavac(path + File.separator + "bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasPrivileges() {
|
||||||
|
File pv = new File(Bukkit.getWorldContainer() + "iristest.json");
|
||||||
|
if (pv.exists()){
|
||||||
|
pv.delete();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (pv.createNewFile()){
|
||||||
|
if (pv.canWrite() && pv.canRead()){
|
||||||
|
pv.delete();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean enoughDiskSpace() {
|
||||||
|
File freeSpace = new File(Bukkit.getWorldContainer() + ".");
|
||||||
|
double gigabytes = freeSpace.getFreeSpace() / (1024.0 * 1024.0 * 1024.0);
|
||||||
|
if (gigabytes > 3){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean checkJavac(String path) {
|
private static boolean checkJavac(String path) {
|
||||||
return !path.isEmpty() && (new File(path, "javac").exists() || new File(path, "javac.exe").exists());
|
return !path.isEmpty() && (new File(path, "javac").exists() || new File(path, "javac.exe").exists());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,14 @@ public class UtilsSFG {
|
|||||||
Iris.safeguard(C.RED + "Unsupported Server Software");
|
Iris.safeguard(C.RED + "Unsupported Server Software");
|
||||||
Iris.safeguard(C.RED + "- Please consider using Paper or Purpur instead.");
|
Iris.safeguard(C.RED + "- Please consider using Paper or Purpur instead.");
|
||||||
}
|
}
|
||||||
|
if (!ServerBootSFG.hasPrivileges) {
|
||||||
|
Iris.safeguard(C.RED + "Insufficient Privileges");
|
||||||
|
Iris.safeguard(C.RED + "- The server has insufficient Privileges to run iris. Please contact support.");
|
||||||
|
}
|
||||||
|
if (!ServerBootSFG.hasEnoughDiskSpace) {
|
||||||
|
Iris.safeguard(C.RED + "Insufficient Disk Space");
|
||||||
|
Iris.safeguard(C.RED + "- The server has insufficient Free DiskSpace to run iris required 3GB+.");
|
||||||
|
}
|
||||||
if (!ServerBootSFG.isJDK17) {
|
if (!ServerBootSFG.isJDK17) {
|
||||||
Iris.safeguard(C.YELLOW + "Unsupported java version");
|
Iris.safeguard(C.YELLOW + "Unsupported java version");
|
||||||
Iris.safeguard(C.YELLOW + "- Please consider using JDK 17 Instead of JDK " + Iris.getJavaVersion());
|
Iris.safeguard(C.YELLOW + "- Please consider using JDK 17 Instead of JDK " + Iris.getJavaVersion());
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class TectonicPlate {
|
|||||||
public static TectonicPlate read(int worldHeight, File file) throws IOException, ClassNotFoundException {
|
public static TectonicPlate read(int worldHeight, File file) throws IOException, ClassNotFoundException {
|
||||||
FileInputStream fin = new FileInputStream(file);
|
FileInputStream fin = new FileInputStream(file);
|
||||||
DataInputStream din;
|
DataInputStream din;
|
||||||
if (file.getName().endsWith("ttp")) {
|
if (file.getName().endsWith("ttp.lz4")) {
|
||||||
GZIPInputStream gzi = new GZIPInputStream(fin);
|
GZIPInputStream gzi = new GZIPInputStream(fin);
|
||||||
din = new DataInputStream(gzi);
|
din = new DataInputStream(gzi);
|
||||||
} else {
|
} else {
|
||||||
@@ -175,7 +175,7 @@ public class TectonicPlate {
|
|||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
DataOutputStream dos;
|
DataOutputStream dos;
|
||||||
if (file.getName().endsWith("ttp")) {
|
if (file.getName().endsWith("ttp.lz4")) {
|
||||||
GZIPOutputStream gzo = new GZIPOutputStream(fos);
|
GZIPOutputStream gzo = new GZIPOutputStream(fos);
|
||||||
dos = new DataOutputStream(gzo);
|
dos = new DataOutputStream(gzo);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user