H1Z1 Server Plugin Template

This is a template for an h1z1-server plugin that can be used as a starting point for developing custom plugins. It extends the BasePlugin class provided by the h1z1-server framework and demonstrates how to override the default behavior of a public function in the ZoneServer2016 class.

Getting Started

To use this plugin template, follow these steps:

  1. Make sure you have the h1z1-server framework installed and set up in your project. Refer to the main h1z1-server repository's documentation for installation and setup instructions.

  2. Clone and pull this plugin-template repository, and put it into the "plugins" folder generated by your h1z1-server instance.

  3. Update the tsconfig.json of the plugin so that the "@h1z1-server/*" path points to your h1z1-server folder so that your plugin can resolve imports.

  4. Customize the plugin properties to fit your needs:

    • Update the name, description, author, and version properties to reflect your plugin's information.
    • Define any additional properties required by your plugin.
    • Modify the loadConfig method to handle loading configuration values from config.yaml or any other configuration source specific to your plugin.
  5. Implement the init method to add your custom logic:

    • Use the server parameter to access the ZoneServer2016 instance and its methods.
    • Override the default behavior of a public function, such as sendChatText, by using the server.pluginManager.hookMethod method. Customize the logic inside the hook to suit your needs.
  6. Compile / transpile the plugin using the npm run build command.

  7. Build and run your h1z1-server project, and the plugin will be loaded and activated.

Usage

Once the plugin is loaded and activated, it will override the default behavior of the sendChatText function in the ZoneServer2016 class. Instead of sending the original message parameter to the client, it will send the custom chatTextMessage property defined in the plugin.

To customize the plugin further, refer to the main h1z1-server repository's documentation, as well as the available classes and methods provided by the server framework.