Ban Reason

Discussion in 'Spigot Plugin Development' started by The_AxeMaster, Mar 31, 2017.

  1. How would i use
    Code (Text):

    String message = "";
                            if(args.length > 2) {
                                for (int i = 1; i < args.length; i++) {
                                    message += args[i] + " ";
    In a different class? Like
    Something like
    Code (Text):
    target.kickPlayer(ChatColor.RED + "You have been banned from this server!" + MyOtherClass.message);[CODE]
  2. Choco


    What? ._. I don't think I understand what exactly you're trying to do? You can use that code snippet in any class such that there's an array titled "args" (presumably from an #onCommand() method)
  3. the integer i should be 2...
  4. I made it in a class and I want to use it in a different class.

    I'll set it to 2.
  5. Why do you want it to be in a different class? Why not just have that in the ban command class so you can grab it easily?
    • Agree Agree x 1
  6. You would need to call an instance of the class and get the variable. For what your doing though, you should have this all in one class.