org.bukkit.entity.Enderman Java Examples
The following examples show how to use
org.bukkit.entity.Enderman.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EndermanData.java From Skript with GNU General Public License v3.0 | 6 votes |
@Override protected boolean init(final @Nullable Class<? extends Enderman> c, final @Nullable Enderman e) { if (e != null) { if (useBlockData) { BlockData data = e.getCarriedBlock(); if (data != null) { Material type = data.getMaterial(); assert type != null; hand = new ItemType[] {new ItemType(type)}; } } else { 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; }
Example #2
Source File: EndermanData.java From Skript with GNU General Public License v3.0 | 6 votes |
@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) { if (useBlockData) { // 1.13: item->block usually keeps only material entity.setCarriedBlock(Bukkit.createBlockData(i.getType())); } else { MaterialData data = i.getData(); assert data != null; entity.setCarriedMaterial(data); } } } }
Example #3
Source File: IslandGuard.java From askyblock with GNU General Public License v2.0 | 6 votes |
/** * 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); }
Example #4
Source File: IslandGuard.java From askyblock with GNU General Public License v2.0 | 6 votes |
/** * Drops the Enderman's block when he dies if he has one * * @param e - event */ @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)); } }
Example #5
Source File: EndermanData.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override public boolean match(final Enderman entity) { return hand == null || SimpleExpression.check(hand, new Checker<ItemType>() { @SuppressWarnings("null") @Override public boolean check(final @Nullable ItemType t) { // TODO {Block/Material}Data -> Material conversion is not 100% accurate, needs a better solution if (useBlockData) return t != null && t.isOfType(entity.getCarriedBlock().getMaterial()); else return t != null && t.isOfType(entity.getCarriedMaterial().getItemType()); } }, false, false); }
Example #6
Source File: EndermanAttackPlayerEvent.java From Kettle with GNU General Public License v3.0 | 4 votes |
public EndermanAttackPlayerEvent(Enderman entity, Player player) { super(entity); this.player = player; }
Example #7
Source File: EndermanEscapeEvent.java From Kettle with GNU General Public License v3.0 | 4 votes |
public EndermanEscapeEvent(Enderman entity, Reason reason) { super(entity); this.reason = reason; }
Example #8
Source File: EndermanEscapeEvent.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public Enderman getEntity() { return (Enderman) super.getEntity(); }
Example #9
Source File: EndermanData.java From Skript with GNU General Public License v3.0 | 4 votes |
@Override public Class<Enderman> getType() { return Enderman.class; }
Example #10
Source File: EntityEndermanPet.java From SonarPet with GNU General Public License v3.0 | 4 votes |
@Override public Enderman getBukkitEntity() { return (Enderman) super.getBukkitEntity(); }
Example #11
Source File: EndermanAttackPlayerEvent.java From Kettle with GNU General Public License v3.0 | 2 votes |
/** * The enderman considering attacking * * @return The enderman considering attacking */ @Override public Enderman getEntity() { return (Enderman) super.getEntity(); }