/* */ 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 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 */