mirror of
https://github.com/Zrips/Jobs.git
synced 2025-02-01 13:01:29 +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.ArrayList;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
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.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.util.BlockIterator;
|
import org.bukkit.util.BlockIterator;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
||||||
@ -69,8 +71,8 @@ public class Util {
|
|||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static ItemStack getSkull(String skullOwner) {
|
public static ItemStack getSkull(String skullOwner) {
|
||||||
ItemStack item = CMIMaterial.PLAYER_HEAD.newItemStack();
|
ItemStack item = CMIMaterial.PLAYER_HEAD.newItemStack();
|
||||||
SkullMeta skullMeta = (SkullMeta) item.getItemMeta();
|
SkullMeta skullMeta = (SkullMeta) item.getItemMeta();
|
||||||
if (skullOwner.length() == 36) {
|
if (skullOwner.length() == 36) {
|
||||||
@ -145,6 +147,15 @@ public class Util {
|
|||||||
distance = 1;
|
distance = 1;
|
||||||
|
|
||||||
ArrayList<Block> blocks = new ArrayList<>();
|
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);
|
Iterator<Block> itr = new BlockIterator(player, distance);
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
Block block = itr.next();
|
Block block = itr.next();
|
||||||
|
Loading…
Reference in New Issue
Block a user