Using BuycraftX standalone APIs

I recently added a feature to BuycraftX that makes setting up standalone Buycraft clients in Java easier.

A quick run-through

You'll need to provide:

  • A ScheduledExecutorService. (Using Executors.newScheduledThreadPool() is recommended.)
  • A PlayerDeterminer to handle player data. (Most applications will find StandaloneUtilities.ALWAYS_OFFLINE_PLAYER_DETERMINER suitable.)
  • A CommandDispatcher to execute commands.
  • A java.util.logging.Logger.
  • A secret key.

An example invocation might look like this:

    StandaloneBuycraftRunnerBuilder.builder()
            .apiKey("")
            .determiner(StandaloneUtilities.ALWAYS_OFFLINE_PLAYER_DETERMINER)
            .dispatcher(this::runCommand)
            .executorService(Executors.newScheduledThreadPool(4))
            .logger(Logger.getLogger("BuycraftXTest"))
            .build()
            .start();