fix: wrap_java

This commit is contained in:
reider745
2026-07-05 08:59:10 +03:00
parent 57e5d0b5d4
commit a0b678a7f8
4 changed files with 3 additions and 4 deletions
@@ -989,7 +989,7 @@ public final class JavaBindingGenerator {
return expr + " instanceof Wrapper ? (long) ((Wrapper) " + expr + ").unwrap() : ((Number) " return expr + " instanceof Wrapper ? (long) ((Wrapper) " + expr + ").unwrap() : ((Number) "
+ expr + ").longValue()"; + expr + ").longValue()";
} else if (arg.type.equals(BASE_TYPE_STRING)) { } else if (arg.type.equals(BASE_TYPE_STRING)) {
return expr + " instanceof String ? " + expr + ".toString() : (" + expr + " != null && " + expr return expr + " instanceof CharSequence ? " + expr + ".toString() : (" + expr + " != null && " + expr
+ " != Undefined.instance ? ScriptRuntime.toString(" + expr + ") : " + nullCase + ")"; + " != Undefined.instance ? ScriptRuntime.toString(" + expr + ") : " + nullCase + ")";
} else if (arg.type.equals(BASE_TYPE_BOOL)) { } else if (arg.type.equals(BASE_TYPE_BOOL)) {
return expr + " instanceof Boolean ? (Boolean) " + expr + " : ScriptRuntime.toBoolean(" + expr + ")"; return expr + " instanceof Boolean ? (Boolean) " + expr + " : ScriptRuntime.toBoolean(" + expr + ")";
@@ -10,6 +10,7 @@ import com.reider745.behavior.BehaviorPack;
import com.reider745.commands.CommandsHelper; import com.reider745.commands.CommandsHelper;
import com.reider745.event.EventListener; import com.reider745.event.EventListener;
import com.reider745.event.InnerCorePlugin; import com.reider745.event.InnerCorePlugin;
import com.reider745.hooks.ZoteClassLoaderPool;
import com.reider745.hooks.item.RuntimeItemsHooks; import com.reider745.hooks.item.RuntimeItemsHooks;
import com.reider745.hooks.SnowfallEverywhere; import com.reider745.hooks.SnowfallEverywhere;
import com.reider745.item.CustomItem; import com.reider745.item.CustomItem;
@@ -204,6 +205,7 @@ public class InnerCoreServer {
org.mozilla.javascript.Logger.DEBUG = Logger::debug; org.mozilla.javascript.Logger.DEBUG = Logger::debug;
Class.forName("org.mozilla.javascript.Context"); Class.forName("org.mozilla.javascript.Context");
ScriptRuntime.GET_MESSAGES = () -> FileTools.getAssetInputStream("rhino/Messages.properties"); ScriptRuntime.GET_MESSAGES = () -> FileTools.getAssetInputStream("rhino/Messages.properties");
Context.BUILD_LOADER = ZoteClassLoaderPool::new;
Thread.currentThread().setPriority(Thread.MAX_PRIORITY); Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
server.getLogger().info("Initiating target directory '" + server.getDataPath() + "'"); server.getLogger().info("Initiating target directory '" + server.getDataPath() + "'");
@@ -189,12 +189,10 @@ public class Compiler {
jarInputStream.close(); jarInputStream.close();
} catch (IOException e) { } catch (IOException e) {
} }
System.out.println(script + " " + jarFile.getAbsolutePath());
return script; return script;
} }
public static Script loadScriptFromDex(File dexFile) throws IOException { public static Script loadScriptFromDex(File dexFile) throws IOException {
System.out.println("GOIDAAA " + dexFile.getAbsolutePath());
String dexFileAbsolute = dexFile.getAbsolutePath(); String dexFileAbsolute = dexFile.getAbsolutePath();
File jarFile = new File( File jarFile = new File(
(dexFileAbsolute.endsWith(".dex") ? dexFileAbsolute.substring(0, dexFileAbsolute.length() - 4) (dexFileAbsolute.endsWith(".dex") ? dexFileAbsolute.substring(0, dexFileAbsolute.length() - 4)
@@ -171,7 +171,6 @@ public class Executable implements Runnable {
result = new NativeJavaClass(parent, ZoteClassLoaderPool.forName(name), false); result = new NativeJavaClass(parent, ZoteClassLoaderPool.forName(name), false);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
result = new NativeJavaPackage(name); result = new NativeJavaPackage(name);
ICLog.e("WRAP_JAVA", e.getMessage(), e);
} }
javaWrapCache.put(name, result); javaWrapCache.put(name, result);
return result; return result;