本文整理汇总了Java中org.bukkit.entity.Skeleton类的典型用法代码示例。如果您正苦于以下问题:Java Skeleton类的具体用法?Java Skeleton怎么用?Java Skeleton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Skeleton类属于org.bukkit.entity包,在下文中一共展示了Skeleton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemFrameDamage
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onItemFrameDamage(final EntityDamageByEntityEvent e) {
// Check world
if (!Util.inWorld(e.getEntity()) || !(e.getEntity() instanceof ItemFrame)) {
return;
}
if (e.getDamager() instanceof Projectile) {
if (DEBUG)
plugin.getLogger().info("DEBUG: Projectile damage to itemframe");
// Find out who fired the arrow
Projectile p = (Projectile) e.getDamager();
if (DEBUG)
plugin.getLogger().info("DEBUG: Shooter is " + p.getShooter().toString());
if (p.getShooter() instanceof Skeleton || p.getShooter() instanceof Golem) {
if (DEBUG)
plugin.getLogger().info("DEBUG: Shooter is mob");
if (!Settings.allowMobDamageToItemFrames) {
if (DEBUG)
plugin.getLogger().info("DEBUG: Damage not allowed, cancelling");
e.setCancelled(true);
}
}
}
}
示例2: onEntityDeath
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
/**
* Utilizes a random chance to either spawn a skeleton with gold armor or resources.
*
* @param event The event
*/
@EventHandler
public void onEntityDeath(EntityDeathEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Sheep) {
double chance = Math.random();
if (0.25 > chance) {
Skeleton skeleton = entity.getWorld().spawn(entity.getLocation(), Skeleton.class);
skeleton.getEquipment().setArmorContents(
new ItemStack[]{
new ItemStack(Material.GOLD_HELMET),
new ItemStack(Material.GOLD_CHESTPLATE),
new ItemStack(Material.GOLD_LEGGINGS),
new ItemStack(Material.GOLD_BOOTS)
}
);
} else if (0.5 > chance) {
event.getDrops().add(new ItemStack(Material.IRON_INGOT));
} else if (0.75 > chance) {
event.getDrops().add(new ItemStack(Material.GOLD_INGOT));
} else {
event.getDrops().add(new ItemStack(Material.DIAMOND));
}
}
}
示例3: onEntityTarget
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onEntityTarget(EntityTargetEvent event)
{
if( event.getEntity() instanceof Skeleton && NavyCraft.aaSkelesList.contains((Skeleton)event.getEntity()) )
{
if( event.getTarget() instanceof Player )
{
Player target = (Player)event.getTarget();
Craft skeleCraft = Craft.getCraft(target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ());
if( skeleCraft != null && !skeleCraft.crewNames.isEmpty() && skeleCraft.crewNames.contains(target.getName()) )
{
event.setCancelled(true);
}
}
}
}
示例4: onEntityBendingDeath
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
@EventHandler
public void onEntityBendingDeath(EntityBendingDeathEvent event) {
Entity v = event.getVictim();
Element e = CoreAbility.getAbility(event.getAbility()).getElement();
int xp;
if(v == null || e == null)
return;
if(v instanceof Player) {
xp = 25 + (int)(Math.random() * ((35 - 25) + 1));
}
else if(v instanceof Zombie || v instanceof Creeper || v instanceof Witch || v instanceof Skeleton || v instanceof Guardian || v instanceof Spider) {
xp = 13 + (int)(Math.random() * ((22 - 13) + 1));
}
else {
xp = 3 + (int)(Math.random() * ((8 - 3) + 1));
}
BendingExp.addExp(event.getAttacker(), e, xp);
}
示例5: onItemFrameDamage
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onItemFrameDamage(final EntityDamageByEntityEvent e) {
// Check world
if (!inWorld(e.getEntity()) || !(e.getEntity() instanceof ItemFrame)) {
return;
}
if (e.getDamager() instanceof Projectile) {
if (DEBUG)
plugin.getLogger().info("DEBUG: Projectile damage to itemframe");
// Find out who fired the arrow
Projectile p = (Projectile) e.getDamager();
if (DEBUG)
plugin.getLogger().info("DEBUG: Shooter is " + p.getShooter().toString());
if (p.getShooter() instanceof Skeleton || p.getShooter() instanceof Golem) {
if (DEBUG)
plugin.getLogger().info("DEBUG: Shooter is mob");
if (!Settings.allowMobDamageToItemFrames) {
if (DEBUG)
plugin.getLogger().info("DEBUG: Damage not allowed, cancelling");
e.setCancelled(true);
}
}
}
}
示例6: onSkeletonShoot
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
@EventHandler
public void onSkeletonShoot(EntityShootBowEvent event){
if(event.getEntity() instanceof Skeleton){
Skeleton s = (Skeleton) event.getEntity();
if(DroneShocktroop.isPossiblyShocktroop(s)){
DroneShocktroop troop = getShocktroop(s);
if(troop == null){
s.remove();
//System.out.println("troop for named skeleton is null, removing!");
event.setCancelled(true);
} else {
//System.out.println("Allowed fire!");
}
}
}
}
示例7: SkeletalArmy
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
public void SkeletalArmy() {
for (Player pl : Bukkit.getOnlinePlayers()) {
Location loc = pl.getLocation();
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "time night");
Bukkit.broadcastMessage(ChatColor.BOLD+""+ChatColor.RED+"The Skeletal Army Event Has Begun!");
Skeleton skeleton = (Skeleton) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.SKELETON);
Skeleton skeleton1 = (Skeleton) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.SKELETON);
Skeleton skeleton2 = (Skeleton) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.SKELETON);
Skeleton skeleton3 = (Skeleton) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.SKELETON);
Skeleton skeleton4 = (Skeleton) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.SKELETON);
Skeleton skeleton5 = (Skeleton) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.SKELETON);
Skeleton skeleton6 = (Skeleton) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.SKELETON);
Skeleton skeleton7 = (Skeleton) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.SKELETON);
Skeleton skeleton8 = (Skeleton) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.SKELETON);
Skeleton skeleton9 = (Skeleton) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.SKELETON);
Skeleton skeleton0 = (Skeleton) pl.getWorld().spawnEntity((Location) Arrays.asList(circle(loc, 4, 1, true, true, 1)), EntityType.SKELETON);
}
}
示例8: onQuit
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
@EventHandler
public void onQuit(PlayerQuitEvent e) {
if(essentialsPlayers.containsKey(e.getPlayer().getName())) {
XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
if(xp.isVanished()) {
essentialsPlayers.remove(e.getPlayer().getName());
return;
}
ItemStack[] items = e.getPlayer().getInventory().getContents();
Skeleton skel = (Skeleton) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation(), EntityType.SKELETON);
//lets pimp the skeleton a bit!
turnSkelToNpc(skel, e.getPlayer().getName());
npcs.put(skel.getUniqueId(), items);
essentialsPlayers.remove(e.getPlayer().getName());
NpcDespawn(skel);
}
}
示例9: onTeleport
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
@EventHandler
public void onTeleport(PlayerTeleportEvent e) {
if(essentialsPlayers.containsKey(e.getPlayer().getName())) {
XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
if(xp.isVanished()) {
return;
}
ItemStack[] items = e.getPlayer().getInventory().getContents();
Skeleton skel = (Skeleton) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation(), EntityType.SKELETON);
//lets pimp the skeleton a bit!
turnSkelToNpc(skel, e.getPlayer().getName());
npcs.put(skel.getUniqueId(), items);
essentialsPlayers.remove(e.getPlayer().getName());
NpcDespawn(skel);
}
}
示例10: onJoinNpc
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onJoinNpc(PlayerJoinEvent e) {
for(Entity entity : e.getPlayer().getNearbyEntities(16, 16, 16)) {
if(entity instanceof Skeleton) {
Skeleton skel = (Skeleton) entity;
if(skel.isCustomNameVisible()) {
if(skel.getCustomName().equalsIgnoreCase(e.getPlayer().getName())) {
e.getPlayer().kickPlayer(ChatColor.GREEN + "[Combat log]" + ChatColor.GRAY + "\nyou are not allowed to join until the npc is dead.");
e.setJoinMessage("");
return;
}
}
}
}
XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
if(xp.isInventoryClearanceOnRelog()) {
xp.ClearInventoryOnRelog();
}
}
示例11: turnSkelToNpc
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
private void turnSkelToNpc(Skeleton skel, String player) {
ItemStack head = new ItemStack(Material.SKULL_ITEM);
head.setDurability((short)3);
SkullMeta meta = (SkullMeta) head.getItemMeta();
meta.setOwner(player);
head.setItemMeta(meta);
head.setAmount(1);
skel.getEquipment().setHelmet(head);
skel.getEquipment().setHelmetDropChance(0);
ItemStack chestplate = new ItemStack(Material.IRON_CHESTPLATE);
chestplate.setAmount(1);
skel.getEquipment().setChestplate(chestplate);
skel.getEquipment().setChestplateDropChance(0);
ItemStack leggings = new ItemStack(Material.IRON_LEGGINGS);
leggings.setAmount(1);
skel.getEquipment().setLeggings(leggings);
skel.getEquipment().setLeggingsDropChance(0);
ItemStack shoes = new ItemStack(Material.IRON_BOOTS);
skel.getEquipment().setBoots(shoes);
skel.getEquipment().setBootsDropChance(0);
skel.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 30));
skel.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 30));
skel.setCustomName(player);
skel.setCustomNameVisible(true);
}
示例12: onCreatureSpawnEventLowest
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onCreatureSpawnEventLowest(CreatureSpawnEvent event) {
if (!(event.getEntity() instanceof Monster) || event.isCancelled()) {
return;
}
if (!mythicDrops.getConfigSettings().getEnabledWorlds().contains(event.getEntity().getWorld()
.getName())) {
return;
}
if (mythicDrops.getConfigSettings().isGiveAllMobsNames()) {
nameMobs(event.getEntity());
}
if (mythicDrops.getConfigSettings().isBlankMobSpawnEnabled()) {
event.getEntity().getEquipment().clear();
if (event.getEntity() instanceof Skeleton && !mythicDrops.getConfigSettings()
.isSkeletonsSpawnWithoutBows()) {
event.getEntity().getEquipment().setItemInMainHand(new ItemStack(Material.BOW, 1));
}
}
event.getEntity()
.setCanPickupItems(mythicDrops.getConfigSettings().isMobsPickupEquipment());
}
示例13: onEntityDeath
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
/**
* When a player breaks ore, spawn mob
*
* @param event Event
*/
@EventHandler(ignoreCancelled = true)
public void onEntityDeath(BlockBreakEvent event)
{
EntityType type;
switch (event.getBlock().getType())
{
case COAL_ORE:
type = EntityType.ZOMBIE;
break;
case IRON_ORE:
type = EntityType.SKELETON;
break;
case GOLD_ORE:
type = EntityType.SPIDER;
break;
case DIAMOND_ORE:
type = EntityType.WITCH;
break;
default:
type = null;
break;
}
Entity entity;
if (type != null && random.nextDouble() < (double) this.moduleConfiguration.get("chance"))
{
entity = event.getBlock().getWorld().spawnEntity(event.getBlock().getLocation(), type);
if (type == EntityType.SKELETON)
((Skeleton) entity).getEquipment().clear(); //Remove skeleton bow
}
}
示例14: getLoggableEntityEvent
import org.bukkit.entity.Skeleton; //导入依赖的package包/类
private LoggableCreatureEvent getLoggableEntityEvent(EntityEventAction action, EntityEvent event) {
final Entity entity = event.getEntity();
final Location location = entity.getLocation();
final World world = entity.getWorld();
Point3d coordinates = new Point3d(location.getX(), location.getY(), location.getZ());
LoggableCreatureEvent entityEvent = new LoggableCreatureEvent(world.getFullTime(), minecraft_server, world.getName(), action);
LivingEntity spCreature = new LivingEntity();
spCreature.setType("creature");
spCreature.setCurrentHealth(((org.bukkit.entity.LivingEntity)entity).getHealth());
spCreature.setMaxHealth(((org.bukkit.entity.LivingEntity)entity).getMaxHealth());
spCreature.setLocation(coordinates);
for (PotionEffect potion : (((org.bukkit.entity.LivingEntity)entity).getActivePotionEffects())) {
spCreature.addPotions(potion.getType().getName() + ":" + potion.getAmplifier());
}
if (event.getEntityType() == EntityType.SKELETON) {
Skeleton skeleton = (org.bukkit.entity.Skeleton) event.getEntity();
spCreature.setName(skeleton.getSkeletonType() + "_SKELETON");
} else {
spCreature.setName(event.getEntityType().name());
}
entityEvent.setEntity(spCreature);
return entityEvent;
}
示例15: convert
import org.bukkit.entity.Skeleton; //导入依赖的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;
}