diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/PosableDroneLoader.java | |
| download | worlds.jar-main.tar.xz worlds.jar-main.zip | |
Diffstat (limited to 'NET/worlds/scape/PosableDroneLoader.java')
| -rw-r--r-- | NET/worlds/scape/PosableDroneLoader.java | 261 |
1 files changed, 261 insertions, 0 deletions
diff --git a/NET/worlds/scape/PosableDroneLoader.java b/NET/worlds/scape/PosableDroneLoader.java new file mode 100644 index 0000000..e74879a --- /dev/null +++ b/NET/worlds/scape/PosableDroneLoader.java @@ -0,0 +1,261 @@ +/* */ package NET.worlds.scape; +/* */ +/* */ import NET.worlds.core.Archive; +/* */ import NET.worlds.network.URL; +/* */ import java.net.MalformedURLException; +/* */ import java.util.Enumeration; +/* */ import java.util.Vector; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class PosableDroneLoader +/* */ implements Runnable +/* */ { +/* */ static final boolean debug = false; +/* */ DroneLoader loader; +/* 156 */ private static boolean useCachedFiles = ; +/* */ private Vector<PendingDrone> droneList; +/* */ +/* */ PosableDroneLoader() { +/* 160 */ this.droneList = new Vector(); +/* */ } +/* */ +/* 163 */ public static boolean usingCache() { return useCachedFiles; } +/* */ +/* */ public static PendingDrone makePendingDrone(PosableDrone _drone, URL _url) +/* */ { +/* 167 */ if (useCachedFiles) { +/* 168 */ return new PendingCacheDrone(_drone, _url); +/* */ } +/* 170 */ return new PendingDrone(_drone, _url); +/* */ } +/* */ +/* */ public void load(PosableDrone _drone, URL _url) +/* */ { +/* 175 */ PendingDrone pd = makePendingDrone(_drone, _url); +/* */ +/* 177 */ this.droneList.addElement(pd); +/* */ +/* */ +/* 180 */ if (this.loader != null) { this.loader.wakeUp(); +/* */ } +/* */ } +/* */ +/* */ public boolean isPending(PosableDrone _drone, URL _url) +/* */ { +/* 186 */ Vector<PendingDrone> listCopy = (Vector)this.droneList.clone(); +/* 187 */ Enumeration<PendingDrone> enums = listCopy.elements(); +/* 188 */ while (enums.hasMoreElements()) +/* */ { +/* 190 */ PendingDrone pd = (PendingDrone)enums.nextElement(); +/* 191 */ if (pd.getUrl().toString().equals(_url.toString())) +/* */ { +/* 193 */ if (pd.getDrone().toString().equals(_drone.toString())) +/* 194 */ return true; +/* */ } +/* */ } +/* 197 */ return false; +/* */ } +/* */ +/* */ public void run() +/* */ { +/* 202 */ this.loader = new DroneLoader(); +/* */ +/* */ for (;;) +/* */ { +/* 206 */ this.loader.load(this.droneList); +/* */ } +/* */ } +/* */ +/* */ public static String getAvatarBaseName(URL pUrl) +/* */ { +/* 212 */ String s = null; +/* */ +/* */ +/* 215 */ int dot = pUrl.getAbsolute().indexOf('.'); +/* 216 */ if (dot != -1) +/* */ { +/* 218 */ s = pUrl.getAbsolute().substring(7, dot); +/* */ } +/* */ +/* 221 */ return s; +/* */ } +/* */ +/* */ +/* */ public static boolean avatarExistsLocally(URL pUrl) +/* */ throws MalformedURLException +/* */ { +/* 228 */ if (useCachedFiles) { +/* 229 */ return false; +/* */ } +/* */ +/* 232 */ if (pUrl.toString().equals(PosableShape.getDefaultURL().toString())) +/* */ { +/* 234 */ return true; +/* */ } +/* */ +/* 237 */ if (!pUrl.getAbsolute().substring(0, 7).equals("avatar:")) { +/* 238 */ throw new MalformedURLException("Not an avatar URL"); +/* */ } +/* 240 */ String s = getAvatarBaseName(pUrl); +/* */ +/* 242 */ if (s == null) { +/* 243 */ throw new MalformedURLException("No file extension"); +/* */ } +/* 245 */ URL realFile = URL.make(pUrl, s + ".bod"); +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 253 */ return Archive.exists(realFile.unalias()); +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\PosableDroneLoader.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |