本文整理匯總了Java中org.bukkit.entity.ArmorStand.setCustomName方法的典型用法代碼示例。如果您正苦於以下問題:Java ArmorStand.setCustomName方法的具體用法?Java ArmorStand.setCustomName怎麽用?Java ArmorStand.setCustomName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.entity.ArmorStand
的用法示例。
在下文中一共展示了ArmorStand.setCustomName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getArmorStand
import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
private static ArmorStand getArmorStand(Block b)
{
Location l = new Location(b.getWorld(), (double)b.getX() + 0.5D, (double)b.getY() + 1.2D, (double)b.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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: getArmorStand
import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
public static ArmorStand getArmorStand(Location reactor)
{
Location l = new Location(reactor.getWorld(), reactor.getX() + 0.5D, reactor.getY(), reactor.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) && l.distanceSquared(n.getLocation()) < 0.40000000000000002D)
return (ArmorStand)n;
}
ArmorStand hologram = ArmorStandFactory.createHidden(l);
hologram.setCustomNameVisible(false);
hologram.setCustomName(null);
return hologram;
}
示例6: placeBlock
import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
@Override
public boolean placeBlock(ArmorStand e, Player p) {
//e.setHelmet(new ItemStack(Material.STONE, 1));
if (e.getWorld().getBlockAt(e.getLocation()).getType() != Material.STANDING_BANNER) {
p.sendMessage(ChatColor.RED + "Please place down a banner first!");
e.remove();
}
else {
e.setCustomName("flag");
p.sendMessage(ChatColor.GREEN + "Flag placed");
}
return true;
}
示例7: 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);
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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);
}
示例12: 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;
}
示例13: 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);
}
示例14: update
import org.bukkit.entity.ArmorStand; //導入方法依賴的package包/類
public static void update(Block b, String name)
{
ArmorStand hologram = getArmorStand(b);
hologram.setCustomName(name);
}
示例15: 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());
}
}
}
}