0

I've been trying to convert this ruby bootstrap to groovy for someone and so far i'm a bit confused as i'm still a beginner in ruby.

This is basically a plugin system. The bootstrap ruby script allows me to create multiple scripts for my server with hooks onto the button handler so I can handle button clicking inside a ruby script instead. An example of the plugin script is this:

Now i'm trying to do it for Groovy but i don't know how to call the extra parameters[player,slot,param] and handle it like in the example plugin script above

Thanks, i hope u guys understand my problem but i'll provide more details if needed.

1 Answer 1

1

I'm no Ruby guru, but AFAIK, Proc is similar to Groovy's Closure, so my guess it'd be something like:

class ProcButtonHandler extends ButtonHook {
  Closure proc
  ProcButtonHandler(id, proc) {
    super(id)
    this.proc = proc
  }

  void handle(player, slot, parameter) {
    proc player, slot, parameter
  }
}
Sign up to request clarification or add additional context in comments.

1 Comment

Aha thanks the closure was what lead me to the right direction :) Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.