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


Java ArmorStand.setGravity方法代碼示例

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


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

示例1: nameTag

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
public void nameTag(String name, String pname) {
	Player player = getPlayer(pname);
	ArmorStand ntag = (ArmorStand) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND);

	ntag.setCustomName(name);
	ntag.setCustomNameVisible(true);
	ntag.addScoreboardTag("p:" + pname);
	ntag.setVisible(false);
	ntag.setGravity(false);

	Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
		@Override
		public void run() {
			ntag.teleport(player.getLocation());
		}
	}, 0, 5);
}
 
開發者ID:GigaGamma,項目名稱:SuperiorCraft,代碼行數:18,代碼來源:SuperiorCraft.java

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

示例3: makeFloatingText

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
public static ArmorStand makeFloatingText(String name, Location loc, double xzOffset, double yMin, double yMax, double durationSec) {
    loc.add(-xzOffset / 2 + (Math.random() * (xzOffset)), (Math.random() * (yMax - yMin)) + yMin, -xzOffset / 2 + (Math.random() * (xzOffset)));
    final ArmorStand as = (ArmorStand) REntities.createLivingEntity(CustomArmorStand.class, loc);
    as.setVisible(false);
    as.setSmall(true);
    as.setMarker(true);
    as.setGravity(false);
    as.setArms(false);
    as.setBasePlate(false);
    as.setCanPickupItems(false);
    as.setCustomName(name);
    as.setCustomNameVisible(true);
    as.setRemoveWhenFarAway(false);
    RScheduler.schedule(SakiCore.plugin, new Runnable() {
        public void run() {
            if (as != null && as.isValid())
                as.remove();
        }
    }, RTicks.seconds(durationSec));
    return as;
}
 
開發者ID:edasaki,項目名稱:ZentrelaCore,代碼行數:22,代碼來源:RTags.java

示例4: makeStand

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
public static ArmorStand makeStand(String name, Location loc, boolean marker) {
    ArmorStand as = (ArmorStand) REntities.createLivingEntity(CustomArmorStand.class, loc);
    as.setVisible(false);
    as.setSmall(true);
    if (marker)
        as.setMarker(true);
    as.setGravity(false);
    as.setArms(false);
    as.setBasePlate(false);
    as.setCanPickupItems(false);
    as.setCustomName(name);
    as.setCustomNameVisible(true);
    as.setRemoveWhenFarAway(false);
    return as;
}
 
開發者ID:edasaki,項目名稱:ZentrelaCore,代碼行數:16,代碼來源:RTags.java

示例5: placeBlock

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
public ArmorStand placeBlock(Location l) {
	ArmorStand block = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
	block.setSmall(true);
	block.setGravity(false);
	block.setCustomName("CustomBlock");
	block.setCustomNameVisible(false);
	block.setInvulnerable(true);
	block.setVisible(false);
	block.setMarker(true);
	block.setSilent(true);
	
	ItemStack a = new ItemStack(Material.LEATHER_BOOTS);
	a.setDurability((short) primary.getTexture());
	LeatherArmorMeta am = (LeatherArmorMeta) a.getItemMeta();
	am.setColor(primary.getColor());
	am.setUnbreakable(true);
	if (primary.isGlowing()) {
		am.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
	}
	a.setItemMeta(am);
	block.setHelmet(a);
	
	if (secondary != null) {
		ItemStack b = new ItemStack(Material.LEATHER_BOOTS);
		b.setDurability((short) secondary.getTexture());
		LeatherArmorMeta bm = (LeatherArmorMeta) b.getItemMeta();
		bm.setColor(secondary.getColor());
		bm.setUnbreakable(true);
		if (secondary.isGlowing()) {
			System.out.println("H");
			bm.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
		}
		b.setItemMeta(bm);
		block.getEquipment().setItemInMainHand(b);
	}
	
	return block;
}
 
開發者ID:GigaGamma,項目名稱:SuperiorCraft,代碼行數:39,代碼來源:CustomBlockTexture.java

示例6: Hologram

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
public Hologram(String t, Location l) {
	hologram = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
	
	hologram.setGravity(false);
	hologram.setVisible(false);
	hologram.setCustomName(t);
	hologram.setCustomNameVisible(true);
	hologram.setMarker(true);
	hologram.setAI(false);
	hologram.addScoreboardTag("hologram");
	
	holograms.add(this);
}
 
