Java Code Examples for org.bukkit.entity.EntityType#VILLAGER
The following examples show how to use
org.bukkit.entity.EntityType#VILLAGER .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Region.java From BedwarsRel with GNU General Public License v3.0 | 6 votes |
public void setVillagerNametag() { Iterator<Entity> entityIterator = this.world.getEntities().iterator(); while (entityIterator.hasNext()) { Entity e = entityIterator.next(); if (!this.isInRegion(e.getLocation())) { continue; } if (e.getType() == EntityType.VILLAGER) { LivingEntity le = (LivingEntity) e; le.setCustomNameVisible(false); le.setCustomName( BedwarsRel ._l(BedwarsRel.getInstance().getServer().getConsoleSender(), "ingame.shop.name")); } } }
Example 2
Source File: CitizensShop.java From Shopkeepers with GNU General Public License v3.0 | 6 votes |
@Override protected void onInit() { super.onInit(); if (this.isActive()) return; if (!CitizensHandler.isEnabled()) return; // create npc: EntityType entityType; String name; if (shopkeeper.getType().isPlayerShopType()) { // player shops will use a player npc: entityType = EntityType.PLAYER; name = ((PlayerShopkeeper) shopkeeper).getOwnerName(); } else { entityType = EntityType.VILLAGER; name = "Shopkeeper"; } // prepare location: World world = Bukkit.getWorld(shopkeeper.getWorldName()); Location location = new Location(world, shopkeeper.getX() + 0.5D, shopkeeper.getY() + 0.5D, shopkeeper.getZ() + 0.5D); // create npc: npcId = CitizensHandler.createNPC(location, entityType, name); }
Example 3
Source File: GameStore.java From BedWars with GNU Lesser General Public License v3.0 | 5 votes |
/** * @param loc * @param shop * @param useParent * @param type * @param shopName * @param enableCustomName * @param isBaby */ public GameStore(Location loc, String shop, boolean useParent, EntityType type, String shopName, boolean enableCustomName, boolean isBaby) { if (type == null || !type.isAlive()) { type = EntityType.VILLAGER; } this.loc = loc; this.shop = shop; this.useParent = useParent; this.type = type; this.shopName = shopName; this.enableCustomName = enableCustomName; this.isBaby = isBaby; }
Example 4
Source File: GameStore.java From BedWars with GNU Lesser General Public License v3.0 | 5 votes |
/** * @param loc * @param shop * @param useParent * @param type * @param shopName * @param enableCustomName * @param isBaby */ public GameStore(Location loc, String shop, boolean useParent, EntityType type, String shopName, boolean enableCustomName, boolean isBaby) { if (type == null || !type.isAlive()) { type = EntityType.VILLAGER; } this.loc = loc; this.shop = shop; this.useParent = useParent; this.type = type; this.shopName = shopName; this.enableCustomName = enableCustomName; this.isBaby = isBaby; }
Example 5
Source File: Listeners.java From PlayerVaults with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onInteractEntity(PlayerInteractEntityEvent event) { Player player = event.getPlayer(); EntityType type = event.getRightClicked().getType(); if ((type == EntityType.VILLAGER || type == EntityType.MINECART) && PlayerVaults.getInstance().getInVault().containsKey(player.getUniqueId().toString())) { event.setCancelled(true); } }
Example 6
Source File: EntityInspectorTool.java From NBTEditor with GNU General Public License v3.0 | 5 votes |
@Override public void onInteractEntity(PlayerInteractEntityEvent event, PlayerDetails details) { Player player = event.getPlayer(); Entity entity = event.getRightClicked(); if (EntityNBT.isValidType(entity.getType())) { EntityNBT entityNBT = EntityNBT.fromEntity(entity); player.sendMessage(ChatColor.YELLOW + "Information about " + EntityTypeMap.getName(entity.getType()) + ""); for (NBTVariableContainer container : entityNBT.getAllVariables()) { player.sendMessage("" + ChatColor.LIGHT_PURPLE + ChatColor.ITALIC + container.getName() + ":"); for (String name : container.getVariableNames()) { String value = container.getVariable(name).get(); player.sendMessage(" " + ChatColor.AQUA + name + ": " + ChatColor.WHITE + (value != null ? value : ChatColor.ITALIC + "none")); } } player.sendMessage(ChatColor.YELLOW + "Extra information:"); boolean extra = false; if (entityNBT.getEntityType() == EntityType.VILLAGER) { player.sendMessage("" + ChatColor.LIGHT_PURPLE + ChatColor.ITALIC + "Trades done:"); int i = 1; for (VillagerOffersVariable.Offer offer : ((VillagerOffersVariable) entityNBT.getVariable("Offers")).getOffers()) { player.sendMessage(" " + ChatColor.AQUA + "trade " + i + ": " + ChatColor.WHITE + offer.uses); ++i; } extra = true; } if (!extra) { player.sendMessage("none"); } event.setCancelled(true); } else { player.sendMessage(ChatColor.RED + "Not a valid entity!"); } }
Example 7
Source File: CraftVillager.java From Kettle with GNU General Public License v3.0 | 4 votes |
public EntityType getType() { return EntityType.VILLAGER; }
Example 8
Source File: SentinelVersionCompat.java From Sentinel with MIT License | 4 votes |
static EntityType[] v1_8_passive() { return new EntityType[]{ EntityType.PIG, EntityType.OCELOT, EntityType.COW, EntityType.RABBIT, EntityType.SHEEP, EntityType.CHICKEN, EntityType.MUSHROOM_COW, EntityType.HORSE, EntityType.IRON_GOLEM, EntityType.SQUID, EntityType.VILLAGER, EntityType.WOLF, EntityType.SNOWMAN }; }
Example 9
Source File: CraftVillager.java From Thermos with GNU General Public License v3.0 | 4 votes |
public EntityType getType() { return EntityType.VILLAGER; }
Example 10
Source File: ScrubEntityType.java From skRayFall with GNU General Public License v3.0 | 4 votes |
/** * Convert a string to a bukkit entity type. * * @param exprs The string to be converted. */ public static EntityType getType(String exprs) { switch (exprs.replace("\"", "").toLowerCase().replace("_", " ").replaceFirst("the ", "")) { case "player": case "the player": return EntityType.PLAYER; case "pig": return EntityType.PIG; case "blaze": return EntityType.BLAZE; case "bat": return EntityType.BAT; case "chicken": return EntityType.CHICKEN; case "creeper": return EntityType.CREEPER; case "cow": return EntityType.COW; case "enderman": return EntityType.ENDERMAN; case "ender dragon": return EntityType.ENDER_DRAGON; case "ghast": return EntityType.GHAST; case "giant": return EntityType.GIANT; case "iron golem": return EntityType.IRON_GOLEM; case "magma cube": return EntityType.MAGMA_CUBE; case "mushroom cow": return EntityType.MUSHROOM_COW; case "ocelot": return EntityType.OCELOT; case "pig zombie": return EntityType.PIG_ZOMBIE; case "sheep": return EntityType.SHEEP; case "silverfish": return EntityType.SILVERFISH; case "squid": return EntityType.SQUID; case "snowman": return EntityType.SNOWMAN; case "wolf": return EntityType.WOLF; case "skeleton": return EntityType.SKELETON; case "slime": return EntityType.SLIME; case "spider": return EntityType.SPIDER; case "witch": return EntityType.WITCH; case "wither": return EntityType.WITHER; case "villager": return EntityType.VILLAGER; case "zombie": return EntityType.ZOMBIE; case "armor stand": return EntityType.ARMOR_STAND; case "guardian": return EntityType.GUARDIAN; default: return EntityType.PLAYER; } }
Example 11
Source File: BlockVillagerSpawnListener.java From Shopkeepers with GNU General Public License v3.0 | 4 votes |
@EventHandler(ignoreCancelled = true) void onSpawn(CreatureSpawnEvent event) { if (event.getEntityType() == EntityType.VILLAGER && event.getSpawnReason() != SpawnReason.CUSTOM) { event.setCancelled(true); } }
Example 12
Source File: GameStore.java From BedWars with GNU Lesser General Public License v3.0 | 2 votes |
/** * @param loc * @param shop * @param useParent * @param shopName * @param enableCustomName * @param isBaby */ public GameStore(Location loc, String shop, boolean useParent, String shopName, boolean enableCustomName, boolean isBaby) { this(loc, shop, useParent, EntityType.VILLAGER, shopName, enableCustomName, isBaby); }
Example 13
Source File: GameStore.java From BedWars with GNU Lesser General Public License v3.0 | 2 votes |
/** * @param loc * @param shop * @param useParent * @param shopName * @param enableCustomName * @param isBaby */ public GameStore(Location loc, String shop, boolean useParent, String shopName, boolean enableCustomName, boolean isBaby) { this(loc, shop, useParent, EntityType.VILLAGER, shopName, enableCustomName, isBaby); }