本文整理匯總了Java中org.bukkit.entity.ArmorStand.setVisible方法的典型用法代碼示例。如果您正苦於以下問題:Java ArmorStand.setVisible方法的具體用法?Java ArmorStand.setVisible怎麽用?Java ArmorStand.setVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.entity.ArmorStand
的用法示例。
在下文中一共展示了ArmorStand.setVisible方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
示例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);
}
示例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;
}
示例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;
}
示例5: AbstractAmo
import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
public AbstractAmo(int range, int damages, Vector direction, GamePlayer owner, WeaponType type) {
RANGE = range;
DAMAGES = damages;
COLOR = owner.getTeamColor();
OWNER = owner;
armorStand = (ArmorStand) owner.getPlayer().getWorld().spawnEntity(owner.getPlayer().getEyeLocation(), EntityType.ARMOR_STAND);
armorStand.setVisible(false);
int r = 20;
if(type == WeaponType.SHOOTER) r = 4;
if(type == WeaponType.SNIPER) r = 2;
double rng = (double) RANGE / r;
if(rng > 5) rng = 5;
armorStand.setVelocity(direction.multiply(rng));
lastLocation = armorStand.getLocation();
onFire(owner.getPlayer().getLocation());
task = Bukkit.getScheduler().runTaskTimer(Absorption.get(), new Runnable() {
@Override
public void run() {
check();
play(armorStand.getLocation());
}
}, 2, 1);
}
示例6: 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;
}
示例7: 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);
}
示例8: 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;
}
示例9: 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);
}
示例10: 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());
}
}
}
}