Skip to content

Commit 12687e3

Browse files
committed
Final changes
1 parent 489de93 commit 12687e3

File tree

3 files changed

+44
-16
lines changed

3 files changed

+44
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Major changes!
66
Due to numerous code and feature changes,
7-
we have bumped up to version 2.
7+
we have bumped to version 2.
88
This update mostly focuses on behind the scene bug
99
fixed and improvements,
1010
but we do have some new features to offer.

README.md

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# PaperMC-Update
2+
23
A simple CLI script that can check, download, and install PaperMC jar files.
34

45
NOTE: This script can only be used for updating a [PaperMC Minecraft Server](https://papermc.io/). I highly recommend
@@ -8,6 +9,7 @@ Check out the [PaperMC Documentation](https://paper.readthedocs.io/en/latest/),
89
[Download Page](https://papermc.io/downloads), and [GitHub](https://github.com/PaperMC).
910

1011
# Prerequisites
12+
1113
You must have Python 3.6+ installed. It should come pre-installed on most linux systems.
1214
This script has no other dependencies, so all you need is python! Instructions for installation are below:
1315

@@ -63,9 +65,9 @@ This can be done like so:
6365

6466
>python[VERSION] script_to_run.py
6567
66-
Using this template, we can run python 3.7 like this:
68+
Using this template, we can run python 3.9 like this:
6769

68-
>python3.7 script_to_run.py
70+
>python3.9 script_to_run.py
6971
7072
This usage is most prevalent on linux devices,
7173
as they may have older versions of python installed for compatibility reasons.
@@ -172,9 +174,6 @@ Displays server version, extracted from configuration file:
172174
Will only output errors and interactive questions to the terminal:
173175
>-q, --quiet
174176
175-
Does not rename the new file, uses recommended name from the PaperAPI:
176-
>-nr, --no-rename
177-
178177
Copies the old file to a new location before the installation process:
179178
>-co [PATH], --copy-old [PATH]
180179
@@ -262,13 +261,8 @@ that share the same name!
262261

263262
If no target filename is specified from the path,
264263
and no output filename is specified,
265-
then the new file will not be renamed.
266-
You can also use the '--no-rename'
267-
parameter to prevent the new file from being renamed.
268-
If the file is not going to be renamed,
269-
then we use the recommended filename from the PaperAPI.
270-
271-
The recommended name usually looks something like this:
264+
then the default filename will be used.
265+
The default name usually looks something like this:
272266
>paper-[VERSION]-[BUILD].jar
273267
274268
So, if you downloaded build 734 version 1.16.5:
@@ -304,6 +298,15 @@ Check to see if a newer version is available, does not install:
304298
Display currently installed server version:
305299
>python server_update.py --server-version [PATH]
306300
301+
Display stats on currently installed server version before installation:
302+
>python server_update.py --stats [PATH]
303+
304+
Display stats on version 1.16.5 build 435 before installation:
305+
>python server_update.py --stats --version 1.16.5 --build 435 [PATH]
306+
307+
Display stats on installed version without installing:
308+
>python server_update.py --check-only [PATH]
309+
307310
Install a paper jar at the given location, without going through the update process.
308311
Great if you want to set up a new server install.
309312
>python server_update.py --new -o paper.jar [PATH]
@@ -322,7 +325,7 @@ and it made using PaperMC-Update a lot more complicated. Now, we read version in
322325
eliminates the need for 'script-generated configuration files',
323326
and makes PaperMC-Update easier to use and more accurate.
324327

325-
However, their are some things to keep in mind:
328+
However, there are some things to keep in mind:
326329

327330
## Official Builds
328331

@@ -358,11 +361,32 @@ for your build.
358361

359362
The old command line options were for managing the configuration file, such as removing it, creating it, and
360363
dumping information to it. These features are now obsolete, but the command line options are included for
361-
backwards compatibility. These options do not appear on the help menu and they do nothing, they are their only to
362-
prevent usage errors. It is highly recommended that you stop using these options, and update any scripts or
364+
backwards compatibility. These options do not appear on the help menu and they do nothing. This is to prevent usage errors. It is highly recommended that you stop using these options, and update any scripts or
363365
implementations that use these features. These features might be removed in a later version if deemed necessary,
364366
so be warned.
365367

368+
# Updater Class:
369+
370+
Developers can import the Updater class into their own projects.
371+
The updater class offers entry points into the PaperMC API,
372+
and allows users to get version/build data
373+
and download jar files.
374+
375+
You can import and create the class like so:
376+
377+
```python
378+
from server_update import Update
379+
380+
update = Update()
381+
```
382+
383+
Just be sure the server_update.py file is present in the directory
384+
of the code importing it.
385+
386+
You should have a look at the docstrings in the source code for usage.
387+
All arguments and outputs are described and typed,
388+
so implementing the Updater class into your code should be relatively painless.
389+
366390
# Conclusion
367391

368392
This script provides a simple method to check/download/install PaperMC server updates. You can add your command to the

server_update.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,10 @@ def install(self, file_path: str, new_path: str, target_copy: str=None, backup=T
691691

692692
# Checking if we should copy the old file:
693693

694+
print("Target Copy: {}".format(target_copy))
695+
print("Is file: {}".format(os.path.isfile(self.path)))
696+
print("Path: {}".format(self.path))
697+
694698
if target_copy is not None and os.path.isfile(self.path):
695699

696700
# Copy the old file:

0 commit comments

Comments
 (0)