Solved Errors with Override and config

Discussion in 'Spigot Plugin Development' started by Igasi, May 5, 2017.

  1. So yeah I decided to move so that someone who is shit at programming can actually achieve something, and I'm getting errors as I move.
    [​IMG]
    So, how do I fix the @Override and the integers for the config?
    It claims that the integers are supposed to be objects, but how do I set it as an integer?

    Also, avoiding valueOf() would be very kind, it is inefficient and not the best solution (And not the one I'm looking for, of course)
     

    Attached Files:

  2. Do call classes from Upper letter
    Why to put both "extends JavaPlugin" and "implements Listener"
    You're highly recommended to work with events in separate class
     
    #2 PROgrm_JARvis, May 5, 2017
    Last edited: May 6, 2017
  3. You should use UUID's instead of names in config and also put saveDefaultConfig() into onEnable.
     
  4. Mas

    Mas

    • Name classes in UpperCamelCase.
    • Tell us what the error is when you hover over the integers when setting config values.
    • Tell us the message (if any) where you are trying to use @Override
    • Do expForNextLevel and EXP_REQ really need to be static? No, consider also using a seprarate class and accessing the method via either a singleton instance or through a getter in the main class.
     
    • Agree Agree x 1
  5. Im used to doing it this way.
    Alright will do
    Errors:
    @Override
    Code (Text):

    Cannot resolve symbol 'Override'
     
    Integers:
    Code (Text):

    Wrong 2nd argument type. Found: 'int', required: 'java.lang.Object' less...

    set
    (String,
    java.lang.Object)
    in MemorySection cannot be applied
    to
    (String,
    int)
     
    And I would prefer them to be static.
     
  6. Nnnnnnnever mind I found out I just forgot to add JDK 8 as a jdk
     
  7. static final fields are fine (they're constants). Also, singleton is not meant for sharing instances, it's meant to enforce singularity.
     
    • Like Like x 1
  8. Out of curiousity, when would you use singleton over just passing the instance through a constructor? Also, is it possible to pass an instance without using singleton in an enum class?

    Edit: Apologise for hijacking the thread :/


    Sent from my iPhone using Tapatalk
     
  9. So all this time you were using JDK 1.5 or something before
    Code (Text):
    @Override
    was added.
     
  10. I had a JDK set up on Eclipse but forgot to do that on Intellij

    I use JKD8