mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-02-16 02:20:44 +00:00
here crazy
This commit is contained in:
@@ -66,10 +66,7 @@ import io.papermc.lib.PaperLib;
|
||||
import lombok.Getter;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -100,6 +97,7 @@ import java.util.regex.Pattern;
|
||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.*;
|
||||
import static com.volmit.iris.core.safeguard.ServerBootSFG.passedserversoftware;
|
||||
import static com.volmit.iris.util.misc.getHardware.getCPUModel;
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
@SuppressWarnings("CanBeFinal")
|
||||
public class Iris extends VolmitPlugin implements Listener {
|
||||
@@ -124,6 +122,10 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
public Iris() {
|
||||
System.out.println("Hello!");
|
||||
}
|
||||
|
||||
private final KList<Runnable> postShutdown = new KList<>();
|
||||
private KMap<Class<? extends IrisService>, IrisService> services;
|
||||
|
||||
@@ -456,12 +458,13 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
}
|
||||
private void enable() {
|
||||
instance = this;
|
||||
boolean configured;
|
||||
services = new KMap<>();
|
||||
setupAudience();
|
||||
initialize("com.volmit.iris.core.service").forEach((i) -> services.put((Class<? extends IrisService>) i.getClass(), (IrisService) i));
|
||||
INMS.get();
|
||||
IO.delete(new File("iris"));
|
||||
IrisSafeguard.IrisSafeguardSystem();
|
||||
IrisSafeguardSystem();
|
||||
getSender().setTag(getTag());
|
||||
compat = IrisCompat.configured(getDataFile("compat.json"));
|
||||
linkMultiverseCore = new MultiverseCoreLink();
|
||||
@@ -469,6 +472,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
configWatcher = new FileWatcher(getDataFile("settings.json"));
|
||||
services.values().forEach(IrisService::onEnable);
|
||||
services.values().forEach(this::registerListener);
|
||||
configured = ServerConfigurator.postConfigure();
|
||||
J.s(() -> {
|
||||
J.a(() -> PaperLib.suggestPaper(this));
|
||||
J.a(() -> IO.delete(getTemp()));
|
||||
@@ -477,10 +481,9 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
J.ar(this::checkConfigHotload, 60);
|
||||
J.sr(this::tickQueue, 0);
|
||||
J.s(this::setupPapi);
|
||||
J.a(ServerConfigurator::configure, 20);
|
||||
if (!configured) J.a(ServerConfigurator::configure, 20);
|
||||
splash();
|
||||
UtilsSFG.splash();
|
||||
|
||||
autoStartStudio();
|
||||
checkForBukkitWorlds();
|
||||
IrisToolbelt.retainMantleDataForSlice(String.class.getCanonicalName());
|
||||
|
||||
@@ -31,16 +31,21 @@ import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class ServerConfigurator {
|
||||
public static void configure() {
|
||||
IrisSettings.IrisSettingsAutoconfiguration s = IrisSettings.get().getAutoConfiguration();
|
||||
@@ -55,6 +60,14 @@ public class ServerConfigurator {
|
||||
installDataPacks(true);
|
||||
}
|
||||
|
||||
public static boolean postConfigure() {
|
||||
if(postVerifyDataPacks(true)) {
|
||||
configure();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void increaseKeepAliveSpigot() throws IOException, InvalidConfigurationException {
|
||||
File spigotConfig = new File("config/spigot.yml");
|
||||
FileConfiguration f = new YamlConfiguration();
|
||||
@@ -91,6 +104,22 @@ public class ServerConfigurator {
|
||||
return worlds;
|
||||
}
|
||||
|
||||
private static boolean postVerifyDataPacks(boolean fast) {
|
||||
try {
|
||||
Properties prop = new Properties();
|
||||
prop.load(new FileInputStream("server.properties"));
|
||||
String world = prop.getProperty("level-name");
|
||||
File worldFolder = new File(Bukkit.getWorldContainer(), world);
|
||||
File datapacksFolder = new File(worldFolder, "datapacks");
|
||||
File IrisDatapacks = new File(datapacksFolder, "iris");
|
||||
if (!datapacksFolder.exists() || !IrisDatapacks.exists()) {
|
||||
return (true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void installDataPacks(boolean fullInstall) {
|
||||
Iris.info("Checking Data Packs...");
|
||||
|
||||
@@ -19,6 +19,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||
|
||||
public class IrisWorldDump {
|
||||
public static int Failed = 0;
|
||||
public static int Success = 0;
|
||||
private KList<MCAFile> mcaList;
|
||||
private World world;
|
||||
private File MCADirectory;
|
||||
@@ -65,18 +67,13 @@ public class IrisWorldDump {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
for (int y = 0; y < CHUNK_HEIGHT; y++) {
|
||||
CompoundTag tag = chunk.getBlockStateAt(x,y,z);
|
||||
int i1 = 0;
|
||||
// CompoundTag tag = chunk.getBlockStateAt(x,y,z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +90,8 @@ public class IrisWorldDump {
|
||||
int l = 0;
|
||||
int f = 0;
|
||||
for (File mca : MCADirectory.listFiles()) {
|
||||
// net.minecraft.world.level.chunk.PalettedContainer
|
||||
// take a look at the classes `net.minecraft.world.level.chunk.PalettedContainer` and `net.minecraft.world.level.chunk.storage.ChunkSerializer`
|
||||
if (mca.getName().endsWith(".mca")) {
|
||||
try {
|
||||
mcaFiles.add(MCAUtil.read(mca));
|
||||
@@ -108,6 +107,8 @@ public class IrisWorldDump {
|
||||
if (f > 0) {
|
||||
sender.sendMessage(C.RED +"Failed " + C.GRAY + "to load: " + f + " MCA Regions");
|
||||
}
|
||||
Iris.info("Successfull: " + Form.f(Success));
|
||||
Iris.info("Failed: " + Form.f(Failed));
|
||||
return mcaFiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@ package com.volmit.iris.util.nbt.mca;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.tools.IrisWorldDump;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.nbt.io.NBTDeserializer;
|
||||
import com.volmit.iris.util.nbt.io.NBTSerializer;
|
||||
import com.volmit.iris.util.nbt.io.NamedTag;
|
||||
@@ -57,6 +59,8 @@ public class Chunk {
|
||||
private ListTag<ListTag<?>> postProcessing;
|
||||
private String status;
|
||||
private CompoundTag structures;
|
||||
private int d;
|
||||
private int f;
|
||||
|
||||
Chunk(int lastMCAUpdate) {
|
||||
this.lastMCAUpdate = lastMCAUpdate;
|
||||
@@ -69,6 +73,8 @@ public class Chunk {
|
||||
*/
|
||||
public Chunk(CompoundTag data) {
|
||||
this.data = data;
|
||||
d = 0;
|
||||
f = 0;
|
||||
initReferences(ALL_DATA);
|
||||
setStatus("full");
|
||||
}
|
||||
@@ -156,11 +162,17 @@ public class Chunk {
|
||||
if (sectionIndex > 15 || sectionIndex < 0) {
|
||||
continue;
|
||||
}
|
||||
Section newSection = new Section(section, dataVersion, loadFlags);
|
||||
if (newSection.isEmpty()) {
|
||||
continue;
|
||||
try {
|
||||
Section newSection = new Section(section, dataVersion, loadFlags);
|
||||
if (newSection.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
sections.put(sectionIndex, newSection);
|
||||
IrisWorldDump.Success++;
|
||||
} catch (Exception e) {
|
||||
IrisWorldDump.Failed++;
|
||||
// e.printStackTrace();
|
||||
}
|
||||
sections.put(sectionIndex, newSection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user