Procházet zdrojové kódy

Minor changes to Tree Feller - use a HashSet, move comment

LinkedHashSet doesn't actually do anything for us - we were never using the consistent ordering it promises, and openjdk-7 doesn't even provide that consistent ordering. Better to just not use it.
riking před 11 roky
rodič
revize
3b1bb3e08a

+ 2 - 2
src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java

@@ -163,7 +163,7 @@ public final class Woodcutting {
      * once the JIT has optimized the function (use the ability about 4 times
      * before taking measurements).
      */
-    protected static void processTree(BlockState blockState, LinkedHashSet<BlockState> treeFellerBlocks) {
+    protected static void processTree(BlockState blockState, Set<BlockState> treeFellerBlocks) {
         List<BlockState> futureCenterBlocks = new ArrayList<BlockState>();
 
         // Check the block up and take different behavior (smaller search) if it's a log
@@ -239,11 +239,11 @@ public final class Woodcutting {
             return false;
         }
 
+        // Without this check Tree Feller propagates through leaves until the threshold is hit
         if (treeFellerBlocks.size() > treeFellerThreshold) {
             treeFellerReachedThreshold = true;
         }
 
-        // Without this check Tree Feller propagates through leaves until the threshold is hit
         if (BlockUtils.isLog(blockState)) {
             treeFellerBlocks.add(blockState);
             futureCenterBlocks.add(blockState);

+ 2 - 2
src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java

@@ -1,6 +1,6 @@
 package com.gmail.nossr50.skills.woodcutting;
 
-import java.util.LinkedHashSet;
+import java.util.HashSet;
 import java.util.Set;
 
 import org.bukkit.Material;
@@ -73,7 +73,7 @@ public class WoodcuttingManager extends SkillManager {
      */
     public void processTreeFeller(BlockState blockState) {
         Player player = getPlayer();
-        LinkedHashSet<BlockState> treeFellerBlocks = new LinkedHashSet<BlockState>();
+        Set<BlockState> treeFellerBlocks = new HashSet<BlockState>();
 
         Woodcutting.treeFellerReachedThreshold = false;