Error

Discussion in 'Plugin Development' started by Coopah, May 2, 2014.

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

    Coopah

    How come this is sending this console error message?
    The console error message is this:
    http://gyazo.com/4ba948aea6e45f795b8ddeaf03f7591e
    The code that is giving the errors is this:
    Code:java
    1. @EventHandler
    2. public void onPlayerJoin(PlayerJoinEvent e) {
    3. Player p = e.getPlayer();
    4. if ((((MetadataValue)p.getMetadata("morphtype").get(0)).asString().equals("spider")) && (DisguiseCraft.getAPI().isDisguised(p))) {
    5. p.removePotionEffect(PotionEffectType.REGENERATION);
    6. p.getInventory().remove(Material.SPIDER_EYE);
    7. p.sendMessage(ChatColor.BLUE + "Morphs> " + ChatColor.GRAY + "You were unmorphed due to logging out.");
    8. Morphs.unmorph(p);
    9. p.setFoodLevel(20);
    10. } else if ((((MetadataValue)p.getMetadata("morphtype").get(0)).asString().equals("chicken")) && (DisguiseCraft.getAPI().isDisguised(p))) {
    11. p.removePotionEffect(PotionEffectType.WEAKNESS);
    12. p.getInventory().remove(Material.FEATHER);
    13. p.sendMessage(ChatColor.BLUE + "Morphs> " + ChatColor.GRAY + "You were unmorphed due to logging out.");
    14. Morphs.unmorph(p);
    15. } else if ((((MetadataValue)p.getMetadata("morphtype").get(0)).asString().equals("golem")) && (DisguiseCraft.getAPI().isDisguised(p))) {
    16. p.removePotionEffect(PotionEffectType.SLOW);
    17. p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
    18. p.removePotionEffect(PotionEffectType.HEALTH_BOOST);
    19. p.getInventory().remove(Material.IRON_INGOT);
    20. p.sendMessage(ChatColor.BLUE + "Morphs> " + ChatColor.GRAY + "You were unmorphed due to logging out.");
    21. Morphs.unmorph(p);
    22. }
    23. }

    Apprently this line is the error:
    if ((((MetadataValue)p.getMetadata("morphtype").get(0)).asString().equals("spider")) && (DisguiseCraft.getAPI().isDisguised(p))) {
     
  2. Offline

    iFamasssxD

    Metadata clears when you relog AFAIK. Thus, the metadata "morphtype" is null and the list is null.
     
  3. Offline

    Coopah

  4. Offline

    iFamasssxD

    Store it then read it
     
  5. Offline

    xTigerRebornx

    Coopah use Player#hasMetadata(String metadata) to check for it?
     
  6. Offline

    MCCoding

  7. Offline

    Kiaeyi

    • Unacceptable behavior, take your hate elsewhere
    There's nothing wrong with spigot. OP, you may want to join us at spigot, definitely less retards like these.
     
  8. Offline

    MCCoding

    Kiaeyi
    I'm going on by what the Admins/Moderators have been doing, closing any posts that use Spigot and redirecting them there for there issues.
     
  9. Offline

    Plo124

    MCCoding
    Also he used flaming, which is against the forum rules
     
  10. Offline

    Kiaeyi

    • Use your words, this isn't an image board
    [​IMG]
     
  11. Offline

    TnT

    Locked. If you need help developing plugins for software we do not make, post on the forums for the software you use. Unofficial builds can and often do change how the Bukkit API functions, so any help we give you may be entirely invalid. You've chosen to use their software, please understand that choice involves using their support.
     
Thread Status:
Not open for further replies.

Share This Page