1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
package NET.worlds.scape;
import NET.worlds.console.Console;
import NET.worlds.network.URL;
public class WobLoader implements BGLoaded {
private WobLoaded loaded;
private URL origURL;
SuperRoot value;
public WobLoader(URL url, WobLoaded loaded) {
this(url, loaded, false);
}
public WobLoader(URL url, WobLoaded loaded, boolean immediate) {
this.origURL = url;
this.loaded = loaded;
if (url.endsWith(".class")) {
String s = url.getAbsolute();
if (s.startsWith("system:")) {
int len = s.length();
try {
Class c = Class.forName(s.substring(7, len - 6));
SuperRoot sr = (SuperRoot)c.newInstance();
sr.loadInit();
this.gotIt(sr);
} catch (Exception var8) {
var8.printStackTrace(System.out);
Console.println("Can't make instance of class " + url);
this.gotIt(null);
}
return;
}
}
if (immediate) {
String s = url.unalias();
if (s.indexOf(58) > 1) {
this.gotIt(null);
} else {
this.syncBackgroundLoad(this.asyncBackgroundLoad(s, url), url);
}
} else {
BackgroundLoader.get(this, url);
}
}
public static SuperRoot immediateLoad(URL url) {
WobLoader w = new WobLoader(url, null, true);
return w.value;
}
@Override
public Object asyncBackgroundLoad(String localName, URL remoteURL) {
return remoteURL.endsWith(".class") ? WobClassLoader.get(localName, remoteURL.getClassName()) : localName;
}
@Override
public boolean syncBackgroundLoad(Object obj, URL remoteURL) {
SuperRoot sr = null;
if (obj != null) {
if (obj instanceof String) {
sr = SuperRoot.readFile((String)obj, remoteURL);
} else {
try {
sr = (SuperRoot)((Class)obj).newInstance();
sr.loadInit();
} catch (Exception var5) {
var5.printStackTrace(System.out);
}
}
}
this.gotIt(sr);
return false;
}
private void gotIt(SuperRoot s) {
if (s != null) {
s.setSourceURL(this.origURL);
}
this.value = s;
if (this.loaded != null) {
this.loaded.wobLoaded(this, s);
}
}
@Override
public Room getBackgroundLoadRoom() {
if (this.loaded instanceof SuperRoot) {
for (SuperRoot o = (SuperRoot)this.loaded; o != null; o = o.getOwner()) {
if (o instanceof WObject) {
return ((WObject)o).getRoom();
}
}
}
return null;
}
public URL getWobName() {
return this.origURL;
}
}
|