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


Java ArmorStand類代碼示例

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


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

示例1: onHit

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
public void onHit(EntityDamageEvent event)
{
	if(event.isCancelled()) return;
	Entity hitTarget = event.getEntity();
	if(hitTarget != null && hitTarget instanceof ArmorStand && hitTarget.getCustomName() == "Chair")
		// Chair entity is immune to damage.
		event.setCancelled(true);
	else if(hitTarget != null && hitTarget instanceof Player && hitTarget.getVehicle() != null)
	{
		// Let players stand up if receiving damage.
		Entity vehicle = hitTarget.getVehicle();
		if(vehicle != null && vehicle instanceof ArmorStand && vehicle.getCustomName() == "Chair")
			vehicle.remove();
	}
}
 
開發者ID:FattyMieo,項目名稱:SurvivalPlus,代碼行數:17,代碼來源:Chairs.java

示例2: spawn

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
public void spawn(Location location) {
    final PetBlockSpawnEvent event = new PetBlockSpawnEvent(this);
    Bukkit.getPluginManager().callEvent(event);
    if (!event.isCanceled()) {
        NMSRegistry.accessWorldGuardSpawn(location);
        this.rabbit.spawn(location);
        final net.minecraft.server.v1_8_R1.World mcWorld = ((org.bukkit.craftbukkit.v1_8_R1.CraftWorld) location.getWorld()).getHandle();
        this.setPosition(location.getX(), location.getY(), location.getZ());
        mcWorld.addEntity(this, SpawnReason.CUSTOM);
        final net.minecraft.server.v1_8_R1.NBTTagCompound compound = new net.minecraft.server.v1_8_R1.NBTTagCompound();
        compound.setBoolean("invulnerable", true);
        compound.setBoolean("Invisible", true);
        compound.setBoolean("PersistenceRequired", true);
        compound.setBoolean("ShowArms", true);
        compound.setBoolean("NoBasePlate", true);
        this.a(compound);
        ((ArmorStand)this.getArmorStand()).setBodyPose(new EulerAngle(0, 0, 2878));
        ((ArmorStand)this.getArmorStand()).setLeftArmPose(new EulerAngle(2878, 0, 0));
        ((ArmorStand)this.getArmorStand()).setMetadata("keep", this.getKeepField());
        NMSRegistry.rollbackWorldGuardSpawn(location);
        ((ArmorStand)this.getArmorStand()).setCustomNameVisible(true);
        ((ArmorStand)this.getArmorStand()).setCustomName(this.petMeta.getPetDisplayName());
        ((ArmorStand)this.getArmorStand()).setRemoveWhenFarAway(false);
        ((LivingEntity) this.rabbit.getEntity()).setRemoveWhenFarAway(false);
        this.health = ConfigPet.getInstance().getCombat_health();
        if (this.petMeta == null)
            return;
        PetBlockHelper.setItemConsideringAge(this);
    }
}
 
開發者ID:Shynixn,項目名稱:PetBlocks,代碼行數:31,代碼來源:CustomGroundArmorstand.java

示例3: run__A

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
private void run__A(int id){
	HashMap<Integer, ArmorStand> car = cars.get(id);
	double radius = carsR.get(id);
	int total = car.size()-1;
	
	ArmorStand A1 = car.get(1);
	
	for(int i = 1; i < total+1; i++)
	{
		ArmorStand A2 = car.get(i+1);
		
		{
			double angle = ((A1.getLocation().getYaw()+(360.0/total*i))*Math.PI / 180);
	        double x = radius*Math.cos(angle);
	        double z = radius*Math.sin(angle);
	        
	        String command = String.format("minecraft:tp @e[name=%s] %s %s %s %s %s", A2.getUniqueId().toString(), A1.getLocation().getX() + x, A1.getLocation().getY(), A1.getLocation().getZ() + z, A1.getLocation().getYaw(), A1.getLocation().getPitch());
	        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
		}
	}
}
 
開發者ID:LimitedDani,項目名稱:Achtbaan,代碼行數:22,代碼來源:attractie.java

