Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Sanity Check #34

Merged
merged 1 commit into from
Oct 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/main/java/com/jadarstudios/developercapes/DevCapes.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ public InputStream getStreamForURL(URL url) {
is = connection.getInputStream();
} catch (IOException e) {
e.printStackTrace();
} finally {
return is;
}
return is;
}

/**
Expand All @@ -68,14 +67,14 @@ public InputStream getStreamForFile(File file) {
is = new FileInputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
return is;
}
return is;
}

@Deprecated
/**
* Registers a config with DevCapes. DEPRECATED: Please use registerConfig(String jsonUrl) instead
* DEPRECATED: Please use {@link #registerConfig(String jsonUrl)} instead.<p>
* Registers a config with DevCapes.
*
* @param jsonUrl
* The URL as a String that links to the Json file that you want
Expand All @@ -89,7 +88,7 @@ public int registerConfig(String jsonURL, String identifier) {
}

/**
* Registers a config with DevCapes. DEPRECATED: Please use registerConfig(String jsonUrl) instead
* Registers a config with DevCapes.
*
* @param jsonUrl The URL as a String that links to the Json file that you want
* to add
Expand All @@ -102,14 +101,14 @@ public int registerConfig(String jsonUrl) {
id = this.registerConfig(url);
} catch (MalformedURLException e) {
e.printStackTrace();
} finally {
return id;
}
return id;
}

@Deprecated
/**
* Registers a config with DevCapes. DEPRECATED: Please use registerConfig(URL url) instead
* DEPRECATED: Please use {@link #registerConfig(URL url)} instead.<p>
* Registers a config with DevCapes.
*
* @param jsonUrl
* A {@link URL} that links to the Json file that you want to add
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.jadarstudios.developercapes.cape;

import com.google.gson.Gson;
import com.jadarstudios.developercapes.user.Group;
import com.jadarstudios.developercapes.user.User;

Expand All @@ -10,15 +9,11 @@
* @author jadar
*/
public class CapeConfig {
private Gson parser;
public HashMap<String, Group> groups;
public HashMap<String, User> users;

public CapeConfig() {
parser = new Gson();
groups = new HashMap<String, Group>();
users = new HashMap<String, User>();
}


}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.jadarstudios.developercapes.cape;

import com.google.common.collect.HashBiMap;
import com.google.common.io.ByteStreams;
import com.google.common.primitives.UnsignedBytes;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
Expand All @@ -10,10 +11,8 @@
import com.jadarstudios.developercapes.user.User;
import com.jadarstudios.developercapes.user.UserManager;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.BitSet;
import java.util.Map;

Expand All @@ -36,7 +35,7 @@ private CapeConfigManager() {

public void addConfig(int id, CapeConfig config) {
int realId = claimId(id);
this.configs.put(id, config);
this.configs.put(realId, config);
try {
for (User u : config.users.values()) {
UserManager.INSTANCE.addUser(u);
Expand Down Expand Up @@ -78,12 +77,6 @@ public static int claimId(int id) {
return id;
}

// public CapeConfig newInstance() {
// CapeConfig instance = new CapeConfig();
// this.addConfig(this.getUniqueId(), );
// return instance;
// }

public CapeConfig parse(String config) {
CapeConfig instance = new CapeConfig();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,8 @@ public Group parse(String name, Map<String, Object> data) {
User user = UserManager.INSTANCE.parse(obj, group.cape);
if (user != null) {
group.addUser(user);
} else {
continue;
}
}

return group;
}
}
}