Add requested changes to PR

This commit is contained in:
Ender 2020-03-25 00:55:09 -05:00
parent ac8d1bf295
commit f8407eeb5a
3 changed files with 4 additions and 75 deletions

View file

@ -50,7 +50,7 @@ public class GeyserBootstrap implements IGeyserBootstrap {
public void onEnable() {
geyserLogger = new GeyserLogger();
Util.checkLoopback(geyserLogger);
LoopbackUtil.checkLoopback(geyserLogger);
try {
File configFile = FileUtils.fileOrCopiedFromResource("config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()));

View file

@ -5,9 +5,10 @@ import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Paths;
import org.geysermc.common.ChatColor;
import org.geysermc.platform.standalone.console.GeyserLogger;
public class Util {
public class LoopbackUtil {
private static final String checkExemption = "powershell -Command \"CheckNetIsolation LoopbackExempt -s\""; // Java's Exec feature runs as CMD, NetIsolation is only accessible from PowerShell.
private static final String loopbackCommand = "powershell -Command \"CheckNetIsolation LoopbackExempt -a -n='Microsoft.MinecraftUWP_8wekyb3d8bbwe'\"";
private static final String startScript = "powershell -Command \"Start-Process 'cmd' -ArgumentList /c,%temp%/loopback_minecraft.bat -Verb runAs\"";
@ -31,7 +32,7 @@ public class Util {
Files.write(Paths.get(System.getenv("temp") + "/loopback_minecraft.bat"), loopbackCommand.getBytes(), new OpenOption[0]);
process = Runtime.getRuntime().exec(startScript);
geyserLogger.warning("Added loopback exemption to Windows!");
geyserLogger.info(ChatColor.AQUA + "Added loopback exemption to Windows!");
}
} catch (Exception e) {
e.printStackTrace();