示例4: ArmorStandGreef

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
@EventHandler
public void ArmorStandGreef(PlayerArmorStandManipulateEvent e){
	if(e.getRightClicked() instanceof ArmorStand){
		ArmorStand clickedA = (ArmorStand) e.getRightClicked();
		if(clickedA.getPassenger() == null){
			ArrayList<Location> all_main_seats = new ArrayList<Location>();
			for(attractie att : Main.r.Attracties.values()){
				for(ArmorStand a : att.getMainSeats())
				{
					all_main_seats.add(a.getLocation());
				}
			}
			if(all_main_seats.contains(clickedA.getLocation())){
				e.setCancelled(true);
			}
		}
	}
}
 
開發者ID:LimitedDani,項目名稱:Achtbaan,代碼行數:19,代碼來源:EntityClick_Listener.java

示例5: onCommand

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
@Override
protected void onCommand(CommandSender sender, String[] args) {
    boolean load = ArmorStands.getPoses().containsKey(args[0]);
    sender.sendMessage(ChatColor.GREEN + "Please right-click the ArmorStand you'd like to " + (load ? "load" : "save") + ".");
    Callbacks.selectEntity((Player) sender, e -> {
        if (!(e instanceof ArmorStand)) {
            sender.sendMessage(ChatColor.RED + "That is not an ArmorStand.");
            return;
        }

        if (load) {
            ArmorStands.assumePose((ArmorStand) e, args[0]);
        } else {
            ArmorStands.getPoses().put(args[0], new ArmorStands.ArmorPose((ArmorStand) e));
        }
        sender.sendMessage(ChatColor.GREEN + "Pose " + (load ? "load" : "sav") + "ed.");
    });
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:19,代碼來源:CommandPose.java

示例6: onPlayerInteractEntity

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent e) {
    PAUser u = PAServer.getUser(e.getPlayer());
    Entity en = e.getRightClicked();

    e.setCancelled(true);
    System.out.println("Entidad encontrada");

    if (en instanceof ArmorStand) {
        ArmorStand ar = (ArmorStand) en;
        e.setCancelled(true);

        System.out.println(ar.getItemInHand().getType());

        switch (ar.getItemInHand().getType()) {
            case IRON_AXE:
                u.sendToServer("toa");
                break;
            case BOW:

                break;
        }
    }
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:25,代碼來源:PlayerEvents.java

示例7: 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

示例8: run

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
@Override
public void run() {
    for (final Player player : PetBlockListener.this.manager.timeBlocked.keySet().toArray(new Player[PetBlockListener.this.manager.timeBlocked.size()])) {
        PetBlockListener.this.manager.timeBlocked.put(player, PetBlockListener.this.manager.timeBlocked.get(player) - 1);
        if (PetBlockListener.this.manager.timeBlocked.get(player) <= 0) {
            PetBlockListener.this.manager.timeBlocked.remove(player);
            PetBlockListener.this.providePet(player, (petMeta, petBlock) -> PetBlockListener.this.setPetBlock(player, petMeta));

        }
    }
    for (final World world : Bukkit.getWorlds()) {
        for (final Entity entity : world.getEntities()) {
            if (entity instanceof ArmorStand && PetBlockListener.this.isDeadPet(entity)) {
                entity.remove();
            } else if (!PetBlockListener.this.isPet(entity) && entity.getCustomName() != null && entity.getCustomName().equals("PetBlockIdentifier")) {
                entity.remove();
            }
        }
    }
}
 
開發者ID:Shynixn,項目名稱:PetBlocks,代碼行數:21,代碼來源:PetBlockListener.java

示例9: 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

示例10: getArmorStand

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
public static ArmorStand getArmorStand(Block hopper)
{
    Location l = new Location(hopper.getWorld(), (double)hopper.getX() + 0.5D, (double)hopper.getY() + 1.2D, (double)hopper.getZ() + 0.5D);
    Entity aentity[];
    int j = (aentity = l.getChunk().getEntities()).length;
    for(int i = 0; i < j; i++)
    {
        Entity n = aentity[i];
        if((n instanceof ArmorStand) && n.getCustomName() == null && l.distanceSquared(n.getLocation()) < 0.40000000000000002D)
            return (ArmorStand)n;
    }

    ArmorStand hologram = ArmorStandFactory.createHidden(l);
    hologram.setCustomNameVisible(false);
    hologram.setCustomName(null);
    return hologram;
}
 
開發者ID:StarWishsama,項目名稱:Slimefun4-Chinese-Version,代碼行數:18,代碼來源:XPCollector.java

示例11: getArmorStand

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
public static ArmorStand getArmorStand(Block hopper)
{
    Location l = new Location(hopper.getWorld(), (double)hopper.getX() + 0.5D, hopper.getY(), (double)hopper.getZ() + 0.5D);
    Entity aentity[];
    int j = (aentity = l.getChunk().getEntities()).length;
    for(int i = 0; i < j; i++)
    {
        Entity n = aentity[i];
        if((n instanceof ArmorStand) && n.getCustomName() == null && l.distanceSquared(n.getLocation()) < 0.40000000000000002D)
            return (ArmorStand)n;
    }

    ArmorStand hologram = ArmorStandFactory.createHidden(l);
    hologram.setCustomNameVisible(false);
    hologram.setCustomName(null);
    return hologram;
}
 
開發者ID:StarWishsama,項目名稱:Slimefun4-Chinese-Version,代碼行數:18,代碼來源:AutoBreeder.java

示例12: update

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
public static void update(final Block b, final String name)
    {
        Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {

            private final Block val$b;
            private final String val$name;

            public void run()
            {
                ArmorStand hologram = EnergyHologram.getArmorStand(b);
                hologram.setCustomName(ChatColor.translateAlternateColorCodes('&', name));
            }

            
            {
                b = block;
                name = s;
                super();
            }
        }
);
    }
 
