Skip to content

Commit

Permalink
Fix #82, #80, #79, #75; Updated PaperMC API and fixed alot of bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Neocky committed Jan 30, 2025
1 parent 6ea80b9 commit 5f22f47
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 100 deletions.
67 changes: 32 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="./assets/branding/pluget-logo-white.png">
Expand All @@ -13,14 +12,14 @@
</p>

<p align="center">
<a href="https://github.com/Neocky/pluGET/blob/main/LICENSE"> <img src="https://img.shields.io/github/license/Neocky/pluGET" alt="Apache-2.0" border="0"></a>
<a href="https://github.com/Neocky/pluGET/releases"> <img src="https://img.shields.io/github/v/release/Neocky/pluGET?include_prereleases" alt"latestrelease"></a>
<a href="https://github.com/Neocky/pluGET/releases"> <img src="https://img.shields.io/github/downloads/Neocky/pluGET/total" alt="downloads" border="0"></a>
<a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FNeocky%2FpluGET&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false"/></a>
<a href="https://discord.gg/475Uf4NBPF"><img src="https://discordapp.com/api/guilds/801903246284685312/widget.png?style=shield"/></a>
</p>


# pluGET
# 🚚💨 pluGET
A powerful package manager which updates [Plugins](https://www.spigotmc.org/resources/) and Server Software for minecraft servers.

<img src="https://user-images.githubusercontent.com/13088544/177011216-1360d444-278a-475e-9863-966c48c60ba7.gif" alt="pluGET.gif" border="0" />
Expand All @@ -39,7 +38,7 @@ A powerful package manager which updates [Plugins](https://www.spigotmc.org/reso

</details>

# About
## 💡 About
pluGET is a standalone package manager written in python for minecraft [Spigot](https://www.spigotmc.org/) servers and its forks (e.g. [PaperMC](https://papermc.io/)). The program works with a locally installed servers or with a remote host through SFTP/FTP, when configured in the config. It uses the [Spiget](https://spiget.org/) API to download and compare plugin versions and download the latest version of plugins from the [Spigot](https://www.spigotmc.org/) site. It can also compare and download the latest update of specific server software (e.g. [PaperMC](https://papermc.io/)).

Plugin management is the hard part of managing a minecraft server. The time it takes to manually check the [Spigot resources](https://www.spigotmc.org/resources/) page for updates and manually downloading all plugins is too long and daunting. So I built pluGET to automate and ease the plugin handling of a minecraft server and to turn the most time consuming part of managing a minecraft server to an easy one.
Expand All @@ -48,7 +47,7 @@ This program is suited for minecraft server owners who want to save time and sta

<img src="https://i.ibb.co/82dnyrK/image.png" alt="meme" border="0" height="350" width="350"></a>

# Features
## 📖 Features
- Works locally or through SFTP/FTP
- Runs directly from the console with command line arguments
- Checks for updates and downloads the latest version of all/specific plugins
Expand All @@ -64,30 +63,30 @@ There are more features in the work. Check [Projects](https://github.com/Neocky/
[Get the latest release here.](https://github.com/Neocky/pluGET/releases)


# Donations ☕
## ☕ Support
If you feel like showing your love and/or appreciation for this project then how about buying me a coffee? ☕🤎

[<img src="https://ko-fi.com/img/githubbutton_sm.svg" alt="ko-fi" width="300"/>](https://ko-fi.com/Y8Y1CKZ43)

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Y8Y1CKZ43)

## ❓ Need help?
Check out the discord!

# Need help?
[<img src="https://i.ibb.co/PQv3KtJ/Discord-Logo-Wordmark-Color.png" alt="Discord" width="300"/>](https://discord.gg/475Uf4NBPF)


# Installation
## 1. Python 3.10.4
## 💻 Installation
### 1. Python 3.10.4
Python needs to be installed on your machine. Get it [here](https://www.python.org/downloads/).

## 2. Dependencies
### 2. Dependencies
In order to install dependencies run the `install_requirements_WINDOWS/LINUX` file, of course depending on your system.

## 3. Edit the config
### 3. Edit the config
When run pluGET for the first time, the `pluGET_config.yaml` file will be created in the main folder and the program will close.
Edit the config to your needs and relaunch pluGET.
**Now you are good to go!**

## 4. Running the program
### 4. Running the program
Execute the `pluget.py` file with python in the `\pluGET` folder.
This will launch pluGET correctly.
```python
Expand All @@ -97,11 +96,9 @@ py pluget.py
python3 pluget.py
```

# Usage
## 🚀 Usage and Commands
> As always, if you update plugins, shut down your server!
## Commands:

### • Show the information about all commands.
<!-- <details>
<summary>Output</summary>
Expand All @@ -124,13 +121,13 @@ exit .
help .
```

## Manage Plugins
### • Download the latest update of a specific package:
### Manage Plugins
#### • Download the latest update of a specific package:
```
get [pluginID/pluginName]
```

### • Check all plugins/one specific plugin for updates with optional changelog output:
#### • Check all plugins/one specific plugin for updates with optional changelog output:
<!-- <details>
<summary>Output</summary>
Expand All @@ -142,73 +139,73 @@ get [pluginID/pluginName]
check [all/pluginName] [changelog]
```

### • Update all plugins/one specific plugin:
#### • Update all plugins/one specific plugin:
```
update [all/pluginName]
```

### • Remove a plugin with the ID/Name:
#### • Remove a plugin with the ID/Name:
```
remove [pluginID/pluginName]
```

### • Search for a plugin:
#### • Search for a plugin:
```
search [pluginName]
```

## Manage Server Software
### Manage Server Software

### • Check installed server software for updates:
#### • Check installed server software for updates:
```
check serverjar
```

### • Update installed server software to latest/specific version:
#### • Update installed server software to latest/specific version:
```
update serverjar [Version]
```

### • Download specific paper version:
#### • Download specific paper version:
```
get-paper [paperBuild] [minecraftVersion]
```

### • Download specific waterfall version:
#### • Download specific waterfall version:
```
get-waterfall [waterfallBuild] [minecraftVersion]
```

### • Download specific velocity version:
#### • Download specific velocity version:
```
get-velocity [velocityBuild] [minecraftVersion]
```

### • Download specific purpur version:
#### • Download specific purpur version:
```
get-purpur [purpurBuild] [minecraftVersion]
```

# Command line arguments
## Command line arguments
pluGET supports all commands directly through the command line. Get the list of all available command line arguments with the `-h` argument.

Example direct command line call:
```shell
py pluget.py check all
```

# Known problems
## Known problems

## Can't get latest version/Update available
### Can't get latest version/Update available

### Inconsistent Names and Versions
#### Inconsistent Names and Versions
Example:
![EssentialsX](https://i.ibb.co/fDyCYQ8/essentialsx.png)
EssentialsX is a prominent example of inconsisten version naming. The installed version is `2.18.2.0` but on [Spigot](https://www.spigotmc.org/resources/essentialsx.9089/update?update=371379) the version is only described as `2.18.2`.
That's the reason pluGET can't detect it automatically.
> There are of course many more plugins which have some sort of inconsistency which makes it sadly impossible for pluGET to detect them all. EssentialsX is used only as an example.
### Solution
#### Solution
Download the plugins with the `get [pluginName]` command to make them detectable for pluGET.
After downloading EssentialsX with `get EssentialsX` and using `check all`:
![EssentialsX](https://i.ibb.co/ws5wHTj/essentialsx-2.png)
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/handle_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def get_input() -> str:
:returns: Optional parameter
"""
input_command = None
print("\n'STRG + C' to exit")
print("\n'CTRL + C' to exit")
while True:
try:
input_command, input_selected_object, *input_parameter = input("pluGET >> ").split()
Expand Down
16 changes: 13 additions & 3 deletions src/handlers/handle_sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import stat
import re

from src.utils.console_output import rich_print_error
from src.utils.console_output import rich_print_error, rich_print_warning
from src.handlers.handle_config import config_value


Expand Down Expand Up @@ -67,8 +67,18 @@ def sftp_upload_file(sftp, path_item) -> None:
sftp.chdir(path_upload_folder)
sftp.put(path_item)
except FileNotFoundError:
rich_print_error("Error: [SFTP]: The 'plugins' folder couldn't be found on the remote host!")
rich_print_error("Error: [SFTP]: Aborting uploading.")
rich_print_error(f"Error: [SFTP]: The '{path_upload_folder}' folder couldn't be found on the remote host!")
try:
sftp.makedirs(path_upload_folder)
rich_print_warning(f"Warning: [SFTP]: Created '{path_upload_folder}' for you.")
sftp.chdir(path_upload_folder)
sftp.put(path_item)
except:
rich_print_error(
f"Error: [SFTP]: The '{path_upload_folder}' folder couldn't be created or the upload failed!"
)
rich_print_error("Error: [SFTP]: Aborting uploading.")

sftp.close()
return None

Expand Down
16 changes: 15 additions & 1 deletion src/plugin/plugin_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
File and functions which handle the download of the specific plugins
"""

import os
import re
from pathlib import Path
import requests
from zipfile import ZipFile

from rich.table import Table
from rich.console import Console
Expand Down Expand Up @@ -127,7 +129,6 @@ def download_specific_plugin_version_spiget(plugin_id, download_path, version_id
if file_size == 0:
continue
progress.update(download_task, advance=len(data))
#f.flush()

# use rich console for nice colors
console = Console()
Expand All @@ -144,12 +145,25 @@ def download_specific_plugin_version_spiget(plugin_id, download_path, version_id
console.print(" [not bold][bright_green]Downloaded[bright_magenta] " + (str(file_size_data)).rjust(9) + \
f" KB [cyan]→ [white]{download_path}")

# check if plugin file is a proper .jar-file (try to open plugin.yml file)
# if it is not it could be a premium plugin
try:
with ZipFile(download_path, "r") as plugin_jar:
plugin_jar.open("plugin.yml", "r")
except:
rich_print_error("Error: Downloaded plugin file was not a proper jar-file! Premium plugins are not supported!")
rich_print_error("Removing file...")
os.remove(download_path)
return None

if config_values.connection == "sftp":
sftp_session = sftp_create_connection()
sftp_upload_file(sftp_session, download_path)

elif config_values.connection == "ftp":
ftp_session = ftp_create_connection()
ftp_upload_file(ftp_session, download_path)

return None


Expand Down
Loading

0 comments on commit 5f22f47

Please sign in to comment.