All external scripts of type "Java" are now synced to client on login/script reload

This commit is contained in:
bigguy345 committed 2025-12-15 10:28:17 +02:00
1 parent 8a2ba6ae4e
commit a8b3c0b8d4
4 files changed
+49 -27

No files matched your search

@@ -3,7 +3,9 @@ package noppes.npcs.controllers;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import jdk.nashorn.api.scripting.ClassFilter;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import kamkeel.npcs.network.packets.request.script.ScriptFilesPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
@@ -230,6 +232,14 @@ public class ScriptController {
customNPCThread.execute(this::saveGlobalNpcScripts);
}
public void syncClientScripts(EntityPlayerMP player) {
if (player != null) {
ScriptFilesPacket.sendToPlayer(player, "Java");
} else {
ScriptFilesPacket.sendToAll("Java");
}
}
public void loadCategories() {
dir = new File(CustomNpcs.getWorldSaveDirectory(), "scripts");
if (!dir.exists())