@EventHandler public void onEntityInteract(PlayerInteractEntityEvent event) { if (event.getRightClicked() != null && event.getRightClicked() instanceof Villager) event.setCancelled(true); if (event.getRightClicked() != null && npcs.containsKey(event.getRightClicked().getUniqueId())) { event.setCancelled(true); Player p = event.getPlayer(); if (plugin.getPD(p) != null) { if (lastClick.containsKey(p.getUniqueId())) { if (System.currentTimeMillis() - lastClick.get(p.getUniqueId()) < 333) { return; } } lastClick.put(p.getUniqueId(), System.currentTimeMillis()); npcs.get(event.getRightClicked().getUniqueId()).interact(p, plugin.getPD(p)); } } }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onTouchEntity(PlayerInteractEntityEvent e) { if (!cm.isAntiVillagerTrade) { return; } Entity entity = e.getRightClicked(); if (entity == null || NeverLagUtils.checkCustomNpc(entity)) { return; } World world = entity.getWorld(); if (world == null) { return; } if (cm.disableVillagerTradeWorld.contains(world.getName())) { if (entity instanceof Villager) { e.setCancelled(true); } } }
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; } }
/** * 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; }
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; } } }
public void modify(Villager villager, Player player) { WrappedEntityVillager<?> handle = WrapperCache.get(WrappedEntityVillager.class); handle.setVillager(villager); WrappedMerchantRecipeList<?> list = handle.getOffers(); List<WrappedMerchantRecipe<?>> recipes = list.getRecipes(); WrappedItemStack<?> item = WrapperCache.get(WrappedItemStack.class); for(WrappedMerchantRecipe<?> recipe : recipes) { recipe.newInstance(getItem(item, recipe.handleGetBuyingItem1()), getItem(item, recipe.handleGetBuyingItem2()), getItem(item, recipe.handleGetSellingItem()), recipe.getUses(), recipe.getMaxUses()); } list.setRecipes(recipes); item.cache(); recipes.forEach(Wrappable::cache); list.cache(); handle.cache(); }
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (sender instanceof Player) { Player player = (Player) sender; if (command.getName().equalsIgnoreCase("spawnNPC")) { if (!player.hasPermission("deathswap.admin")) { player.sendMessage(ChatUtil.formatWithPrefix("&cYou do not have permission to use this command!")); return true; } Villager villager = (Villager) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.VILLAGER); villager.setCustomName(ChatUtil.format("&aJoin DeathSwap")); villager.setProfession(Villager.Profession.BUTCHER); villager.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999, 999999)); } } return false; }
@Override public void onEnable() { if(this.getServer().getPluginManager().isPluginEnabled("Vault")) { economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); } fillTradeTable(); //_location = new Location(getServer().getWorld("world"), -163.0, 71.0, 145.0); // server test punisher _location = new Location(getServer().getWorld("world"), 691.0,69.0,276.0); // shop village _zone = new WorldZone(_location, 5); //_zone = new WorldZone(getServer().getWorld("world"), "-167,140,-159,150,69,75"); _villager = (Villager)getServer().getWorld("world").spawnCreature(_location, EntityUtilities.getCreatureType("Villager")); _location = _villager.getLocation(); getServer().getPluginManager().registerEvents(this, this); getCommand("tv").setExecutor(this); Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(this, 0, 100, TimeUnit.MILLISECONDS); ZoneServer.getInstance().addListener(this); }
@EventHandler public void onInteractEvent(PlayerInteractEntityEvent e){ RedProtect.get().logger.debug("RPEntityListener - Is PlayerInteractEntityEvent"); if (e.isCancelled()) { return; } Player p = e.getPlayer(); if (p == null){ return; } Location l = e.getRightClicked().getLocation(); Region r = RedProtect.get().rm.getTopRegion(l); Entity et = e.getRightClicked(); if (r != null && !r.canInteractPassives(p) && (et instanceof Animals || et instanceof Villager || et instanceof Golem)) { if (et instanceof Tameable){ Tameable tam = (Tameable) et; if (tam.isTamed() && tam.getOwner() != null && tam.getOwner().getName().equals(p.getName())){ return; } } e.setCancelled(true); RPLang.sendMessage(p, "entitylistener.region.cantinteract"); } }
private String ds(Villager.Profession a) { switch (a) { case BLACKSMITH: return "Blacksmith"; case BUTCHER: return "Butcher"; case FARMER: return "Farmer"; case HUSK: return "Husk"; case LIBRARIAN: return "Librarian"; case NITWIT: return "Nitwit"; case PRIEST: return "Priest"; default: return "Unknown 0x8." + a.ordinal(); } }
@EventHandler public void onVillagerDamage(EntityDamageByEntityEvent event) { if(event.getDamager() instanceof Player && event.getEntity() instanceof Villager) { Villager villager = (Villager) event.getEntity(); Player damager = (Player) event.getDamager(); if(villager.getCustomName().equals(damager.getName())) { for(Player online : Bukkit.getOnlinePlayers()) { if(online.hasPermission("cnohacks.view") || online.isOp()) { if (ConfigManager.contains("alerts.yml", online.getName())) { if (ConfigManager.get("alerts.yml").getBoolean(online.getName() + ".Alerts")) { online.sendMessage(Utils.getPrefix() + damager.getDisplayName() + " §7might be using §cForcefield"); } } } } } } }
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; }
@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"); } } } }
public CreatureType getCreatureType(EntityType entityType) { if (Monster.class.isAssignableFrom(entityType.getEntityClass()) || WaterMob.class.isAssignableFrom(entityType.getEntityClass()) || Slime.class.isAssignableFrom(entityType.getEntityClass()) || Ghast.class.isAssignableFrom(entityType.getEntityClass()) ) { return CreatureType.MONSTER; } else if (Animals.class.isAssignableFrom(entityType.getEntityClass())) { return CreatureType.ANIMAL; } else if (Villager.class.isAssignableFrom(entityType.getEntityClass())) { return CreatureType.VILLAGER; } else if (Golem.class.isAssignableFrom(entityType.getEntityClass())) { return CreatureType.GOLEM; } return CreatureType.UNKNOWN; }
@EventHandler(priority = EventPriority.HIGHEST) public void onDamage(EntityDamageByEntityEvent ev) { if ((ev.getDamager() instanceof Player)) { Player pl = (Player)ev.getDamager(); // Is in game? if (this.am.isInGame(pl)) { if (((ev.getEntity() instanceof Villager)) || ((ev.getEntity() instanceof Player))) { // Cancel damage ev.setCancelled(true); } for (Arena a : this.am.arenas) { if (a.deadPlayers.contains(pl.getName())) { // Avoid damage by dead players ev.setCancelled(true); } } } } else if (ev.getDamager() instanceof Arrow){ // To avoid damage by arrow if (((ev.getEntity() instanceof Villager)) || ((ev.getEntity() instanceof Player))) { ev.setCancelled(true); } } }
@EventHandler public void i(PlayerInteractEntityEvent e){ Player p = e.getPlayer(); Entity ent = e.getRightClicked(); if(!(ent instanceof Villager)){ return; } e.setCancelled(true); Villager v = (Villager) ent; if(v.getCustomName().equalsIgnoreCase(ChatColor.RED + "" + ChatColor.BOLD + "Mineageddon")){ p.sendMessage(ChatColor.AQUA + "" + ChatColor.BOLD + "--------" + ChatColor.RED + "" + ChatColor.BOLD + "Mineageddon" + ChatColor.AQUA + "" + ChatColor.BOLD + "--------"); p.sendMessage(ChatColor.BLUE + "Description: " + ChatColor.GRAY + "Use our amazing custom items to kill other players whilst destorying everything!"); p.sendMessage(ChatColor.BLUE + "Category: " + ChatColor.GRAY + "Kit PvP"); p.sendMessage(ChatColor.BLUE + "Coded by: " + ChatColor.GRAY + "nxsupert"); p.sendMessage(ChatColor.AQUA + "" + ChatColor.BOLD + "------------------" + ChatColor.AQUA + "" + ChatColor.BOLD + "--------"); } }
@EventHandler public void PlayerRightClick(PlayerInteractEntityEvent event) { if(event.getRightClicked() instanceof Villager) { Player p = event.getPlayer(); if(p.getInventory().getHelmet() != null) { p.getInventory().getHelmet().setDurability((short) 0); } if(p.getInventory().getChestplate() != null){ p.getInventory().getChestplate().setDurability((short) 0); } if(p.getInventory().getLeggings() != null) { p.getInventory().getLeggings().setDurability((short) 0); } if(p.getInventory().getLeggings() != null) { p.getInventory().getBoots().setDurability((short) 0); } } }
@Override public InventoryView openMerchant(Villager villager, boolean force) { Preconditions.checkNotNull(villager, "villager cannot be null"); if (!force && villager.isTrading()) { return null; } else if (villager.isTrading()) { // we're not supposed to have multiple people using the same villager, so we have to close it. villager.getTrader().closeInventory(); } EntityVillager ev = ((CraftVillager) villager).getHandle(); ev.setTradingPlayer(this.getHandle()); this.getHandle().openTrade(ev); return this.getHandle().activeContainer.getBukkitView(); }
@Override public BehaviourItem[] getDefaultMovementBehaviours() { return new BehaviourItem[]{ new BehaviourItem(0, new BehaviourFloat(this)), new BehaviourItem(1, new BehaviourAvoidEntity(this, Zombie.class, 8.0F, 0.6D, 0.6D)), new BehaviourItem(1, new BehaviourTradeWithPlayer(this)), new BehaviourItem(1, new BehaviourLookAtTradingPlayer(this)), new BehaviourItem(2, new BehaviourMoveIndoors(this)), new BehaviourItem(3, new BehaviourRestrictOpenDoor(this)), new BehaviourItem(4, new BehaviourOpenDoor(this, true)), new BehaviourItem(5, new BehaviourMoveTowardsRestriction(this, 0.6D)), new BehaviourItem(6, new BehaviourMakeLove(this)), new BehaviourItem(7, new BehaviourTakeFlower(this)), new BehaviourItem(8, new BehaviourVillagerPlay(this, 0.32D)), new BehaviourItem(9, new BehaviourInteract(this, HumanEntity.class, 3.0F, 1.0F)), new BehaviourItem(9, new BehaviourInteract(this, Villager.class, 3.0F, 1.0F)), new BehaviourItem(9, new BehaviourRandomStroll(this, 0.6D)), new BehaviourItem(10, new BehaviourLookAtNearestEntity(this, InsentientEntity.class, 8.0F)) }; }
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; }
protected boolean spawn() { if (loc.getChunk().isLoaded()) { despawn(); le = type.createEntity(loc.clone().add(0, 0.5, 0)); boolean mobile = false; if (this instanceof GenericNPC) { ((Leashable) ((CraftLivingEntity) le).getHandle()).allowWalk(((GenericNPC) this).leash); mobile = true; } String displayName = getColor() + name; le.setCustomName(displayName); le.setCustomNameVisible(true); if (le instanceof Villager) { if (this instanceof QuestVillager) { ((Villager) le).setProfession(Profession.PRIEST); } else if (this instanceof ShopVillager) { ((Villager) le).setProfession(Profession.LIBRARIAN); } else if (this instanceof DungeonVillager) { ((Villager) le).setProfession(Profession.BUTCHER); } else if (this instanceof HorseVillager) { ((Villager) le).setProfession(Profession.BLACKSMITH); } } if (!mobile) { double mult = type.tagHeight; as = RTags.makeStand(ChatColor.GRAY + getSub(), loc.clone().add(0, ((CraftLivingEntity) le).getHandle().getHeadHeight() * mult, 0), true); NPCManager.npcs.put(as.getUniqueId(), this); } NPCManager.npcs.put(le.getUniqueId(), this); RScheduler.schedule(NPCManager.plugin, new Runnable() { public void run() { if (loc.getChunk().isLoaded() && le != null && le.isValid()) { le.teleport(loc); } } }, RTicks.seconds(1)); return true; } return false; }
public LoggerEntity(Plugin plugin, Player player) { this.plugin = plugin; this.uuid = player.getUniqueId(); this.name = player.getName(); this.health = player.getHealth(); this.contents = player.getInventory().getContents(); this.armour = player.getInventory().getArmorContents(); this.world = player.getWorld(); this.villager = (Villager) this.world.spawnEntity(player.getLocation(), EntityType.VILLAGER); this.villager.setCustomName(this.name); this.villager.setHealth(this.health); this.resetTimer(); }
@ListenerScope(MatchScope.LOADED) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void processItemRemoval(PlayerInteractEntityEvent event) { if(event.getRightClicked() instanceof Villager) { event.setCancelled(true); event.getPlayer().openMerchantCopy((Villager) event.getRightClicked()); } }
/** * @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; }
/** * @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; }
@EventHandler public void onInteract(PlayerInteractEntityEvent evt) { if (!(evt.getRightClicked() instanceof Villager) || !evt.getRightClicked().getCustomName().contains("Barley") || Cutscenes.isWatching(evt.getPlayer()) || isComplete()) return; if (evt.getPlayer().getInventory().contains(Material.SHEARS)) { evt.getPlayer().getInventory().remove(Material.SHEARS); complete(); } else { evt.getPlayer().sendMessage(ChatColor.DARK_GREEN + "Mr. Barley> " + ChatColor.GREEN + "We need my shears to move onward. Help me search from them!"); } }
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); } }
public static void killAllNPCs() { for (Villager npc : getWorld().getEntitiesByClass(Villager.class)) { if (npc == null) continue; npc.setHealth(0); } npcs.clear(); }
@Override public void onLoad() { add(Villager.Profession.FARMER, "Farmer", "Default", "Def", "Normal", "None", "Farm", "FA", "F"); add(Villager.Profession.LIBRARIAN, "Librarian", "Library", "Lib", "LI", "L"); add(Villager.Profession.PRIEST, "Priest", "PR", "P"); add(Villager.Profession.BLACKSMITH, "Blacksmith", "Smith", "BSmith", "BlackS", "BS", "BL"); add(Villager.Profession.BUTCHER, "Butcher", "BU", "B"); }
@Override @Nullable public Villager spawn(final Location loc) { final Villager v = super.spawn(loc); if (v == null) return null; if (profession == null) v.setProfession(CollectionUtils.getRandom(Profession.values())); return v; }
@EventHandler public void onInteract(PlayerInteractEntityEvent e) { if (e.getRightClicked() instanceof Villager && ((LivingEntity) e.getRightClicked()).getCustomName() != null && ((LivingEntity) e.getRightClicked()).getCustomName().equals("�5�lLost Librarian")) { e.setCancelled(true); try { LostLibrarian.openMenu(e.getPlayer()); } catch (Exception e1) { e1.printStackTrace(); } } }
@Override public void rawset(LuaValue key, LuaValue value) { if (key.isstring()) { switch (key.checkjstring()) { case "profession": getVillagerTrait().setProfession(ScriptUtil.enumValue(value, Villager.Profession.class)); break; } } super.rawset(key, value); }
@EventHandler public void onCreatureSpawn(CreatureSpawnEvent event) { RedProtect.get().logger.debug("RPGlobalListener - Is CreatureSpawnEvent event! Cancelled? " + event.isCancelled()); if (event.isCancelled()) { return; } Entity e = event.getEntity(); if (e == null) { return; } Location l = event.getLocation(); Region r = RedProtect.get().rm.getTopRegion(l); if (r != null){ return; } if (e instanceof Wither && event.getSpawnReason().equals(SpawnReason.BUILD_WITHER) && !RPConfig.getGlobalFlagBool(e.getWorld().getName()+".spawn-wither")){ event.setCancelled(true); return; } if (e instanceof Monster && !RPConfig.getGlobalFlagBool(e.getWorld().getName()+".spawn-monsters")) { if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.NATURAL) || event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.SPAWNER) || event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.CHUNK_GEN) || event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.DEFAULT)) { event.setCancelled(true); return; } } if ((e instanceof Animals || e instanceof Villager || e instanceof Golem) && !RPConfig.getGlobalFlagBool(e.getWorld().getName()+".spawn-passives")) { if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.NATURAL) || event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.SPAWNER) || event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.CHUNK_GEN) || event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.DEFAULT)) { event.setCancelled(true); } } }
@EventHandler public void onVillagerInteract(PlayerInteractEntityEvent event) { if(event.getRightClicked() instanceof Villager) { Villager villager = (Villager) event.getRightClicked(); if(villager.hasMetadata("cancel")) { event.setCancelled(true); } } }
public CreatureType getCreatureType(LivingEntity creature) { if (creature instanceof Monster || creature instanceof WaterMob || creature instanceof Slime || creature instanceof Ghast) { return CreatureType.MONSTER; } else if (creature instanceof Animals) { return CreatureType.ANIMAL; } else if (creature instanceof Villager) { return CreatureType.VILLAGER; } else if (creature instanceof Golem) { return CreatureType.GOLEM; } return CreatureType.UNKNOWN; }
/** * @return Provides count of villagers within the protected island boundaries */ public int getPopulation() { int result = 0; for (int x = getMinProtectedX() /16; x <= (getMinProtectedX() + getProtectionSize() - 1)/16; x++) { for (int z = getMinProtectedZ() /16; z <= (getMinProtectedZ() + getProtectionSize() - 1)/16; z++) { for (Entity entity : world.getChunkAt(x, z).getEntities()) { if (entity instanceof Villager && onIsland(entity.getLocation())) { result++; } } } } return result; }
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)); } }
public static Villager spawn(Location location) { World mcWorld = (World) ((CraftWorld) location.getWorld()).getHandle(); final HubVillager customEntity = new HubVillager( mcWorld,1); customEntity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); ((CraftLivingEntity) customEntity.getBukkitEntity()) .setRemoveWhenFarAway(false); mcWorld.addEntity(customEntity, SpawnReason.CUSTOM); return (CraftVillager) customEntity.getBukkitEntity(); }
public void createNPC(UUID uuid) { OfflinePlayer player = Bukkit.getOfflinePlayer(uuid); World world = player.getPlayer().getWorld(); Villager villager = world.spawn(player.getPlayer().getLocation(), Villager.class);//Spawn villager at the player's location villager.setAge(9999); villager.setAgeLock(true); }