0
這種能力在這裏完美運作,除非受害者站立在石板或任何其他類型的地方,否則它們會被石板取代。這隻發生在平板上,例如砂岩樓梯將被砂岩樓梯取代後才能使用。我該如何阻止這種用石板取代特殊板的能力?
@EventHandler
public void onPlayerInteractBlockEarthSpike(PlayerInteractEvent event) {
final Player player = event.getPlayer();
int selected = player.getInventory().getHeldItemSlot();
if (selected == 5){
if (player.getFoodLevel() > 9){
Block target = (Block) player.getTargetBlock((Set<Material>) null, 15).getLocation().getBlock();
List<Entity> victims = (List<Entity>) target.getWorld().getNearbyEntities(target.getLocation(), 2, 2, 2);
player.getWorld().playEffect(target.getLocation().clone().add(0,1,0), Effect.SMOKE, 10);
for (Entity victim : victims){
if (victim instanceof LivingEntity){
victim.setVelocity(new Vector(0,1,0));
((LivingEntity) victim).damage(2,player);
victim.setVelocity(new Vector(0,1,0));
final Block block1 = victim.getLocation().getBlock();
final Block block2 = victim.getLocation().clone().add(0,1,0).getBlock();
final Material type1 = block1.getType();
final Material type2 = block2.getType();
Bukkit.getScheduler().runTaskLater(MagictgCraft.that, new Runnable(){
@Override
public void run(){
block1.setType(Material.STONE);
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 10, 5);
int count = 0;
while (count < 20){
player.getWorld().playEffect(block1.getLocation().clone().add(0.5,0.5,0.5), Effect.LAVA_POP, 10);
count = count + 1;
}
}
},3);
Bukkit.getScheduler().runTaskLater(MagictgCraft.that, new Runnable(){
@Override
public void run() {
block2.setType(Material.STONE);
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 10, 5);
int count = 0;
while (count < 10){
count = count + 1;
player.getWorld().playEffect(block1.getLocation().clone().add(0.5,0.5,0.5), Effect.LAVA_POP, 10);
}
}
},5);
Bukkit.getScheduler().runTaskLater(MagictgCraft.that, new Runnable(){
@Override
public void run(){
block2.setType(type2);
}
},8);
Bukkit.getScheduler().runTaskLater(MagictgCraft.that, new Runnable(){
@Override
public void run(){
block1.setType(type1);
}
},10);
}
}
}
}
我認爲它是因爲1型& 2沒有得到分配給他們的亞型(這是奇怪的,因爲正如我所說的,樓梯不受此影響) 如何使它分配的亞型類型1 & 2?