blob: 96d3ec5700e37c9b6fc1df1e89b8f7a9a242109e (
plain) (
blame)
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
|
package NET.worlds.console;
import NET.worlds.network.Cache;
import NET.worlds.network.CacheFile;
import NET.worlds.network.NetUpdate;
import NET.worlds.network.URL;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.Hashtable;
public class EmoteHandler {
private Hashtable<String, String> emoteHash = new Hashtable<String, String>();
public EmoteHandler() {
this.Load("EmoteList.txt");
}
public EmoteHandler(String filename) {
this.Load(filename);
}
public void Load(String filename) {
File file = null;
try {
CacheFile cf = Cache.getFile(URL.make(NetUpdate.getUpgradeServerURL() + filename));
if (cf != null) {
file = new File(cf.getLocalName());
cf.waitUntilLoaded();
}
if (file != null) {
this.LoadFile(file);
}
} catch (Exception var4) {
}
file = new File(filename);
if (file != null) {
this.LoadFile(file);
}
}
private void LoadFile(File file) {
if (file != null && file.exists()) {
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
String line = "";
while ((line = reader.readLine()) != null) {
String[] words = line.split("[ \t]");
for (int i = 1; i < words.length; i++) {
this.put(words[i].toLowerCase(), words[0]);
}
}
reader.close();
} catch (Exception var6) {
var6.printStackTrace();
}
}
}
public void put(String emote, String imagename) {
this.emoteHash.put(emote, imagename);
}
public String get(String emote) {
return this.emoteHash.get(emote);
}
public ImageCanvas getImage(String emote) {
String imagename = this.get(emote);
return imagename != null && imagename.length() > 0 ? new ImageCanvas(imagename) : null;
}
}
|