mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Autoconfigure iris first time startup
This commit is contained in:
parent
c744f761a1
commit
d4f26577a5
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris;
|
package com.volmit.iris;
|
||||||
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.ServerConfigurator;
|
||||||
import com.volmit.iris.core.link.IrisPapiExpansion;
|
import com.volmit.iris.core.link.IrisPapiExpansion;
|
||||||
import com.volmit.iris.core.link.MultiverseCoreLink;
|
import com.volmit.iris.core.link.MultiverseCoreLink;
|
||||||
import com.volmit.iris.core.link.MythicMobsLink;
|
import com.volmit.iris.core.link.MythicMobsLink;
|
||||||
@ -237,6 +238,8 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) {
|
while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) {
|
||||||
fileOutputStream.write(dataBuffer, 0, bytesRead);
|
fileOutputStream.write(dataBuffer, 0, bytesRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fileOutputStream.flush();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
@ -405,7 +408,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
initialize("com.volmit.iris.core.service").forEach((i) -> services.put((Class<? extends IrisService>) i.getClass(), (IrisService) i));
|
initialize("com.volmit.iris.core.service").forEach((i) -> services.put((Class<? extends IrisService>) i.getClass(), (IrisService) i));
|
||||||
INMS.get();
|
INMS.get();
|
||||||
IO.delete(new File("iris"));
|
IO.delete(new File("iris"));
|
||||||
installDataPacks();
|
|
||||||
fixShading();
|
fixShading();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +447,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
J.ar(this::checkConfigHotload, 60);
|
J.ar(this::checkConfigHotload, 60);
|
||||||
J.sr(this::tickQueue, 0);
|
J.sr(this::tickQueue, 0);
|
||||||
J.s(this::setupPapi);
|
J.s(this::setupPapi);
|
||||||
J.a(this::verifyDataPacksPost, 20);
|
J.a(ServerConfigurator::configure, 20);
|
||||||
splash();
|
splash();
|
||||||
|
|
||||||
if (IrisSettings.get().getStudio().isAutoStartDefaultStudio()) {
|
if (IrisSettings.get().getStudio().isAutoStartDefaultStudio()) {
|
||||||
@ -494,72 +496,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getDatapacksFolder() {
|
|
||||||
if (!IrisSettings.get().getGeneral().forceMainWorld.isEmpty()) {
|
|
||||||
return new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks");
|
|
||||||
}
|
|
||||||
|
|
||||||
File props = new File("server.properties");
|
|
||||||
|
|
||||||
if (props.exists()) {
|
|
||||||
try {
|
|
||||||
KList<String> m = new KList<>(IO.readAll(props).split("\\Q\n\\E"));
|
|
||||||
|
|
||||||
for (String i : m) {
|
|
||||||
if (i.trim().startsWith("level-name=")) {
|
|
||||||
return new File(i.trim().split("\\Q=\\E")[1] + "/datapacks");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void installDataPacks() {
|
|
||||||
Iris.info("Checking Data Packs...");
|
|
||||||
boolean reboot = false;
|
|
||||||
File packs = new File("plugins/Iris/packs");
|
|
||||||
File dpacks = getDatapacksFolder();
|
|
||||||
|
|
||||||
if (dpacks == null) {
|
|
||||||
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (packs.exists()) {
|
|
||||||
for (File i : packs.listFiles()) {
|
|
||||||
if (i.isDirectory()) {
|
|
||||||
Iris.verbose("Checking Pack: " + i.getPath());
|
|
||||||
IrisData data = IrisData.get(i);
|
|
||||||
File dims = new File(i, "dimensions");
|
|
||||||
|
|
||||||
if (dims.exists()) {
|
|
||||||
for (File j : dims.listFiles()) {
|
|
||||||
if (j.getName().endsWith(".json")) {
|
|
||||||
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
|
|
||||||
|
|
||||||
if (dim == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath());
|
|
||||||
if (dim.installDataPack(() -> data, dpacks)) {
|
|
||||||
reboot = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.info("Data Packs Setup!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
|
|
||||||
@ -609,104 +545,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verifyDataPacksPost() {
|
|
||||||
File packs = new File("plugins/Iris/packs");
|
|
||||||
File dpacks = getDatapacksFolder();
|
|
||||||
|
|
||||||
if (dpacks == null) {
|
|
||||||
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean bad = false;
|
|
||||||
if (packs.exists()) {
|
|
||||||
for (File i : packs.listFiles()) {
|
|
||||||
if (i.isDirectory()) {
|
|
||||||
Iris.verbose("Checking Pack: " + i.getPath());
|
|
||||||
IrisData data = IrisData.get(i);
|
|
||||||
File dims = new File(i, "dimensions");
|
|
||||||
|
|
||||||
if (dims.exists()) {
|
|
||||||
for (File j : dims.listFiles()) {
|
|
||||||
if (j.getName().endsWith(".json")) {
|
|
||||||
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
|
|
||||||
|
|
||||||
if (dim == null) {
|
|
||||||
Iris.error("Failed to load " + j.getPath() + " ");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!verifyDataPackInstalled(dim)) {
|
|
||||||
bad = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bad && INMS.get().supportsDataPacks()) {
|
|
||||||
Iris.error("============================================================================");
|
|
||||||
Iris.error(C.ITALIC + "You need to restart your server to properly generate custom biomes.");
|
|
||||||
Iris.error(C.ITALIC + "By continuing, Iris will use backup biomes in place of the custom biomes.");
|
|
||||||
Iris.error("----------------------------------------------------------------------------");
|
|
||||||
Iris.error(C.UNDERLINE + "IT IS HIGHLY RECOMMENDED YOU RESTART THE SERVER BEFORE GENERATING!");
|
|
||||||
Iris.error("============================================================================");
|
|
||||||
|
|
||||||
for (Player i : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (i.isOp() || i.hasPermission("iris.all")) {
|
|
||||||
VolmitSender sender = new VolmitSender(i, getTag("WARNING"));
|
|
||||||
sender.sendMessage("There are some Iris Packs that have custom biomes in them");
|
|
||||||
sender.sendMessage("You need to restart your server to use these packs.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
J.sleep(3000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verifyDataPackInstalled(IrisDimension dimension) {
|
|
||||||
IrisData idm = IrisData.get(getDataFolder("packs", dimension.getLoadKey()));
|
|
||||||
KSet<String> keys = new KSet<>();
|
|
||||||
boolean warn = false;
|
|
||||||
|
|
||||||
for (IrisBiome i : dimension.getAllBiomes(() -> idm)) {
|
|
||||||
if (i.isCustom()) {
|
|
||||||
for (IrisBiomeCustom j : i.getCustomDerivitives()) {
|
|
||||||
keys.add(dimension.getLoadKey() + ":" + j.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!INMS.get().supportsDataPacks()) {
|
|
||||||
if (!keys.isEmpty()) {
|
|
||||||
Iris.warn("===================================================================================");
|
|
||||||
Iris.warn("Pack " + dimension.getLoadKey() + " has " + keys.size() + " custom biome(s). ");
|
|
||||||
Iris.warn("Your server version does not yet support datapacks for iris.");
|
|
||||||
Iris.warn("The world will generate these biomes as backup biomes.");
|
|
||||||
Iris.warn("====================================================================================");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String i : keys) {
|
|
||||||
Object o = INMS.get().getCustomBiomeBaseFor(i);
|
|
||||||
|
|
||||||
if (o == null) {
|
|
||||||
Iris.warn("The Biome " + i + " is not registered on the server.");
|
|
||||||
warn = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (warn) {
|
|
||||||
Iris.error("The Pack " + dimension.getLoadKey() + " is INCAPABLE of generating custom biomes, restart your server before generating with this pack!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return !warn;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
return super.onCommand(sender, command, label, args);
|
return super.onCommand(sender, command, label, args);
|
||||||
|
@ -35,6 +35,7 @@ public class IrisSettings {
|
|||||||
public static transient IrisSettings settings;
|
public static transient IrisSettings settings;
|
||||||
private IrisSettingsGeneral general = new IrisSettingsGeneral();
|
private IrisSettingsGeneral general = new IrisSettingsGeneral();
|
||||||
private IrisSettingsGUI gui = new IrisSettingsGUI();
|
private IrisSettingsGUI gui = new IrisSettingsGUI();
|
||||||
|
private IrisSettingsAutoconfiguration autoConfiguration = new IrisSettingsAutoconfiguration();
|
||||||
private IrisSettingsGenerator generator = new IrisSettingsGenerator();
|
private IrisSettingsGenerator generator = new IrisSettingsGenerator();
|
||||||
private IrisSettingsConcurrency concurrency = new IrisSettingsConcurrency();
|
private IrisSettingsConcurrency concurrency = new IrisSettingsConcurrency();
|
||||||
private IrisSettingsStudio studio = new IrisSettingsStudio();
|
private IrisSettingsStudio studio = new IrisSettingsStudio();
|
||||||
@ -48,6 +49,13 @@ public class IrisSettings {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class IrisSettingsAutoconfiguration {
|
||||||
|
public boolean configureSpigotTimeoutTime = true;
|
||||||
|
public boolean configurePaperWatchdogDelay = true;
|
||||||
|
public boolean autoRestartOnCustomBiomeInstall = true;
|
||||||
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class IrisSettingsConcurrency {
|
public static class IrisSettingsConcurrency {
|
||||||
public int parallelism = -1;
|
public int parallelism = -1;
|
||||||
|
@ -16,32 +16,63 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.volmit.iris.util.plugin;
|
package com.volmit.iris.core;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
|
import com.volmit.iris.core.nms.INMS;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiomeCustom;
|
||||||
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
|
import com.volmit.iris.util.collection.KList;
|
||||||
|
import com.volmit.iris.util.collection.KSet;
|
||||||
|
import com.volmit.iris.util.format.C;
|
||||||
|
import com.volmit.iris.util.io.IO;
|
||||||
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
|
import com.volmit.iris.util.scheduling.J;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class ServerConfigurator {
|
public class ServerConfigurator {
|
||||||
public void increaseKeepAliveSpigot() throws IOException, InvalidConfigurationException {
|
public static void configure()
|
||||||
|
{
|
||||||
|
IrisSettings.IrisSettingsAutoconfiguration s = IrisSettings.get().getAutoConfiguration();
|
||||||
|
if(s.isConfigureSpigotTimeoutTime())
|
||||||
|
{
|
||||||
|
J.attempt(ServerConfigurator::increaseKeepAliveSpigot);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(s.isConfigurePaperWatchdogDelay())
|
||||||
|
{
|
||||||
|
J.attempt(ServerConfigurator::increasePaperWatchdog);
|
||||||
|
}
|
||||||
|
|
||||||
|
installDataPacks(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void increaseKeepAliveSpigot() throws IOException, InvalidConfigurationException {
|
||||||
File spigotConfig = new File("spigot.yml");
|
File spigotConfig = new File("spigot.yml");
|
||||||
FileConfiguration f = new YamlConfiguration();
|
FileConfiguration f = new YamlConfiguration();
|
||||||
f.load(spigotConfig);
|
f.load(spigotConfig);
|
||||||
long tt = f.getLong("settings.timeout-time");
|
long tt = f.getLong("settings.timeout-time");
|
||||||
|
|
||||||
if(tt < TimeUnit.MINUTES.toMillis(7))
|
if(tt < TimeUnit.MINUTES.toSeconds(5))
|
||||||
{
|
{
|
||||||
Iris.warn("Updating spigot.yml timeout-time: " + tt + " -> " + TimeUnit.MINUTES.toMillis(5) + " (5 minutes). You can disable this change (autoconfigureServer) in Iris settings, then change back the value.");
|
Iris.warn("Updating spigot.yml timeout-time: " + tt + " -> " + TimeUnit.MINUTES.toSeconds(5) + " (5 minutes). You can disable this change (autoconfigureServer) in Iris settings, then change back the value.");
|
||||||
|
f.set("settings.timeout-time", TimeUnit.MINUTES.toSeconds(5));
|
||||||
|
f.save(spigotConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void increasePaperWatchdog() throws IOException, InvalidConfigurationException {
|
private static void increasePaperWatchdog() throws IOException, InvalidConfigurationException {
|
||||||
File spigotConfig = new File("spigot.yml");
|
File spigotConfig = new File("paper.yml");
|
||||||
FileConfiguration f = new YamlConfiguration();
|
FileConfiguration f = new YamlConfiguration();
|
||||||
f.load(spigotConfig);
|
f.load(spigotConfig);
|
||||||
long tt = f.getLong("settings.watchdog.early-warning-delay");
|
long tt = f.getLong("settings.watchdog.early-warning-delay");
|
||||||
@ -49,6 +80,197 @@ public class ServerConfigurator {
|
|||||||
if(tt < TimeUnit.MINUTES.toMillis(3))
|
if(tt < TimeUnit.MINUTES.toMillis(3))
|
||||||
{
|
{
|
||||||
Iris.warn("Updating paper.yml watchdog early-warning-delay: " + tt + " -> " + TimeUnit.MINUTES.toMillis(3) + " (3 minutes). You can disable this change (autoconfigureServer) in Iris settings, then change back the value.");
|
Iris.warn("Updating paper.yml watchdog early-warning-delay: " + tt + " -> " + TimeUnit.MINUTES.toMillis(3) + " (3 minutes). You can disable this change (autoconfigureServer) in Iris settings, then change back the value.");
|
||||||
|
f.set("settings.watchdog.early-warning-delay", TimeUnit.MINUTES.toMillis(3));
|
||||||
|
f.save(spigotConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static File getDatapacksFolder() {
|
||||||
|
if (!IrisSettings.get().getGeneral().forceMainWorld.isEmpty()) {
|
||||||
|
return new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks");
|
||||||
|
}
|
||||||
|
|
||||||
|
File props = new File("server.properties");
|
||||||
|
|
||||||
|
if (props.exists()) {
|
||||||
|
try {
|
||||||
|
KList<String> m = new KList<>(IO.readAll(props).split("\\Q\n\\E"));
|
||||||
|
|
||||||
|
for (String i : m) {
|
||||||
|
if (i.trim().startsWith("level-name=")) {
|
||||||
|
return new File(i.trim().split("\\Q=\\E")[1] + "/datapacks");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void installDataPacks(boolean fullInstall)
|
||||||
|
{
|
||||||
|
Iris.info("Checking Data Packs...");
|
||||||
|
boolean reboot = false;
|
||||||
|
File packs = new File("plugins/Iris/packs");
|
||||||
|
File dpacks = getDatapacksFolder();
|
||||||
|
|
||||||
|
if (dpacks == null) {
|
||||||
|
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packs.exists()) {
|
||||||
|
for (File i : packs.listFiles()) {
|
||||||
|
if (i.isDirectory()) {
|
||||||
|
Iris.verbose("Checking Pack: " + i.getPath());
|
||||||
|
IrisData data = IrisData.get(i);
|
||||||
|
File dims = new File(i, "dimensions");
|
||||||
|
|
||||||
|
if (dims.exists()) {
|
||||||
|
for (File j : dims.listFiles()) {
|
||||||
|
if (j.getName().endsWith(".json")) {
|
||||||
|
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
|
||||||
|
|
||||||
|
if (dim == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath());
|
||||||
|
if (dim.installDataPack(() -> data, dpacks)) {
|
||||||
|
reboot = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Iris.info("Data Packs Setup!");
|
||||||
|
|
||||||
|
if(fullInstall)
|
||||||
|
{
|
||||||
|
verifyDataPacksPost(IrisSettings.get().getAutoConfiguration().isAutoRestartOnCustomBiomeInstall());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void verifyDataPacksPost(boolean allowRestarting) {
|
||||||
|
File packs = new File("plugins/Iris/packs");
|
||||||
|
File dpacks = getDatapacksFolder();
|
||||||
|
|
||||||
|
if (dpacks == null) {
|
||||||
|
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean bad = false;
|
||||||
|
if (packs.exists()) {
|
||||||
|
for (File i : packs.listFiles()) {
|
||||||
|
if (i.isDirectory()) {
|
||||||
|
Iris.verbose("Checking Pack: " + i.getPath());
|
||||||
|
IrisData data = IrisData.get(i);
|
||||||
|
File dims = new File(i, "dimensions");
|
||||||
|
|
||||||
|
if (dims.exists()) {
|
||||||
|
for (File j : dims.listFiles()) {
|
||||||
|
if (j.getName().endsWith(".json")) {
|
||||||
|
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
|
||||||
|
|
||||||
|
if (dim == null) {
|
||||||
|
Iris.error("Failed to load " + j.getPath() + " ");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!verifyDataPackInstalled(dim)) {
|
||||||
|
bad = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bad)
|
||||||
|
{
|
||||||
|
if(allowRestarting)
|
||||||
|
{
|
||||||
|
restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (INMS.get().supportsDataPacks()) {
|
||||||
|
Iris.error("============================================================================");
|
||||||
|
Iris.error(C.ITALIC + "You need to restart your server to properly generate custom biomes.");
|
||||||
|
Iris.error(C.ITALIC + "By continuing, Iris will use backup biomes in place of the custom biomes.");
|
||||||
|
Iris.error("----------------------------------------------------------------------------");
|
||||||
|
Iris.error(C.UNDERLINE + "IT IS HIGHLY RECOMMENDED YOU RESTART THE SERVER BEFORE GENERATING!");
|
||||||
|
Iris.error("============================================================================");
|
||||||
|
|
||||||
|
for (Player i : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (i.isOp() || i.hasPermission("iris.all")) {
|
||||||
|
VolmitSender sender = new VolmitSender(i, Iris.instance.getTag("WARNING"));
|
||||||
|
sender.sendMessage("There are some Iris Packs that have custom biomes in them");
|
||||||
|
sender.sendMessage("You need to restart your server to use these packs.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
J.sleep(3000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void restart() {
|
||||||
|
J.s(() -> {
|
||||||
|
Iris.warn("New data pack entries have been installed in Iris! Restarting server! (You can disable this auto restart in iris settings). This will only happen when your pack changes (updates/first time setup)");
|
||||||
|
J.s(() -> {
|
||||||
|
Iris.warn("Looks like the restart command diddn't work. Stopping the server instead!");
|
||||||
|
Bukkit.shutdown();
|
||||||
|
}, 100);
|
||||||
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "restart");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean verifyDataPackInstalled(IrisDimension dimension) {
|
||||||
|
IrisData idm = IrisData.get(Iris.instance.getDataFolder("packs", dimension.getLoadKey()));
|
||||||
|
KSet<String> keys = new KSet<>();
|
||||||
|
boolean warn = false;
|
||||||
|
|
||||||
|
for (IrisBiome i : dimension.getAllBiomes(() -> idm)) {
|
||||||
|
if (i.isCustom()) {
|
||||||
|
for (IrisBiomeCustom j : i.getCustomDerivitives()) {
|
||||||
|
keys.add(dimension.getLoadKey() + ":" + j.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!INMS.get().supportsDataPacks()) {
|
||||||
|
if (!keys.isEmpty()) {
|
||||||
|
Iris.warn("===================================================================================");
|
||||||
|
Iris.warn("Pack " + dimension.getLoadKey() + " has " + keys.size() + " custom biome(s). ");
|
||||||
|
Iris.warn("Your server version does not yet support datapacks for iris.");
|
||||||
|
Iris.warn("The world will generate these biomes as backup biomes.");
|
||||||
|
Iris.warn("====================================================================================");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String i : keys) {
|
||||||
|
Object o = INMS.get().getCustomBiomeBaseFor(i);
|
||||||
|
|
||||||
|
if (o == null) {
|
||||||
|
Iris.warn("The Biome " + i + " is not registered on the server.");
|
||||||
|
warn = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warn) {
|
||||||
|
Iris.error("The Pack " + dimension.getLoadKey() + " is INCAPABLE of generating custom biomes, restart your server before generating with this pack!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return !warn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import com.google.gson.Gson;
|
|||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
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.pack.IrisPack;
|
import com.volmit.iris.core.pack.IrisPack;
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
import com.volmit.iris.core.project.IrisProject;
|
||||||
@ -285,8 +286,7 @@ public class StudioSVC implements IrisService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage("Successfully Aquired " + d.getName());
|
sender.sendMessage("Successfully Aquired " + d.getName());
|
||||||
Iris.instance.installDataPacks();
|
ServerConfigurator.installDataPacks(true);
|
||||||
Iris.instance.verifyDataPacksPost();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public KMap<String, String> getListing(boolean cached) {
|
public KMap<String, String> getListing(boolean cached) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user