開發者ID:GigaGamma,項目名稱:SuperiorCraft,代碼行數:14,代碼來源:Hologram.java

示例7: dropSeat

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
private ArmorStand dropSeat(Block chair, Stairs stairs)
{
	Location location = chair.getLocation().add(0.5, (-0.7 - 0.5), 0.5);
	
	switch(stairs.getDescendingDirection())
	{
		case NORTH:
			location.setYaw(180);
			break;
		case EAST:
			location.setYaw(270);
			break;
		case SOUTH:
			location.setYaw(0);
			break;
		case WEST:
			location.setYaw(90);
		default:
	}
	
	ArmorStand drop = (ArmorStand)location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
	drop.setCustomName("Chair");
	drop.setVelocity(new Vector(0, 0, 0));
	drop.setGravity(false);
	drop.setVisible(false);
	
	return drop;
}
 
開發者ID:FattyMieo,項目名稱:SurvivalPlus,代碼行數:29,代碼來源:Chairs.java

示例8: rewardsChest

import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
public static void rewardsChest(Dungeon dungeon) {
    DungeonBoss db = dungeon.boss;
    World w = db.getLoc().getWorld();
    ArmorStand as = (ArmorStand) w.spawnEntity(db.getLoc().add(0, -1.00, 0), EntityType.ARMOR_STAND);
    as.setGravity(false);
    as.setAI(false);
    as.setVisible(false);
    as.setCustomName(ChatColor.GOLD + "Dungeon Rewards");
    as.setCustomNameVisible(true);
    as.setHelmet(new ItemStack(Material.CHEST));

    ArmorStand as2 = (ArmorStand) w.spawnEntity(db.getLoc().add(0, -0.25, 0), EntityType.ARMOR_STAND);
    as2.setGravity(false);
    as2.setAI(false);
    as2.setVisible(false);
    as2.setCustomName(ChatColor.GREEN + "Disappearing in " + ChatColor.YELLOW + ChatColor.BOLD + "60" + ChatColor.GREEN + "...");
    as2.setCustomNameVisible(true);

    ArmorStand as3 = (ArmorStand) w.spawnEntity(db.getLoc().add(0, -0.50, 0), EntityType.ARMOR_STAND);
    as3.setGravity(false);
    as3.setAI(false);
    as3.setVisible(false);
    as3.setCustomName(ChatColor.GRAY + "[Click to Open]");
    as3.setCustomNameVisible(true);

    db.rewardsStage = true;
    Chunk chunk = as.getLocation().getChunk();
    Chunk chunk2 = as2.getLocation().getChunk();
    Chunk chunk3 = as3.getLocation().getChunk();

    rewardsToBosses.put(as.getUniqueId(), db);
    rewardsToBosses.put(as2.getUniqueId(), db);
    rewardsToBosses.put(as3.getUniqueId(), db);

    RScheduler.schedule(plugin, new Runnable() {
        int counter = 0;
        int sec = 60;

        public void run() {
            if (!chunk.isLoaded() || !chunk2.isLoaded() || !chunk3.isLoaded() || !as.isValid() || !as2.isValid() || !as3.isValid()) {
                db.rewardsStage = false;
                try {
                    as.remove();
                    as2.remove();
                    as3.remove();
                    rewardsToBosses.remove(as.getUniqueId());
                    rewardsToBosses.remove(as2.getUniqueId());
                    rewardsToBosses.remove(as3.getUniqueId());
                    dungeon.boss.spawnSpawner();
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return;
            }
            ((CraftArmorStand) as).getHandle().yaw += 10;
            if (counter++ < RTicks.seconds(60)) {
                RScheduler.schedule(plugin, this, 1);
                if (this.counter % 20 == 0)
                    as2.setCustomName(ChatColor.GREEN + "Disappearing in " + ChatColor.YELLOW + ChatColor.BOLD + (--sec) + ChatColor.GREEN + "...");
            } else {
                db.rewardsStage = false;
                as.remove();
                as2.remove();
                as3.remove();
                rewardsToBosses.remove(as.getUniqueId());
                rewardsToBosses.remove(as2.getUniqueId());
                rewardsToBosses.remove(as3.getUniqueId());
                dungeon.boss.spawnSpawner();
            }
        }
    }, 1);
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:73,代碼來源:DungeonManager.java

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


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