Fix conflicts that got missed previously

This commit is contained in:
tehdiplomat
2018-08-03 22:36:40 -04:00
parent e601a6deae
commit e4e33ebac0
2 changed files with 24 additions and 17 deletions

View File

@@ -39,13 +39,19 @@ public class TokenDb implements ITokenDatabase {
@Override
public PaperToken getToken(String tokenName, String edition) {
try {
PaperToken pt = new PaperToken(rulesByName.get(tokenName), editions.get(edition));
// TODO Cache the token after it's referenced
return pt;
} catch(Exception e) {
return null;
String fullName = String.format("%s_%s", tokenName, edition.toLowerCase());
if (!tokensByName.containsKey(fullName)) {
try {
PaperToken pt = new PaperToken(rulesByName.get(tokenName), editions.get(edition));
tokensByName.put(fullName, pt);
return pt;
} catch(Exception e) {
return null;
}
}
return tokensByName.get(fullName);
}
@Override