mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Hardcoding this is a bad idea.
This commit is contained in:
parent
6518d192ec
commit
62146480db
@ -1,9 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.mining;
|
package com.gmail.nossr50.skills.mining;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
|
||||||
@ -88,16 +84,4 @@ public class BlastMining {
|
|||||||
public static int detonatorID = Config.getInstance().getDetonatorItemID();
|
public static int detonatorID = Config.getInstance().getDetonatorItemID();
|
||||||
|
|
||||||
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
||||||
|
|
||||||
protected static HashSet<Byte> generateTransparentBlockList() {
|
|
||||||
HashSet<Byte> transparentBlocks = new HashSet<Byte>();
|
|
||||||
|
|
||||||
for (Material material : Material.values()) {
|
|
||||||
if (material.isTransparent()) {
|
|
||||||
transparentBlocks.add((byte) material.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return transparentBlocks;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.mining;
|
package com.gmail.nossr50.skills.mining;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -93,9 +92,7 @@ public class MiningManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
public void remoteDetonation() {
|
public void remoteDetonation() {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
Block targetBlock = player.getTargetBlock(BlockUtils.getTransparentBlocks(), BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE);
|
||||||
HashSet<Byte> transparentBlocks = BlastMining.generateTransparentBlockList();
|
|
||||||
Block targetBlock = player.getTargetBlock(transparentBlocks, BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE);
|
|
||||||
|
|
||||||
if (targetBlock.getType() != Material.TNT || !SkillUtils.blockBreakSimulate(targetBlock, player, true) || !blastMiningCooldownOver()) {
|
if (targetBlock.getType() != Material.TNT || !SkillUtils.blockBreakSimulate(targetBlock, player, true) || !blastMiningCooldownOver()) {
|
||||||
return;
|
return;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.bukkit.CropState;
|
import org.bukkit.CropState;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NetherWartsState;
|
import org.bukkit.NetherWartsState;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.material.CocoaPlant;
|
import org.bukkit.material.CocoaPlant;
|
||||||
@ -323,6 +323,14 @@ public final class BlockUtils {
|
|||||||
* @return HashSet with the IDs of every transparent block
|
* @return HashSet with the IDs of every transparent block
|
||||||
*/
|
*/
|
||||||
public static HashSet<Byte> getTransparentBlocks() {
|
public static HashSet<Byte> getTransparentBlocks() {
|
||||||
return new HashSet<Byte>(Arrays.asList((byte) 0, (byte) 6, (byte) 18, (byte) 20, (byte) 27, (byte) 28, (byte) 31, (byte) 32, (byte) 32, (byte) 34, (byte) 37, (byte) 38, (byte) 39, (byte) 40, (byte) 50, (byte) 51, (byte) 52, (byte) 53, (byte) 55, (byte) 59, (byte) 63, (byte) 64, (byte) 65, (byte) 66, (byte) 67, (byte) 68, (byte) 69, (byte) 70, (byte) 71, (byte) 72, (byte) 75, (byte) 76, (byte) 77, (byte) 78, (byte) 79, (byte) 81, (byte) 83, (byte) 85, (byte) 92, (byte) 93, (byte) 94, (byte) 96, (byte) 101, (byte) 102, (byte) 104, (byte) 105, (byte) 106, (byte) 107, (byte) 108, (byte) 109, (byte) 111, (byte) 113, (byte) 114, (byte) 115, (byte) 119, (byte) 126, (byte) 128, (byte) 131, (byte) 132, (byte) 134, (byte) 135, (byte) 136, (byte) 139, (byte) 141, (byte) 142, (byte) 143, (byte) 145, (byte) 147, (byte) 148, (byte) 149, (byte) 150, (byte) 151, (byte) 156, (byte) 157, (byte) 171));
|
HashSet<Byte> transparentBlocks = new HashSet<Byte>();
|
||||||
|
|
||||||
|
for (Material material : Material.values()) {
|
||||||
|
if (material.isTransparent()) {
|
||||||
|
transparentBlocks.add((byte) material.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return transparentBlocks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user