当前位置: 首页>>代码示例>>Java>>正文


Java SkeletonType类代码示例

本文整理汇总了Java中org.bukkit.entity.Skeleton.SkeletonType的典型用法代码示例。如果您正苦于以下问题:Java SkeletonType类的具体用法?Java SkeletonType怎么用?Java SkeletonType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SkeletonType类属于org.bukkit.entity.Skeleton包,在下文中一共展示了SkeletonType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convert

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@Override
@Nullable
public ItemType convert(final Object o) {
	final SkullType type;
	if (o instanceof Skeleton || o instanceof SkeletonData) {
		if (o instanceof SkeletonData ? ((SkeletonData) o).isWither() : ((Skeleton) o).getSkeletonType() == SkeletonType.WITHER) {
			type = SkullType.WITHER;
		} else {
			type = SkullType.SKELETON;
		}
	} else if (o instanceof Zombie || o instanceof EntityData && Zombie.class.isAssignableFrom(((EntityData<?>) o).getType())) {
		type = SkullType.ZOMBIE;
	} else if (o instanceof OfflinePlayer || o instanceof PlayerData) {
		type = SkullType.PLAYER;
	} else if (o instanceof Creeper || o instanceof CreeperData) {
		type = SkullType.CREEPER;
	} else {
		return null;
	}
	@SuppressWarnings("deprecation")
	final ItemType i = new ItemType(Material.SKULL_ITEM.getId(), (short) type.ordinal());
	if (o instanceof OfflinePlayer) {
		final SkullMeta s = (SkullMeta) Bukkit.getItemFactory().getItemMeta(Material.SKULL_ITEM);
		s.setOwner(((OfflinePlayer) o).getName());
		i.setItemMeta(s);
	}
	return i;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:29,代码来源:ExprSkull.java

示例2: getState

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@Override
public RequirementState getState() {
	YamlConfiguration myState = new YamlConfiguration();
	
	myState.set("type", "vr");
	
	ConfigurationSection foeSection = myState.createSection("foe");
	foeSection.set("type", foe.getType().name());
	foeSection.set("maxhp", foe.getMaxHealth());
	foeSection.set("hp", foe.getHealth());
	foeSection.set("name", foe.getCustomName());
	foeSection.set("location", foe.getLocation());
	
	if (foe instanceof Guardian) {
		foeSection.set("elder", ((Guardian) foe).isElder());
	}
	
	if (foe instanceof Slime) {
		foeSection.set("size", ((Slime) foe).getSize());
	}
	
	if (foe instanceof Skeleton) {
		foeSection.set("wither", ((Skeleton) foe).getSkeletonType() == SkeletonType.WITHER);
	}
	
	EquipmentConfiguration econ = new EquipmentConfiguration(foe.getEquipment());
	foeSection.set("equipment", econ.getConfiguration());
	
	return new RequirementState(myState);
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:31,代码来源:VanquishRequirement.java

示例3: spawnWitherSkeleton

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@Override
public LivingEntity spawnWitherSkeleton(Location loc)
{
	Skeleton entity = (Skeleton) loc.getWorld().spawnEntity(loc, EntityType.SKELETON);
	entity.setSkeletonType(SkeletonType.WITHER);
	return entity;
}
 
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:8,代码来源:SpecialEntities.java

示例4: effect

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@Override
public void effect(Event e, ItemStack item, int level) {
    EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e;
    final Player player = (Player) event.getDamager();
    final LivingEntity ent = (LivingEntity) event.getEntity();

    new BukkitRunnable() {
        @Override
        public void run() {

            if (ent.getHealth() <= 0) {
                byte type = 3;

                if (ent instanceof Skeleton) {
                    type = 0;
                    if (((Skeleton) ent).getSkeletonType().equals(SkeletonType.WITHER))
                        type = 1;
                } else if (ent instanceof Zombie)
                    type = 2;
                else if (ent instanceof Creeper)
                    type = 4;

                ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, type);
                if (type == 3) {
                    SkullMeta sm = (SkullMeta) skull.getItemMeta();
                    sm.setOwner(ent.getName());
                    skull.setItemMeta(sm);
                }
                ent.getWorld().dropItem(ent.getLocation(), skull);
                EffectManager.playSound(player.getLocation(), "BLOCK_ANVIL_LAND", 0.1f, 1.5f);
            }
        }
    }.runTaskLater(getPlugin(), 5l);

}
 
开发者ID:Taiterio,项目名称:ce,代码行数:36,代码来源:Headless.java

示例5: onDeath

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST)
public void onDeath(final EntityDeathEvent e) {
	if (e.getEntity().hasMetadata("android_killer")) {
		for (MetadataValue value: e.getEntity().getMetadata("android_killer")) {
			final AndroidObject obj = (AndroidObject) value.value();
			Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
				
				@SuppressWarnings("deprecation")
				@Override
				public void run() {
					List<ItemStack> items = new ArrayList<ItemStack>();
					for (Entity n: e.getEntity().getNearbyEntities(0.5D, 0.5D, 0.5D)) {
						if (n instanceof Item && !n.hasMetadata("no_pickup")) {
							items.add(((Item) n).getItemStack());
							n.remove();
						}
					}
					
					switch (e.getEntityType()) {
					case BLAZE: {
						items.add(new ItemStack(Material.BLAZE_ROD, 1 + CSCoreLib.randomizer().nextInt(2)));
						break;
					}
					case PIG_ZOMBIE: {
						items.add(new ItemStack(Material.GOLD_NUGGET, 1 + CSCoreLib.randomizer().nextInt(3)));
						break;
					}
					case SKELETON: {
						if (((Skeleton) e.getEntity()).getSkeletonType().equals(SkeletonType.WITHER)) {
							if (CSCoreLib.randomizer().nextInt(250) < 2) items.add(new MaterialData(Material.SKULL_ITEM, (byte) 1).toItemStack(1));
						}
						break;
					}
					default:
						break;
					}
					
					obj.getAndroid().addItems(obj.getBlock(), items.toArray(new ItemStack[items.size()]));
					ExperienceOrb exp = (ExperienceOrb) e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.EXPERIENCE_ORB);
					exp.setExperience(1 + CSCoreLib.randomizer().nextInt(6));
				}
			}, 1L);
			return;
		}
	}
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:47,代码来源:AndroidKillingListener.java

