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 emoteHash = new Hashtable(); 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; } }