This commit is contained in:
eaglercraft 2024-03-10 13:49:48 -07:00
parent af50d17c9a
commit aae277ed5d
20 changed files with 495 additions and 57 deletions

View File

@ -57,7 +57,7 @@ public class DesktopClientConfigAdapter implements IClientConfigAdapter {
} }
@Override @Override
public JSONObject dumpConfig() { public JSONObject getIntegratedServerOpts() {
return new JSONObject("{\"container\":null,\"worldsDB\":\"desktop\"}"); return new JSONObject("{\"container\":null,\"worldsDB\":\"desktop\"}");
} }

View File

@ -10,7 +10,7 @@ public class EaglercraftVersion {
/// Customize these to fit your fork: /// Customize these to fit your fork:
public static final String projectForkName = "EaglercraftX"; public static final String projectForkName = "EaglercraftX";
public static final String projectForkVersion = "u26"; public static final String projectForkVersion = "u27";
public static final String projectForkVendor = "lax1dude"; public static final String projectForkVendor = "lax1dude";
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
@ -20,7 +20,7 @@ public class EaglercraftVersion {
public static final String projectOriginName = "EaglercraftX"; public static final String projectOriginName = "EaglercraftX";
public static final String projectOriginAuthor = "lax1dude"; public static final String projectOriginAuthor = "lax1dude";
public static final String projectOriginRevision = "1.8"; public static final String projectOriginRevision = "1.8";
public static final String projectOriginVersion = "u26"; public static final String projectOriginVersion = "u27";
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
@ -31,7 +31,7 @@ public class EaglercraftVersion {
public static final boolean enableUpdateService = true; public static final boolean enableUpdateService = true;
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client"; public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
public static final int updateBundlePackageVersionInt = 26; public static final int updateBundlePackageVersionInt = 27;
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName; public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;

View File

@ -44,7 +44,7 @@ public interface IClientConfigAdapter {
String getResourcePacksDB(); String getResourcePacksDB();
JSONObject dumpConfig(); JSONObject getIntegratedServerOpts();
List<RelayEntry> getRelays(); List<RelayEntry> getRelays();

View File

@ -1,4 +1,4 @@
package net.minecraft.entity; package net.lax1dude.eaglercraft.v1_8.minecraft;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -1,8 +1,10 @@
package net.lax1dude.eaglercraft.v1_8.update; package net.lax1dude.eaglercraft.v1_8.update;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.EagRuntime;
@ -36,8 +38,30 @@ public class UpdateService {
private static UpdateCertificate latestUpdateFound = null; private static UpdateCertificate latestUpdateFound = null;
private static final Set<UpdateCertificate> availableUpdates = new HashSet(); private static final Set<UpdateCertificate> availableUpdates = new HashSet();
private static final Set<RawKnownCertHolder> fastUpdateKnownCheckSet = new HashSet();
private static final Set<UpdateCertificate> dismissedUpdates = new HashSet(); private static final Set<UpdateCertificate> dismissedUpdates = new HashSet();
private static class RawKnownCertHolder {
private final byte[] data;
private final int hashcode;
private final long age;
public RawKnownCertHolder(byte[] data) {
this.data = data;
this.hashcode = Arrays.hashCode(data);
this.age = System.currentTimeMillis();
}
public int hashCode() {
return hashcode;
}
public boolean equals(Object o) {
return o != null && (o == this || ((o instanceof RawKnownCertHolder) && Arrays.equals(((RawKnownCertHolder)o).data, data)));
}
}
public static boolean supported() { public static boolean supported() {
return EaglercraftVersion.enableUpdateService && EagRuntime.getConfiguration().allowUpdateSvc() && PlatformUpdateSvc.supported(); return EaglercraftVersion.enableUpdateService && EagRuntime.getConfiguration().allowUpdateSvc() && PlatformUpdateSvc.supported();
} }
@ -102,6 +126,16 @@ public class UpdateService {
if (EagRuntime.getConfiguration().allowUpdateDL()) { if (EagRuntime.getConfiguration().allowUpdateDL()) {
synchronized(availableUpdates) { synchronized(availableUpdates) {
try { try {
if(certificateData.length > 32767) {
throw new CertificateInvalidException("Certificate is too large! (" + certificateData.length + " bytes)");
}
if(!fastUpdateKnownCheckSet.add(new RawKnownCertHolder(certificateData))) {
if (EagRuntime.getConfiguration().isLogInvalidCerts()) {
logger.info("Ignoring {} byte certificate that has already been processed", certificateData.length);
}
freeMemory();
return;
}
UpdateCertificate cert = UpdateCertificate.parseAndVerifyCertificate(certificateData); UpdateCertificate cert = UpdateCertificate.parseAndVerifyCertificate(certificateData);
if (EaglercraftVersion.updateBundlePackageName.equalsIgnoreCase(cert.bundlePackageName)) { if (EaglercraftVersion.updateBundlePackageName.equalsIgnoreCase(cert.bundlePackageName)) {
if (myUpdateCert == null || !Arrays.equals(cert.bundleDataHash, myUpdateCert.bundleDataHash)) { if (myUpdateCert == null || !Arrays.equals(cert.bundleDataHash, myUpdateCert.bundleDataHash)) {
@ -140,6 +174,17 @@ public class UpdateService {
} }
} }
private static void freeMemory() {
if(fastUpdateKnownCheckSet.size() > 127) {
List<RawKnownCertHolder> lst = new ArrayList(fastUpdateKnownCheckSet);
fastUpdateKnownCheckSet.clear();
lst.sort((c1, c2) -> { return (int)(c2.age - c1.age); });
for(int i = 0; i < 64; ++i) {
fastUpdateKnownCheckSet.add(lst.get(i));
}
}
}
public static void startClientUpdateFrom(UpdateCertificate clientUpdate) { public static void startClientUpdateFrom(UpdateCertificate clientUpdate) {
PlatformUpdateSvc.startClientUpdateFrom(clientUpdate); PlatformUpdateSvc.startClientUpdateFrom(clientUpdate);
} }

View File

@ -17,6 +17,7 @@ import net.lax1dude.eaglercraft.v1_8.EaglercraftSoundManager;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.lax1dude.eaglercraft.v1_8.IOUtils; import net.lax1dude.eaglercraft.v1_8.IOUtils;
import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
import net.lax1dude.eaglercraft.v1_8.json.JSONTypeProvider; import net.lax1dude.eaglercraft.v1_8.json.JSONTypeProvider;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger; import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
@ -266,7 +267,7 @@ public class SoundHandler implements IResourceManagerReloadListener, ITickable {
if (arraylist.isEmpty()) { if (arraylist.isEmpty()) {
return null; return null;
} else { } else {
return (SoundEventAccessorComposite) arraylist.get((new EaglercraftRandom()).nextInt(arraylist.size())); return (SoundEventAccessorComposite) arraylist.get(ThreadLocalRandom.current().nextInt(arraylist.size()));
} }
} }

View File

@ -9,6 +9,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.HString; import net.lax1dude.eaglercraft.v1_8.HString;
import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -115,7 +116,7 @@ public class CommandSpreadPlayers extends CommandBase {
private void func_110669_a(ICommandSender worldIn, List<Entity> parList, CommandSpreadPlayers.Position parPosition, private void func_110669_a(ICommandSender worldIn, List<Entity> parList, CommandSpreadPlayers.Position parPosition,
double parDouble1, double parDouble2, World parWorld, boolean parFlag) throws CommandException { double parDouble1, double parDouble2, World parWorld, boolean parFlag) throws CommandException {
EaglercraftRandom random = new EaglercraftRandom(); EaglercraftRandom random = ThreadLocalRandom.current();
double d0 = parPosition.field_111101_a - parDouble2; double d0 = parPosition.field_111101_a - parDouble2;
double d1 = parPosition.field_111100_b - parDouble2; double d1 = parPosition.field_111100_b - parDouble2;
double d2 = parPosition.field_111101_a + parDouble2; double d2 = parPosition.field_111101_a + parDouble2;

View File

@ -2,6 +2,7 @@ package net.minecraft.command;
import java.util.List; import java.util.List;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
@ -55,7 +56,7 @@ public class CommandWeather extends CommandBase {
*/ */
public void processCommand(ICommandSender parICommandSender, String[] parArrayOfString) throws CommandException { public void processCommand(ICommandSender parICommandSender, String[] parArrayOfString) throws CommandException {
if (parArrayOfString.length >= 1 && parArrayOfString.length <= 2) { if (parArrayOfString.length >= 1 && parArrayOfString.length <= 2) {
int i = (300 + (new EaglercraftRandom()).nextInt(600)) * 20 * 2; int i = (300 + ThreadLocalRandom.current().nextInt(600)) * 20 * 2;
if (parArrayOfString.length >= 2) { if (parArrayOfString.length >= 2) {
i = parseInt(parArrayOfString[1], 1, 1000000) * 20; i = parseInt(parArrayOfString[1], 1, 1000000) * 20;
} }

View File

@ -10,6 +10,7 @@ import com.google.common.collect.Maps;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger; import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.lax1dude.eaglercraft.v1_8.minecraft.EntityConstructor;
import net.minecraft.entity.ai.EntityMinecartMobSpawner; import net.minecraft.entity.ai.EntityMinecartMobSpawner;
import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.boss.EntityWither;

View File

@ -79,6 +79,10 @@ public abstract class EntityFireball extends Entity {
this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch);
this.setPosition(x, y, z); this.setPosition(x, y, z);
double d0 = (double) MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ); double d0 = (double) MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ);
if (d0 == 0.0) {
this.accelerationX = this.accelerationY = this.accelerationZ = 0.0D;
return;
}
this.accelerationX = accelX / d0 * 0.1D; this.accelerationX = accelX / d0 * 0.1D;
this.accelerationY = accelY / d0 * 0.1D; this.accelerationY = accelY / d0 * 0.1D;
this.accelerationZ = accelZ / d0 * 0.1D; this.accelerationZ = accelZ / d0 * 0.1D;
@ -95,6 +99,10 @@ public abstract class EntityFireball extends Entity {
accelY = accelY + this.rand.nextGaussian() * 0.4D; accelY = accelY + this.rand.nextGaussian() * 0.4D;
accelZ = accelZ + this.rand.nextGaussian() * 0.4D; accelZ = accelZ + this.rand.nextGaussian() * 0.4D;
double d0 = (double) MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ); double d0 = (double) MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ);
if (d0 == 0.0) {
this.accelerationX = this.accelerationY = this.accelerationZ = 0.0D;
return;
}
this.accelerationX = accelX / d0 * 0.1D; this.accelerationX = accelX / d0 * 0.1D;
this.accelerationY = accelY / d0 * 0.1D; this.accelerationY = accelY / d0 * 0.1D;
this.accelerationZ = accelZ / d0 * 0.1D; this.accelerationZ = accelZ / d0 * 0.1D;
@ -144,7 +152,7 @@ public abstract class EntityFireball extends Entity {
.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); .addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D; double d0 = 0.0D;
for (int i = 0; i < list.size(); ++i) { for (int i = 0, l = list.size(); i < l; ++i) {
Entity entity1 = (Entity) list.get(i); Entity entity1 = (Entity) list.get(i);
if (entity1.canBeCollidedWith() if (entity1.canBeCollidedWith()
&& (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) { && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) {

View File

@ -4,9 +4,7 @@ import java.io.PrintStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject;
import org.teavm.jso.JSBody; import org.teavm.jso.JSBody;
import org.teavm.jso.JSFunctor; import org.teavm.jso.JSFunctor;
import org.teavm.jso.JSObject; import org.teavm.jso.JSObject;
@ -22,6 +20,9 @@ import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion; import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformApplication; import net.lax1dude.eaglercraft.v1_8.internal.PlatformApplication;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime; import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsAssetsURI;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsAssetsURIsArray;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRoot;
import net.lax1dude.eaglercraft.v1_8.log4j.ILogRedirector; import net.lax1dude.eaglercraft.v1_8.log4j.ILogRedirector;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile; import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile;
@ -52,8 +53,6 @@ public class ClientMain {
return crashImage.substring(0); return crashImage.substring(0);
} }
private static String crashScreenOptsDump = null;
@JSBody(params = {}, script = "if((typeof window.__isEaglerX188Running === \"string\") && window.__isEaglerX188Running === \"yes\") return true; window.__isEaglerX188Running = \"yes\"; return false;") @JSBody(params = {}, script = "if((typeof window.__isEaglerX188Running === \"string\") && window.__isEaglerX188Running === \"yes\") return true; window.__isEaglerX188Running = \"yes\"; return false;")
private static native boolean getRunningFlag(); private static native boolean getRunningFlag();
@ -66,7 +65,7 @@ public class ClientMain {
} }
try { try {
systemOut.println("ClientMain: [INFO] eaglercraftx is starting..."); systemOut.println("ClientMain: [INFO] eaglercraftx is starting...");
String opts = getEaglerXOpts(); JSObject opts = getEaglerXOpts();
if(opts == null) { if(opts == null) {
systemErr.println("ClientMain: [ERROR] the \"window.eaglercraftXOpts\" variable is undefined"); systemErr.println("ClientMain: [ERROR] the \"window.eaglercraftXOpts\" variable is undefined");
@ -76,38 +75,40 @@ public class ClientMain {
} }
try { try {
JSONObject eaglercraftOpts = new JSONObject(opts); JSEaglercraftXOptsRoot eaglercraftOpts = (JSEaglercraftXOptsRoot)opts;
configRootElementId = eaglercraftOpts.getString("container"); configRootElementId = eaglercraftOpts.getContainer();
if(configRootElementId == null) {
throw new JSONException("window.eaglercraftXOpts.container is undefined!");
}
configRootElement = Window.current().getDocument().getElementById(configRootElementId); configRootElement = Window.current().getDocument().getElementById(configRootElementId);
Object epkConfig = eaglercraftOpts.get("assetsURI"); String epkSingleURL = eaglercraftOpts.getAssetsURI();
if(epkConfig instanceof JSONArray) { if(epkSingleURL != null) {
JSONArray epkConfigArr = (JSONArray)epkConfig; configEPKFiles = new EPKFileEntry[] { new EPKFileEntry(epkSingleURL, "") };
if(epkConfigArr.length() == 0) { }else {
JSEaglercraftXOptsAssetsURIsArray epkURLs = eaglercraftOpts.getAssetsURIArray();
int len = epkURLs.getLength();
if(len == 0) {
throw new JSONException("assetsURI array cannot be empty!"); throw new JSONException("assetsURI array cannot be empty!");
} }
configEPKFiles = new EPKFileEntry[epkConfigArr.length()]; configEPKFiles = new EPKFileEntry[len];
for(int i = 0, l = configEPKFiles.length; i < l; ++i) { for(int i = 0; i < len; ++i) {
configEPKFiles[i] = parseEntry(epkConfigArr.getJSONObject(i)); JSEaglercraftXOptsAssetsURI etr = epkURLs.get(i);
String url = etr.getURL();
if(url == null) {
throw new JSONException("assetsURI is missing a url!");
} }
}else if(epkConfig instanceof JSONObject) { configEPKFiles[i] = new EPKFileEntry(url, etr.getPath(""));
configEPKFiles = new EPKFileEntry[] { parseEntry((JSONObject)epkConfig) };
}else if(epkConfig instanceof String) {
String epkConfigStr = (String)epkConfig;
configEPKFiles = new EPKFileEntry[] { new EPKFileEntry(epkConfigStr, "") };
if(epkConfigStr.length() > 128) {
eaglercraftOpts.put("assetsURI", epkConfigStr.substring(0, 128) + " ... ");
} }
} }
configLocalesFolder = eaglercraftOpts.optString("localesURI", "lang"); configLocalesFolder = eaglercraftOpts.getLocalesURI("lang");
if(configLocalesFolder.endsWith("/")) { if(configLocalesFolder.endsWith("/")) {
configLocalesFolder = configLocalesFolder.substring(0, configLocalesFolder.length() - 1); configLocalesFolder = configLocalesFolder.substring(0, configLocalesFolder.length() - 1);
} }
((TeaVMClientConfigAdapter)TeaVMClientConfigAdapter.instance).loadJSON(eaglercraftOpts); ((TeaVMClientConfigAdapter)TeaVMClientConfigAdapter.instance).loadNative(eaglercraftOpts);
crashScreenOptsDump = eaglercraftOpts.toString();
systemOut.println("ClientMain: [INFO] configuration was successful"); systemOut.println("ClientMain: [INFO] configuration was successful");
}catch(Throwable t) { }catch(Throwable t) {
@ -192,9 +193,9 @@ public class ClientMain {
} }
@JSBody(params = {}, script = "if(typeof window.eaglercraftXOpts === \"undefined\") {return null;}" @JSBody(params = {}, script = "if(typeof window.eaglercraftXOpts === \"undefined\") {return null;}"
+ "else if(typeof window.eaglercraftXOpts === \"string\") {return window.eaglercraftXOpts;}" + "else if(typeof window.eaglercraftXOpts === \"string\") {return JSON.parse(window.eaglercraftXOpts);}"
+ "else {return JSON.stringify(window.eaglercraftXOpts);}") + "else {return window.eaglercraftXOpts;}")
private static native String getEaglerXOpts(); private static native JSObject getEaglerXOpts();
public static class EPKFileEntry { public static class EPKFileEntry {
@ -207,18 +208,6 @@ public class ClientMain {
} }
} }
private static EPKFileEntry parseEntry(JSONObject obj) {
String url = obj.getString("url");
String path = obj.optString("path", "");
if(url.length() > 128) {
obj.put("url", url.substring(0, 128) + " ... ");
}
if(path == null) {
path = "";
}
return new EPKFileEntry(url, path);
}
public static String configRootElementId = null; public static String configRootElementId = null;
public static HTMLElement configRootElement = null; public static HTMLElement configRootElement = null;
public static EPKFileEntry[] configEPKFiles = null; public static EPKFileEntry[] configEPKFiles = null;
@ -269,7 +258,7 @@ public class ClientMain {
str.append(addWebGLToCrash()); str.append(addWebGLToCrash());
str.append('\n'); str.append('\n');
str.append("window.eaglercraftXOpts = "); str.append("window.eaglercraftXOpts = ");
str.append(crashScreenOptsDump).append('\n'); str.append(TeaVMClientConfigAdapter.instance.toString()).append('\n');
str.append('\n'); str.append('\n');
str.append("currentTime = "); str.append("currentTime = ");
str.append(EagRuntime.fixDateFormat(new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z")).format(new Date())).append('\n'); str.append(EagRuntime.fixDateFormat(new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z")).format(new Date())).append('\n');

View File

@ -10,8 +10,15 @@ import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayManager; import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayManager;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapter; import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapter;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRelay;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRelaysArray;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRoot;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsServer;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsServersArray;
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayEntry; import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayEntry;
/** /**
@ -39,7 +46,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
private String serverToJoin = null; private String serverToJoin = null;
private String worldsDB = "worlds"; private String worldsDB = "worlds";
private String resourcePacksDB = "resourcePacks"; private String resourcePacksDB = "resourcePacks";
private JSONObject originalEaglercraftOpts; private JSONObject integratedServerOpts;
private boolean checkShaderGLErrors = false; private boolean checkShaderGLErrors = false;
private boolean demoMode = EaglercraftVersion.forceDemoMode; private boolean demoMode = EaglercraftVersion.forceDemoMode;
private boolean isAllowUpdateSvc = EaglercraftVersion.enableUpdateService; private boolean isAllowUpdateSvc = EaglercraftVersion.enableUpdateService;
@ -51,8 +58,92 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
private boolean checkRelaysForUpdates = false; private boolean checkRelaysForUpdates = false;
private boolean enableSignatureBadge = false; private boolean enableSignatureBadge = false;
public void loadNative(JSObject jsObject) {
integratedServerOpts = new JSONObject();
JSEaglercraftXOptsRoot eaglercraftXOpts = (JSEaglercraftXOptsRoot)jsObject;
defaultLocale = eaglercraftXOpts.getLang("en_US");
serverToJoin = eaglercraftXOpts.getJoinServer(null);
worldsDB = eaglercraftXOpts.getWorldsDB("worlds");
resourcePacksDB = eaglercraftXOpts.getResourcePacksDB("resourcePacks");
checkShaderGLErrors = eaglercraftXOpts.getCheckShaderGLErrors(false);
demoMode = EaglercraftVersion.forceDemoMode || eaglercraftXOpts.getDemoMode(false);
isAllowUpdateSvc = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getAllowUpdateSvc(true);
isAllowUpdateDL = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getAllowUpdateDL(true);
isEnableDownloadOfflineButton = eaglercraftXOpts.getEnableDownloadOfflineButton(true);
downloadOfflineButtonLink = eaglercraftXOpts.getDownloadOfflineButtonLink(null);
useSpecialCursors = eaglercraftXOpts.getHtml5CursorSupport(false);
logInvalidCerts = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getLogInvalidCerts(false);
enableSignatureBadge = eaglercraftXOpts.getEnableSignatureBadge(false);
integratedServerOpts.put("worldsDB", worldsDB);
integratedServerOpts.put("demoMode", demoMode);
integratedServerOpts.put("lang", defaultLocale);
integratedServerOpts.put("allowUpdateSvc", isAllowUpdateSvc);
integratedServerOpts.put("allowUpdateDL", isAllowUpdateDL);
JSEaglercraftXOptsServersArray serversArray = eaglercraftXOpts.getServers();
if(serversArray != null) {
for(int i = 0, l = serversArray.getLength(); i < l; ++i) {
JSEaglercraftXOptsServer serverEntry = serversArray.get(i);
String serverAddr = serverEntry.getAddr();
if(serverAddr != null) {
String serverName = serverEntry.getName("Default Server #" + i);
defaultServers.add(new DefaultServer(serverName, serverAddr));
}
}
}
JSEaglercraftXOptsRelaysArray relaysArray = eaglercraftXOpts.getRelays();
if(relaysArray != null) {
boolean gotAPrimary = false;
for(int i = 0, l = relaysArray.getLength(); i < l; ++i) {
JSEaglercraftXOptsRelay relay = relaysArray.get(i);
String addr = relay.getAddr();
if(addr != null) {
boolean p = relay.getPrimary();
if(p) {
if(gotAPrimary) {
p = false;
}else {
gotAPrimary = true;
}
}
relays.add(new RelayEntry(relay.getAddr(), relay.getComment("Default Relay #" + i), p));
}
}
}
boolean officialUpdates = !demoMode && EaglercraftVersion.updateBundlePackageName.equals("net.lax1dude.eaglercraft.v1_8.client");
if (relays.size() <= 0) {
int choice = ThreadLocalRandom.current().nextInt(3);
relays.add(new RelayEntry("wss://relay.deev.is/", "lax1dude relay #1", choice == 0));
relays.add(new RelayEntry("wss://relay.lax1dude.net/", "lax1dude relay #2", choice == 1));
relays.add(new RelayEntry("wss://relay.shhnowisnottheti.me/", "ayunami relay #1", choice == 2));
checkRelaysForUpdates = !demoMode && eaglercraftXOpts.getCheckRelaysForUpdates(officialUpdates);
}else {
if(officialUpdates) {
for(int i = 0, l = relays.size(); i < l; ++i) {
String addr = relays.get(i).address;
if(!addr.contains("deev.is") && !addr.contains("lax1dude.net") && !addr.contains("shhnowisnottheti.me")) {
officialUpdates = false;
break;
}
}
}
checkRelaysForUpdates = !demoMode && eaglercraftXOpts.getCheckRelaysForUpdates(officialUpdates);
}
RelayManager.relayManager.load(EagRuntime.getStorage("r"));
if (RelayManager.relayManager.count() <= 0) {
RelayManager.relayManager.loadDefaults();
RelayManager.relayManager.save();
}
}
public void loadJSON(JSONObject eaglercraftOpts) { public void loadJSON(JSONObject eaglercraftOpts) {
originalEaglercraftOpts = eaglercraftOpts; integratedServerOpts = eaglercraftOpts;
defaultLocale = eaglercraftOpts.optString("lang", "en_US"); defaultLocale = eaglercraftOpts.optString("lang", "en_US");
serverToJoin = eaglercraftOpts.optString("joinServer", null); serverToJoin = eaglercraftOpts.optString("joinServer", null);
worldsDB = eaglercraftOpts.optString("worldsDB", "worlds"); worldsDB = eaglercraftOpts.optString("worldsDB", "worlds");
@ -67,7 +158,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
isEnableDownloadOfflineButton = eaglercraftOpts.optBoolean("enableDownloadOfflineButton", true); isEnableDownloadOfflineButton = eaglercraftOpts.optBoolean("enableDownloadOfflineButton", true);
downloadOfflineButtonLink = eaglercraftOpts.optString("downloadOfflineButtonLink", null); downloadOfflineButtonLink = eaglercraftOpts.optString("downloadOfflineButtonLink", null);
useSpecialCursors = eaglercraftOpts.optBoolean("html5CursorSupport", false); useSpecialCursors = eaglercraftOpts.optBoolean("html5CursorSupport", false);
logInvalidCerts = !demoMode && eaglercraftOpts.optBoolean("logInvalidCerts", false); logInvalidCerts = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftOpts.optBoolean("logInvalidCerts", false);
enableSignatureBadge = eaglercraftOpts.optBoolean("enableSignatureBadge", false); enableSignatureBadge = eaglercraftOpts.optBoolean("enableSignatureBadge", false);
JSONArray serversArray = eaglercraftOpts.optJSONArray("servers"); JSONArray serversArray = eaglercraftOpts.optJSONArray("servers");
if(serversArray != null) { if(serversArray != null) {
@ -152,8 +243,8 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
} }
@Override @Override
public JSONObject dumpConfig() { public JSONObject getIntegratedServerOpts() {
return originalEaglercraftOpts; return integratedServerOpts;
} }
@Override @Override
@ -211,4 +302,42 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
return enableSignatureBadge; return enableSignatureBadge;
} }
@Override
public String toString() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("lang", defaultLocale);
jsonObject.put("joinServer", serverToJoin);
jsonObject.put("worldsDB", worldsDB);
jsonObject.put("resourcePacksDB", resourcePacksDB);
jsonObject.put("checkShaderGLErrors", checkShaderGLErrors);
jsonObject.put("demoMode", demoMode);
jsonObject.put("allowUpdateSvc", isAllowUpdateSvc);
jsonObject.put("allowUpdateDL", isAllowUpdateDL);
jsonObject.put("enableDownloadOfflineButton", isEnableDownloadOfflineButton);
jsonObject.put("downloadOfflineButtonLink", downloadOfflineButtonLink);
jsonObject.put("html5CursorSupport", useSpecialCursors);
jsonObject.put("logInvalidCerts", logInvalidCerts);
jsonObject.put("checkRelaysForUpdates", checkRelaysForUpdates);
jsonObject.put("enableSignatureBadge", enableSignatureBadge);
JSONArray serversArr = new JSONArray();
for(int i = 0, l = defaultServers.size(); i < l; ++i) {
DefaultServer srv = defaultServers.get(i);
JSONObject obj = new JSONObject();
obj.put("addr", srv.addr);
obj.put("name", srv.name);
serversArr.put(obj);
}
jsonObject.put("servers", serversArr);
JSONArray relaysArr = new JSONArray();
for(int i = 0, l = relays.size(); i < l; ++i) {
RelayEntry rl = relays.get(i);
JSONObject obj = new JSONObject();
obj.put("addr", rl.address);
obj.put("comment", rl.comment);
obj.put("primary", rl.primary);
relaysArr.put(obj);
}
jsonObject.put("relays", relaysArr);
return jsonObject.toString();
}
} }

View File

@ -0,0 +1,29 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public abstract class JSEaglercraftXOptsAssetsURI implements JSObject {
@JSBody(script = "return (typeof this.url === \"string\") ? this.url : null;")
public native String getURL();
@JSBody(params = { "def" }, script = "return (typeof this.path === \"string\") ? this.path : def;")
public native String getPath(String defaultValue);
}

View File

@ -0,0 +1,30 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public interface JSEaglercraftXOptsAssetsURIsArray extends JSObject {
@JSIndexer
JSEaglercraftXOptsAssetsURI get(int idx);
@JSProperty
int getLength();
}

View File

@ -0,0 +1,32 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public abstract class JSEaglercraftXOptsRelay implements JSObject {
@JSBody(script = "return (typeof this.addr === \"string\") ? this.addr : null;")
public native String getAddr();
@JSBody(params = { "def" }, script = "return (typeof this.comment === \"string\") ? this.comment : def;")
public native String getComment(String defaultValue);
@JSBody(script = "return (typeof this.primary === \"boolean\") ? this.primary : false;")
public native boolean getPrimary();
}

View File

@ -0,0 +1,30 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public interface JSEaglercraftXOptsRelaysArray extends JSObject {
@JSIndexer
JSEaglercraftXOptsRelay get(int idx);
@JSProperty
int getLength();
}

View File

@ -0,0 +1,83 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public abstract class JSEaglercraftXOptsRoot implements JSObject {
@JSBody(script = "return (typeof this.container === \"string\") ? this.container : null;")
public native String getContainer();
@JSBody(script = "return (typeof this.assetsURI === \"string\") ? this.assetsURI : null;")
public native String getAssetsURI();
@JSBody(script = "return (typeof this.assetsURI === \"object\") ? this.assetsURI : null;")
public native JSEaglercraftXOptsAssetsURIsArray getAssetsURIArray();
@JSBody(params = { "def" }, script = "return (typeof this.lang === \"string\") ? this.lang : def;")
public native String getLang(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.joinServer === \"string\") ? this.joinServer : def;")
public native String getJoinServer(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.localesURI === \"string\") ? this.localesURI : def;")
public native String getLocalesURI(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.worldsDB === \"string\") ? this.worldsDB : def;")
public native String getWorldsDB(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.resourcePacksDB === \"string\") ? this.resourcePacksDB : def;")
public native String getResourcePacksDB(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.demoMode === \"boolean\") ? this.demoMode : def;")
public native boolean getDemoMode(boolean defaultValue);
@JSBody(script = "return (typeof this.servers === \"object\") ? this.servers : null;")
public native JSEaglercraftXOptsServersArray getServers();
@JSBody(script = "return (typeof this.relays === \"object\") ? this.relays : null;")
public native JSEaglercraftXOptsRelaysArray getRelays();
@JSBody(params = { "def" }, script = "return (typeof this.checkShaderGLErrors === \"boolean\") ? this.checkShaderGLErrors : def;")
public native boolean getCheckShaderGLErrors(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.enableDownloadOfflineButton === \"boolean\") ? this.enableDownloadOfflineButton : def;")
public native boolean getEnableDownloadOfflineButton(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.downloadOfflineButtonLink === \"string\") ? this.downloadOfflineButtonLink : def;")
public native String getDownloadOfflineButtonLink(String defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.html5CursorSupport === \"boolean\") ? this.html5CursorSupport : def;")
public native boolean getHtml5CursorSupport(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.allowUpdateSvc === \"boolean\") ? this.allowUpdateSvc : def;")
public native boolean getAllowUpdateSvc(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.allowUpdateDL === \"boolean\") ? this.allowUpdateDL : def;")
public native boolean getAllowUpdateDL(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.logInvalidCerts === \"boolean\") ? this.logInvalidCerts : def;")
public native boolean getLogInvalidCerts(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.enableSignatureBadge === \"boolean\") ? this.enableSignatureBadge : def;")
public native boolean getEnableSignatureBadge(boolean defaultValue);
@JSBody(params = { "def" }, script = "return (typeof this.checkRelaysForUpdates === \"boolean\") ? this.checkRelaysForUpdates : def;")
public native boolean getCheckRelaysForUpdates(boolean defaultValue);
}

View File

@ -0,0 +1,29 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public abstract class JSEaglercraftXOptsServer implements JSObject {
@JSBody(script = "return (typeof this.addr === \"string\") ? this.addr : null;")
public native String getAddr();
@JSBody(params = { "def" }, script = "return (typeof this.name === \"string\") ? this.name : def;")
public native String getName(String defaultValue);
}

View File

@ -0,0 +1,30 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public interface JSEaglercraftXOptsServersArray extends JSObject {
@JSIndexer
JSEaglercraftXOptsServer get(int idx);
@JSProperty
int getLength();
}

View File

@ -191,7 +191,7 @@ public class ClientPlatformSingleplayer {
} }
}); });
registerPacketHandler(workerObj, new WorkerBinaryPacketHandlerImpl()); registerPacketHandler(workerObj, new WorkerBinaryPacketHandlerImpl());
sendWorkerStartPacket(workerObj, PlatformRuntime.getClientConfigAdapter().dumpConfig().toString()); sendWorkerStartPacket(workerObj, PlatformRuntime.getClientConfigAdapter().getIntegratedServerOpts().toString());
} }