Java Code Examples for org.bukkit.entity.EntityType#WITHER
The following examples show how to use
org.bukkit.entity.EntityType#WITHER .
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: BossBarLine.java From TAB with Apache License 2.0 | 6 votes |
public void create(ITabPlayer to){ to.setProperty("bossbar-text-" + name, text, null); to.setProperty("bossbar-progress-" + name, progress, null); to.setProperty("bossbar-color-" + name, color, null); to.setProperty("bossbar-style-" + name, style, null); if (ProtocolVersion.SERVER_VERSION.getMinorVersion() >= 9) { to.sendCustomPacket(PacketPlayOutBoss.CREATE( uuid, to.properties.get("bossbar-text-" + name).get(), (float)parseProgress(to.properties.get("bossbar-progress-" + name).get())/100, parseColor(to.properties.get("bossbar-color-" + name).get()), parseStyle(to.properties.get("bossbar-style-" + name).get()) ) ); } else { PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(entityId, null, EntityType.WITHER, ((BossBar_legacy)Shared.features.get("bossbar1.8")).getWitherLocation(to)); DataWatcher w = new DataWatcher(null); DataWatcher.Helper.setEntityFlags(w, (byte) 32); DataWatcher.Helper.setCustomName(w, to.properties.get("bossbar-text-" + name).get(), to.getVersion()); float health = (float)3*parseProgress(to.properties.get("bossbar-progress-" + name).get()); if (health == 0) health = 1; DataWatcher.Helper.setHealth(w, health); packet.setDataWatcher(w); to.sendCustomBukkitPacket(packet); } }
Example 2
Source File: SentinelVersionCompat.java From Sentinel with MIT License | 6 votes |
static EntityType[] v1_16_monsters() { return new EntityType[]{ // 1.8 minus PigZombie EntityType.GUARDIAN, EntityType.CREEPER, EntityType.SKELETON, EntityType.ZOMBIE, EntityType.MAGMA_CUBE, EntityType.SILVERFISH, EntityType.BAT, EntityType.BLAZE, EntityType.GHAST, EntityType.GIANT, EntityType.SLIME, EntityType.SPIDER, EntityType.CAVE_SPIDER, EntityType.ENDERMAN, EntityType.ENDERMITE, EntityType.WITHER, EntityType.ENDER_DRAGON, EntityType.WITCH, // 1.9 EntityType.SHULKER, // 1.11 EntityType.VEX, EntityType.HUSK, EntityType.ELDER_GUARDIAN, EntityType.EVOKER, EntityType.STRAY, EntityType.ZOMBIE_VILLAGER, EntityType.WITHER_SKELETON, EntityType.VINDICATOR, // 1.12 EntityType.ILLUSIONER, // 1.13 EntityType.DROWNED, EntityType.PHANTOM, // 1.14 EntityType.RAVAGER, EntityType.PILLAGER, // 1.15 EntityType.BEE, // 1.16 EntityType.HOGLIN, EntityType.PIGLIN, EntityType.ZOGLIN, EntityType.ZOMBIFIED_PIGLIN }; }
Example 3
Source File: FlyingMobEvents.java From askyblock with GNU General Public License v2.0 | 6 votes |
/** * Withers change blocks to air after they are hit (don't know why) * This prevents this when the wither has been spawned by a visitor * @param e - event */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void WitherChangeBlocks(final EntityChangeBlockEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } // Only cover withers in the island world if (e.getEntityType() != EntityType.WITHER || !IslandGuard.inWorld(e.getEntity()) ) { return; } if (mobSpawnInfo.containsKey(e.getEntity())) { // We know about this wither if (DEBUG) { plugin.getLogger().info("DEBUG: We know about this wither"); } if (!mobSpawnInfo.get(e.getEntity()).inIslandSpace(e.getEntity().getLocation())) { // Cancel the block changes if (DEBUG) { plugin.getLogger().info("DEBUG: cancelled wither block change"); } e.setCancelled(true); } } }
Example 4
Source File: WitherListener.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true) public void onWitherDestroy(EntityChangeBlockEvent e) { if (e.getEntity().getType() == EntityType.WITHER) { String id = BlockStorage.checkID(e.getBlock()); if (id != null) { WitherProof witherproof = SlimefunPlugin.getRegistry().getWitherProofBlocks().get(id); if (witherproof != null) { e.setCancelled(true); witherproof.onAttack(e.getBlock(), (Wither) e.getEntity()); } } } }
Example 5
Source File: CraftWither.java From Kettle with GNU General Public License v3.0 | 4 votes |
public EntityType getType() { return EntityType.WITHER; }
Example 6
Source File: ChunkEventHelper.java From ClaimChunk with MIT License | 4 votes |
public static void handleExplosionIfConfig(@Nonnull EntityExplodeEvent e) { if (e.isCancelled()) return; final ChunkHandler CHUNK_HANLDE = ClaimChunk.getInstance().getChunkHandler(); final EntityType TYPE = e.getEntityType(); final Chunk CHUNK = e.getLocation().getChunk(); // If the explosion is within a claimed chunk, it will cancel the whole // event. boolean inClaimedChunk = CHUNK_HANLDE.isClaimed(CHUNK); boolean hardCancel = inClaimedChunk || blockUnclaimedChunk(CHUNK.getWorld().getName()); // If the event is TNT/Mincart TNT related, it should be cancelled boolean isTnt = TYPE == EntityType.PRIMED_TNT || TYPE == EntityType.MINECART_TNT; boolean protectTnt = isTnt && config.getBool("protection", "blockTnt"); // If TNT is blocked, check if the user has used `/chunk tnt` to enable // it in this chunk. if (protectTnt && CHUNK_HANLDE.isTntEnabled(CHUNK)) { protectTnt = false; } if (protectTnt) { cancelExplosionEvent(hardCancel, e); return; } // Cancel crepper explosions if protection against them is enabled // within the config. boolean isCreeper = TYPE == EntityType.CREEPER; if (isCreeper && config.getBool("protection", "blockCreeper")) { cancelExplosionEvent(hardCancel, e); return; } // If wither damage is prevented within the config, cancel this event // if it's a wither event. boolean isWither = TYPE == EntityType.WITHER || TYPE == EntityType.WITHER_SKULL; if (isWither && config.getBool("protection", "blockWither")) { cancelExplosionEvent(hardCancel, e); } }
Example 7
Source File: SentinelVersionCompat.java From Sentinel with MIT License | 4 votes |
static EntityType[] v1_8_monsters() { return new EntityType[]{EntityType.GUARDIAN, EntityType.CREEPER, EntityType.SKELETON, EntityType.ZOMBIE, EntityType.MAGMA_CUBE, EntityType.valueOf("PIG_ZOMBIE"), EntityType.SILVERFISH, EntityType.BAT, EntityType.BLAZE, EntityType.GHAST, EntityType.GIANT, EntityType.SLIME, EntityType.SPIDER, EntityType.CAVE_SPIDER, EntityType.ENDERMAN, EntityType.ENDERMITE, EntityType.WITHER, EntityType.ENDER_DRAGON, EntityType.WITCH}; }
Example 8
Source File: CraftWither.java From Thermos with GNU General Public License v3.0 | 4 votes |
public EntityType getType() { return EntityType.WITHER; }
Example 9
Source File: ScrubEntityType.java From skRayFall with GNU General Public License v3.0 | 4 votes |
/** * Convert a string to a bukkit entity type. * * @param exprs The string to be converted. */ public static EntityType getType(String exprs) { switch (exprs.replace("\"", "").toLowerCase().replace("_", " ").replaceFirst("the ", "")) { case "player": case "the player": return EntityType.PLAYER; case "pig": return EntityType.PIG; case "blaze": return EntityType.BLAZE; case "bat": return EntityType.BAT; case "chicken": return EntityType.CHICKEN; case "creeper": return EntityType.CREEPER; case "cow": return EntityType.COW; case "enderman": return EntityType.ENDERMAN; case "ender dragon": return EntityType.ENDER_DRAGON; case "ghast": return EntityType.GHAST; case "giant": return EntityType.GIANT; case "iron golem": return EntityType.IRON_GOLEM; case "magma cube": return EntityType.MAGMA_CUBE; case "mushroom cow": return EntityType.MUSHROOM_COW; case "ocelot": return EntityType.OCELOT; case "pig zombie": return EntityType.PIG_ZOMBIE; case "sheep": return EntityType.SHEEP; case "silverfish": return EntityType.SILVERFISH; case "squid": return EntityType.SQUID; case "snowman": return EntityType.SNOWMAN; case "wolf": return EntityType.WOLF; case "skeleton": return EntityType.SKELETON; case "slime": return EntityType.SLIME; case "spider": return EntityType.SPIDER; case "witch": return EntityType.WITCH; case "wither": return EntityType.WITHER; case "villager": return EntityType.VILLAGER; case "zombie": return EntityType.ZOMBIE; case "armor stand": return EntityType.ARMOR_STAND; case "guardian": return EntityType.GUARDIAN; default: return EntityType.PLAYER; } }
Example 10
Source File: FlyingMobEvents.java From askyblock with GNU General Public License v2.0 | 4 votes |
/** * Deal with pre-explosions */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void WitherExplode(final ExplosionPrimeEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } // Only cover withers in the island world if (!IslandGuard.inWorld(e.getEntity()) || e.getEntity() == null) { return; } // The wither or wither skulls can both blow up if (e.getEntityType() == EntityType.WITHER) { //plugin.getLogger().info("DEBUG: Wither"); // Check the location if (mobSpawnInfo.containsKey(e.getEntity())) { // We know about this wither if (DEBUG) { plugin.getLogger().info("DEBUG: We know about this wither"); } if (!mobSpawnInfo.get(e.getEntity()).inIslandSpace(e.getEntity().getLocation())) { // Cancel the explosion if (DEBUG) { plugin.getLogger().info("DEBUG: cancelling wither pre-explosion"); } e.setCancelled(true); } } // Testing only e.setCancelled(true); } if (e.getEntityType() == EntityType.WITHER_SKULL) { //plugin.getLogger().info("DEBUG: Wither skull"); // Get shooter Projectile projectile = (Projectile)e.getEntity(); if (projectile.getShooter() instanceof Wither) { //plugin.getLogger().info("DEBUG: shooter is wither"); Wither wither = (Wither)projectile.getShooter(); // Check the location if (mobSpawnInfo.containsKey(wither)) { // We know about this wither if (DEBUG) { plugin.getLogger().info("DEBUG: We know about this wither"); } if (!mobSpawnInfo.get(wither).inIslandSpace(e.getEntity().getLocation())) { // Cancel the explosion if (DEBUG) { plugin.getLogger().info("DEBUG: cancel wither skull explosion"); } e.setCancelled(true); } } } } }