I'm trying to make an "Enemies" list to integrate with a suite of custom scripts that I'm developing; I have figured out how to create and use a FriendsConfig object to do this with the following:
FriendsConfig = Java.type("net.ccbluex.liquidbounce.file.configs.FriendsConfig");
jFile = Java.type("java.io.File");
dir = new jFile(mc.mcDataDir, LiquidBounce.CLIENT_NAME + "-" + LiquidBounce.MINECRAFT_VERSION);
EnemiesConfig = new FriendsConfig(new jFile(dir, "enemies.json"));
EnemiesConfig.createConfig();
saveMethod = EnemiesConfig.getClass().getDeclaredMethod("saveConfig");
saveMethod.setAccessible(true);
loadMethod = EnemiesConfig.getClass().getDeclaredMethod("loadConfig");
loadMethod.setAccessible(true);
loadMethod.invoke(EnemiesConfig);
My problem is that I need to transfer the FriendsConfig object stored in the EnemiesConfig variable to my other scripts to be able to check if a player is an enemy (for example, a killaura script that prioritizes targeting enemies over other players).
I have tried import/export but have not been able to figure out how it works; whenever I reload my script shows an error saying something like "Expected an operand but found export".
A possible solution I've thought of is to create a separate FriendsConfig object that reads from enemies.json in each script, but that seems like a messy solution as it would require constant re-reading from the file to check for changes.
(I already have all of the code to add/remove/list enemies working via a command, I just need help getting the object from one script to the other)
If it is of any importance, I am using CzechHek's Core.lib for all my scripts.