From 5fa564969e8a9e0ae8e92a44d73e0020ffd091b0 Mon Sep 17 00:00:00 2001 From: RePixelatedMC Date: Sat, 28 Oct 2023 20:51:32 +0200 Subject: [PATCH] Added cmd to see what is causing the instability --- .../iris/core/commands/CommandIris.java | 28 +++++++++++++++++-- .../iris/engine/safeguard/ServerBootSFG.java | 15 ++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/volmit/iris/core/commands/CommandIris.java b/core/src/main/java/com/volmit/iris/core/commands/CommandIris.java index eb3e12ac5..f4f6e88eb 100644 --- a/core/src/main/java/com/volmit/iris/core/commands/CommandIris.java +++ b/core/src/main/java/com/volmit/iris/core/commands/CommandIris.java @@ -46,9 +46,11 @@ import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.World; +import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; +import java.io.Console; import java.io.File; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -86,7 +88,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 + "----------------------------------------------------------------"); sender().sendMessage(C.RED + "Command ran: /iris create"); - sender().sendMessage(C.RED + ServerBootSFG.MSGIncompatiblePluginWarnings()); + sender().sendMessage(C.RED + ServerBootSFG.MSGIncompatibleWarnings()); sender().sendMessage(C.RED + "----------------------------------------------------------------"); } if (unstablemode && !multiverse) { @@ -94,7 +96,7 @@ public class CommandIris implements DecreeExecutor { sender().sendMessage(C.RED + "Please rectify this problem to avoid further complications."); sender().sendMessage(C.RED + "----------------------------------------------------------------"); sender().sendMessage(C.RED + "Command ran: /iris create"); - sender().sendMessage(C.RED + ServerBootSFG.MSGIncompatiblePluginWarnings()); + sender().sendMessage(C.RED + ServerBootSFG.MSGIncompatibleWarnings()); sender().sendMessage(C.RED + "----------------------------------------------------------------"); } } @@ -179,6 +181,28 @@ public class CommandIris implements DecreeExecutor { IrisPackBenchmarking.runBenchmark(); } + @Decree(description = "Benchmark a pack", origin = DecreeOrigin.CONSOLE) + public void fixunstable() throws InterruptedException { + if (unstablemode){ + if (sender() instanceof Player) { // todo: fix this being always false + sender().sendMessage(C.RED + "Your server is experiencing an incompatibility with the Iris plugin."); + sender().sendMessage(C.RED + "Please rectify this problem to avoid further complications."); + sender().sendMessage(C.RED + "----------------------------------------------------------------"); + sender().sendMessage(C.RED + "Command ran: /iris fixunstable"); + sender().sendMessage(C.RED + "Server Issues: " + C.DARK_RED + ServerBootSFG.MSGIncompatibleWarnings()); + sender().sendMessage(C.RED + "----------------------------------------------------------------"); + } + Iris.info(C.RED + "Your server is experiencing an incompatibility with the Iris plugin."); + Iris.info(C.RED + "Please rectify this problem to avoid further complications."); + Iris.info(C.RED + "----------------------------------------------------------------"); + Iris.info(C.RED + "Command ran: /iris fixunstable"); + ServerBootSFG.printIncompatiblePluginWarnings(); + Iris.info(C.RED + "----------------------------------------------------------------"); + } else { + Iris.info(C.BLUE + "Iris is running stable.."); + sender().sendMessage("Iris is running stable.."); + } + } @Decree(description = "Print world height information", origin = DecreeOrigin.PLAYER) public void height() { diff --git a/core/src/main/java/com/volmit/iris/engine/safeguard/ServerBootSFG.java b/core/src/main/java/com/volmit/iris/engine/safeguard/ServerBootSFG.java index 2e82d77f6..a2b517cc4 100644 --- a/core/src/main/java/com/volmit/iris/engine/safeguard/ServerBootSFG.java +++ b/core/src/main/java/com/volmit/iris/engine/safeguard/ServerBootSFG.java @@ -121,12 +121,11 @@ public class ServerBootSFG { Iris.safeguard(C.RED + "Unsupported Server Software"); Iris.safeguard(C.RED + "- Please consider using Paper or Purpur instead."); - // todo Add a cmd to show all issues? } } } - public static String MSGIncompatiblePluginWarnings(){ + public static String MSGIncompatibleWarnings(){ StringBuilder stringBuilder = new StringBuilder(); List incompatibleList = new ArrayList<>(); @@ -151,6 +150,18 @@ public class ServerBootSFG { stringBuilder.append(incompatibility4).append(", "); incompatibleList.add(incompatibility4); + } + if(unsuportedversion){ + String incompatibility5 = "Server Version"; + stringBuilder.append(incompatibility5).append(", "); + incompatibleList.add(incompatibility5); + + } + if(!passedserversoftware){ + String incompatibility6 = "Server Software"; + stringBuilder.append(incompatibility6).append(", "); + incompatibleList.add(incompatibility6); + } String MSGIncompatiblePlugins = stringBuilder.toString();