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


Java Enderman类代码示例

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


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

示例1: onEndermanGrief

import org.bukkit.entity.Enderman; //导入依赖的package包/类
/**
 * Allows or prevents enderman griefing
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEndermanGrief(final EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!(e.getEntity() instanceof Enderman)) {
        return;
    }
    if (!Util.inWorld(e.getEntity())) {
        return;
    }
    // Prevent Enderman griefing at spawn
    if (plugin.getIslands() != null && plugin.getIslands().isAtSpawn(e.getEntity().getLocation())) {
        e.setCancelled(true);
    }
    if (Settings.allowEndermanGriefing)
        return;
    // Stop the Enderman from griefing
    // plugin.getLogger().info("Enderman stopped from griefing);
    e.setCancelled(true);
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:25,代码来源:IslandGuard.java

示例2: onEndermanDeath

import org.bukkit.entity.Enderman; //导入依赖的package包/类
/**
 * Drops the Enderman's block when he dies if he has one
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEndermanDeath(final EntityDeathEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!Settings.endermanDeathDrop)
        return;
    if (!Util.inWorld(e.getEntity())) {
        return;
    }
    if (!(e.getEntity() instanceof Enderman)) {
        // plugin.getLogger().info("Not an Enderman!");
        return;
    }
    // Get the block the enderman is holding
    Enderman ender = (Enderman) e.getEntity();
    MaterialData m = ender.getCarriedMaterial();
    if (m != null && !m.getItemType().equals(Material.AIR)) {
        // Drop the item
        // plugin.getLogger().info("Dropping item " + m.toString());
        e.getEntity().getWorld().dropItemNaturally(e.getEntity().getLocation(), m.toItemStack(1));
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:29,代码来源:IslandGuard.java

示例3: onEntityPickup

import org.bukkit.entity.Enderman; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityPickup(EntityChangeBlockEvent event)
{
	//FEATURE: endermen don't steal claimed blocks
	
	//if its an enderman
	if(event.getEntity() instanceof Enderman)
	{
		//and the block is claimed
		if(this.dataStore.getClaimAt(event.getBlock().getLocation(), false, null) != null)
		{
			//he doesn't get to steal it
			event.setCancelled(true);
		}
	}
}
 
开发者ID:john01dav,项目名称:GriefPreventionPlus,代码行数:17,代码来源:EntityEventHandler.java

示例4: onEndermanGrief

import org.bukkit.entity.Enderman; //导入依赖的package包/类
/**
 * Allows or prevents enderman griefing
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEndermanGrief(final EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!(e.getEntity() instanceof Enderman)) {
        return;
    }
    if (!inWorld(e.getEntity())) {
        return;
    }
    // Prevent Enderman griefing at spawn
    if (plugin.getGrid() != null && plugin.getGrid().isAtSpawn(e.getEntity().getLocation())) {
        e.setCancelled(true);
    }
    if (Settings.allowEndermanGriefing)
        return;
    // Stop the Enderman from griefing
    // plugin.getLogger().info("Enderman stopped from griefing);
    e.setCancelled(true);
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:25,代码来源:IslandGuard.java

示例5: onEndermanDeath

import org.bukkit.entity.Enderman; //导入依赖的package包/类
/**
 * Drops the Enderman's block when he dies if he has one
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEndermanDeath(final EntityDeathEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!Settings.endermanDeathDrop)
        return;
    if (!inWorld(e.getEntity())) {
        return;
    }
    if (!(e.getEntity() instanceof Enderman)) {
        // plugin.getLogger().info("Not an Enderman!");
        return;
    }
    // Get the block the enderman is holding
    Enderman ender = (Enderman) e.getEntity();
    MaterialData m = ender.getCarriedMaterial();
    if (m != null && !m.getItemType().equals(Material.AIR)) {
        // Drop the item
        // plugin.getLogger().info("Dropping item " + m.toString());
        e.getEntity().getWorld().dropItemNaturally(e.getEntity().getLocation(), m.toItemStack(1));
    }
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:29,代码来源:IslandGuard.java

示例6: init

import org.bukkit.entity.Enderman; //导入依赖的package包/类
@Override
protected boolean init(final @Nullable Class<? extends Enderman> c, final @Nullable Enderman e) {
	if (e != null) {
		final MaterialData m = e.getCarriedMaterial();
		if (m != null) {
			final ItemStack i = m.toItemStack(1);
			if (i == null)
				return false;
			hand = new ItemType[] {new ItemType(i)};
		}
	}
	return true;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:14,代码来源:EndermanData.java

示例7: set

import org.bukkit.entity.Enderman; //导入依赖的package包/类
@Override
public void set(final Enderman entity) {
	if (hand != null) {
		final ItemType t = CollectionUtils.getRandom(hand);
		assert t != null;
		final ItemStack i = t.getBlock().getRandom();
		if (i != null)
			entity.setCarriedMaterial(i.getData());
	}
	
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:12,代码来源:EndermanData.java

示例8: match

import org.bukkit.entity.Enderman; //导入依赖的package包/类
@Override
public boolean match(final Enderman entity) {
	return hand == null || SimpleExpression.check(hand, new Checker<ItemType>() {
		@SuppressWarnings("deprecation")
		@Override
		public boolean check(final @Nullable ItemType t) {
			return t != null && t.isOfType(entity.getCarriedMaterial().getItemTypeId(), entity.getCarriedMaterial().getData());
		}
	}, false, false);
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:11,代码来源:EndermanData.java

示例9: onEntityChangeBlock

import org.bukkit.entity.Enderman; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
    AttackType attackType = AttackType.UNKNOWN;
    if (event instanceof EntityBreakDoorEvent) {
        attackType = AttackType.ZOMBIE;
    } else if (event.getEntity() instanceof Enderman) {
        attackType = AttackType.ENDERMAN;
    }
    if (plugin.getChestSettings().allowDestroyBy(attackType)) {
        return;
    }
    if (isProtected(event.getBlock())) {
        event.setCancelled(true);
    }
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:16,代码来源:BlockDestroyListener.java

示例10: onEntityChangeBlock

import org.bukkit.entity.Enderman; //导入依赖的package包/类
/**
 * Monitor EntityChangeBlock events.
 *
 * @param event The event to watch
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
    Block block = event.getBlock();

    // When the event is fired for the falling block that changes back to a normal block
    // event.getBlock().getType() returns AIR
    if (!BlockUtils.shouldBeWatched(block.getState()) && block.getType() != Material.AIR) {
        return;
    }

    Entity entity = event.getEntity();

    if (entity instanceof FallingBlock || entity instanceof Enderman) {
        boolean isTracked = entity.hasMetadata(mcMMO.entityMetadataKey);

        if (mcMMO.getPlaceStore().isTrue(block) && !isTracked) {
            mcMMO.getPlaceStore().setFalse(block);
            entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
        }
        else if (isTracked) {
            mcMMO.getPlaceStore().setTrue(block);
        }
    }
    else if ((block.getType() == Material.REDSTONE_ORE || block.getType() == Material.GLOWING_REDSTONE_ORE) && (event.getTo() == Material.REDSTONE_ORE || event.getTo() == Material.GLOWING_REDSTONE_ORE)) {
        return;
    }
    else {
        if (mcMMO.getPlaceStore().isTrue(block)) {
            mcMMO.getPlaceStore().setFalse(block);
        }
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:38,代码来源:EntityListener.java

示例11: onEntityChangeBlock

import org.bukkit.entity.Enderman; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityChangeBlock(final EntityChangeBlockEvent event)
{
    ActionEntityBlock action;
    if (event.getEntityType() == SHEEP)
    {
        action = this.newAction(SheepEat.class, event.getBlock().getWorld());
    }
    else if (event.getEntity() instanceof Enderman)
    {
        if (event.getTo() == AIR)
        {
            action = this.newAction(EndermanPickup.class, event.getBlock().getWorld());
        }
        else
        {
            action = this.newAction(EndermanPlace.class, event.getBlock().getWorld());
        }
    }
    else
    {
        action = this.newAction(EntityChange.class, event.getBlock().getWorld());
    }
    if (action != null)
    {
        action.setNewBlock(event.getTo());
        this.setAndLog(action, event.getBlock().getState(), event.getEntity());
    }
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:30,代码来源:ListenerEntityBlock.java

示例12: onEntityChangeBlock

import org.bukkit.entity.Enderman; //导入依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityChangeBlock(final EntityChangeBlockEvent event) {
    if (event.getEntityType() == EntityType.ENDERMAN) {
        final GeneralRegion region = this.getPlugin().getDb().getPriorByLocation(event.getBlock().getLocation());
        if (region != null && region.getFlag(Flag.ENDERMANGRIEF)) {
            ((Enderman)event.getEntity()).setCarriedMaterial(Material.JACK_O_LANTERN.getNewData((byte)0));
            event.setCancelled(true);
        }
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:11,代码来源:EndermanGriefFlagListener.java

示例13: getType

import org.bukkit.entity.Enderman; //导入依赖的package包/类
@Override
public Class<Enderman> getType() {
	return Enderman.class;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:5,代码来源:EndermanData.java

示例14: getBukkitEntity

import org.bukkit.entity.Enderman; //导入依赖的package包/类
@Override
public Enderman getBukkitEntity() {
    return (Enderman) super.getBukkitEntity();
}
 
开发者ID:TechzoneMC,项目名称:SonarPet,代码行数:5,代码来源:EntityEndermanPet.java

示例15: CanaryEnderman

import org.bukkit.entity.Enderman; //导入依赖的package包/类
public CanaryEnderman(net.canarymod.api.entity.living.monster.Enderman entity) {
    super(entity);
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:4,代码来源:CanaryEnderman.java


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