Package org.bukkit.entity

Examples of org.bukkit.entity.EntityType


        }
    }

    @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
    public void onExplosionPrime(ExplosionPrimeEvent event) {
        EntityType entity = event.getEntityType();
        FlagPermissions perms = Residence.getPermsByLoc(event.getEntity().getLocation());
        if (entity == EntityType.CREEPER) {
            if (!perms.has("creeper", perms.has("explode", true))) {
                event.setCancelled(true);
                event.getEntity().remove();
View Full Code Here


    @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
    public void onEntityExplode(EntityExplodeEvent event) {
        if (event.isCancelled() || event.getEntity() == null)
            return;
        Boolean cancel = false;
        EntityType entity = event.getEntityType();
        FlagPermissions perms = Residence.getPermsByLoc(event.getEntity().getLocation());
        FlagPermissions world = Residence.getWorldFlags().getPerms(event.getEntity().getWorld().getName());
        if (entity == EntityType.CREEPER) {
            if (!perms.has("creeper", perms.has("explode", true))) {
                cancel = true;
View Full Code Here

            if(!skull.hasOwner())
                return;
            String playerName = ChatColor.stripColor(skull.getOwner());
            LocalPlayer player = CraftBookPlugin.inst().wrapPlayer(event.getPlayer());

            EntityType type = MobSkullType.getEntityType(playerName);

            ItemStack stack = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
            SkullMeta meta = (SkullMeta) stack.getItemMeta();
            meta.setOwner(playerName);

            if(type != null && !enableMobs)
                return;
            if(type == null && !enablePlayers)
                return;

            if(!event.getPlayer().hasPermission("craftbook.mech.headdrops.break")) {
                player.printError("mech.headdrops.break-permission");
                return;
            }

            if(type != null)
                meta.setDisplayName(ChatColor.RESET + StringUtils.replace(type.getName(), "_", " ") + " Head");
            else
                meta.setDisplayName(ChatColor.RESET + playerName + "'s Head");

            stack.setItemMeta(meta);
View Full Code Here

        }

        @Override
        public void verify(ChangedSign sign) throws ICVerificationException {

            EntityType type = EntityType.fromName(sign.getLine(2).trim().toLowerCase(Locale.ENGLISH));
            if(type == null)
                type = EntityType.valueOf(sign.getLine(2).trim().toUpperCase(Locale.ENGLISH));
            if (type == null)
                throw new ICVerificationException("Invalid Entity! See bukkit EntityType list!");
            else if (!type.isSpawnable())
                throw new ICVerificationException("Entity is not spawnable!");
        }
View Full Code Here

            }

            CustomDropDefinition def = null;
            if(type.equalsIgnoreCase("entity") || type.equalsIgnoreCase("mob")) {

                EntityType ent = EntityType.valueOf(config.getString("custom-drops." + key + ".entity-type"));

                def = new EntityCustomDropDefinition(key, drops, rewards, ent);
            } else if(type.equalsIgnoreCase("block")) {

                ItemInfo data = new ItemInfo(config.getString("custom-drops." + key + ".block"));
View Full Code Here

                    String[] data = RegexUtil.COLON_PATTERN.split(bit);

                    if (data[0].equalsIgnoreCase("e")) EntityUtil.setEntityData(ent, bit.substring(2));
                    else if (data[0].equalsIgnoreCase("r")) {
                        EntityType rider = EntityType.fromName(data[1].trim());
                        Entity rid = BukkitUtil.toSign(getSign()).getWorld().spawnEntity(location, rider);
                        ent.setPassenger(rid);
                    } else if (data[0].equalsIgnoreCase("p") && ent instanceof LivingEntity) {
                        for (int a = 1; a < data.length; a++) {
                            try {
View Full Code Here

        @Override
        public void verify(ChangedSign sign) throws ICVerificationException {

            String[] splitLine3 = RegexUtil.ASTERISK_PATTERN.split(sign.getLine(3).trim());
            EntityType type = EntityType.fromName(splitLine3[0].trim().toLowerCase(Locale.ENGLISH));
            if(type == null)
                type = EntityType.valueOf(splitLine3[0].trim().toUpperCase(Locale.ENGLISH));
            if (type == null)
                throw new ICVerificationException("Invalid Entity! See bukkit EntityType list!");
            else if (!type.isSpawnable())
                throw new ICVerificationException("Entity is not spawnable!");
        }
View Full Code Here

     * @throws com.sk89q.minecraft.util.commands.CommandException if no CreatureType could be found
     */
    public static EntityType matchCreatureType(CommandSender sender,
            String filter, boolean requireSpawnable) throws CommandException {
       
        EntityType partialMatch = null;

        for (EntityType type : EntityType.values()) {
            Class<?> clazz = type.getEntityClass();
            if (clazz == null) continue;
            if (!LivingEntity.class.isAssignableFrom(clazz)) continue;
View Full Code Here

    }

    private static CreatureSpawnEvent mockSpawnEvent(LivingEntity e, SpawnReason reason) {
        CreatureSpawnEvent event = mock(CreatureSpawnEvent.class);
        when(event.getEntity()).thenReturn(e);
        EntityType type = e.getType();
        when(event.getEntityType()).thenReturn(type);
        when(event.getSpawnReason()).thenReturn(reason);
        return event;
    }
View Full Code Here

          type = "mob";
        } else if (args[0].equalsIgnoreCase("npc")) {
          type = "npc";
        } else {
          type = args[0].toUpperCase(Locale.ENGLISH);
          EntityType ctype = ParseUtil.parseEnum(EntityType.class, type, null);
          if (ctype == null && type.endsWith("S")) {
            ctype = ParseUtil.parseEnum(EntityType.class, type.substring(0, type.length() - 2), null);
          }
          if (ctype != null) {
            type = ctype.name().toLowerCase(Locale.ENGLISH);
          } else {
            type = null;
          }
        }
        //Set it, of course
View Full Code Here

TOP

Related Classes of org.bukkit.entity.EntityType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.