1.8.8 Need someone to review my plugin code

Discussion in 'Spigot Plugin Development' started by ZeTioZ, Jan 24, 2020.

  1. Hi, I was trying to add a premium ressource and it got refused :'(
    So, I was wondering if someone could review my code and maybe tell me what's going on and what I should change/improve on it!

    I'll send the code in pm ^^
     
  2. Sure, why did it get refused though?
     
    • Agree Agree x 1
  3. Low effort resource with beginner coding mistakes. Improve the quality of your code design (e.g. by properly and efficiently using OOP/Bukkit/Java API)

    I don't know if it's really a low effort plugin, but what's sure it's that there are no other plugin doing the same thing as mine and I thought I did it well but I may be wrong :/ That's why I would like somebody opinion to see what to change/improve ^^

    (I mean, it's ok to tell me "you way to code is not a good ways, you should do that, that and that", but they don't specify anything :/ so how could I improve myself and plugin itself ?)
     
  4. I'll take a look at it, if you want you can PM me the source
     
    • Agree Agree x 1
  5. I'll take a look at it too if you want! The more eyes the better IMO.
     
    • Agree Agree x 2
  6. I can take a look at it, just send me the jar
     
    • Agree Agree x 1
  7. drives_a_ford

    Moderator

    Looking at the one actual (public) plugin that you do have, if I were to guess, your issues include (but are not limited to) static abuse as well as violations of the single responsibility principle.

    I suggest you read Beginner Programming Mistakes and Why You're Making Them to begin with.
     
    • Agree Agree x 1
    • Informative Informative x 1
  8. I don't know if I do static abuse, butsincerily I use it only for the plugin instance and the fileManager class in my already posted resource and in this one only for the plugin instance so idk :/
     
  9. drives_a_ford

    Moderator

    I can forgive one for trying to use the sigleton pattern on the JavaPlugin instance, because there can only ever be one instance of it. Although I would rather use JavaPlugin#getPlugin instead.

    But one should never have random static fields and getters on a class. If you're going to use it as a singleton, just have FileManager and its getter as a non-static field and if you were to need it, just get the plugin instance and then the FileManager. But for something as small as the plugin I'm talking about, using dependency injection would be far better.
     
    • Useful Useful x 1
  10. Sure, I'll change that! Thanks for the help ;)