本文整理汇总了Java中org.bukkit.entity.Villager.setCustomNameVisible方法的典型用法代码示例。如果您正苦于以下问题:Java Villager.setCustomNameVisible方法的具体用法?Java Villager.setCustomNameVisible怎么用?Java Villager.setCustomNameVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Villager
的用法示例。
在下文中一共展示了Villager.setCustomNameVisible方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: spawnVillager
import org.bukkit.entity.Villager; //导入方法依赖的package包/类
private boolean spawnVillager(Location l, int data) {
final Villager v = (Villager) l.getWorld().spawnEntity(l, EntityType.VILLAGER);
v.setAgeLock(true);
v.setCustomNameVisible(true);
NoAI.setAIEnabled(v, false); //No queremos la "querida" AI de Minecraft :D
v.teleport(l);
switch (data) {
case 0:
v.setProfession(Villager.Profession.FARMER);
v.setCustomName("&dComprador Variado");
return true;
case 1:
v.setProfession(Villager.Profession.BLACKSMITH);
v.setCustomName("&cComprador Armas");
return true;
default:
return false;
}
}
示例2: spawnVillager
import org.bukkit.entity.Villager; //导入方法依赖的package包/类
/**
* Spawns a Villager of the given VillagerType at the provided Location
*
* @param type - the Type of the Villager you wish to Spawn
* @param location - the Location at which you want the Villager to be
* @return Villager - the Villager that you had set at the provided Location if you wish to use it
*/
public Villager spawnVillager(VillagerType type, Location location) {
if (!location.getChunk().isLoaded()) {
location.getChunk().load();
}
Villager villager = (Villager) location.getWorld().spawnEntity(location, EntityType.VILLAGER);
villager.setAdult();
villager.setAgeLock(true);
villager.setProfession(Profession.FARMER);
villager.setRemoveWhenFarAway(false);
villager.setCustomName(type.getColor() + type.getName());
villager.setCustomNameVisible(true);
villager.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, -6, true), true);
villager.teleport(location, TeleportCause.PLUGIN);
villager.setHealth(20.0D);
return villager;
}
示例3: resetupNPC
import org.bukkit.entity.Villager; //导入方法依赖的package包/类
public static void resetupNPC(String namee) {
killNPC(namee);
for (String name : MerchantManager.getAllNPCs()) {
if (name.equals(namee)) {
Villager npc = getWorld().spawn(MerchantManager.getLocation(name), Villager.class);
npc.setCustomName(name); //change name here
npc.setCustomNameVisible(true);
npc.setAI(false);
npc.setInvulnerable(true);
npc.setProfession(Villager.Profession.BLACKSMITH);
npcs.add(npc);
break;
}
}
}
示例4: onCommand
import org.bukkit.entity.Villager; //导入方法依赖的package包/类
public boolean onCommand(CommandSender sender, Command cmd, String tag, String[] args) {
if (tag.equalsIgnoreCase("test")) {
for (Player online : Bukkit.getOnlinePlayers()) {
final Villager villager = (Villager) online.getLocation().getWorld().spawnEntity(online.getLocation().subtract(3,0,3), EntityType.VILLAGER);
villager.setCustomName(online.getName());
villager.setCustomNameVisible(true);
villager.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1));
villager.setMetadata("cancel", (MetadataValue)new FixedMetadataValue((Plugin)plugin, (Object)true));
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
public void run() {
vilager.removeMetaData("cancel");
villager.remove();
}
}, 10);
}
}
return false;
}
示例5: onEntityInteract
import org.bukkit.entity.Villager; //导入方法依赖的package包/类
@EventHandler
public void onEntityInteract(PlayerInteractEntityEvent e) {
if (Main.PlayingPlayers.contains(e.getPlayer()) || Main.WaitingPlayers.contains(e.getPlayer())) {
e.setCancelled(true);
}
if (e.getRightClicked() instanceof Villager) {
Villager v = (Villager) e.getRightClicked();
if (v.getCustomName().equals("Try Guns") || v.getCustomName().equals("§b§lTry Guns")) {
if (Main.WaitingPlayers.contains(e.getPlayer())) {
Player p = e.getPlayer();
v.setCustomName("§b§lTry Guns");
v.setCustomNameVisible(true);
p.openInventory(Guns.tryGunsInventory);
} else {
e.setCancelled(true);
e.getPlayer().sendMessage(Main.codSignature + "§cYou may only try guns when in COD-Warfare");
}
}
}
}
示例6: SpawnVillager
import org.bukkit.entity.Villager; //导入方法依赖的package包/类
public static Villager SpawnVillager(World world, Location loc, String name){
if(EpicSystem.useCitizens()) return null;
//Check if villager exists
if(GetEntity(world, name) != null){
RemoveVillager(world, name);
}
//Set properties
Villager villager = (Villager) world.spawnEntity(loc, EntityType.VILLAGER);
villager.setCustomName(name);
villager.setCustomNameVisible(true);
villager.setAgeLock(true);
villager.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000000000, 100000000));
villager.setCanPickupItems(false);
QuestEntity epicVillager = new QuestEntity(villager);
epicVillager.originalLocation = loc;
entityList.put(villager, epicVillager);
return villager;
}
示例7: spawnVillager
import org.bukkit.entity.Villager; //导入方法依赖的package包/类
/**
* @param location
* the location where the villager will spawn
* @return
* the spawned villager
*/
public static Villager spawnVillager(Location location) {
Villager villager = (Villager) location.getWorld().spawnEntity(location, EntityType.VILLAGER);
if (Version.andHigher(Version.MC1_11).contains(CompatibilityHandler.getInstance().getVersion())) {
villager.setProfession(Profession.NITWIT);
} else {
villager.setProfession(Profession.FARMER);
}
villager.setCustomName(MOB_VILLAGER.getMessage());
villager.setCustomNameVisible(true);
return villager;
}
示例8: spawnTrader
import org.bukkit.entity.Villager; //导入方法依赖的package包/类
/**
* @param location
* the location where the trader will spawn
* @return
* the spawned trader
*/
public static Villager spawnTrader(Location location) {
Villager villager = (Villager) location.getWorld().spawnEntity(location, EntityType.VILLAGER);
villager.setProfession(Profession.LIBRARIAN);
villager.setCustomName(MOB_TRADER.getMessage());
villager.setCustomNameVisible(true);
return villager;
}
示例9: setupNPCs
import org.bukkit.entity.Villager; //导入方法依赖的package包/类
private static void setupNPCs() {
for (String name : MerchantManager.getAllNPCs()) {
Villager npc = getWorld().spawn(MerchantManager.getLocation(name), Villager.class);
npc.setCustomName(name); //change name here
npc.setCustomNameVisible(true);
npc.setAI(false);
npc.setInvulnerable(true);
npc.setProfession(Villager.Profession.BLACKSMITH);
npcs.add(npc);
}
}
示例10: spawn
import org.bukkit.entity.Villager; //导入方法依赖的package包/类
public static void spawn(){
for(Location loc : mineageddon()){
final Villager v = HubVillager.spawn(loc);
v.setAdult();
v.setCustomName(ChatColor.RED + "" + ChatColor.BOLD + "Mineageddon");
v.setCustomNameVisible(true);
v.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 10000000,100,false));
}
}