{"_id":"@ahdg/minecraftstatuspinger","name":"@ahdg/minecraftstatuspinger","dist-tags":{"latest":"1.1.5"},"versions":{"1.1.5":{"name":"@ahdg/minecraftstatuspinger","repository":{"type":"git","url":"git+https://github.com/woodendoors7/MinecraftStatusPinger.git"},"version":"1.1.5","description":"The best modern library for getting the ping and status of Minecraft servers, written in TypeScript with zero dependencies.","keywords":["minecraft status","minecraft ping","minecraft server","motd","minecraft"],"author":{"name":"woodendoors_7"},"homepage":"https://pinger.floppa.hair/","bugs":{"url":"https://github.com/woodendoors7/MinecraftStatusPinger/issues"},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.cts","exports":{"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"},"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"}},"engines":{"node":">=16.0.0"},"license":"GPL-3.0-or-later","devDependencies":{"@types/express":"^4.17.16","@types/node":"^18.11.18","@types/varint":"^6.0.1","pkgroll":"^2.0.2","typedoc":"^0.23.25","typescript":"^4.9.4"},"scripts":{"test":"cls && tsc && cd test && tsc --target ES2021 --strictNullChecks true --moduleResolution node test.ts && node test.js","start":"node dist/index.js","build":"pkgroll","prepublish":"pkgroll","dev":"ts-node-dev src/index.ts"},"_id":"@ahdg/minecraftstatuspinger@1.1.5","_integrity":"sha512-A/urKqyiytILlQaOGYx/WcpvC0qXLD6xWwpKclwvn3D2rTd07anECFe6E2Lge4hhz9gcW+Jyrk5jcKZGETZW0A==","_resolved":"C:\\Users\\ahdg\\AppData\\Local\\Temp\\e97b2085b5e5bb2c4655b4b6696a2de0\\ahdg-minecraftstatuspinger-1.1.5.tgz","_from":"file:ahdg-minecraftstatuspinger-1.1.5.tgz","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-A/urKqyiytILlQaOGYx/WcpvC0qXLD6xWwpKclwvn3D2rTd07anECFe6E2Lge4hhz9gcW+Jyrk5jcKZGETZW0A==","shasum":"830af3d784c4edcad9e6325faae68eda7a200516","tarball":"https://registry.npmjs.org/@ahdg/minecraftstatuspinger/-/minecraftstatuspinger-1.1.5.tgz","fileCount":8,"unpackedSize":66069,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFQjOA1TQF1LzAkGVkk4sbJkK0hrb19/SKQV1ChWELE5AiEAilC/3IO7evvIC+zyR1Wfkv4wKEaFWMtMjO/pYkO2tUA="}]},"_npmUser":{"name":"ahdg","email":"ahdg6@outlook.com"},"directories":{},"maintainers":[{"name":"ahdg","email":"ahdg6@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/minecraftstatuspinger_1.1.5_1713527778237_0.2907972428448824"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-19T11:56:18.098Z","1.1.5":"2024-04-19T11:56:18.398Z","modified":"2024-04-19T11:56:18.725Z"},"maintainers":[{"name":"ahdg","email":"ahdg6@outlook.com"}],"description":"The best modern library for getting the ping and status of Minecraft servers, written in TypeScript with zero dependencies.","homepage":"https://pinger.floppa.hair/","keywords":["minecraft status","minecraft ping","minecraft server","motd","minecraft"],"repository":{"type":"git","url":"git+https://github.com/woodendoors7/MinecraftStatusPinger.git"},"author":{"name":"woodendoors_7"},"bugs":{"url":"https://github.com/woodendoors7/MinecraftStatusPinger/issues"},"license":"GPL-3.0-or-later","readme":"\r\n\r\n<div align=\"center\">\r\n  <img src=\"https://papers.floppa.hair/mcstatuspinger/mcblock.png\" alt=\"big MinecraftStatusPinger logo\" width=\"600\" border=\"0px\"/>\r\n</div>\r\n<h3><code style=\"color: yellowgreen\">A modern, small, fast, performant, zero dependency TypeScript library made for pinging and getting status of Minecraft servers.</code></h3>\r\n\r\n<hr>\r\n\r\n### What can this be used for?\r\n\r\n- Getting server **Latency (ping)**\r\n- Getting server **MOTD**\r\n- Downloading server **Thumbnail (favicon)**\r\n- Viewing Server **Version**\r\n- Fetching **Player Count** and **Playerlist**\r\n\r\n**And in general, checking the status of Minecraft servers!**\r\n## Getting started\r\n### Requirements\r\n- NodeJS or Deno (used to run JavaScript code)\r\n- NPM (used to install Node packages)\r\n\r\n### Installation\r\n```bat\r\nnpm install minecraftstatuspinger\r\n```\r\n\r\n### Basic Example\r\n```typescript\r\nimport mc from \"minecraftstatuspinger\";\r\n\r\nlet result = await mc.lookup({ host: \"mc.hypixel.net\" })\r\nconsole.log(result);\r\n```\r\n\r\n<details>\r\n<summary><h3>Advanced Example</h3></summary>\r\n<br>\r\n\r\n```typescript\r\nimport mc from \"minecraftstatuspinger\";\r\n\r\nlet result = await mc.lookup({\r\n    host: \"mc.hypixel.net\",\r\n    port: 25565,\r\n    ping: true,\r\n    protocolVersion: 764,\r\n    timeout: 10000,\r\n    throwOnParseError: true,\r\n    disableSRV: false,\r\n    disableJSONParse: false\r\n})\r\n\r\nconsole.log(result);\r\n```\r\n\r\n</details>\r\n\r\n## Docs\r\n\r\n<img src=\"https://papers.floppa.hair/mcstatuspinger/pleasestar.png\" alt=\"emoji holding a heart, pleading to star the repository\" width=\"350\">\r\n\r\n* <b id=\"lookupOptions\">.lookup(): </b>*`((options: ServerStatusOptions) => Promise<ServerStatus>)`*\r\n  * **options:** ServerStatusOptions\r\n    * <b>`host:`</b> string\r\n      > Either an IP, or a hostname of the server. (alias: hostname)\r\n    * <b>`port?:`</b> number <i> `default: 25565`</i>\r\n      > Port of the server. SRV lookup is disabled when using ports other than 25565.\r\n    * <b>`timeout?:`</b> number <i>`default: 10000`</i>\r\n      > How long until an error is thrown if the transaction still hasn't finished. Default is 10 seconds.\r\n    * <b>`ping?:`</b> boolean <i>`default: true`</i>\r\n      > Whether to send a payload at the end to measure the server latency. If false, the `latency` field will be null.\r\n    * <b>`protocolVersion?:`</b> number <i>`default: 764`</i>\r\n      > Protocol version to send to the server to simulate different Minecraft client versions. Here, you can see the [Protocol Version Numbers](https://wiki.vg/Protocol_version_numbers). The current default protocol version is for 1.20.2 (764) and will be irregularly updated to newer versions.\r\n    * <b>`throwOnParseError?:`</b> boolean <i>`default: true`</i>\r\n      > Whether to throw an error if the status packet fails to parse the status field. The `statusRaw` field is always included.\r\n    * <b>`disableSrv?:`</b> boolean <i>`default: false`</i>\r\n      > Whether to force skip SRV lookups. Useful when only pinging IP addresses and not hostnames (domains).\r\n    * <b>`disableJSONParse?:`</b> boolean <i>`default: false`</i>\r\n      > Whether to skip JSON parsing. Useful if you only want a raw plaintext response. If true, the `status` field will be undefined.\r\n  * ServerStatus\r\n    * <b>`latency?:`</b> number\r\n      > The time it takes to receive back a response after sending a small payload to a server, in milliseconds. Will be null if the `ping` option is false.\r\n    * <b>`status?:`</b> DynamicObject\r\n      > Parsed status response from the server. Will be null if the status fails to parse, or if disableJSONParse is true. <a href=\"https://pinger.floppa.hair/responses/\">Example of a valid Status Response.</a>\r\n    * <b>`statusRaw:`</b> string\r\n      > Plaintext status response in the form of JSON. Useful when `status` fails to parse.\r\n\r\n* <b id=\"setDnsOptions\">.setDnsServers(): `((serverArray: string[]) => Promise<boolean>)`</b>\r\n  > It wraps the `dns.setServers` function, useful for looking up SRV records through different DNS servers. <br>\r\n    The first IP in the array will always be used first, others will be tried if the first one is unreachable. <br><br>\r\n    Accepts an array of hostnames or IP addresses of DNS servers. It will either return true, or throw an error. \r\n  \r\n  \r\n  Usage:\r\n  ```js\r\n    // For example:\r\n    mc.setDnsServers([\"9.9.9.9\", \"1.1.1.1\", \"8.8.8.8\"])\r\n    // (Quad9, Cloudflare, Google)\r\n    // Cloudflare is usually the fastest for DNS queries.\r\n  ```\r\n  If you never changed the DNS settings of your computer, the default DNS server will be your ISP's.<br>\r\n  <code style=\"color : darkorange\">❗ I recommend changing your default DNS servers if you're doing thousands of lookups, such as for mass scanning.</code><br>\r\n\r\n### Changelog\r\n  \r\n   **[View Changelog](https://pinger.floppa.hair/changelog/)**,\r\n  Latest version: <b><i><code>v1.1.5</code></i></b>\r\n\r\n\r\n\r\n### Contact\r\n\r\nIf you have some questions, you can message me through Discord - **woodendoors7**\r\n\r\n### Acknowledgements\r\n\r\n[TINY Readme](https://gist.github.com/noperator/4eba8fae61a23dc6cb1fa8fbb9122d45)\r\n\r\n\r\n### To-do\r\n\r\n- [x] Do SRV lookups\r\n- [ ] Support versions less than 1.7.\r\n- [ ] Support Bedrock\r\n\r\n\r\n### License\r\n\r\nThis project is licensed under the [GNU General Public License v3.0](LICENSE).\r\n","readmeFilename":"README.md"}