diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/scape/PendingCacheDrone.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/scape/PendingCacheDrone.java')
| -rw-r--r-- | NET/worlds/scape/PendingCacheDrone.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/NET/worlds/scape/PendingCacheDrone.java b/NET/worlds/scape/PendingCacheDrone.java new file mode 100644 index 0000000..550b8ef --- /dev/null +++ b/NET/worlds/scape/PendingCacheDrone.java @@ -0,0 +1,66 @@ +package NET.worlds.scape; + +import NET.worlds.core.IniFile; +import NET.worlds.network.Cache; +import NET.worlds.network.CacheFile; +import NET.worlds.network.NetUpdate; +import NET.worlds.network.URL; + +public class PendingCacheDrone extends PendingDrone { + static String upgradeDir = IniFile.gamma().getIniString("avatarDir", "avatar/"); + + static { + if (!upgradeDir.endsWith("/")) { + upgradeDir = upgradeDir + "/"; + } + + nativeInit(); + } + + public PendingCacheDrone(PosableDrone _drone, URL _url) { + super(_drone, _url); + } + + @Override + public synchronized void download(URL avURL) { + } + + public static native void nativeInit(); + + public static native void nativeDestroy(); + + public static synchronized native void notifySeqLoaded(int var0, String var1); + + public static void downloadSeqFile(String seqFileName, boolean force, int nativeNotifyObject) { + seqFileName = seqFileName.toLowerCase(); + if (!PosableDroneLoader.usingCache()) { + notifySeqLoaded(nativeNotifyObject, ".\\avatars\\" + seqFileName); + } else { + String path = NetUpdate.getUpgradeServerURL() + upgradeDir + seqFileName; + if (force) { + CacheFile cf = Cache.getFile(URL.make(path)); + cf.waitUntilLoaded(); + if (cf.error()) { + return; + } + + notifySeqLoaded(nativeNotifyObject, cf.getLocalName()); + } else { + new SeqFile(nativeNotifyObject, URL.make(path)); + } + } + } + + public static String getAvatarDatPath() { + if (!PosableDroneLoader.usingCache()) { + return ".\\avatars\\avatars.dat"; + } else if (IniFile.gamma().getIniInt("localavatarsdat", 0) == 1) { + return ".\\avatars\\avatars.dat"; + } else { + String datURL = NetUpdate.getUpgradeServerURL() + upgradeDir + "avatars.dat"; + CacheFile cf = Cache.getFile(URL.make(datURL)); + cf.waitUntilLoaded(); + return cf.error() ? null : cf.getLocalName(); + } + } +} |