本文整理汇总了Java中org.bukkit.entity.Snowman类的典型用法代码示例。如果您正苦于以下问题:Java Snowman类的具体用法?Java Snowman怎么用?Java Snowman使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Snowman类属于org.bukkit.entity包,在下文中一共展示了Snowman类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SnowGolemMenu
import org.bukkit.entity.Snowman; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public SnowGolemMenu(Plot plot, Snowman snowman) {
super(plot, snowman);
ItemStack pumpkin = new ItemStack(Material.PUMPKIN);
ItemMeta pumpkinMeta = pumpkin.getItemMeta();
pumpkinMeta.setDisplayName(ChatColor.GREEN + "Change whether this snow golem has a pumpkin");
pumpkin.setItemMeta(pumpkinMeta);
insertItem(pumpkin, event -> {
snowman.setDerp(!snowman.isDerp());
event.setCancelled(true);
}, 0);
}
示例2: onLingeringPotionDamage
import org.bukkit.entity.Snowman; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onLingeringPotionDamage(final EntityDamageByEntityEvent e) {
if (DEBUG) {
plugin.getLogger().info("1.9 lingering potion damage " + e.getEventName());
plugin.getLogger().info("1.9 lingering potion entity = " + e.getEntity());
plugin.getLogger().info("1.9 lingering potion entity type = " + e.getEntityType());
plugin.getLogger().info("1.9 lingering potion cause = " + e.getCause());
plugin.getLogger().info("1.9 lingering potion damager = " + e.getDamager());
}
if (!Util.inWorld(e.getEntity().getLocation())) {
return;
}
if (e.getEntity() == null || e.getEntity().getUniqueId() == null) {
return;
}
if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && thrownPotions.containsKey(e.getDamager().getEntityId())) {
UUID attacker = thrownPotions.get(e.getDamager().getEntityId());
// Self damage
if (attacker.equals(e.getEntity().getUniqueId())) {
if (DEBUG)
plugin.getLogger().info("DEBUG: Self damage from lingering potion!");
return;
}
Island island = plugin.getIslands().getIslandAt(e.getEntity().getLocation());
boolean inNether = false;
if (e.getEntity().getWorld().equals(IslandWorld.getNetherWorld())) {
inNether = true;
}
// Monsters being hurt
if (e.getEntity() instanceof Monster || e.getEntity() instanceof Slime || e.getEntity() instanceof Squid) {
// Normal island check
if (island != null && island.getMembers().contains(attacker)) {
// Members always allowed
return;
}
if (actionAllowed(attacker, e.getEntity().getLocation(), SettingsFlag.HURT_MONSTERS)) {
return;
}
// Not allowed
e.setCancelled(true);
return;
}
// Mobs being hurt
if (e.getEntity() instanceof Animals || e.getEntity() instanceof IronGolem || e.getEntity() instanceof Snowman
|| e.getEntity() instanceof Villager) {
if (island != null && (island.getFlag(SettingsFlag.HURT_ANIMALS) || island.getMembers().contains(attacker))) {
return;
}
if (DEBUG)
plugin.getLogger().info("DEBUG: Mobs not allowed to be hurt. Blocking");
e.setCancelled(true);
return;
}
// Establish whether PVP is allowed or not.
boolean pvp = false;
if ((inNether && island != null && island.getFlag(SettingsFlag.PVP_NETHER) || (!inNether && island != null && island.getFlag(SettingsFlag.PVP_OVERWORLD)))) {
if (DEBUG) plugin.getLogger().info("DEBUG: PVP allowed");
pvp = true;
}
// Players being hurt PvP
if (e.getEntity() instanceof Player) {
if (!pvp) {
if (DEBUG) plugin.getLogger().info("DEBUG: PVP not allowed");
e.setCancelled(true);
}
}
}
}
示例3: CanarySnowman
import org.bukkit.entity.Snowman; //导入依赖的package包/类
public CanarySnowman(net.canarymod.api.entity.living.Snowman entity) {
super(entity);
}
示例4: LorePacker
import org.bukkit.entity.Snowman; //导入依赖的package包/类
/**
* Assembles an ArrayList of the properties for the specified Entity that
* is to be used for a spawn egg. All instanceof checks are done internally
* by the LorePackager, so no type checking is required prior to calling
* this method. Null Entities will throw an IllegalArgumentException. <b>The
* actual ArrayList is returned by {@link #getLore() LorePacker.getLore()}.
* </b>
* @param livingEntity - The Entity to assemble a lore for.
* @return An ArrayList of Strings
* @throws IllegalArgumentException If entity parameter is null
*/
public LorePacker(LivingEntity livingEntity) throws IllegalArgumentException {
if (livingEntity == null) {
throw new IllegalArgumentException("Can't assemble lore for a null entity!");
}
lore = new ArrayList<String>();
// This needs to always be on top of an egg's lore
lore.add("Identifier: SimpleEgg." + livingEntity.getType().getEntityClass().getSimpleName() + "." + Main.getSelf().getDescription().getVersion());
lore.addAll(livingEntity(livingEntity));
if (livingEntity instanceof Ageable) {
lore.addAll(ageable((Ageable) livingEntity));
if (livingEntity instanceof Sheep) {
lore.addAll(sheep((Sheep) livingEntity));
} else if (livingEntity instanceof Pig) {
lore.addAll(pig((Pig) livingEntity));
} else if (livingEntity instanceof Rabbit) {
lore.addAll(rabbit((Rabbit) livingEntity));
} else if (livingEntity instanceof Villager) {
lore.addAll(villager((Villager) livingEntity));
} else if (livingEntity instanceof Tameable) {
lore.addAll(tameable((Tameable) livingEntity));
if (livingEntity instanceof AbstractHorse) {
lore.addAll(abstractHorse((AbstractHorse) livingEntity));
if (livingEntity instanceof Horse) {
lore.addAll(horse((Horse) livingEntity));
} else if (livingEntity instanceof ChestedHorse) {
lore.addAll(chestedHorse((ChestedHorse) livingEntity));
if (livingEntity instanceof Llama) {
lore.addAll(llama((Llama) livingEntity));
}
}
} else if (livingEntity instanceof Sittable) {
lore.addAll(sittable((Sittable) livingEntity));
if (livingEntity instanceof Wolf) {
lore.addAll(wolf((Wolf) livingEntity));
} else if (livingEntity instanceof Ocelot) {
lore.addAll(ocelot((Ocelot) livingEntity));
} else if (livingEntity instanceof Parrot) {
lore.addAll(parrot((Parrot) livingEntity));
}
}
}
} else if (livingEntity instanceof Slime) {
lore.addAll(slime((Slime) livingEntity));
} else if (livingEntity instanceof Creeper) {
lore.addAll(creeper((Creeper) livingEntity));
} else if (livingEntity instanceof Zombie) {
lore.addAll(zombie((Zombie) livingEntity));
if (livingEntity instanceof PigZombie) {
lore.addAll(pigZombie((PigZombie) livingEntity));
} else if (livingEntity instanceof ZombieVillager) {
lore.addAll(zombieVillager((ZombieVillager) livingEntity));
}
} else if (livingEntity instanceof Spellcaster) {
lore.addAll(spellCaster((Spellcaster) livingEntity));
} else if (livingEntity instanceof IronGolem) {
lore.addAll(ironGolem((IronGolem) livingEntity));
} else if (livingEntity instanceof Snowman) {
lore.addAll(snowman((Snowman) livingEntity));
}
}
示例5: onLingeringPotionDamage
import org.bukkit.entity.Snowman; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onLingeringPotionDamage(final EntityDamageByEntityEvent e) {
if (DEBUG) {
plugin.getLogger().info("1.9 lingering potion damage " + e.getEventName());
plugin.getLogger().info("1.9 lingering potion entity = " + e.getEntity());
plugin.getLogger().info("1.9 lingering potion entity type = " + e.getEntityType());
plugin.getLogger().info("1.9 lingering potion cause = " + e.getCause());
plugin.getLogger().info("1.9 lingering potion damager = " + e.getDamager());
}
if (!IslandGuard.inWorld(e.getEntity().getLocation())) {
return;
}
if (e.getEntity() == null || e.getEntity().getUniqueId() == null) {
return;
}
if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && thrownPotions.containsKey(e.getDamager().getEntityId())) {
UUID attacker = thrownPotions.get(e.getDamager().getEntityId());
// Self damage
if (attacker.equals(e.getEntity().getUniqueId())) {
if (DEBUG)
plugin.getLogger().info("DEBUG: Self damage from lingering potion!");
return;
}
Island island = plugin.getGrid().getIslandAt(e.getEntity().getLocation());
boolean inNether = false;
if (e.getEntity().getWorld().equals(ASkyBlock.getNetherWorld())) {
inNether = true;
}
// Monsters being hurt
if (e.getEntity() instanceof Monster || e.getEntity() instanceof Slime || e.getEntity() instanceof Squid) {
// Normal island check
if (island != null && island.getMembers().contains(attacker)) {
// Members always allowed
return;
}
if (actionAllowed(attacker, e.getEntity().getLocation(), SettingsFlag.HURT_MONSTERS)) {
return;
}
// Not allowed
e.setCancelled(true);
return;
}
// Mobs being hurt
if (e.getEntity() instanceof Animals || e.getEntity() instanceof IronGolem || e.getEntity() instanceof Snowman
|| e.getEntity() instanceof Villager) {
if (island != null && (island.getIgsFlag(SettingsFlag.HURT_MOBS) || island.getMembers().contains(attacker))) {
return;
}
if (DEBUG)
plugin.getLogger().info("DEBUG: Mobs not allowed to be hurt. Blocking");
e.setCancelled(true);
return;
}
// Establish whether PVP is allowed or not.
boolean pvp = false;
if ((inNether && island != null && island.getIgsFlag(SettingsFlag.NETHER_PVP) || (!inNether && island != null && island.getIgsFlag(SettingsFlag.PVP)))) {
if (DEBUG) plugin.getLogger().info("DEBUG: PVP allowed");
pvp = true;
}
// Players being hurt PvP
if (e.getEntity() instanceof Player) {
if (pvp) {
if (DEBUG) plugin.getLogger().info("DEBUG: PVP allowed");
return;
} else {
if (DEBUG) plugin.getLogger().info("DEBUG: PVP not allowed");
e.setCancelled(true);
return;
}
}
}
}
示例6: RemoteSnowman
import org.bukkit.entity.Snowman; //导入依赖的package包/类
public RemoteSnowman(int inID, RemoteSnowmanEntity inEntity, EntityManager inManager)
{
super(inID, RemoteEntityType.Snowman, inManager);
this.m_entity = inEntity;
}