Solved Replace Words plugin ( whats wrong)

Discussion in 'Plugin Development' started by kaaseigenaar, Jun 27, 2017.

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

    kaaseigenaar

    hey, the plugin doesnt work does anyone know that i do wrong?
    code:
     
    Last edited: Jun 30, 2017
  2. Offline

    timtower Administrator Administrator Moderator

    InstanceofDeath likes this.
  3. Offline

    kaaseigenaar

    \
     
    Last edited: Jun 30, 2017
  4. Offline

    timtower Administrator Administrator Moderator

    @kaaseigenaar plugin is null.
    Don't make a plugin variable at all, certainly not public static.
     
  5. Offline

    kaaseigenaar

    k
     
    Last edited: Jun 30, 2017
  6. Offline

    timtower Administrator Administrator Moderator

    @kaaseigenaar Again, no plugin variable, that code is exactly the same actually.
     
  7. Offline

    Zombie_Striker

    @kaaseigenaar
    Plugin is still null. You are not setting it anywhere in your code.

    Because of how small your code is, you might as well remove the field entirely and replace 'plugin' with 'this'.

    (BTW: You never have to use static when writing plugins; Doing so normally shows that the developer is too lazy to implement proper getters and setters, or means they are handling the object poorly)
     
  8. Offline

    FrostedSnowman

    dont use static to get reference to your main class. this is NOT what static is for. static is not a global accessor to something(unless util class). use dependency injection to get the main class object.

    also, as said above there is no need to even get a reference, your main plugin arg required, is that class itself. you can just use.

    Code:
    registerEvents(this, this);
     
  9. Offline

    kaaseigenaar

     
    Last edited: Jun 30, 2017
  10. Offline

    timtower Administrator Administrator Moderator

Thread Status:
Not open for further replies.

Share This Page