@Override public FilterState evaluate(Object... objects) { for (Object object : objects) { if (object instanceof CreatureType) { if (object.equals(mobType)) return ALLOW; else return DENY; } } return (getParent() == null ? ABSTAIN : getParent().evaluate(objects)); }
public void enable() { // plugin.getServer().getPluginManager().registerEvents(this, plugin); mobs.add(CreatureType.PIG); mobs.add(CreatureType.SHEEP); mobs.add(CreatureType.COW); mobs.add(CreatureType.CHICKEN); mobs.add(CreatureType.ZOMBIE); mobs.add(CreatureType.SKELETON); mobs.add(CreatureType.SPIDER); mobs.add(CreatureType.CAVE_SPIDER); mobs.add(CreatureType.PIG_ZOMBIE); log("Enabled"); }
private int getInt(CreatureType c) { for (int i = 0; i < mobs.size(); i++) { if (mobs.get(i) == c) return i; } return 0; }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onCreatureSpawnEvent(CreatureSpawnEvent event) { Entity mob = event.getEntity(); if (mob instanceof Monster) { CreatureType type = event.getCreatureType(); pg.mb.alter(mob, type); } if (mob.getType().equals(EntityType.IRON_GOLEM)) { } }
public boolean alter(Entity mob, CreatureType type) { if (pg.config.diffmob != true) return true; if (type == null) return true; Damageable mob2 = (Damageable) mob; mob2.setMaxHealth(150); mob2.setHealth(150); return true; }
@Deprecated public LivingEntity spawnCreature(Location loc, CreatureType creatureType) { return spawnCreature(loc, creatureType.toEntityType()); }
@Deprecated public CreatureType getCreatureType() { return CreatureType.fromName(spawner.func_145881_a().getEntityNameToSpawn()); }
@Deprecated public void setCreatureType(CreatureType creatureType) { spawner.func_145881_a().setEntityName(creatureType.getName()); }
@Deprecated public CreatureSpawnEvent(Entity spawnee, CreatureType type, Location loc, SpawnReason reason) { super(spawnee); spawnReason = reason; }
@Deprecated public PlayerEggThrowEvent(Player player, Egg egg, boolean hatching, byte numHatches, CreatureType hatchingType) { this(player, egg, hatching, numHatches, hatchingType.toEntityType()); }
public MobFilterParser(final Element element) { super(element); this.mobType = CreatureType.valueOf(element.getText().toUpperCase().replace(" ", "_")); }
public CreatureType getMobType() { return mobType; }
@SuppressWarnings("deprecation") public LivingEntity spawnCreature(Location loc, CreatureType type) { throw new NotImplementedException("spawnCreature(Location, CreatureType)"); }
@Deprecated public CreatureType getCreatureType() { return CreatureType.fromName(spawner.getSpawner().getMobName()); }
@Deprecated public void setCreatureType(CreatureType creatureType) { spawner.getSpawner().setMobName(creatureType.getName()); }
@Deprecated public CreatureType getCreatureType() { return CreatureType.fromName(spawner.a().getMobName()); }
@Deprecated public void setCreatureType(CreatureType creatureType) { spawner.a().a(creatureType.getName()); }
private void playSound(CreatureType c, Block b) { e = b.getWorld().spawnCreature(b.getLocation().add(.5, 1, .5), c); e.damage(200); }