First ever plugin completed, please give me criticism to improve for my next ones!

Discussion in 'Plugin Development' started by Excalibur, Jul 26, 2014.

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

    Excalibur

    Here is my github:

    https://github.com/SteveGP/Archer-Arena

    As you can see, I don't use config files at all and hard coded it all to my map, but it does work. I did this because this was supposed to be a learning plugin, nothing special.

    How it works:

    1. /start is initiated

    2. Fires off all the different runnable tasks to be run at certain times (I don't know if there is a better way to do this)

    3. Teleports players and spectators into the arena, gives the competitors a bow and arrows.

    4. Counts down to 0, then breaks the gates to let the competitors out as specified in the Constants.java file.

    5. Listens for PlayerDeathEvent to reset everything by referencing an global-ish Arena object in the Constants class. (Thinking about this now, I think I could of done a Singleton or something like that. Keep in mind I am a complete beginner.

    If its possible, can someone who is experienced with Java run through my code and tell me things that I have done terribly wrong? I know there are a ton of issues with the way I coded it, I really want to improve my syntax, knowledge, and organization for my next plugins hence why I give you this source.

    Anyone who could do this would be my hero! Thanks!
     
  2. Offline

    spurkle

    I'm pretty sure this should be in Resources category, this category is for plugin development help.
     
  3. Offline

    Stealth2800

    spurkle ...he basically is asking for help here...
     
    ZeusAllMighty11 likes this.
  4. Offline

    ZeusAllMighty11

    He's asking for criticism on his plugin. Definitely not a resource.



    Excalibur

    Just a quick scan over your project.. here are some tips:
    - Don't use a switch statement if you can use a single if | if/else | if/else if/else statement
    - Don't store references to the player.. Players store a load of references. Just store their name and convert it back to Player with Bukkit.getPlayerExact(name);
    - You can generate random numbers easier.. The way you are doing it now is much more intensive than using Java's 'Random' class.
    - Don't hardcode values unless they'll never need to change... For example, a string prefix which will be used throughout the whole project, or a speed float value which is applied to mobs (just examples)
    - Use the modulus (%) operator to easily check if a number is divisible by 5. [ if(numberVar % 5 00 =) { /* Divisible by 5 */ }
    - Instead of storing static and public+static variables, just store a private variable and have it use a getter/setter..
     
Thread Status:
Not open for further replies.

Share This Page