* 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
This commit is contained in:
Alexander Meech 2016-10-18 22:43:00 -04:00 committed by Christopher Martin
parent 0a8bb3203d
commit 2fdc59c0a5
3 changed files with 9 additions and 20 deletions

View file

@ -89,12 +89,6 @@
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>me.ryanhamshire</groupId>
<artifactId>GriefPrevention</artifactId>

View file

@ -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<String, Map<Block, BlockCacheElement>> BLOCK_CACHE = new ConcurrentHashMap<>();

View file

@ -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]));