當前位置: 首頁>>代碼示例>>Java>>正文


Java ArmorStand.setPassenger方法代碼示例

本文整理匯總了Java中org.bukkit.entity.ArmorStand.setPassenger方法的典型用法代碼示例。如果您正苦於以下問題:Java ArmorStand.setPassenger方法的具體用法?Java ArmorStand.setPassenger怎麽用?Java ArmorStand.setPassenger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.entity.ArmorStand的用法示例。


在下文中一共展示了ArmorStand.setPassenger方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: play

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
@Override
public void play(PAUser u) {
    if (isInCooldown(u, getName())) return;

    final ArmorStand as = (ArmorStand) spawnEntity(u.getLoc(), EntityType.ARMOR_STAND);
    as.setGravity(false);
    as.setSmall(true);
    as.setVisible(false);
    as.setHelmet(new ItemStack(Material.SEA_LANTERN));
    as.setPassenger(u.getPlayer());

    as.teleport(as.getLocation().add(0, 5, 0));

    bt = plugin.getServer().getScheduler().runTaskTimer(plugin, ()-> {
        as.teleport(as.getLocation().add(0, 0.2, 0));

        if (count <= 0) {
            remove(u, as);
            bt.cancel();
            return;
        }
        count--;
    }, 0, 20);
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:25,代碼來源:AntiGravity.java

示例2: EntityClick

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
@EventHandler
public void EntityClick(PlayerInteractAtEntityEvent e)
{
	Player p = e.getPlayer();
	if(e.getRightClicked() instanceof ArmorStand){
		ArmorStand clickedA = (ArmorStand) e.getRightClicked();
		if(clickedA.getPassenger() == null){
			for(Rollercoaster att : Main.r.Attracties.values()){
				if(att.getSeats().contains(clickedA)){
					if(att.allowSit != false){
						e.setCancelled(true);
						p.teleport(clickedA);
						clickedA.setPassenger(p);
						att.addPassagier(p, clickedA);
					}
					return;
				}
			}
		}
	}
}
 
開發者ID:LimitedDani,項目名稱:Achtbaan,代碼行數:22,代碼來源:EntityClick_Listener.java

示例3: EntityClick

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
@EventHandler
public void EntityClick(PlayerInteractAtEntityEvent e)
{
	Player p = e.getPlayer();
	if(e.getRightClicked() instanceof ArmorStand){
		ArmorStand clickedA = (ArmorStand) e.getRightClicked();
		if(clickedA.getPassenger() == null){
			for(attractie att : Main.r.Attracties.values()){
				if(att.getSeats().contains(clickedA)){
					if(att.allowSit == true){
						e.setCancelled(true);
						p.teleport(clickedA);
						clickedA.setPassenger(p);
						att.addPassagier(p, clickedA);
					}
					return;
				}
			}
		}
	}
}
 
開發者ID:LimitedDani,項目名稱:Achtbaan,代碼行數:22,代碼來源:EntityClick_Listener.java

示例4: EntityClick

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
@EventHandler
public void EntityClick(PlayerInteractAtEntityEvent e)
{
	Player p = e.getPlayer();
	if(e.getRightClicked() instanceof ArmorStand){
		ArmorStand clickedA = (ArmorStand) e.getRightClicked();
		if(clickedA.getPassenger() == null){
			for(attractie att : Main.r.Attracties.values()){
				for(ArmorStand a : att.getSeats())
				{
					if(a.getLocation().getX() == clickedA.getLocation().getX() && 
							a.getLocation().getY() == clickedA.getLocation().getY() && 
							a.getLocation().getZ() == clickedA.getLocation().getZ())
					{
						if(att.allowSit == true){
							e.setCancelled(true);
							p.teleport(clickedA);
							clickedA.setPassenger(p);
							att.addPassagier(p, clickedA);
						}
						return;
					}
				}
			}
		}
	}
}
 
開發者ID:LimitedDani,項目名稱:Achtbaan,代碼行數:28,代碼來源:EntityClick_Listener.java

示例5: onSit

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
@EventHandler
public void onSit(PlayerInteractEvent e){
    Player p = e.getPlayer();
    Block b;

    if (e.getItem() == null){
        if (e.getAction() == Action.RIGHT_CLICK_BLOCK){
            if(p.getInventory().getItemInMainHand() != null) return;
            b = e.getClickedBlock();
            if (isStairs(b.getType())) {
                if(!p.isSneaking() && p.getVehicle() != null) {
                    p.getVehicle().remove();
                    return;
                }
                p.setSneaking(false);

                Location l = b.getLocation().add(0.5, -1.3, 0.3);

                switch (b.getState().getData().toItemStack().getDurability()){
                    case 0: //west
                        l.setYaw(90f);
                        l.setZ(l.getZ() + 0.2);
                        break;
                    case 1: //east
                        l.setYaw(-90f);
                        l.setZ(l.getZ() + 0.2);
                        break;
                    case 2: //north
                        l.setYaw(-180f);
                        break;
                    case 3: //south
                        l.setYaw(0);
                        l.setZ(l.getZ() + 0.2);
                        break;
                }

                if (b.getState().getData().toItemStack().getDurability() >= 4) return;

                ArmorStand as = (ArmorStand) p.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
                as.teleport(l);
                as.setVisible(false);
                as.setGravity(false);
                as.setMaxHealth(1);
                as.setHealth(1);
                as.setCustomName("wcc_silla");
                as.setCustomNameVisible(false);
                as.setPassenger(p);

                e.setCancelled(true);

                if (new Random().nextInt(10) + 1 >= 9) p.sendMessage(magic());
            }
        }
    }
}
 
開發者ID:cadox8,項目名稱:WC,代碼行數:56,代碼來源:Sit.java

示例6: onCommand

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
 if (cmd.getName().equalsIgnoreCase("klotentoren")) {
  sender.sendMessage("ja hoor");
  Player p = (Player) sender;
  ArmorStand armorStand = (ArmorStand) p.getLocation().getWorld().spawn(p.getLocation(), ArmorStand.class);
  ItemStack is = new ItemStack(Material.LAPIS_ORE, 64);
  armorStand.setHelmet(is);
  armorStand.setPassenger((Entity) sender);
  armorStand.setBasePlate(false);
  ArmorStand armorStand2 = (ArmorStand) p.getLocation().getWorld().spawn(p.getLocation(), ArmorStand.class);
  armorStand2.setHelmet(is);
  armorStand2.setBasePlate(false);
  ArmorStand armorStand3 = (ArmorStand) p.getLocation().getWorld().spawn(p.getLocation(), ArmorStand.class);
  armorStand3.setHelmet(is);
  armorStand3.setBasePlate(false);
  ArmorStand armorStand4 = (ArmorStand) p.getLocation().getWorld().spawn(p.getLocation(), ArmorStand.class);
  armorStand4.setHelmet(is);
  armorStand4.setBasePlate(false);
  degree = 0;
  flyingheight = 28;
  direction = false;
  rotating = false;
  uploopcounter = 0;

  Bukkit.getScheduler().scheduleSyncRepeatingTask(main.getPL(), new Runnable() {
   @Override
   public void run() {
    if (rotating == true) {
     degree++;
     degree++;
    }
    if (degree == 360 || degree > 360) {
     degree = 0;
    }
    moveEntity(armorStand, degree + 1 * 90);
    moveEntity(armorStand2, degree + 2 * 90);
    moveEntity(armorStand3, degree + 3 * 90);
    moveEntity(armorStand4, degree + 4 * 90);
   }
  }, 0, 1);

  Bukkit.getScheduler().scheduleSyncRepeatingTask(main.getPL(), new Runnable() {
   @Override
   public void run() {
    if (flyingheight == 60) {
     direction = true;
    } else if (flyingheight == 28 || flyingheight < 35) {
     direction = false;
    }
    if (direction == true) {
     rotating = true;
     flyingheight--;
     //flyingheight--;
    } else {
     smallBittUp();
    }
   }
  }, 90, 1);
 } else {}
 return false;
}
 
開發者ID:Mindgamesnl,項目名稱:UselessCode,代碼行數:62,代碼來源:DumbDropTowerTest.java


注:本文中的org.bukkit.entity.ArmorStand.setPassenger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。