Make staff list based on remote webpage (#618)

* Make staff list based on remote webpage

* Update WhoCommand.java
This commit is contained in:
Alexander Meech 2016-10-16 22:48:23 -04:00 committed by Christopher Martin
parent ce03cf4863
commit f94c861804

View file

@ -5,6 +5,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -32,7 +37,7 @@ public class WhoCommand extends PKCommand {
/** /**
* Map storage of all ProjectKorra staffs' UUIDs and titles * Map storage of all ProjectKorra staffs' UUIDs and titles
*/ */
Map<String, String> staff = new HashMap<String, String>(), playerInfoWords = new HashMap<String, String>(); final Map<String, String> staff = new HashMap<String, String>(), playerInfoWords = new HashMap<String, String>();
private String databaseOverload, noPlayersOnline, playerOffline; private String databaseOverload, noPlayersOnline, playerOffline;
@ -43,31 +48,37 @@ public class WhoCommand extends PKCommand {
noPlayersOnline = ConfigManager.languageConfig.get().getString("Commands.Who.NoPlayersOnline"); noPlayersOnline = ConfigManager.languageConfig.get().getString("Commands.Who.NoPlayersOnline");
playerOffline = ConfigManager.languageConfig.get().getString("Commands.Who.PlayerOffline"); playerOffline = ConfigManager.languageConfig.get().getString("Commands.Who.PlayerOffline");
staff.put("8621211e-283b-46f5-87bc-95a66d68880e", ChatColor.RED + "ProjectKorra Founder"); // MistPhizzle new BukkitRunnable()
{
public void run()
{
try {
// Create a URL for the desired page
URL url = new URL("http://www.projectkorra.com/internals/staff.html");
staff.put("a197291a-cd78-43bb-aa38-52b7c82bc68c", ChatColor.DARK_PURPLE + "ProjectKorra Lead Developer"); // OmniCypher // Read all the text returned by the server
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
staff.put("15d1a5a7-76ef-49c3-b193-039b27c47e30", ChatColor.GREEN + "ProjectKorra Administrator"); // Kiam String unparsed = in.readLine(); // Read first line
if (unparsed != null)
staff.put("1553482a-5e86-4270-9262-b57c11151074", ChatColor.GOLD + "ProjectKorra Head Community Moderator"); // Pickle9775 {
String[] staffUUIDS = unparsed.split("\\|");
staff.put("96f40c81-dd5d-46b6-9afe-365114d4a082", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // Coolade for (String s : staffUUIDS)
staff.put("833a7132-a9ec-4f0a-ad9c-c3d6b8a1c7eb", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // Jacklin213 {
staff.put("d7757be8-86de-4898-ab4f-2b1b2fbc3dfa", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // StrangeOne101 String[] parts = s.split("/");
staff.put("3b5bdfab-8ae1-4794-b160-4f33f31fde99", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // kingbirdy if (parts.length == 2)
staff.put("dedf335b-d282-47ab-8ffc-a80121661cd1", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // grasshopperMatt {
staff.put("679a6396-6a31-4898-8130-044f34bef743", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // savior67 staff.put(parts[0], parts[1]);
staff.put("1c30007f-f8ef-4b4e-aff0-787aa1bc09a3", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // Sorin }
staff.put("dd578a4f-d35e-4fed-94db-9d5a627ff962", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // Sobki }
staff.put("9636d66a-bff8-48e4-993e-68f0e7891c3b", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // runefist }
in.close();
staff.put("623df34e-9cd4-438d-b07c-1905e1fc46b6", ChatColor.GREEN + "ProjectKorra Concept Designer"); // Loony } catch (MalformedURLException e) {
staff.put("3c484e61-7876-46c0-98c9-88c7834dc96c", ChatColor.GREEN + "ProjectKorra Concept Designer"); // SamuraiSnowman (Zmeduna) e.printStackTrace();
} catch (IOException e) {
staff.put("3d5bc713-ab8b-4125-b5ba-a1c1c2400b2c", ChatColor.GOLD + "ProjectKorra Community Moderator"); // Gold e.printStackTrace();
staff.put("38217173-8a32-4ba7-9fe1-dd4fed031a74", ChatColor.GOLD + "ProjectKorra Community Moderator"); // Easte }
}
staff.put("f2868ba3-e2fc-4731-8e36-56de2f3e6471", ChatColor.BLUE + "ProjectKorra Graphic Designer"); // paliate }.runTaskTimerAsynchronously(ProjectKorra.plugin, 0, 20 * 60);
} }
@Override @Override