2015-11-27 15:34:19 +01:00
|
|
|
package com.gamingmesh.jobs.nmsUtil;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2016-04-03 16:22:44 +02:00
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
import org.bukkit.Material;
|
2015-11-27 15:34:19 +01:00
|
|
|
import org.bukkit.block.Block;
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.entity.Guardian;
|
2016-06-09 17:35:24 +02:00
|
|
|
import org.bukkit.entity.Horse;
|
2016-03-30 15:42:36 +02:00
|
|
|
import org.bukkit.entity.Player;
|
2016-06-09 17:35:24 +02:00
|
|
|
import org.bukkit.entity.Skeleton;
|
|
|
|
import org.bukkit.entity.Zombie;
|
|
|
|
import org.bukkit.entity.Horse.Variant;
|
|
|
|
import org.bukkit.entity.Skeleton.SkeletonType;
|
2015-11-27 15:34:19 +01:00
|
|
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
2016-03-30 15:42:36 +02:00
|
|
|
import org.bukkit.inventory.ItemStack;
|
2015-11-27 15:34:19 +01:00
|
|
|
|
|
|
|
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
|
2016-06-09 17:35:24 +02:00
|
|
|
public String getRealType(Entity entity) {
|
|
|
|
String name = entity.getType().name();
|
|
|
|
switch (entity.getType()) {
|
|
|
|
case GUARDIAN:
|
|
|
|
Guardian g = (Guardian) entity;
|
|
|
|
if (g.isElder())
|
|
|
|
name = "GuardianElder";
|
|
|
|
break;
|
|
|
|
case HORSE:
|
|
|
|
Horse horse = (Horse) entity;
|
|
|
|
if (horse.getVariant() == Variant.UNDEAD_HORSE)
|
|
|
|
name = "HorseZombie";
|
|
|
|
if (horse.getVariant() == Variant.SKELETON_HORSE)
|
|
|
|
name = "HorseSkeleton";
|
|
|
|
break;
|
|
|
|
case SKELETON:
|
|
|
|
Skeleton skeleton = (Skeleton) entity;
|
|
|
|
if (skeleton.getSkeletonType() == SkeletonType.WITHER)
|
|
|
|
name = "SkeletonWither";
|
|
|
|
break;
|
|
|
|
case ZOMBIE:
|
|
|
|
Zombie zombie = (Zombie) entity;
|
|
|
|
if (zombie.isVillager())
|
|
|
|
return "ZombieVillager";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2015-11-27 15:34:19 +01:00
|
|
|
}
|
2016-06-09 17:35:24 +02:00
|
|
|
return name;
|
2015-11-27 15:34:19 +01:00
|
|
|
}
|
2016-06-09 17:35:24 +02:00
|
|
|
|
2016-03-30 15:42:36 +02:00
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
@Override
|
|
|
|
public ItemStack getItemInMainHand(Player player) {
|
|
|
|
return player.getInventory().getItemInHand();
|
|
|
|
}
|
2016-04-03 16:22:44 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public Block getTargetBlock(Player player, int range) {
|
|
|
|
return player.getTargetBlock((Set<Material>) null, range);
|
|
|
|
}
|
2015-11-27 15:34:19 +01:00
|
|
|
}
|