{"id":22945490,"url":"https://github.com/windowsgsm/plugin-development-guide","last_synced_at":"2025-04-01T21:44:53.885Z","repository":{"id":106796717,"uuid":"286220905","full_name":"WindowsGSM/Plugin-Development-Guide","owner":"WindowsGSM","description":"🧩 WindowsGSM Plugin Development Guide - Support more game servers by creating and installing plugins!","archived":false,"fork":false,"pushed_at":"2020-08-10T01:09:29.000Z","size":11,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-07T14:28:22.302Z","etag":null,"topics":["game-servers","plugins","windowsgsm"],"latest_commit_sha":null,"homepage":"https://windowsgsm.com/plugins","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WindowsGSM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-09T11:11:23.000Z","updated_at":"2024-03-02T21:47:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"9331f0c5-dc67-4b51-b02c-bbeee4a9c029","html_url":"https://github.com/WindowsGSM/Plugin-Development-Guide","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WindowsGSM%2FPlugin-Development-Guide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WindowsGSM%2FPlugin-Development-Guide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WindowsGSM%2FPlugin-Development-Guide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WindowsGSM%2FPlugin-Development-Guide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WindowsGSM","download_url":"https://codeload.github.com/WindowsGSM/Plugin-Development-Guide/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246717058,"owners_count":20822557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game-servers","plugins","windowsgsm"],"created_at":"2024-12-14T14:33:04.193Z","updated_at":"2025-04-01T21:44:53.868Z","avatar_url":"https://github.com/WindowsGSM.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plugin-Development-Guide\n🧩 WindowsGSM Plugin Development Guide - Support more game servers by creating and installing plugins!\n\n\n#### Support server\nhttps://discord.gg/bGc7t2R\n\n#### Table of Contents:\n1. [Introduction](#Introduction)\n1. [Basic Knowledge](#Knowledge)\n1. [Set up a plugin development environment](#Set-up-a-plugin-development-environment) \n1. [Creating Your First Plugin](#Creating-your-first-plugin) \n1. [Testing Your First Plugin](#Testing-your-first-plugin) \n\n\u003ca name=\"Introduction\"/\u003e\n\n## Introduction\n[WindowsGSM](https://github.com/WindowsGSM/WindowsGSM) (**\u003e= 1.21.0**) starts supporting plugins installation since users want to add their own game servers to WindowsGSM which WindowsGSM doesn't support those game servers yet. More importantly, users can wait for a plugin release on the community instead of WindowsGSM release. \n\n\u003e (27/01/2020) **! AssaultLine** says... _We need to know if its possible to add a game now in a custom way._\n\n\u003e (14/04/2020) **Redyear20** says... _I want to know if this game panel is capable to add games not listed. For example I want to add The Isle_\n\n\u003e (20/07/2020) **Kratomasy 🌈 aka Alaric** says... _is there a way to add a custom steam game server that is not in the list of GSM?_\n\n\u003e (06/08/2020) **Tempus Thales** says... _If I wanted to add a server that is not listed in your tool, can I still add it with your tool?_\n\n\u003e (09/08/2020) WindowsGSM v1.21.0 released! 🥳\n\n\u003ca name=\"Knowledge\"/\u003e\n\n## Basic Knowledge\n✔ Before writing plugins, lets understand how it looks like and how it works. \n\n#### How plugins works?\nWindowsGSM scan the plugins folder and loads **{PLUGIN_NAME}.cs**, **{PLUGIN_NAME}.png** and **author.png** files of each plugin.\n\n##### The plugin file structure is basically like that: (Installed [WindowsGSM.ARMA3](https://github.com/BattlefieldDuck/WindowsGSM.ARMA3) and [WindowsGSM.PaperMC](https://github.com/BattlefieldDuck/WindowsGSM.PaperMC))\n\n![Plugin File Structure](https://windowsgsm.com/assets/images/WindowsGSM-PluginsFileStructure-v1.21.0.png)\n\n##### For **WindowsGSM.PaperMC** plugin, WindowsGSM reads folder **PaperMC.cs** and loads **PaperMC.cs**, **PaperMC.png** and **author.png**\n![Plugin File Structure](https://windowsgsm.com/assets/images/plugin-demos/PaperMC-files-usage.png)\n\n\u003ca name=\"Set-up-a-plugin-development-environment\"/\u003e\n\n## Set up a plugin development environment\nNow let's set up a plugin development environment.\n\n#### Prerequisites\n1. [.NET Framework 4.7.2](https://dotnet.microsoft.com/download/dotnet-framework/net472)\n1. [Visual Studio 2019](https://sr.gdprvalidate.de/redir/clickGate.php?u=8otB939m\u0026m=12\u0026p=3b121G4eNI\u0026t=33\u0026splash=0\u0026s=\u0026url=https%3A%2F%2Fvisualstudio.microsoft.com%2Fzh-hant%2Fdownloads%2F)\n\n#### Preparations\nDownload or git pull the latest WindowsGSM #master (https://github.com/WindowsGSM/WindowsGSM)\n\n#### Get Started\nOpen **WindowsGSM.sln** with Visual Studio 2019\n\n##### You should see something like this\n![](https://windowsgsm.com/assets/images/plugin-demos/vs-plugins.png)\n\nThe plugin development environment is set up! 🥳\n\n\u003ca name=\"Creating-your-first-plugin\"/\u003e\n\n## Creating Your First Plugin\nAs you know, most game servers use steamcmd to install and update the server. WindowsGSM already created [SteamCMDAgent](https://github.com/WindowsGSM/WindowsGSM/blob/master/WindowsGSM/GameServer/Engine/SteamCMDAgent.cs) class for inheritance purpose, so adding a game server that uses steamcmd is much easier than adding a server that does not support steamcmd.\n\n### 1. Create a new plugin script\nCreate a **MyFirstPlugin.cs** file inside **Plugins** folder on WindowsGSM-Plugin-Development project\n\n### 2. Edit the plugin script\n#### Add WindowsGSM references\n```cs\nusing WindowsGSM.Functions;\nusing WindowsGSM.GameServer.Engine;\nusing WindowsGSM.GameServer.Query;\nusing Newtonsoft.Json.Linq;\n```\n\n#### Change the namespace to WindowsGSM.Plugins\n```cs\nnamespace WindowsGSM.Plugins\n```\n\n#### Setting up plugin info\n```cs\npublic Plugin Plugin = new Plugin\n{\n    name = \"WindowsGSM.XXXXX\",\n    author = \"Your name\",\n    description = \"🧩 WindowsGSM plugin for supporting XXXXXX Server\",\n    version = \"1.0\",\n    url = \"https://github.com/XXXXXXXX/XXXXXXXX\",\n    color = \"#ffffff\"\n};\n```\n\n#### Continue read ...\n\n\u003cdetails\u003e\n  \u003csummary\u003ePlugin Format that inherits SteamCMDAgent\u003c/summary\u003e\n  \n  #### Set SteamCMDAgent as parent \n  ```cs\n  public class MyFirstPlugin : SteamCMDAgent\n  ```\n  \n  #### Add constructor and properties\n  ```cs\n  public MyFirstPlugin(ServerConfig serverData) : base(serverData) =\u003e base.serverData = _serverData = serverData;\n  private readonly ServerConfig _serverData;\n  ```\n  \n  #### Add properties for SteamCMD installer\n  ```cs\n  public override bool loginAnonymous =\u003e false; // true if allows login anonymous on steamcmd, else false\n  public override string AppId =\u003e \"\"; // Value of app_update \u003cAppId\u003e \n  ```\n  \n  #### Add standard variables\n  ```cs\n  public override string StartPath =\u003e \"\"; // Game server start path\n  public string FullName = \"\"; // Game server FullName\n  public bool AllowsEmbedConsole = false;  // Does this server support output redirect?\n  public int PortIncrements = 1; // This tells WindowsGSM how many ports should skip after installation\n  public object QueryMethod = null; // Query method. Accepted value: null or new A2S() or new FIVEM() or new UT3()\n\n  public string Port = \"\"; // Default port\n  public string QueryPort = \"\"; // Default query port\n  public string Defaultmap = \"\"; // Default map name\n  public string Maxplayers = \"\"; // Default maxplayers\n  public string Additional = \"\"; // Additional server start parameter\n  ```\n  \n  #### Add standard functions\n  ```cs\n  public async void CreateServerCFG() { } // Creates a default cfg for the game server after installation\n\n  public async Task\u003cProcess\u003e Start() { return null; } // Start server function, return its Process\n  public async Task Stop(Process p) { } // Stop server function\n  ```\n  \n  Done! All necessary variables and functions were all created. you can now start edit your script and create your first plugin!\n  \n  #### Example plugin with plugin format that inherits SteamCMDAgent: [WindowsGSM.ARMA3](https://github.com/BattlefieldDuck/WindowsGSM.ARMA3)\n  \n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eClassic Plugin Format\u003c/summary\u003e\n\n  #### Add constructor and properties\n  ```cs\n  public MyFirstPlugin(ServerConfig serverData) =\u003e _serverData = serverData;\n  private readonly ServerConfig _serverData;\n  public string Error, Notice;\n  ```\n\n  #### Add standard variables\n  ```cs\n  public string StartPath = \"\"; // Game server start path\n  public string FullName = \"\"; // Game server FullName\n  public bool AllowsEmbedConsole = false;  // Does this server support output redirect?\n  public int PortIncrements = 1; // This tells WindowsGSM how many ports should skip after installation\n  public object QueryMethod = null; // Query method. Accepted value: null or new A2S() or new FIVEM() or new UT3()\n\n  public string Port = \"\"; // Default port\n  public string QueryPort = \"\"; // Default query port\n  public string Defaultmap = \"\"; // Default map name\n  public string Maxplayers = \"\"; // Default maxplayers\n  public string Additional = \"\"; // Additional server start parameter\n  ```\n\n  #### Add standard functions\n  ```cs\n  public async void CreateServerCFG() { } // Creates a default cfg for the game server after installation\n\n  public async Task\u003cProcess\u003e Start() { return null; } // Start server function, return its Process\n  public async Task Stop(Process p) { } // Stop server function\n  public async Task\u003cProcess\u003e Install() { return null; } // Install server function\n  public async Task\u003cProcess\u003e Update() { return null; } // Update server function\n\n  public bool IsInstallValid() { return false; } // Check if the installation is successful\n  public bool IsImportValid(string path) { return false; } // Check is the directory valid for import\n\n  public string GetLocalBuild() { return \"\"; } // Return local server version\n  public async Task\u003cstring\u003e GetRemoteBuild() { return \"\"; } // Return latest server version\n  ```\n  \n  Done! All necessary variables and functions were all created. you can now start edit your script and create your first plugin! \n  \n  #### Example plugin with classic plugin format: [WindowsGSM.PaperMC](https://github.com/BattlefieldDuck/WindowsGSM.PaperMC)\n  \n\u003c/details\u003e\n\n\u003ca name=\"Testing-your-first-plugin\"/\u003e\n\n## Testing Your First Plugin\n\n![Install Plugin](https://windowsgsm.com/assets/images/plugin-demos/install-plugins.png)\n\n1. Set **Startup Project** to **WindowsGSM-Plugin-Development** and click **Start** to start installing your plugins.\n1. Set **Startup Project** to **WindowsGSM** and click **Start** to start WindowsGSM and start debug!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindowsgsm%2Fplugin-development-guide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwindowsgsm%2Fplugin-development-guide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindowsgsm%2Fplugin-development-guide/lists"}