1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 23:13:48 +01:00
Jobs/com/gamingmesh/jobs/nmsUtil/v1_8.java
2016-04-03 17:22:44 +03:00

45 lines
1.1 KiB
Java

package com.gamingmesh.jobs.nmsUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.inventory.ItemStack;
import com.gamingmesh.jobs.NMS;
public class v1_8 implements NMS {
@Override
public List<Block> getPistonRetractBlocks(BlockPistonRetractEvent event) {
List<Block> blocks = new ArrayList<Block>();
blocks.addAll(event.getBlocks());
return blocks;
}
@Override
public boolean isElderGuardian(Entity entity) {
if (entity instanceof Guardian) {
Guardian guardian = (Guardian) entity;
if (guardian.isElder())
return true;
}
return false;
}
@SuppressWarnings("deprecation")
@Override
public ItemStack getItemInMainHand(Player player) {
return player.getInventory().getItemInHand();
}
@Override
public Block getTargetBlock(Player player, int range) {
return player.getTargetBlock((Set<Material>) null, range);
}
}