本文整理汇总了Java中org.bukkit.entity.Golem类的典型用法代码示例。如果您正苦于以下问题:Java Golem类的具体用法?Java Golem怎么用?Java Golem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Golem类属于org.bukkit.entity包,在下文中一共展示了Golem类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemFrameDamage
import org.bukkit.entity.Golem; //导入依赖的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: onInteractEvent
import org.bukkit.entity.Golem; //导入依赖的package包/类
@EventHandler
public void onInteractEvent(PlayerInteractEntityEvent e){
RedProtect.get().logger.debug("RPEntityListener - Is PlayerInteractEntityEvent");
if (e.isCancelled()) {
return;
}
Player p = e.getPlayer();
if (p == null){
return;
}
Location l = e.getRightClicked().getLocation();
Region r = RedProtect.get().rm.getTopRegion(l);
Entity et = e.getRightClicked();
if (r != null && !r.canInteractPassives(p) && (et instanceof Animals || et instanceof Villager || et instanceof Golem)) {
if (et instanceof Tameable){
Tameable tam = (Tameable) et;
if (tam.isTamed() && tam.getOwner() != null && tam.getOwner().getName().equals(p.getName())){
return;
}
}
e.setCancelled(true);
RPLang.sendMessage(p, "entitylistener.region.cantinteract");
}
}
示例3: getCreatureType
import org.bukkit.entity.Golem; //导入依赖的package包/类
public CreatureType getCreatureType(EntityType entityType) {
if (Monster.class.isAssignableFrom(entityType.getEntityClass())
|| WaterMob.class.isAssignableFrom(entityType.getEntityClass())
|| Slime.class.isAssignableFrom(entityType.getEntityClass())
|| Ghast.class.isAssignableFrom(entityType.getEntityClass())
) {
return CreatureType.MONSTER;
} else if (Animals.class.isAssignableFrom(entityType.getEntityClass())) {
return CreatureType.ANIMAL;
} else if (Villager.class.isAssignableFrom(entityType.getEntityClass())) {
return CreatureType.VILLAGER;
} else if (Golem.class.isAssignableFrom(entityType.getEntityClass())) {
return CreatureType.GOLEM;
}
return CreatureType.UNKNOWN;
}
示例4: onItemFrameDamage
import org.bukkit.entity.Golem; //导入依赖的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);
}
}
}
}
示例5: onCreatureSpawn
import org.bukkit.entity.Golem; //导入依赖的package包/类
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent event) {
RedProtect.get().logger.debug("RPGlobalListener - Is CreatureSpawnEvent event! Cancelled? " + event.isCancelled());
if (event.isCancelled()) {
return;
}
Entity e = event.getEntity();
if (e == null) {
return;
}
Location l = event.getLocation();
Region r = RedProtect.get().rm.getTopRegion(l);
if (r != null){
return;
}
if (e instanceof Wither && event.getSpawnReason().equals(SpawnReason.BUILD_WITHER) && !RPConfig.getGlobalFlagBool(e.getWorld().getName()+".spawn-wither")){
event.setCancelled(true);
return;
}
if (e instanceof Monster && !RPConfig.getGlobalFlagBool(e.getWorld().getName()+".spawn-monsters")) {
if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.NATURAL)
|| event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.SPAWNER)
|| event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.CHUNK_GEN)
|| event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.DEFAULT)) {
event.setCancelled(true);
return;
}
}
if ((e instanceof Animals || e instanceof Villager || e instanceof Golem) && !RPConfig.getGlobalFlagBool(e.getWorld().getName()+".spawn-passives")) {
if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.NATURAL)
|| event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.SPAWNER)
|| event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.CHUNK_GEN)
|| event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.DEFAULT)) {
event.setCancelled(true);
}
}
}