From b5f6b1d97f507a1017d3c69c031adfa89565b2b9 Mon Sep 17 00:00:00 2001 From: Erik Date: Sat, 5 Aug 2017 11:50:24 -0700 Subject: [PATCH 1/2] Fix for 3250 - HashSet to HashSet for getTargetBlock --- .../java/com/gmail/nossr50/listeners/PlayerListener.java | 2 +- .../com/gmail/nossr50/skills/fishing/FishingManager.java | 4 ++-- .../java/com/gmail/nossr50/skills/mining/MiningManager.java | 2 +- src/main/java/com/gmail/nossr50/util/BlockUtils.java | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 8f67f7914..d2ab93e87 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -240,7 +240,7 @@ public class PlayerListener implements Listener { return; case IN_GROUND: - Block block = player.getTargetBlock((HashSet) null, 100); + Block block = player.getTargetBlock((HashSet) null, 100); if (fishingManager.canIceFish(block)) { event.setCancelled(true); diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index 425239960..6c46047b1 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -104,7 +104,7 @@ public class FishingManager extends SkillManager { vehicle.remove(); } - player.teleport(player.getTargetBlock((HashSet) null, 100).getLocation(), TeleportCause.PLUGIN); + player.teleport(player.getTargetBlock((HashSet) null, 100).getLocation(), TeleportCause.PLUGIN); String unleashMessage = AdvancedConfig.getInstance().getPlayerUnleashMessage(); @@ -167,7 +167,7 @@ public class FishingManager extends SkillManager { return false; } - Block targetBlock = getPlayer().getTargetBlock((HashSet) BlockUtils.getTransparentBlocks(), 100); + Block targetBlock = getPlayer().getTargetBlock((HashSet) BlockUtils.getTransparentBlocks(), 100); if (!targetBlock.isLiquid()) { return false; diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java index 62701aca0..0d073af46 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -94,7 +94,7 @@ public class MiningManager extends SkillManager { */ public void remoteDetonation() { Player player = getPlayer(); - Block targetBlock = player.getTargetBlock((HashSet) BlockUtils.getTransparentBlocks(), BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE); + Block targetBlock = player.getTargetBlock((HashSet) BlockUtils.getTransparentBlocks(), BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE); if (targetBlock.getType() != Material.TNT || !EventUtils.simulateBlockBreak(targetBlock, player, true) || !blastMiningCooldownOver()) { return; diff --git a/src/main/java/com/gmail/nossr50/util/BlockUtils.java b/src/main/java/com/gmail/nossr50/util/BlockUtils.java index d54e04808..57580d584 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockUtils.java +++ b/src/main/java/com/gmail/nossr50/util/BlockUtils.java @@ -305,12 +305,12 @@ public final class BlockUtils { * * @return HashSet with the IDs of every transparent block */ - public static HashSet getTransparentBlocks() { - HashSet transparentBlocks = new HashSet(); + public static HashSet getTransparentBlocks() { + HashSet transparentBlocks = new HashSet(); for (Material material : Material.values()) { if (material.isTransparent()) { - transparentBlocks.add((byte) material.getId()); + transparentBlocks.add(material); } } From 0e7ee41444d49791a9e32558e8a1f651097aef2d Mon Sep 17 00:00:00 2001 From: Erik Date: Sat, 5 Aug 2017 11:53:38 -0700 Subject: [PATCH 2/2] Follow spacing convention --- src/main/java/com/gmail/nossr50/util/BlockUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/util/BlockUtils.java b/src/main/java/com/gmail/nossr50/util/BlockUtils.java index 57580d584..3f3d10e83 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockUtils.java +++ b/src/main/java/com/gmail/nossr50/util/BlockUtils.java @@ -310,7 +310,7 @@ public final class BlockUtils { for (Material material : Material.values()) { if (material.isTransparent()) { - transparentBlocks.add(material); + transparentBlocks.add(material); } }