You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -23,63 +23,76 @@ MCPM requires Java 19, which can be installed [here](https://www.oracle.com/java
23
23
24
24
MCPM runs in two environments:
25
25
26
+
- The **In-Game** environment, where you can configure your server in-game. (Recommended)
26
27
- The **CLI** environment, where you can search, download, update and configure plugins from the command line.
27
-
- The **In-Game** environment, where you can configure your server in-game.
28
28
29
-
To access the CLI environment on a Unix machine, you can use the `./mcpm` shortcut in the root directory.
30
-
31
-
```shell
32
-
mcpm search JedCore # Look for plugins named JedCore
33
-
mcpm install JedCore # Install it to our local directory!
34
-
```
35
-
36
-
On a Windows machine, I recommend executing the shortcut via a bash emulator (Git Bash),
37
-
launching the app yourself using `java`, or investigating the scripts in the /tools folder (run.py).
29
+
### In-Game Environment
38
30
39
31
The In-Game environment is more involved and requires a server with our MCPM plugin.
40
32
41
-
You can quickly set up a test server using the `tools/start_server.py` script.
33
+
To install MCPM as a plugin on an existing Bukkit-API Minecraft server (e.g. Spigot / Paper / Purpur / Pufferfish), you can go to [GitHub Releases](https://github.com/CSC207-2022F-UofT/mcpm/releases), download the latest version's jar, drag it into the `plugins` folder of your server, and restart the server.
34
+
35
+
However, if you are someone grading the course project, you probably don't have an existing minecraft server. You can easily set up a testing Minecraft server using the `tools/start_server.py` script on **Unix** (Linux / macOS).
42
36
This script will automatically download the proper JDK to build and run the server environment.
37
+
If you are using **Windows**, please run this script in the Windows Subsystem for Linux (WSL) environment.
43
38
44
39
```shell
45
40
pip install -r requirements.txt
46
-
python -m tools.start_server
41
+
python -m tools.start_server
47
42
```
48
43
49
44
When in-game, use the `/mcpm ...` slash command to start configuring plugins.
50
45
51
46
For example, if you wanted to search for plugins named `JedCore`, type `/mcpm search JedCore` in chat.
52
47
53
-
#Getting Help
48
+
### CLI Environment
54
49
55
-
If you need a reminder of what mcpm provides, you can use the `-h` or `--help` argument to learn more.
50
+
The CLI environment provides easy access across directories without having to install MCPM to a server. However, CLI usage provides a reduced set of features because hot reloading requires the server JVM environment. To access the CLI environment on a **Unix** machine, you can use the `./mcpm` shortcut in the root directory.
56
51
52
+
```shell
53
+
mcpm search JedCore # Look for plugins named JedCore
54
+
mcpm install JedCore # Install it to our local directory!
57
55
```
58
-
> mcpm --help
59
56
60
-
usage: mcpm [-h] {echo,export} ...
57
+
On a Windows machine, I recommend running MCPM in the minecraft server environment. Alternatively, you can setup Windows Subsystem for Linux (WSL) to run everything as if you're using Linux.
58
+
59
+
# Getting Help
60
+
61
+
If you need a reminder of what mcpm provides, you can type in `mcpm` without arguments or use the `mcpm help` command.
61
62
62
-
positional arguments:
63
-
echo: This is a dummy echo command that...
64
-
export: This command allows you to export...
65
-
66
-
named arguments:
67
-
-h, --help show this help message and exit
63
+
```
64
+
> mcpm help
65
+
66
+
mcpm: Minecraft Plugin Package Manager
67
+
/mcpm export - Export plugin configuration
68
+
/mcpm import - Import a plugins config from a previous export
69
+
/mcpm list - List installed plugins
70
+
/mcpm search - Search for a plugin in the database
71
+
/mcpm mirror - Select a source (mirror) to download plugins from
72
+
/mcpm info - Show the info of an installed plugin
73
+
/mcpm install - Download and install a plugin from the database
74
+
/mcpm refresh - Refresh cached plugin database
75
+
/mcpm uninstall - Uninstall a plugin from file system
76
+
/mcpm update - Updates plugins to the latest version.
77
+
/mcpm load - Load a plugin in the plugins folder
78
+
/mcpm reload - Reload a currently loaded plugin
79
+
/mcpm unload - Unload a currently loaded plugin
80
+
To view the help message of a command, use /mcpm <command> -h
68
81
```
69
82
70
83
You can also learn more about the options that each subcommand provides by passing `-h` to them!
@@ -201,3 +214,140 @@ mcpm export # export to a url
201
214
mcpm export file plugins.txt # Export a list of all currently installed plugins into a file called plugins.txt.
202
215
mcpm import file plugins.txt # Import (install) every plugin contained in the plugins.txt file.
203
216
```
217
+
218
+
## MCPRS - Plugin Repository Server
219
+
220
+
The downloadable Spigot plugins and their meta info are stored on our server, hosted in Toronto 🇨🇦. If you live far from Canada, please consider switching to one of the mirrors below:
| mcprs-tokyo.hydev.org | HyDEV | Vultr | 🇯🇵 Tokyo | 200 Mbps | 1 day |
240
+
241
+
If you want to contribute your network traffic by setting up a mirror, feel free to check out [How to set up a mirror](#How to set up a mirror)
242
+
243
+
### How to set up a mirror
244
+
245
+
The MCPRS server is hosted with a plain file server that supports both http and rsync. The official server is hosted using Nginx, but any file server with such compatibility would work. You can follow one of the approaches below to set up a mirror.
246
+
247
+
After setting up a mirror, if you want to add it to our mirror list, you can submit a pull request to this repo editing the [mirrorlist.yml](mirrorlist.yml) file.
248
+
249
+
#### Setup Mirror using Docker Compose
250
+
251
+
For convenience, we created a docker image so that you can set up a mirror using Docker. It will automatically set up:
252
+
253
+
1.`mcprs-sync`: Script to automatically sync updates every 24 hours (configurable)
254
+
2.`mcprs-rsyncd`: rsync server
255
+
3.`mcprs-nginx`: HTTP server (without SSL). This is only recommended if you don't have any other HTTP services set up
256
+
257
+
You need to install docker and docker-compose, then you need to run:
# Then, you should review or edit the docker-compose.yml script. After that:
264
+
265
+
sudo mkdir -p /data/mcprs
266
+
267
+
# If you want to start everything (including nginx):
268
+
sudo docker-compose up -d
269
+
270
+
# Or if you want to start sync and rsyncd but want to use your own HTTP server, do:
271
+
sudo docker-compose up mcprs-sync mcprs-rsyncd -d
272
+
```
273
+
274
+
Note: If `docker-compose` says command not found, try `docker compose` instead.
275
+
276
+
#### Setup Mirror Manually
277
+
278
+
You can sync all files from an existing mirror by using `rsync`, run rsync automatically using `crontab` or systemd timer, and hosting the synchronized local directory using `nginx`.
279
+
280
+
```bash
281
+
# Use rsync to sync
282
+
alias rsync1="rsync -rlptH --info=progress2 --safe-links --delete-delay --delay-updates --timeout=600 --contimeout=60 --no-motd"
283
+
rsync1 "SOURCE_URL""LOCAL_DIR"
284
+
```
285
+
286
+
```nginx.conf
287
+
# /etc/nginx/conf.d/mcprs.conf
288
+
# Make sure to include this sub-config in your /etc/nginx/nginx.conf
289
+
# You can do "include /etc/nginx/conf.d/*.conf;"
290
+
# After testing the http server works, you can use certbot to obtain a HTTPS certificate
291
+
server
292
+
{
293
+
listen 443 ssl;
294
+
listen [::]:443 ssl;
295
+
server_name mcprs.example.com; # TODO: Change this to your domain
296
+
297
+
root LOCAL_DIR; # TODO: Change this to your filesystem location
298
+
299
+
location / {
300
+
autoindex on;
301
+
}
302
+
}
303
+
304
+
# HTTPS Redirect
305
+
server
306
+
{
307
+
listen 80 default_server;
308
+
listen [::]:80 default_server;
309
+
server_name default;
310
+
return 301 https://$host$request_uri;
311
+
}
312
+
```
313
+
314
+
```rsyncd.conf
315
+
# /etc/rsyncd.conf
316
+
uid = nobody
317
+
gid = nobody
318
+
use chroot = no
319
+
max connections = 4
320
+
syslog facility = local5
321
+
pid file = /run/rsyncd.pid
322
+
323
+
[mcprs]
324
+
path = /ws/mcpm/.mcpm
325
+
comment = MCPM Plugin Repository Server
326
+
```
327
+
328
+
### How does the server work?
329
+
330
+
Server file/endpoint structure:
331
+
332
+
`/db` : Database sync
333
+
`/db/core.json` : Core database (plain text)
334
+
`/db/core.zst` : Core database (compressed)
335
+
`/pkgs` : List of packages
336
+
`/pkgs/spiget` : Raw Spiget packages indexed by resource ids and version ids
337
+
`/pkgs/spiget/{resource-id}` : One Spiget resource
338
+
`/pkgs/spiget/{resource-id}/{version-id}` : One Spiget version
339
+
`/pkgs/spiget/{resource-id}/{version-id}/release.jar` : Jar published by the developer
340
+
`/pkgs/spiget/{resource-id}/{version-id}/plugin.yml` : Meta info
341
+
`/pkgs/links` : Generated symbolic links indexed by names and version names
342
+
`/pkgs/links/{name}` : One package
343
+
`/pkgs/links/{name}/{version}` : One version
344
+
`/pkgs/links/{name}/{version}/release.jar` : Prebuilt jar for the version of a package
345
+
`/pkgs/links/{name}/{version}/plugin.yml` : Meta info for the version of a package
346
+
347
+
Internal server file structure:
348
+
349
+
`/crawler` : Crawler cache / data storage
350
+
`/crawler/spiget` : Spiget crawler
351
+
`/crawler/spiget/resources.json` : List of all resources on SpigotMC
0 commit comments