我一直在制作一个 bukkit 插件,它显示在插件列表中,但是当我做我想让代码做的事情时,什么也没发生。
public class MyClass extends JavaPlugin implements Listener {
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (player.isSneaking()) {
player.sendMessage("Fire!");
Arrow arrow = player.launchProjectile(Arrow.class);
arrow.setShooter(player);
arrow.setGravity(false);
arrow.setSilent(true);
arrow.setBounce(false);
Block attach = arrow.getAttachedBlock();
Location attachlocation = attach.getLocation();
attachlocation.getWorld().createExplosion(attachlocation, 3);
arrow.setVelocity((player.getEyeLocation().getDirection().multiply(1000)));
}
}
}
撒科打诨
慕桂英4014372
翻过高山走不出你
相关分类