summaryrefslogtreecommitdiff
path: root/NET/worlds/console/EmoteHandler.java
blob: f60927365636f163950144366b2c7aa9e0ca1f5e (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
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
108
109
110
111
112
113
114
115
116
117
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
 */