開發者ID:StarWishsama,項目名稱:Slimefun4-Chinese-Version,代碼行數:23,代碼來源:EnergyHologram.java

示例13: remove

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
public static void remove(final Block b)
    {
        Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {

            private final Block val$b;

            public void run()
            {
                ArmorStand hologram = EnergyHologram.getArmorStand(b);
                hologram.remove();
            }

            
            {
                b = block;
                super();
            }
        }
);
    }
 
開發者ID:StarWishsama,項目名稱:Slimefun4-Chinese-Version,代碼行數:21,代碼來源:EnergyHologram.java

示例14: getArmorStand

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
public static ArmorStand getArmorStand(Block hopper, boolean createIfNoneFound) {
	Location l = new Location(hopper.getWorld(), hopper.getX() + 0.5, hopper.getY() + offset, hopper.getZ() + 0.5);
	
	for (Entity n: l.getChunk().getEntities()) {
		if (n instanceof ArmorStand) {
			if (n.getCustomName() == null && l.distanceSquared(n.getLocation()) < 0.4D) return (ArmorStand) n;
		}
	}

	if (!createIfNoneFound) {
		return null;
	}
	
	ArmorStand hologram = ArmorStandFactory.createHidden(l);
	hologram.setCustomNameVisible(false);
	hologram.setCustomName(null);
	return hologram;
}
 
開發者ID:StarWishsama,項目名稱:Slimefun4-Chinese-Version,代碼行數:19,代碼來源:InfusedHopper.java

示例15: assumePose

import org.bukkit.entity.ArmorStand; //導入依賴的package包/類
/**
 * Force an ArmorStand to assume a pose.
 * @param stand
 * @param pose
 */
public static void assumePose(ArmorStand stand, ArmorPose pose) {
    if (!stand.isInvulnerable()) {
        stand.setInvulnerable(true);
        stand.setBasePlate(false);
        stand.setArms(true);
        MetadataManager.setMetadata(stand, "noModify", true);
    }

    assert pose != null;
    // Set Pose
    stand.setHeadPose(pose.getHead());
    stand.setBodyPose(pose.getBody());
    stand.setLeftArmPose(pose.getLeftArm());
    stand.setRightArmPose(pose.getRightArm());
    stand.setLeftLegPose(pose.getLeftLeg());
    stand.setRightLegPose(pose.getRightLeg());

    // Give gear.
    Map<EquipmentSlot, ItemStack> map = pose.getGear().toEnumMap(EquipmentSlot.class);
    for (EquipmentSlot slot : map.keySet())
        Utils.setItem(stand, slot, map.get(slot));
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:28,代碼來源:ArmorStands.java


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