How do you add custom effects on a Item

Discussion in 'Plugin Development' started by js_bagel, Dec 3, 2015.

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


    Hello, I have just finished a course on rudimentary java. I was wondering how to have an event like this occur:
    After Right-clicking a certain block it runs through an event like for example teleporting a player underneath them to the same block as the player who is right-clicking for mentioned block.

    I would just like an example if that's fine, I had a bit of trouble finding this is Spigots Api xD
  2. Offline


  3. Offline


    Edit: Forget that code.
    Last edited: Dec 4, 2015
  4. Offline


    And no, don't use Timber's code.
  5. Offline


    Seriously, if you can't create a code, that isn't W.E.T. code, then please, don't tell others to learn the API.
    Seriously, you use .equals for enums, and the code currently tries to teleport the player to the same location.
    Please, delete that code, you teach bad habits and you even spoonfeed.
    Btw.: in java, you need to put the brackets in the same line as the statement. Not that it matters, but you only put the brackets on the next lime in C#
  6. Offline


  7. Formatting is about the programming-style and has nothing to do with the programming-skills, just saying. I am working as a professional programmer for multiple clients and depending on the client some of those companies want their own code-style so you gotta adjust it. I ve also had it that they wanted the brackets in different lines. Also its not just C# which is using that default-formatting
    but using equals for enums is really a no-go.
    Dont think this is spoonfeeding tho, since he didnt ask for a solution for a problem. he just wanted to see some java-code to see how the api is used for stuff like that. he doesnt even need the code

    @js_bagel what you mentioned is no event. An event is a container for multiple information which is given to a listener so it can read them. Usually you wouldn't need events since you could add all the information in single parameters, but why having 50 parameters if you can have 1 event-parameter from which you can request the information with getters. what you was talking about is a function which is invoked by a listener if an specific event is fired. To react on such a event you have to create a listener which listens to that event and register that listener on the object which is gonna fire the event you wanna listen to.
  8. Offline


    It's definitely spoonfeeding
  9. @Scimiguy Well i guess that depends on the definition of spoonfeeding which everybody sees a little different. For me spoonfeeding is the providing of the solution without explanation for a specific problem.

    so what i see here is a) its not the solution, its a hint and b) we dont have a problem to solve since he just wanted to see the code, not to use it because he needs it
  10. Offline


    The problem with providing code here is that often, the question asker won't know whether it's the solution or not.
    This is a problem inherent to Bukkit Forums.
  11. Offline


    Java naming conventions, just saying.
  12. I guess you replied in your post there to the wrong post of mine but i know what you are referring to. Well you are right there are naming conventions, but as you wrote
    "you need to put the brackets in the same line"
    i just wanted to have it said that there is no need to it. it is a java convention, correct so he should use it if there arent reasons for ignoring them, but he doesnt have to. just sounded like its not gonna work if you dont do that
  13. Offline


    Yes, you're right
    Shmobi likes this.
  14. Offline


    He's providing code for other people in an attempt to teach them.
    Seems like the perfect time to be FOLLOWING JAVA CONVENTIONS.
  15. @Scimiguy did i ever say that he shouldn't? Actually i remember that i just said that he usually should. Call me out if i quote my self wrong but didn't i say "he should use it if there arent reasons for ignoring them" and "i just wanted to have it said that there is no need to it"?

    I just tried to make our friend hier not believing something he got wrong because it was weird explained and to spare him searching for brackets which could be not right behind the statement.
Thread Status:
Not open for further replies.

Share This Page