This commit is contained in:
RePixelatedMC committed 2023-10-08 14:10:44 +02:00
1 parent 7a31fd31eb
commit e4c27bd49c
6 files changed
+12 -30

No files matched your search

+3 -3
View File
@@ -465,9 +465,9 @@ public class Iris extends VolmitPlugin implements Listener {
J.s(this::setupPapi); J.s(this::setupPapi);
J.a(ServerConfigurator::configure, 20); J.a(ServerConfigurator::configure, 20);
splash(); splash();
ServerBoot.unstablemode(); ServerBoot.UnstableMode();
ServerBoot.supportedserversoftware(); ServerBoot.SupportedServerSoftware();
ServerBoot.incompatiblepluginset(); ServerBoot.printincompatiblepluginWarnings();
autoStartStudio(); autoStartStudio();
checkForBukkitWorlds(); checkForBukkitWorlds();
IrisToolbelt.retainMantleDataForSlice(String.class.getCanonicalName()); IrisToolbelt.retainMantleDataForSlice(String.class.getCanonicalName());
@@ -78,7 +78,7 @@ public class CommandIris implements DecreeExecutor {
sender().sendMessage(C.RED + "it is strongly advised for you to take action. see log for full detail"); sender().sendMessage(C.RED + "it is strongly advised for you to take action. see log for full detail");
Iris.safeguard(C.RED + "----------------------------------------------------------------"); Iris.safeguard(C.RED + "----------------------------------------------------------------");
Iris.safeguard(C.RED + "Command ran: /iris create"); Iris.safeguard(C.RED + "Command ran: /iris create");
ServerBoot.incompatiblepluginset(); ServerBoot.printincompatiblepluginWarnings();
Iris.safeguard(C.RED + "----------------------------------------------------------------"); Iris.safeguard(C.RED + "----------------------------------------------------------------");
} }
if (name.equals("iris")) { if (name.equals("iris")) {
@@ -56,7 +56,7 @@ public class CommandWorldManager implements DecreeExecutor {
String worldNameToCheck = "YourWorldName"; String worldNameToCheck = "YourWorldName";
VolmitSender sender = Iris.getSender(); VolmitSender sender = Iris.getSender();
@Decree(description = "Unload an Iris World", origin = DecreeOrigin.PLAYER, sync = true) @Decree(description = "Unload an Iris World", origin = DecreeOrigin.PLAYER, sync = true)
public void unloadworld( public void unloadWorld(
@Param(description = "The world to unload") @Param(description = "The world to unload")
World world World world
) { ) {
@@ -76,7 +76,7 @@ public class CommandWorldManager implements DecreeExecutor {
} }
@Decree(description = "Load an Iris World", origin = DecreeOrigin.PLAYER, sync = true, aliases = {"import"}) @Decree(description = "Load an Iris World", origin = DecreeOrigin.PLAYER, sync = true, aliases = {"import"})
public void loadworld( public void loadWorld(
@Param(description = "The name of the world to load") @Param(description = "The name of the world to load")
String world String world
) { ) {
@@ -89,7 +89,6 @@ public class CommandWorldManager implements DecreeExecutor {
sender().sendMessage(C.YELLOW + world + " Doesnt exist on the server."); sender().sendMessage(C.YELLOW + world + " Doesnt exist on the server.");
return; return;
} }
WorldToLoad = world; WorldToLoad = world;
File BUKKIT_YML = new File("bukkit.yml"); File BUKKIT_YML = new File("bukkit.yml");
String pathtodim = world + "\\iris\\pack\\dimensions\\"; String pathtodim = world + "\\iris\\pack\\dimensions\\";
@@ -130,7 +129,6 @@ public class CommandWorldManager implements DecreeExecutor {
} }
checkForBukkitWorlds(); checkForBukkitWorlds();
sender().sendMessage(C.GREEN + world + " loaded successfully."); sender().sendMessage(C.GREEN + world + " loaded successfully.");
} }
@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(
@@ -143,7 +141,6 @@ public class CommandWorldManager implements DecreeExecutor {
} }
sender().sendMessage(C.GREEN + "Evacuating world" + world.getName()); sender().sendMessage(C.GREEN + "Evacuating world" + world.getName());
IrisToolbelt.evacuate(world); IrisToolbelt.evacuate(world);
} }
@Decree(description = "Remove an Iris world", aliases = {"del", "rm"}, sync = true) @Decree(description = "Remove an Iris world", aliases = {"del", "rm"}, sync = true)
public void remove( public void remove(
@@ -177,8 +174,7 @@ public class CommandWorldManager implements DecreeExecutor {
} }
} }
} }
boolean doesWorldExist(String worldName) {
public static boolean doesWorldExist(String worldName) {
File worldContainer = Bukkit.getWorldContainer(); File worldContainer = Bukkit.getWorldContainer();
File worldDirectory = new File(worldContainer, worldName); File worldDirectory = new File(worldContainer, worldName);
return worldDirectory.exists() && worldDirectory.isDirectory(); return worldDirectory.exists() && worldDirectory.isDirectory();
@@ -198,12 +194,10 @@ public class CommandWorldManager implements DecreeExecutor {
if (!worldsToLoad.contains(s)) { if (!worldsToLoad.contains(s)) {
continue; continue;
} }
ConfigurationSection entry = section.getConfigurationSection(s); ConfigurationSection entry = section.getConfigurationSection(s);
if (!entry.contains("generator", true)) { if (!entry.contains("generator", true)) {
continue; continue;
} }
String generator = entry.getString("generator"); String generator = entry.getString("generator");
if (generator.startsWith("Iris:")) { if (generator.startsWith("Iris:")) {
generator = generator.split("\\Q:\\E")[1]; generator = generator.split("\\Q:\\E")[1];
@@ -212,13 +206,10 @@ public class CommandWorldManager implements DecreeExecutor {
} else { } else {
continue; continue;
} }
Iris.info("2 World: %s | Generator: %s", s, generator); Iris.info("2 World: %s | Generator: %s", s, generator);
if (Bukkit.getWorlds().stream().anyMatch(w -> w.getName().equals(s))) { if (Bukkit.getWorlds().stream().anyMatch(w -> w.getName().equals(s))) {
continue; continue;
} }
Iris.info(C.LIGHT_PURPLE + "Preparing Spawn for " + s + "' using Iris:" + generator + "..."); Iris.info(C.LIGHT_PURPLE + "Preparing Spawn for " + s + "' using Iris:" + generator + "...");
new WorldCreator(s) new WorldCreator(s)
.generator(getDefaultWorldGenerator(s, generator)) .generator(getDefaultWorldGenerator(s, generator))
@@ -230,7 +221,6 @@ public class CommandWorldManager 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")) {
@@ -244,8 +234,6 @@ public class CommandWorldManager implements DecreeExecutor {
} }
} }
} }
IrisDimension dim; IrisDimension dim;
if (id == null || id.isEmpty()) { if (id == null || id.isEmpty()) {
dim = IrisData.loadAnyDimension(IrisSettings.get().getGenerator().getDefaultWorldType()); dim = IrisData.loadAnyDimension(IrisSettings.get().getGenerator().getDefaultWorldType());
@@ -266,9 +254,7 @@ public class CommandWorldManager implements DecreeExecutor {
Iris.info("Resolved missing dimension, proceeding with generation."); Iris.info("Resolved missing dimension, proceeding with generation.");
} }
} }
Iris.debug("Assuming IrisDimension: " + dim.getName()); Iris.debug("Assuming IrisDimension: " + dim.getName());
IrisWorld w = IrisWorld.builder() IrisWorld w = IrisWorld.builder()
.name(worldName) .name(worldName)
.seed(1337) .seed(1337)
@@ -277,15 +263,12 @@ public class CommandWorldManager implements DecreeExecutor {
.minHeight(dim.getMinHeight()) .minHeight(dim.getMinHeight())
.maxHeight(dim.getMaxHeight()) .maxHeight(dim.getMaxHeight())
.build(); .build();
Iris.debug("Generator Config: " + w.toString()); Iris.debug("Generator Config: " + w.toString());
File ff = new File(w.worldFolder(), "iris/pack"); File ff = new File(w.worldFolder(), "iris/pack");
if (!ff.exists() || ff.listFiles().length == 0) { if (!ff.exists() || ff.listFiles().length == 0) {
ff.mkdirs(); ff.mkdirs();
service(StudioSVC.class).installIntoWorld(sender, dim.getLoadKey(), ff.getParentFile()); service(StudioSVC.class).installIntoWorld(sender, dim.getLoadKey(), ff.getParentFile());
} }
return new BukkitChunkGenerator(w, false, ff, dim.getLoadKey()); return new BukkitChunkGenerator(w, false, ff, dim.getLoadKey());
} }
} }
@@ -7,7 +7,7 @@ public class IrisSafeguard {
public static boolean unstablemode = false; public static boolean unstablemode = false;
public static void IrisSafeguardSystem() { public static void IrisSafeguardSystem() {
Iris.info("Enabled Iris SafeGuard"); Iris.info("Enabled Iris SafeGuard");
ServerBoot.bootcheck(); ServerBoot.BootCheck();
} }
} }
@@ -1,5 +1,4 @@
package com.volmit.iris.engine.safeguard; package com.volmit.iris.engine.safeguard;
public class SafeguardUtils { public class SafeguardUtils {
public static void resetdatapacks(){ public static void resetdatapacks(){
@@ -20,7 +20,7 @@ public class ServerBoot {
public static boolean passedserversoftware = true; public static boolean passedserversoftware = true;
protected static byte count; protected static byte count;
public static void bootcheck() { public static void BootCheck() {
Iris.info("Checking for possible conflicts.."); Iris.info("Checking for possible conflicts..");
org.bukkit.plugin.PluginManager pluginManager = Bukkit.getPluginManager(); org.bukkit.plugin.PluginManager pluginManager = Bukkit.getPluginManager();
Plugin[] plugins = pluginManager.getPlugins(); Plugin[] plugins = pluginManager.getPlugins();
@@ -74,20 +74,20 @@ public class ServerBoot {
Iris.safeguard(pluginList.toString()); Iris.safeguard(pluginList.toString());
} }
public static void unstablemode(){ public static void UnstableMode(){
if (unstablemode) { if (unstablemode) {
Iris.safeguard(C.DARK_RED + "Iris is running in Unstable Mode"); Iris.safeguard(C.DARK_RED + "Iris is running in Unstable Mode");
} else { } else {
Iris.safeguard(C.BLUE + "Iris is running Stable"); Iris.safeguard(C.BLUE + "Iris is running Stable");
} }
} }
public static void supportedserversoftware(){ public static void SupportedServerSoftware(){
if (!passedserversoftware) { if (!passedserversoftware) {
Iris.safeguard(C.DARK_RED + "Server is running unsupported server software"); Iris.safeguard(C.DARK_RED + "Server is running unsupported server software");
Iris.safeguard(C.RED + "Supported: Purpur, Pufferfish, Paper, Spigot, Bukkit"); Iris.safeguard(C.RED + "Supported: Purpur, Pufferfish, Paper, Spigot, Bukkit");
} }
} }
public static void incompatiblepluginset(){ public static void printincompatiblepluginWarnings(){
if (safeguardPassed) { if (safeguardPassed) {
Iris.safeguard(C.BLUE + "0 Conflicts found"); Iris.safeguard(C.BLUE + "0 Conflicts found");