Abilities Problem *for (Abilities a : ) {*

Discussion in 'Plugin Development' started by ProxyZ, Jan 31, 2015.

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

    ProxyZ

    He guys i got an problem with an plugin that i found on a platform it was free to use and update and now i got one problem

    The Code
    Code:
    import Abilieties.CfgManager;
    
    import org.bukkit.Bukkit;
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.PlayerInventory;
    
    public enum Abilities
    {
      thunder("thunder", "Creates a lightning bolt"),  fireball("fireball", "creates an fireball"),  SNOWBALL("SNOWBALL", "Shoot snowballs");
    
      String aname;
      static CfgManager cf = CfgManager.get();
      String adesc;
    
      private Abilities(String name, String description)
      {
        this.aname = name;
        this.adesc = description;
      }
    
      public String toString()
      {
        return this.aname;
      }
    
      public String getDescription()
      {
        return this.adesc;
      }
    
      public static Abilities fromString(String ability)
      {
        for (Abilities a : ) {
          if (a.toString().equalsIgnoreCase(ability)) {
            return a;
          }
        }
        return null;
      }
    
      public static Abilities getCurrHand(Player p)
      {
        String ability = cf.getUsers().getString(p.getName() + "." + (p.getInventory().getHeldItemSlot() + 1));
        return fromString(ability);
      }
    }
    
    Error is in this part
    Code:
      {
        for (Abilities a : ) {
          if (a.toString().equalsIgnoreCase(ability)) {
            return a;
          }
        }
        return null;
      }
    Already thanks for helping
     
  2. Offline

    nverdier

    @ProxyZ Do you even know how to program in Java? If you did, the problem would be obvious. 'for (Abilities a : )' isn't valid. It simply won't work. Please learn Java well enough before making Bukkit plugins. This question has nothing to do with Bukkit, and doesn't really belong here.
     
  3. Offline

    ProxyZ

    @nverdier
    if you had read the discription (What im shure about u didn't ) you see i'm trying to update an outdated plugin..
     
  4. Offline

    nverdier

    @ProxyZ And if you knew Java, you wouldn't need help with for loop formatting. Don't try to update an outdated plugin without any knowledge of Java. And I did answer your question, without spoon-feeding, of course.
     
  5. Offline

    GriffinPvP

    for (Abilities a : Abilities.values()) i guess
     
    1Rogue likes this.
Thread Status:
Not open for further replies.

Share This Page