示例6: init

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@Override
protected boolean init(final @Nullable Class<? extends Skeleton> c, final @Nullable Skeleton e) {
	wither = (e == null || !hasWither) ? false : e.getSkeletonType() == SkeletonType.WITHER;
	return true;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:6,代码来源:SkeletonData.java

示例7: set

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@Override
public void set(final Skeleton entity) {
	if (hasWither)
		entity.setSkeletonType(wither ? SkeletonType.WITHER : SkeletonType.NORMAL);
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:6,代码来源:SkeletonData.java

示例8: match

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@Override
protected boolean match(final Skeleton entity) {
	return hasWither ? (entity.getSkeletonType() == SkeletonType.WITHER) == wither : true;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:5,代码来源:SkeletonData.java

示例9: activate

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@Override
public void activate() {
	ConfigurationSection myState = foeStateRecord.getConfig();
	
	//get rid of any entities we already have
	if (foe != null && !foe.isDead()) {
		foe.remove();			
	}
	
	
	ConfigurationSection foeState =  myState.getConfigurationSection("foe");
	Location loc = ((LocationState) foeState.get("location")).getLocation();
	
	//load chunk before creating foe
	loc.getChunk();
	
	foe = (LivingEntity) loc.getWorld().spawnEntity(loc, EntityType.valueOf(foeState.getString("type")));
	this.id = foe.getUniqueId();
	foe.setMaxHealth(foeState.getDouble("maxhp"));
	foe.setHealth(foeState.getDouble("hp"));
	foe.setCustomName(foeState.getString("name"));
	
	foe.setRemoveWhenFarAway(false);
	
	EntityEquipment equipment = foe.getEquipment();
	EquipmentConfiguration econ = new EquipmentConfiguration();
	try {
		econ.load( foeState.getConfigurationSection("equipment"));
	} catch (InvalidConfigurationException e) {
		e.printStackTrace();
	}
	
	equipment.setHelmet(econ.getHead());
	equipment.setChestplate(econ.getChest());
	equipment.setLeggings(econ.getLegs());
	equipment.setBoots(econ.getBoots());
	equipment.setItemInMainHand(econ.getHeldMain());
	equipment.setItemInOffHand(econ.getHeldOff());
	
	//special checks
	if (foe instanceof Guardian) {
		if (foeState.getBoolean("elder", false)) {
			((Guardian) foe).setElder(true);
		}
	}
	
	if (foe instanceof Slime) {
		if (foeState.getInt("size", 1) > 1) {
			((Slime) foe).setSize(foeState.getInt("size"));
		}
	}
	
	if (foe instanceof Skeleton) {
		if (foeState.getBoolean("wither", false)) {
			((Skeleton) foe).setSkeletonType(SkeletonType.WITHER);
		}
	}
	
	if (desc == null) {
		desc = foeState.getString("description", "Slay " + foe.getCustomName());
	}
	
	//add as NPC for non-removal
	foeNPC = new QuestMonsterNPC();
	foeNPC.setEntity(foe);
	
	QuestManagerPlugin.questManagerPlugin.getManager().registerNPC(foeNPC);
	
	update();
	Bukkit.getPluginManager().registerEvents(this, QuestManagerPlugin.questManagerPlugin);
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:72,代码来源:VanquishRequirement.java

示例10: onSpawn

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@Override
public void onSpawn() {
    Skeleton skeleton = (Skeleton) getNPC().getEntity();
    skeleton.setSkeletonType(isWitherSkeleton ? SkeletonType.WITHER : SkeletonType.NORMAL);
}
 
开发者ID:leMaik,项目名称:RpgPlus,代码行数:6,代码来源:SkeletonTrait.java

示例11: setWitherSkeleton

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
public void setWitherSkeleton(boolean isWitherSkeleton) {
	this.isWitherSkeleton = isWitherSkeleton;
    if (getNPC().isSpawned()) ((Skeleton) getNPC().getEntity()).setSkeletonType(isWitherSkeleton ? SkeletonType.WITHER : SkeletonType.NORMAL);
}
 
开发者ID:leMaik,项目名称:RpgPlus,代码行数:5,代码来源:SkeletonTrait.java

示例12: shakeCheck

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
/**
 * Handle the Shake ability
 *
 * @param target The {@link LivingEntity} affected by the ability
 */
public void shakeCheck(LivingEntity target) {
    fishingTries--; // Because autoclicking to shake is OK.

    SecondaryAbilityWeightedActivationCheckEvent activationEvent = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.SHAKE, getShakeProbability() / activationChance);
    mcMMO.p.getServer().getPluginManager().callEvent(activationEvent);
    if ((activationEvent.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
        List<ShakeTreasure> possibleDrops = Fishing.findPossibleDrops(target);

        if (possibleDrops == null || possibleDrops.isEmpty()) {
            return;
        }

        ItemStack drop = Fishing.chooseDrop(possibleDrops);

        // It's possible that chooseDrop returns null if the sum of probability in possibleDrops is inferior than 100
        if (drop == null) {
            return;
        }

        // Extra processing depending on the mob and drop type
        switch (target.getType()) {
            case SHEEP:
                Sheep sheep = (Sheep) target;

                if (drop.getType() == Material.WOOL) {
                    if (sheep.isSheared()) {
                        return;
                    }

                    drop = new Wool(sheep.getColor()).toItemStack(drop.getAmount());
                    sheep.setSheared(true);
                }
                break;

            case SKELETON:
                if (((Skeleton) target).getSkeletonType() == SkeletonType.WITHER) {
                    switch (drop.getType()) {
                        case SKULL_ITEM:
                            drop.setDurability((short) 1);
                            break;

                        case ARROW:
                            drop.setType(Material.COAL);
                            break;

                        default:
                            break;
                    }
                }
                break;

            default:
                break;
        }

        McMMOPlayerShakeEvent shakeEvent = new McMMOPlayerShakeEvent(getPlayer(), drop);

        drop = shakeEvent.getDrop();

        if (shakeEvent.isCancelled() || drop == null) {
            return;
        }

        Misc.dropItem(target.getLocation(), drop);
        CombatUtils.dealDamage(target, Math.max(target.getMaxHealth() / 4, 1)); // Make it so you can shake a mob no more than 4 times.
        applyXpGain(ExperienceConfig.getInstance().getFishingShakeXP(), XPGainReason.PVE);
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:74,代码来源:FishingManager.java

示例13: onEntityDeath

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityDeath(EntityDeathEvent event) {
	Player killer = event.getEntity().getKiller();

	if (killer == null) {
		return;
	}

	SPlayer sply = plugin.players.get(killer.getName());

	int currencyGain = 0;
	if (plugin.silverManager.mobPayouts.containsKey(event.getEntityType())) {
		currencyGain = plugin.silverManager.mobPayouts.get(event.getEntityType());
	}

	if (plugin.silverManager.mobAwardsPrimary.containsKey(event.getEntityType())) {
		plugin.awardManager.updateAward(plugin.silverManager.mobAwardsPrimary.get(event.getEntityType()), 1, killer);

		if (killer.getInventory().getItemInHand().getType() == Material.BOW) {
			plugin.awardManager.updateAward(AwardType.KATNISS_EVERDEEN, 1, killer);
		}

		if (killer.getInventory().getItemInHand().getAmount() == 0) {
			plugin.awardManager.updateAward(AwardType.NINJA, 1, killer);
		}

		if (killer.getInventory().getItemInHand().getType() == Material.IRON_AXE) {
			plugin.awardManager.updateAward(AwardType.EXECUTIONER, 1, killer);
		}

		if (killer.getInventory().getItemInHand().getType() == Material.IRON_SWORD || killer.getInventory().getItemInHand().getType() == Material.DIAMOND_SWORD || killer.getInventory().getItemInHand().getType() == Material.STONE_SWORD) {
			plugin.awardManager.updateAward(AwardType.SWORDSMAN, 1, killer);
		}

	}

	if (plugin.silverManager.mobAwardsSecondary.containsKey(event.getEntityType())) {
		plugin.awardManager.updateAward(plugin.silverManager.mobAwardsSecondary.get(event.getEntityType()), 1, killer);
	}

	if (event.getEntityType() == EntityType.WOLF) {
		Wolf w = (Wolf) event.getEntity();

		if (w.isAngry()) {
			plugin.awardManager.updateAward(AwardType.LYCAN_HUNTER, 1, killer);
		}
	}

	if (event.getEntityType() == EntityType.VILLAGER) {
		plugin.awardManager.updateAward(AwardType.MARAUDER, 1, killer);
	}

	if (event.getEntityType() == EntityType.SKELETON) {
		Skeleton skeleton = (Skeleton) event.getEntity();

		if (skeleton.getSkeletonType() == SkeletonType.WITHER) {
			plugin.awardManager.updateAward(AwardType.THE_DAMNED, 1, killer);
		}
	}

	if (event.getEntityType() == EntityType.ENDER_DRAGON) {
		for (Player p : plugin.getServer().getOnlinePlayers()) {
			if (p.getWorld().getName().contains("end")) {
				plugin.awardManager.addAward(AwardType.VOID_KING, p);
				plugin.awardManager.updateAward(AwardType.DARK_ONE, 1, p);
			}
		}
	}

	if (currencyGain == 0) {
		return;
	}

	plugin.getServer().getLogger().log(Level.INFO, "Silver Transaction: " + sply.getPlayer().getName() + " gained currency for killing " + event.getEntityType().getName() + ".");

	sply.addCurrency(currencyGain);
	sply.tickMobsDestroyed();
}
 
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:79,代码来源:EntityListener.java

示例14: getType

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
@Deprecated public static SkeletonType getType(int id) {
	return null;
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:Skeleton.java

示例15: spawnEntity

import org.bukkit.entity.Skeleton.SkeletonType; //导入依赖的package包/类
public void spawnEntity(Location loc) {
    Skeleton e = (Skeleton) loc.getWorld().spawnEntity(loc, EntityType.SKELETON);
    e.setSkeletonType(SkeletonType.WITHER);
    e.setCanPickupItems(true);
}
 
开发者ID:cybertiger,项目名称:Bukkit-Instances,代码行数:6,代码来源:Mob.java


注:本文中的org.bukkit.entity.Skeleton.SkeletonType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。