Spawning entity

Discussion in 'Plugin Development' started by ThePluginMaker, Jun 23, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ThePluginMaker

    Heres my code:
    Code:java
    1. else if (args[0].equalsIgnoreCase("create")) {
    2. if ((sender instanceof Player)) {
    3. Player p = (Player)sender;
    4. if (p.isOp()) {
    5. Location loc = (Location) p.getLocation();
    6.  
    7. LivingEntity entity = ((LivingEntity) loc).getWorld().spawnEntity(loc, EntityType.VILLAGER);
    8. String name = getString(ChatColor.GOLD + "Bartender");
    9. entity.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 2147483647, 1000));
    10. entity.setMaxHealth(1.7976931348623157E+308D);
    11. } else {
    12. sender.sendMessage("ยง4You don't have permission for this command!");
    13. }
    14. }
    15. else {
    16. sender.sendMessage("You can't do this from console!");
    17. }


    I'm getting an error on VILLAGER for: VILLAGER cannot be resolved or is not a field

    Any ideas?
     
  2. Offline

    Bavestry

    ThePluginMaker Make sure you imported
    Code:
    org.bukkit.entity.EntityType
    instead of
    Code:
    com.avaje.ebeaninternal.server.deploy.BeanDescriptor.EntityType
    When importing, make sure you don't just click the first option if there are several. Always read the imports and pick the correct one, otherwise you won't be able to accomplish what you're attempting. :p
     
Thread Status:
Not open for further replies.

Share This Page