mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-30 12:29:20 +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 + "@@@@@@@@@@@@@@"
|
||||
};
|
||||
String[] splash;
|
||||
File freeSpace = new File(Bukkit.getWorldContainer() + ".");
|
||||
if (unstablemode) {
|
||||
splash = splashunstable;
|
||||
} else if (warningmode) {
|
||||
@@ -835,6 +836,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
|
||||
Iris.info("Process Threads: " + getCPUThreads());
|
||||
Iris.info("Process Memory: " + getHardware.getProcessMemory() + " MB");
|
||||
Iris.info("Free DiskSpace: " + Form.ofSize(freeSpace.getFreeSpace(), 1024));
|
||||
if (getHardware.getProcessMemory() < 5999) {
|
||||
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.plugin.Plugin;
|
||||
|
||||
import javax.print.attribute.standard.Severity;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -18,7 +19,9 @@ import static com.volmit.iris.core.safeguard.IrisSafeguard.*;
|
||||
public class ServerBootSFG {
|
||||
public static final Map<String, Boolean> incompatibilities = new HashMap<>();
|
||||
public static boolean isJDK17 = true;
|
||||
public static boolean hasEnoughDiskSpace = false;
|
||||
public static boolean isJRE = false;
|
||||
public static boolean hasPrivileges = false;
|
||||
public static boolean unsuportedversion = false;
|
||||
protected static boolean safeguardPassed;
|
||||
public static boolean passedserversoftware = true;
|
||||
@@ -82,6 +85,16 @@ public class ServerBootSFG {
|
||||
joiner.add("Unsupported JDK");
|
||||
severityMedium++;
|
||||
}
|
||||
if (!hasPrivileges()){
|
||||
hasPrivileges = true;
|
||||
joiner.add("Insufficient Privileges");
|
||||
severityHigh++;
|
||||
}
|
||||
if (!enoughDiskSpace()){
|
||||
hasEnoughDiskSpace = false;
|
||||
joiner.add("Insufficient Disk Space");
|
||||
severityHigh++;
|
||||
}
|
||||
|
||||
allIncompatibilities = joiner.toString();
|
||||
|
||||
@@ -122,6 +135,34 @@ public class ServerBootSFG {
|
||||
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) {
|
||||
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 + "- 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) {
|
||||
Iris.safeguard(C.YELLOW + "Unsupported java version");
|
||||
Iris.safeguard(C.YELLOW + "- Please consider using JDK 17 Instead of JDK " + Iris.getJavaVersion());
|
||||
|
||||
@@ -683,23 +683,23 @@ public class Form {
|
||||
*/
|
||||
public static String ofSize(long s, int div) {
|
||||
double d = (double) s;
|
||||
String sub = "Bytes";
|
||||
String sub = " Bytes";
|
||||
|
||||
if (d > div - 1) {
|
||||
d /= div;
|
||||
sub = "KB";
|
||||
sub = " KB";
|
||||
|
||||
if (d > div - 1) {
|
||||
d /= div;
|
||||
sub = "MB";
|
||||
sub = " MB";
|
||||
|
||||
if (d > div - 1) {
|
||||
d /= div;
|
||||
sub = "GB";
|
||||
sub = " GB";
|
||||
|
||||
if (d > div - 1) {
|
||||
d /= div;
|
||||
sub = "TB";
|
||||
sub = " TB";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class TectonicPlate {
|
||||
public static TectonicPlate read(int worldHeight, File file) throws IOException, ClassNotFoundException {
|
||||
FileInputStream fin = new FileInputStream(file);
|
||||
DataInputStream din;
|
||||
if (file.getName().endsWith("ttp")) {
|
||||
if (file.getName().endsWith("ttp.lz4")) {
|
||||
GZIPInputStream gzi = new GZIPInputStream(fin);
|
||||
din = new DataInputStream(gzi);
|
||||
} else {
|
||||
@@ -175,7 +175,7 @@ public class TectonicPlate {
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
DataOutputStream dos;
|
||||
if (file.getName().endsWith("ttp")) {
|
||||
if (file.getName().endsWith("ttp.lz4")) {
|
||||
GZIPOutputStream gzo = new GZIPOutputStream(fos);
|
||||
dos = new DataOutputStream(gzo);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user