Toggle command for join messages

Discussion in 'Plugin Development' started by AddventureTime, Nov 23, 2020.

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

    AddventureTime

    can someone please make an example for a toggle command with which you can turn the join message on and off

    even if it's spoonfeeding. i just want an example

    Please accept that.
     
  2. Offline

    timtower Administrator Administrator Moderator

    @AddventureTime We don't spoonfeed here.
    Make a boolean, have a command to change it.
    If you have issues then please share them.
     
  3. Offline

    AddventureTime

    I know how to do the command but I don't know how to get the join message from the listener
     
  4. Offline

    timtower Administrator Administrator Moderator

  5. Offline

    AddventureTime

  6. Offline

    timtower Administrator Administrator Moderator

    CommandExecutor is extend, Listener is implement, you can use both.
     
  7. Offline

    AddventureTime

    Help?
    [​IMG]
     
  8. Offline

    timtower Administrator Administrator Moderator

  9. Offline

    AddventureTime

    Last edited: Nov 24, 2020
  10. Offline

    timtower Administrator Administrator Moderator

    That you imported the CraftBukkit.jar, not the Bukkit.jar
     
  11. Offline

    AddventureTime

    ??? also what imports do I need for the commandexecutor / listener
     
  12. Offline

    timtower Administrator Administrator Moderator

    @AddventureTime They are both implements, and your IDE should figure that out on its own.
     
  13. Offline

    AddventureTime

    but it doesn't find out :/
     
  14. Offline

    timtower Administrator Administrator Moderator

    Both using implements?
     
  15. Offline

    AddventureTime

    Do u mean this?

    [​IMG]
     
  16. Offline

    AddventureTime

    Attached Files:

  17. Offline

    timtower Administrator Administrator Moderator

  18. Offline

    AddventureTime

    That’s the source code :/

    if u don’t trust check it with an anti Virus
     
  19. Offline

    CraftCreeper6

    @AddventureTime
    Put it on github.
    Alternatively, just post the code here.
     
  20. Offline

    AddventureTime

  21. Offline

    timtower Administrator Administrator Moderator

    That does not mean that I am scared of a virus, it means that I can't be bothered to download a zip.
    replaceAll does not take null as arguments -.-
     
  22. Offline

    AddventureTime

    what do I have to change now
     
  23. Offline

    timtower Administrator Administrator Moderator

    Remove everything where you have null
     
  24. Offline

    Strahan

    I'd highly recommend you learn to read a stack trace. As timtower said, you can't use null there. The trace tells you specifically what is wrong and even where the problem is.

    Why are you implementing Listener in your command class (the JoinQuitToggle_command). You do not actually have a listener in there. Also why check if the sender is a Player? Nothing you do requires a Player. It's best to not arbitrarily restrict command usage. Further you should be using the ChatColor enum, not embedding the color character. The way you are using four static variables to handle two messages is also a little weird. It would make more sense to me if you are going to static the variables to one of those classes to attach it to the listener that actually uses it directly, but honestly I wouldn't do it that way either.

    Oh, one other thing I just saw. You don't need to check for wildcards when doing perm checks. That's the purview of the permissions manager, not you. Lastly I'd suggest you consider negative check and return instead of positive checks, it will reduce a lot of that indentation. Personally, I hate when code looks like a huge greater than symbol lol
     
Thread Status:
Not open for further replies.

Share This Page