This is a project demonstrating one method of auto-reload (on save) with Grakkit. Inspired by Create-React-App's WebpackDevServer.
I used Java Express (which is inspired from NodeJS Express) for the backend server within MC. You can swap it out. You could use Websockets as well.
- This uses a webserver within the minecraft server.
- When in development mode, it enables a new API route called
/reload
. - The solution is built using webpack (which is fast) and it will put the compiled files in
server/plugins/grakkit/dist
. - Using a custom start up script in
scripts/start/index.ts
, it will build the solution, enable development mode, and ping the/reload
endpoint.- Once the endpoint is hit, well, the server reloads grakkit.
- Using webpack, it'll build the files to
/dist
. Any code relying ondevelopment
will be disabled.
- Run
yarn install
(or change over tonpm install
) - Place your server jar in the
server
folder (such as paper.jar). - Add the grakkit jar in the
/server/plugins
folder. - Run
yarn start
/npm run start
first to sync files. - Run
yarn start:server
to start mc server
- You may need to tweak the startup to your configuration.
- Run
yarn start
- Run
yarn start:server
When developing plugins, you may need to hook into additional dependencies. You can add those jars to the ./deps
folder.
If you need further customization, you can update scripts/start/index.ts
The startup script is forked from Create-React-App's WebpackDevServer. It works, but isn't perfect.