Came here after being tired of trying

Discussion in 'Plugin Development' started by wydgabriel, May 16, 2016.

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

    wydgabriel

    Hello guys, I'm here because it got enough of trying.
    Well, I'm trying to make a attribute system that dont let the item get the same attribute again.
    So, I'm trying to call a method inside a for loop, and when I reach my condition, this loop stops.
    The problem is: it seems that my method is not being called for being inside a for loop.
    Do anyone knows how to make it work?
    Here is my code: http://pastebin.com/CVtM6nU2
    I'm trying to call the method "atributos()'' inside a for loop in method "darAtributoArma()"
    Thanks!
     
  2. Offline

    glassbillen

    Have you actually debugged the code? Where do the code stop? Is there any errors? Do the code stop before the call?
     
  3. Offline

    Zombie_Striker

    Code:
    import static me.batz.arvaksecurity.MobsArmadura.formatMessage;
    import net.md_5.bungee.api.ChatColor;
    
    Can you explain why you need a static import? Also, that is the wrong import for ChatColor. Use the org.bukkit import instead.

    The rest of your code is unreadable and will not work as you most likely intended.. You have not formatted, so it will be extremely hard for me to understand what each method does. You treat your 'random' as though it will generate the same random number twice in each if/else statement. You also are violating D.R.Y (Don't Repeat Yourself) by copying and pasting the same methods/ blocks of code in different places inside your class.

    Before we can help you, you need to do the following:
    • Format your code.
    • Remove redundant lines and repetitive code.
    • Debug.
     
  4. Offline

    wydgabriel

    Everything works fine, but the method atributos() is not being called..
    In the first lines, its called, but inside this for loop, it wont..
     
  5. Offline

    Lordloss

    @wydgabriel please do what Zombie_Striker told you to do, your last post was just useless.
     
  6. Offline

    glassbillen

    Well if it wont run in the loop and the loop is running. Then this could be the stopping part?

    Code:
                if ((atributo33.equalsIgnoreCase(atributo11) || atributo33.equalsIgnoreCase(atributo22) || atributo22.equalsIgnoreCase(atributo11))){
    
     
Thread Status:
Not open for further replies.

Share This Page