mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-20 23:21:19 +01:00
Good old fashion way to get target block which seem to be working on
older versions
This commit is contained in:
parent
85cdfe1193
commit
7e78a43094
@ -7,6 +7,7 @@ import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
@ -29,6 +30,7 @@ import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
||||
@ -145,6 +147,15 @@ public class Util {
|
||||
distance = 1;
|
||||
|
||||
ArrayList<Block> blocks = new ArrayList<>();
|
||||
|
||||
try {
|
||||
Block bl = player.getTargetBlock(null, distance);
|
||||
if (!CMIMaterial.isAir(bl.getType())) {
|
||||
return bl;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
|
||||
Iterator<Block> itr = new BlockIterator(player, distance);
|
||||
while (itr.hasNext()) {
|
||||
Block block = itr.next();
|
||||
|
Loading…
Reference in New Issue
Block a user