From 2fdc59c0a5fbebe20bb20c762f2d1e4e14ffc0c5 Mon Sep 17 00:00:00 2001 From: Alexander Meech Date: Tue, 18 Oct 2016 22:43:00 -0400 Subject: [PATCH] Update (#627) * Update the interactable materials array to remove unnecessary materials * Remove shaded jsoup lib and change the remote staff fetcher to load and parse a txt file instead of an html file --- pom.xml | 6 ------ .../projectkorra/projectkorra/GeneralMethods.java | 14 ++++++-------- .../projectkorra/command/WhoCommand.java | 9 +++------ 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 749a2fe0..ebe8485b 100644 --- a/pom.xml +++ b/pom.xml @@ -89,12 +89,6 @@ 1.1.1 provided - - - org.jsoup - jsoup - 1.9.2 - me.ryanhamshire GriefPrevention diff --git a/src/com/projectkorra/projectkorra/GeneralMethods.java b/src/com/projectkorra/projectkorra/GeneralMethods.java index 26f3f049..c6684863 100644 --- a/src/com/projectkorra/projectkorra/GeneralMethods.java +++ b/src/com/projectkorra/projectkorra/GeneralMethods.java @@ -130,16 +130,14 @@ public class GeneralMethods { public static final Integer[] NON_OPAQUE = { 0, 6, 8, 9, 10, 11, 27, 28, 30, 31, 32, 37, 38, 39, 40, 50, 51, 55, 59, 66, 68, 69, 70, 72, 75, 76, 77, 78, 83, 90, 93, 94, 104, 105, 106, 111, 115, 119, 127, 131, 132, 175 }; public static final Material[] INTERACTABLE_MATERIALS = { Material.ACACIA_DOOR, Material.ACACIA_FENCE_GATE, Material.ANVIL, - Material.ARMOR_STAND, Material.BEACON, Material.BED, Material.BED_BLOCK, Material.BIRCH_DOOR, - Material.BIRCH_FENCE_GATE, Material.BOAT, Material.BREWING_STAND, Material.BURNING_FURNACE, - Material.CAKE_BLOCK, Material.CHEST, Material.COMMAND, Material.DARK_OAK_DOOR, - Material.DARK_OAK_FENCE_GATE, Material.DISPENSER, Material.DRAGON_EGG, Material.DROPPER, + Material.BEACON, Material.BED_BLOCK, Material.BIRCH_DOOR, Material.BIRCH_FENCE_GATE, Material.BOAT, + Material.BREWING_STAND, Material.BURNING_FURNACE, Material.CAKE_BLOCK, Material.CHEST, Material.COMMAND, + Material.DARK_OAK_DOOR, Material.DARK_OAK_FENCE_GATE, Material.DISPENSER, Material.DRAGON_EGG, Material.DROPPER, Material.ENCHANTMENT_TABLE, Material.ENDER_CHEST, Material.ENDER_PORTAL_FRAME, Material.FENCE_GATE, Material.FURNACE, Material.HOPPER, Material.HOPPER_MINECART, Material.COMMAND_MINECART, - Material.ITEM_FRAME, Material.JUKEBOX, Material.JUNGLE_DOOR, Material.JUNGLE_FENCE_GATE, - Material.LEVER, Material.MINECART, Material.NOTE_BLOCK, Material.PAINTING, Material.SPRUCE_DOOR, - Material.SPRUCE_FENCE_GATE, Material.STONE_BUTTON, Material.TRAPPED_CHEST, Material.TRAP_DOOR, - Material.WOOD_BUTTON, Material.WOOD_DOOR, Material.WORKBENCH }; + Material.JUKEBOX, Material.JUNGLE_DOOR, Material.JUNGLE_FENCE_GATE, Material.LEVER, Material.MINECART, + Material.NOTE_BLOCK, Material.SPRUCE_DOOR, Material.SPRUCE_FENCE_GATE, Material.STONE_BUTTON, + Material.TRAPPED_CHEST, Material.TRAP_DOOR, Material.WOOD_BUTTON, Material.WOOD_DOOR, Material.WORKBENCH }; // Represents PlayerName, previously checked blocks, and whether they were true or false private static final Map> BLOCK_CACHE = new ConcurrentHashMap<>(); diff --git a/src/com/projectkorra/projectkorra/command/WhoCommand.java b/src/com/projectkorra/projectkorra/command/WhoCommand.java index 262c6e0e..2dba0bfe 100644 --- a/src/com/projectkorra/projectkorra/command/WhoCommand.java +++ b/src/com/projectkorra/projectkorra/command/WhoCommand.java @@ -19,8 +19,6 @@ import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.Element; @@ -58,8 +56,9 @@ public class WhoCommand extends PKCommand { { try { + staff.clear(); // Create a URL for the desired page - URLConnection url = new URL("http://www.projectkorra.com/staff.html").openConnection(); + URLConnection url = new URL("http://www.projectkorra.com/staff.txt").openConnection(); url.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); // Read all the text returned by the server @@ -67,9 +66,7 @@ public class WhoCommand extends PKCommand { String unparsed; while ((unparsed = in.readLine()) != null) { - Document doc = Jsoup.parse(unparsed); - String parsed = doc.body().text(); - String[] staffEntry = parsed.split("/"); + String[] staffEntry = unparsed.split("/"); if (staffEntry.length >= 2) { staff.put(staffEntry[0], ChatColor.translateAlternateColorCodes('&', staffEntry[1]));