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/console/EmoteHandler.java | |
| download | worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip | |
Diffstat (limited to 'NET/worlds/console/EmoteHandler.java')
| -rw-r--r-- | NET/worlds/console/EmoteHandler.java | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/NET/worlds/console/EmoteHandler.java b/NET/worlds/console/EmoteHandler.java new file mode 100644 index 0000000..f609273 --- /dev/null +++ b/NET/worlds/console/EmoteHandler.java @@ -0,0 +1,118 @@ +/* */ 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 +/* */ { +/* 19 */ private Hashtable<String, String> emoteHash = new Hashtable(); +/* */ +/* */ public EmoteHandler() { +/* 22 */ Load("EmoteList.txt"); +/* */ } +/* */ +/* */ public EmoteHandler(String filename) { +/* 26 */ Load(filename); +/* */ } +/* */ +/* */ public void Load(String filename) { +/* 30 */ File file = null; +/* */ +/* */ +/* */ try +/* */ { +/* 35 */ CacheFile cf = Cache.getFile(URL.make(NetUpdate.getUpgradeServerURL() + +/* 36 */ filename)); +/* 37 */ if (cf != null) +/* */ { +/* 39 */ file = new File(cf.getLocalName()); +/* 40 */ cf.waitUntilLoaded(); +/* */ } +/* */ +/* 43 */ if (file != null) { +/* 44 */ LoadFile(file); +/* */ } +/* */ } +/* */ catch (Exception localException) {} +/* */ +/* */ +/* */ +/* */ +/* 52 */ file = new File(filename); +/* 53 */ if (file != null) { +/* 54 */ LoadFile(file); +/* */ } +/* */ } +/* */ +/* */ private void LoadFile(File file) { +/* 59 */ if ((file != null) && (file.exists())) { +/* */ try +/* */ { +/* 62 */ BufferedReader reader = new BufferedReader(new FileReader(file)); +/* 63 */ String line = ""; +/* 64 */ String[] words; int i; for (; (line = reader.readLine()) != null; +/* */ +/* */ +/* */ +/* */ +/* 69 */ i < words.length) +/* */ { +/* 66 */ words = line.split("[ \t]"); +/* */ +/* */ +/* 69 */ i = 1; continue; +/* 70 */ put(words[i].toLowerCase(), words[0]);i++; +/* */ } +/* */ +/* */ +/* 73 */ reader.close(); +/* */ } +/* */ catch (Exception e) +/* */ { +/* 77 */ e.printStackTrace(); +/* */ } +/* */ } +/* */ } +/* */ +/* */ public void put(String emote, String imagename) { +/* 83 */ this.emoteHash.put(emote, imagename); +/* */ } +/* */ +/* */ public String get(String emote) { +/* 87 */ return (String)this.emoteHash.get(emote); +/* */ } +/* */ +/* */ public ImageCanvas getImage(String emote) { +/* 91 */ String imagename = get(emote); +/* */ +/* 93 */ if ((imagename != null) && (imagename.length() > 0)) +/* */ { +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 102 */ return new ImageCanvas(imagename); +/* */ } +/* 104 */ return null; +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\EmoteHandler.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |