Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan818fr committed Aug 25, 2023
0 parents commit 69bb462
Show file tree
Hide file tree
Showing 12 changed files with 1,103 additions and 0 deletions.
122 changes: 122 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
### Node
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test
.env*.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
.next-*

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
1 change: 1 addition & 0 deletions .prettierignore
15 changes: 15 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
trailingComma: 'es5'
printWidth: 120
tabWidth: 4
semi: true
singleQuote: true
jsxSingleQuote: true
bracketSpacing: false
proseWrap: 'always'
overrides:
- files: ['*.md']
options: {printWidth: 80}
- files: ['*.html', '*.css', '*.less', '*.scss', '*.md', '*.json', '*.yml', '*.yaml', '*.xml']
options: {tabWidth: 2}
- files: ['*.php']
options: {phpVersion: '7.1', braceStyle: '1tbs'}
Binary file added .readme/kick.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .readme/server-list.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Nathan Poirier <nathan@poirier.io>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Fake Minecraft Server

This is a fake Minecraft server that only responds to server list requests and
sends a kick message when a player try to join.

![server list example](./.readme/server-list.png?raw=true)
![kick message example](./.readme/kick.png?raw=true)

## Usage

To start this server, simply run:

```shell
npm ci
npm run start
```

## Configuration

The configuration is defined via environment variables:

| Variable | Description | Default |
| ------------------ | ----------------------------------------------------------------------------------------------------------- | ----------------- |
| `LISTEN_HOST` | The hostname or IP address to listen on | `::` |
| `LISTEN_PORT` | The port number to listen on | `25565` |
| `LISTEN_BACKLOG` | The maximum number of queued pending connections | - |
| `KICK_MESSAGE` | The message to send when a player try to join | `§cNot available` |
| `MOTD` | The message displayed in the server list | `§eHello World!` |
| `FAVICON` | The favicon displayed in the server list (path to a PNG file, or a string like `data:image/png;base64,XXX`) | - |
| `MAX_PLAYERS` | The number of slots displayed in the server list | `0` |
| `ONLINE_PLAYERS` | The number of online players displayed in the server list | `0` |
| `PROTOCOL_NAME` | The protocol name reported in the server list | (empty) |
| `PROTOCOL_VERSION` | The protocol version reported in the server list | `0` |

To set these environment variables, you can either export them in your shell or
create a `.env` file in the root of the project with the following format:

```
LISTEN_PORT=25565
KICK_MESSAGE="§c§lSorry.\n§cCome back later."
MOTD="§eWelcome to My Server!\n§dJoin now!"
PROTOCOL_NAME="§cHey!"
```

0 comments on commit 69bb462

Please sign in to comment.