Compare commits

...
20 Commits
Author SHA1 Message Date
Andre601 8459eee57d Fix wrong Modrinth ID. 2024-02-13 21:19:38 +01:00
Andre601 f5cebf42ab Change ~= to ~= 2024-02-13 21:05:52 +01:00
Andre601 731bdeba7d Change way of applying dependencies in ModrinthVersionUploader 2024-02-13 17:31:45 +01:00
Andre601 d14cda243a Bump mkdocs-material to 9.5.9 2024-02-10 14:23:29 +00:00
Andre601 0a98aad138 Use hook to remove backslash from | 2024-02-09 16:00:52 +01:00
Andre601 1249a08264 Make sure Anonymous is in double quotes. 2024-02-09 01:36:15 +00:00
Andre601 c0414a5962 Actually, starts with operator is better 2024-02-09 01:34:50 +00:00
Andre601 9cc4d4bb36 Add example for contains expression 2024-02-09 01:33:51 +00:00
Andre601 338358a2ab Why did it remove magiclink? 2024-02-09 01:23:41 +00:00
Andre601 805ba83bb6 fix typos and improve readme 2024-02-08 00:30:21 +00:00
Andre601 0f646a8f8d Merge pull request 'Update dependency mkdocs-material to v9.5.8' (#220) from renovate/mkdocs-material-9.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/220
2024-02-07 12:31:20 +00:00
Andre601's Renovate Bot 2519f09f6f Update dependency mkdocs-material to v9.5.8 2024-02-07 12:01:04 +00:00
Andre601 60bca9e3d7 Redo getting started guide and migration page 2024-02-07 01:41:08 +01:00
Andre601 da8f72fc50 Update mkdocs.yml... I think 2024-02-07 01:06:06 +01:00
Andre601 c42d4b8967 Add operand examples and open original in new tab 2024-02-05 12:46:30 +00:00
Andre601 0110854ae4 Fix some typo 2024-02-04 19:20:01 +00:00
Andre601 d6d5952cbc Merge pull request 'Update dependency org.junit.jupiter:junit-jupiter-engine to v5.10.2' (#219) from renovate/org.junit.jupiter-junit-jupiter-engine-5.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/219
2024-02-04 12:54:07 +00:00
Andre601's Renovate Bot f9d961cae7 Update dependency org.junit.jupiter:junit-jupiter-engine to v5.10.2 2024-02-04 12:01:05 +00:00
Andre601 a387feea23 Fix wrong operand for contains in docs 2024-02-03 17:39:51 +01:00
Andre601 359c58163b Only add ViaVersion on paper platform. 2024-02-03 17:34:55 +01:00
19 changed files with 278 additions and 77 deletions

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ steps:
- mv VersionUploader.jar ../../
- cd ../../
# Execute Jar file
- java -jar VersionUploader.jar --modrinth
- java -jar VersionUploader.jar --all
uploadToCodeberg:
image: woodpeckerci/plugin-gitea-release
settings:
+8 -4
View File
@@ -1,6 +1,6 @@
# AdvancedServerList
AdvancedServerList is a plugin that allowys you to customize your server's MOTD, favicon, Player count text and player count hover displayed in a player's multiplayer server list based on conditions and priorities.
AdvancedServerList is a plugin that allows you to customize your server's MOTD, favicon, Player count text and player count hover displayed in a player's multiplayer server list based on conditions and priorities.
## Downloads
@@ -30,29 +30,33 @@ AdvancedServerList is a plugin that allowys you to customize your server's MOTD,
</a>
## What is a Server List Profile?
A Server List Profile refers to a YAML file located in the plugin's `profiles` directory.
It allows you to configure specific aspects of the server display in the MC-Client's multiplayer server list, such as the MOTD, player count text, player count hover or Favicon.
> [*Read More*][profiles]
### Conditions
Thanks to conditions can you determine when a profile should be displayed in the player’s server list, to allow displaying specific text (i.e. a warning when they are using an outdated version).
When multiple profiles exist that have valid conditions will the one with the highest priority (Higher number = higher priority) be selected. Having no conditions makes the profile automatically return true.
Thanks to conditions can you determine when a profile should be displayed in the player's server list, to allow displaying specific text (i.e. a warning when they are using an outdated version).
When multiple profiles exist that have valid conditions will the one with the highest priority (Higher number = higher priority) be selected. Having no conditions makes it automatically true.
> [*Read More*][conditions]
### Placeholders
Placeholders can be used within conditions to further customize them. They can also be used in any other text option to display their respective values.
The format is `${<target> <identifier>}` which was adopted from BungeeTabListPlus. Depending on what platform you use the plugin on are only specific placeholders available.
When using the SpigotMC/PaperMC version, or while PAPIProxyBridge is installed on your proxy, can you also use placeholders from [PlaceholderAPI][placeholderapi] using its `%<identifier>_<values>%` placeholder format. PlaceholderAPI needs to be installed for that.
When using the SpigotMC/PaperMC version, or while [PAPIProxyBridge][papiproxybridge] is installed on your proxy, can you also use placeholders from [PlaceholderAPI][placeholderapi] using its `%<identifier>_<values>%` placeholder format. PlaceholderAPI needs to be installed on the server (not proxy) for that.
If you're a plugin dev can you even add your own custom placeholders through AdvancedServerList's own API.
> [*Read More*][placeholders]
### Formatting
The plugin uses the MiniMessage format for a consistent, easy way of formatting your text.
Only certain options are usable for each option. As an example does motd support HEX colours and gradients, while the other options only support default colour codes.
+1 -1
View File
@@ -129,7 +129,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.1</version>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -94,9 +94,10 @@ public class ExpressionEngine{
.tokenReader(new PatternTokenReader(DefaultTokens.OR, "or"))
.tokenReader(new PatternTokenReader(DefaultTokens.OR, "||"))
.tokenReader(new PatternTokenReader(DefaultTokens.EQUAL, "=="))
.tokenReader(new PatternTokenReader(DefaultTokens.EQUAL_IGNORE_CASE, "=~"))
.tokenReader(new PatternTokenReader(DefaultTokens.EQUAL, "="))
.tokenReader(new PatternTokenReader(DefaultTokens.EQUAL_IGNORE_CASE, "~"))
.tokenReader(new PatternTokenReader(DefaultTokens.NOT_EQUAL, "!="))
.tokenReader(new PatternTokenReader(DefaultTokens.EQUAL_IGNORE_CASE, "~="))
.tokenReader(new PatternTokenReader(DefaultTokens.NOT_EQUAL_IGNORE_CASE, "!~"))
.tokenReader(new PatternTokenReader(DefaultTokens.STARTS_WITH, "|-"))
.tokenReader(new PatternTokenReader(DefaultTokens.ENDS_WITH, "-|"))
-4
View File
@@ -9,7 +9,6 @@
from __future__ import annotations
import posixpath
import re
from mkdocs.config.defaults import MkDocsConfig
@@ -39,9 +38,6 @@ def on_page_markdown(
elif type == "deprecated": return _admo(text = args, type = "deprecated")
else: return _admo(text = args)
# Otherwise, raise an error
raise RuntimeError(f"Unknown shortcode: {type}")
# Find and replace all external asset URLs in current page
return re.sub(
r"<!-- admo:(\w+)(.*?) -->",
+26
View File
@@ -0,0 +1,26 @@
#
# A simple hook that replaces any appearances of \| with just |.
#
# There is an inconsistency between GitHub flavourited Markdown and Python Markdown
# where the former treats | as part of a table, even if it is inside inline code
# causing unwanted table rendering.
#
# The only way to prevent this is to escape it by prefixing it with a back slash (\).
# Unfortunately does this cause issues on Python-Markdown, as it renders inline code
# content as-is without special treatments whatsoever, meaning that `\|` will be
# rendered as <code>\|</code> in the end.
#
# Using this hook, `\|` is being turned into `|` before further processing, resulting
# in <code>|</code> being rendered in the end, while preserving proper table rendering
# on GitHub and co.
#
import re
from mkdocs.config.defaults import MkDocsConfig
from mkdocs.structure.files import File, Files
from mkdocs.structure.pages import Page
def on_page_markdown(
markdown: str, *, page: Page, config: MkDocsConfig, files: Files
):
return re.sub(r"\\\|","|",markdown)
+1 -1
View File
@@ -40,7 +40,7 @@ document$.subscribe(async () => {
const versionToken = '{version}'
const entries = document.querySelectorAll('.md-content code');
for(const entry of entries) {
entry.innerHTML = entry.innerHTML.replace(new RegExp(versionToken, 'g'), version);
entry.innerHTML = entry.innerHTML.replace(new RegExp(versionToken, 'g'), version.substring(1));
}
}
+25 -4
View File
@@ -17,7 +17,9 @@ Feel free to suggest additional examples on my [Discord Server](https://discord.
- [Versions](#versions)
- [Different List for outdated Clients](#different-list-for-outdated-clients)
- [Different MOTD for < 1.16](#different-motd-for-116)
- [Spigot/PaperMC](#spigotpapermc)
- [BungeeCord/Velocity](#bungeecordvelocity)
- [Display MOTD for a set of subdomains](#display-motd-for-a-set-of-subdomains)
- [PaperMC](#papermc)
- [Different profile for banned Player](#different-profile-for-banned-player)
- [Other](#other)
- [Different profile for different host](#different-profile-for-different-host)
@@ -64,9 +66,28 @@ motd:
```
----
## Spigot/PaperMC
## BungeeCord/Velocity
Examples that can be used with the Spigot or PaperMC version.
Examples usable on the BungeeCord and Velocity version.
### Display MOTD for a set of subdomains
Displays the same MOTDs for the server when pinged on any sub-domain starting with `lobby` (i.e. `lobby-1.example.com`).
```yaml title="lobby-motd.yml"
priority: 1
condition: '${server host} |- "lobby"'
motd:
- '<green>Lobby Server'
- '<grey>Example Server'
```
----
## PaperMC
Examples that can be used with the PaperMC version.
### Different profile for banned Player
@@ -114,7 +135,7 @@ Display a different profile, if the player pinging the server is "known" by Adva
```yaml title="personalized.yml"
priority: 1
condition: '${player name} != Anonymous' # "Anonymous" would be the value from the "unknownPlayer > name" option.
condition: '${player name} != "Anonymous"' # "Anonymous" would be the value from the "unknownPlayer > name" option.
motd:
- '<grey>Hello there <aqua>${player name}</aqua>!'
+70 -19
View File
@@ -11,17 +11,36 @@ It tries to be an easy to understand as possible. But if you still have problems
The first step would be to download the plugin from a download page of your choice. As of writing this is AdvancedServerList updated and available on these sites:
- [Modrinth]
- [Codeberg]
<div class="grid cards" markdown>
- [:simple-modrinth: **Modrinth**][modrinth]
----
:octicons-check-24:{ style="color: var(--md-badge-fg--success);" } **Actively updated!**
- [:simple-codeberg: **Codeberg**][codeberg]
----
:octicons-check-24:{ style="color: var(--md-badge-fg--success);" } **Actively updated!**
- [:fontawesome-solid-paper-plane: **HangarMC**][hangar]
----
:octicons-alert-24:{ style="color: var(--md-badge-fg--warning);" } **On Pause!**
- [:simple-spigotmc: **SpigotMC**][spigot]
----
:octicons-alert-24:{ style="color: var(--md-badge-fg--warning);" } **Discontinued!**
</div>
[modrinth]: https://modrinth.com/plugin/advancedserverlist
[codeberg]: https://codeberg.org/Andre601/AdvancedServerList
The plugin is also available on these platforms, but not actively updated there anymore:
- [Spigot] (Latest version: `3.3.0-b1`)
- [Hangar] (Latest version: `3.5.0`)
[spigot]: https://www.spigotmc.org/resources/102910/
[hangar]: https://hangar.papermc.io/Andre_601/AdvancedServerList
@@ -29,10 +48,44 @@ The plugin is available for Paper, BungeeCord, Waterfall and Velocity, and has b
The plugin also supports these additional plugins. They are all optional.
- [PlaceholderAPI] - Used on the Spigot and Paper server for additional Placeholder parsing.
- [ViaVersion] - Used on the Paper server for additional protocol version handling.
- [PAPIProxyBridge] - Used on BungeeCord, Waterfall and Velocity for PlaceholderAPI support.
- [Maintenance] - Used to disable server list handling while maintenance is active.
<div class="grid cards" markdown>
- [**PlaceholderAPI**][placeholderapi]
----
Supported on:
- :fontawesome-solid-paper-plane: Paper
- [**ViaVersion**][viaversion]
----
Supported on:
- :fontawesome-solid-paper-plane: Paper
- [**PAPIProxyBridge**][papiproxybridge]
----
Supported on:
- :simple-spigotmc: BungeeCord
- :fontawesome-solid-paper-plane: Velocity
- [**Maintenance**][maintenance]
----
Supported on:
- :fontawesome-solid-paper-plane: Paper
- :simple-spigotmc: BungeeCord
- :fontawesome-solid-paper-plane: Velocity
</div>
[placeholderapi]: https://hangar.papermc.io/HelpChat/PlaceholderAPI
[viaversion]: https://hangar.papermc.io/ViaVersion/ViaVersion
@@ -85,13 +138,12 @@ On first creation will the folder have a `default.yml` file. This file contains
priority: 0
#
# Set conditions that needs to be met.
# Only when all conditions return true will the profile be shown (Given no profile with higher priority is used).
# Set conditions that need to me met to show this profile.
# You can use keywords 'and' or 'or' (Or alternatively '&&' or `||`) to make more complex condition sets.
#
# Read more: https://asl.andre601.ch/profiles/#conditions
# Read more: https://asl.andre601.ch/profiles/#condition
#
#conditions:
# - '{playerVersion} < 759'
# condition: '${player protocol} < 759'
#
# Option that allows you to define multiple profiles to use.
@@ -359,8 +411,7 @@ Here is another example profile using conditions:
```yaml title="other_profile.yml"
priority: 1
conditions:
- '${player isBanned} = true'
condition: '${player isBanned}'
motd:
- '<red>You got <bold>banned</bold> from this server.'
+7
View File
@@ -0,0 +1,7 @@
nav:
- index.md
- v3_8_0-to-v3_9_0.md
- v3_7_0-to-v3_8_0.md
- pre-v3_7_0-to-v3_7_0.md
- v1_9_0-to-v1_10_0.md
- v1_5_3-to-v1_6_0.md
+27 -1
View File
@@ -10,4 +10,30 @@ Note that these pages only cover server list profile files. The config.yml is au
## Pages
{nav}
<div class="grid cards" markdown>
- [**v3.7.0 to v3.8.0**](v3_7_0-to-v3_8_0.md)
----
Migrating from version 3.7.0 to 3.8.0.
- [**< v3.7.0 to v3.7.0**](pre-v3_7_0-to-v3_7_0.md)
----
Migrate from any version prior to 3.7.0 to 3.7.0 or newer.
- [**v1.9.0 to v1.10.0**](v1_9_0-to-v1_10_0.md)
----
Migrate from version 1.9.0 to 1.10.0.
- [**v1.5.3 to v1.6.0**](v1_5_3-to-v1_6_0.md)
----
Migrate from version 1.5.3 to 1.6.0.
</div>
-1
View File
@@ -29,7 +29,6 @@ motd:
```yaml
priority: 0
# The text can all be in one line. This is only for better readability.
condition: '${server host} <_ "survival"'
motd:
+49
View File
@@ -0,0 +1,49 @@
---
icon: octicons/arrow-right-24
---
# v3.8.0 to v3.9.0
v3.9.0 brings a small change to the `~=` operand by changing it to `=~` for sake of consistent pattern design. Additionally, was `~` added as a single-character equivalent to `=`.
## Migration
To migrate, switch any appearances of `~=` with `=~` or `~`.
## Example
Here is a before and after example to help visualize the change:
/// tab | Before
```yaml
priority: 0
conditions: '${player name} ~= "Someone"'
motd:
- 'Welcome ${player name}!'
```
///
/// tab | After
```yaml
priority: 0
condition: '${player name} =~ "Someone"'
motd:
- 'Welcome ${player name}!'
```
///
/// tab | Diff View
```diff
priority: 0
-condition: '${player name} ~= "Someone"'
+condition: '${player name} =~ "Someone"'
motd:
- 'Welcome ${player name}!'
```
///
+31 -18
View File
@@ -32,12 +32,14 @@ The following cases are considered literal values:
Any number is considered an expression, meaning the below examples are considered valid:
/// example | Examples
```
0
1000
-7
47.2
```
///
#### Strings
@@ -50,10 +52,12 @@ As an example, `Sand` would cause the expression engine to see `S AND` due to pa
To avoid this is it very important to always surround Strings with single or double quotes, as that tells the expression engine to treat as a String.
///
/// example | Examples
```
"Hello World!"
""
```
///
#### Booleans
@@ -63,6 +67,7 @@ Strings `true` and `false` are treated as boolean literals.
Any [placeholder](placeholders.md) is a valid expression.
/// example | Examples
```
${player protocol}
${player name}
@@ -70,6 +75,7 @@ ${player name}
${server playersOnline}
${server host}
```
///
### Binary Operators
@@ -77,23 +83,23 @@ ${server host}
The following binary operators can be used for boolean evaluation:
| Operator | True if |
|----------------------------------|-------------------------------------------------------------------------------------------------------------|
| `and` / `&&` | Both expressions return true. |
| `or` / <code>&#124;&#124;</code> | Either expression returns true. |
| `==` / `=` | Both expressions are equal (Case sensitive). |
| `~=` | Both expressions are equal (Not Case sensitive). |
| `!=` | Both expressions are not equal (Case sensitive). |
| `!~` | Both expressions are not equal (Not case sensitive). |
| <code>&#124;-</code> | Left expression starts with right expression. |
| <code>-&#124;</code> | Left expression ends with right expression. |
| `<-` | Left expression contains right expression. |
| `<` | Left expression is less than the right expression. Strings use their text length as number. |
| `<=` | Left expression is less than, or equal to, the right expression. Strings use their text length as number. |
| `>` | Left expression is larger than the right expression. Strings use their text length as number. |
| `>=` | Left expression is larger than, or equal to, the right expression. Strings use their text length as number. |
| Operator | True if |
|---------------|-------------------------------------------------------------------------------------------------------------|
| `and` / `&&` | Both expressions return true. |
| `or` / `\|\|` | Either expression returns true. |
| `==` / `=` | Both expressions are equal (Case sensitive). |
| `=~` / `~` | Both expressions are equal (Not Case sensitive). |
| `!=` | Both expressions are not equal (Case sensitive). |
| `!~` | Both expressions are not equal (Not case sensitive). |
| `\|-` | Left expression starts with right expression. |
| `-\|` | Left expression ends with right expression. |
| `<_` | Left expression contains right expression. |
| `<` | Left expression is less than the right expression. Strings use their text length as number. |
| `<=` | Left expression is less than, or equal to, the right expression. Strings use their text length as number. |
| `>` | Left expression is larger than the right expression. Strings use their text length as number. |
| `>=` | Left expression is larger than, or equal to, the right expression. Strings use their text length as number. |
Additionally can these additional binary operators used for specific actions:
These additional binary operators can also be used to perform certain actions:
| Operator | Semantic |
|----------|-----------------------------------------------------------------------------|
@@ -103,10 +109,17 @@ Additionally can these additional binary operators used for specific actions:
| `*` | Multiplies two numbers. Strings use their text length as number. |
| `/` | Divides one number by another. Strings use their text length as number. |
/// example | Examples
```
${player name} != "Anonymous"
763 > ${player protocol} > 758
${player hasPlayedBefore} and ${player isBanned} == "false"
```
///
### Parenthesis
`( <expression> )` is a valid expression.
Parenthesis can be used to prevent ambiguities.
### Negation
@@ -120,4 +133,4 @@ Parenthesis can be used to prevent ambiguities.
## Credits
This page, including examples used, was adobted from the BungeeTabListPlus wiki.
The original wiki page can be found here: https://github.com/CodeCrafter47/BungeeTabListPlus/wiki/Expressions
The original wiki page can be found here: https://github.com/CodeCrafter47/BungeeTabListPlus/wiki/Expressions{ target="_blank" rel="nofollow" }
+1
View File
@@ -106,3 +106,4 @@ markdown_extensions:
hooks:
- docs/.hooks/badges.py
- docs/.hooks/replacer.py
+1 -1
View File
@@ -38,7 +38,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.commit/>
<plugin.version>3.8.0</plugin.version>
<plugin.version>3.9.0</plugin.version>
<plugin.description>Create multiple Server lists based on conditions.</plugin.description>
<api.version>v3.1.0</api.version>
+1 -1
View File
@@ -1,4 +1,4 @@
mkdocs-material==9.5.7
mkdocs-material==9.5.9
mkdocs-glightbox==0.3.7
mkdocs-awesome-pages-plugin==2.9.2
git+https://github.com/Andre601/mkdocs-pagenav-generator
@@ -123,7 +123,7 @@ public class HangarVersionUploader{
Platform.VELOCITY, velocityDependencies
),
Map.of(
Platform.PAPER, List.of("1.19.x", "1.20.x"),
Platform.PAPER, List.of("1.19.4", "1.20.x"),
Platform.WATERFALL, List.of("1.19.x", "1.20.x"),
Platform.VELOCITY, Collections.singletonList("3.2")
),
@@ -38,8 +38,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
public class ModrinthVersionUploader{
@@ -52,8 +52,7 @@ public class ModrinthVersionUploader{
PlatformInfo.VELOCITY
);
private final List<String> versions = List.of(
"1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4",
"1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4"
"1.19.4", "1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4"
);
private final ModrinthAPI api;
@@ -82,22 +81,26 @@ public class ModrinthVersionUploader{
final boolean prerelease = release.prerelease();
CompletableFuture<?>[] futures = new CompletableFuture[platforms.size()];
List<ProjectVersion.ProjectDependency> paperDependencies = List.of(
new ProjectVersion.ProjectDependency(null, "VCAqN1ln", null, ProjectVersion.ProjectDependencyType.OPTIONAL), // Maintenance
new ProjectVersion.ProjectDependency(null, "P1OZGk5p", null, ProjectVersion.ProjectDependencyType.OPTIONAL) // ViaVersion
);
List<ProjectVersion.ProjectDependency> bungeeDependencies = List.of(
new ProjectVersion.ProjectDependency(null, "VCAqN1ln", null, ProjectVersion.ProjectDependencyType.OPTIONAL), // Maintenance
new ProjectVersion.ProjectDependency(null, "bEIUEGTX", null, ProjectVersion.ProjectDependencyType.OPTIONAL) // PAPIProxyBridge
);
List<ProjectVersion.ProjectDependency> velocityDependencies = List.of(
new ProjectVersion.ProjectDependency(null, "VCAqN1ln", null, ProjectVersion.ProjectDependencyType.OPTIONAL), // Maintenance
new ProjectVersion.ProjectDependency(null, "bEIUEGTX", null, ProjectVersion.ProjectDependencyType.OPTIONAL) // PAPIProxyBridge
);
for(int i = 0; i < platforms.size(); i++){
LOGGER.info("Creating release for platform {}...", platforms.get(i).getPlatform());
File file = new File(platforms.get(i).getFilePath().replace("{{version}}", pluginVersion));
List<ProjectVersion.ProjectDependency> dependencies = new ArrayList<>();
// Maintenance plugin
dependencies.add(new ProjectVersion.ProjectDependency(null, "VCAqN1ln", null, ProjectVersion.ProjectDependencyType.OPTIONAL));
// ViaVersion plugin
dependencies.add(new ProjectVersion.ProjectDependency(null, "P1OZGk5p", null, ProjectVersion.ProjectDependencyType.OPTIONAL));
if(!platforms.get(i).getPlatform().equalsIgnoreCase("paper")){
// PAPIProxyBridge plugin
dependencies.add(new ProjectVersion.ProjectDependency(null, "bEIUEGTX", null, ProjectVersion.ProjectDependencyType.OPTIONAL));
}
CreateVersion.CreateVersionRequest request = CreateVersion.CreateVersionRequest.builder()
CreateVersion.CreateVersionRequest.CreateVersionRequestBuilder builder = CreateVersion.CreateVersionRequest.builder()
.projectId("xss83sOY")
.name(String.format("v%s (%s)", releaseVersion, String.join(", ", platforms.get(i).getLoaders())))
.versionNumber(releaseVersion)
@@ -106,13 +109,17 @@ public class ModrinthVersionUploader{
.files(file)
.gameVersions(versions)
.loaders(platforms.get(i).getLoaders())
.versionType(prerelease ? ProjectVersion.VersionType.BETA : ProjectVersion.VersionType.RELEASE)
.dependencies(dependencies)
.build();
.versionType(prerelease ? ProjectVersion.VersionType.BETA : ProjectVersion.VersionType.RELEASE);
switch(platforms.get(i).getPlatform().toLowerCase(Locale.ROOT)){
case "paper" -> builder.dependencies(paperDependencies);
case "bungeecord" -> builder.dependencies(bungeeDependencies);
case "velocity" -> builder.dependencies(velocityDependencies);
}
if(dryrun){
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(request);
String json = gson.toJson(builder.build());
LOGGER.info("JSON Data to send: {}", json);
@@ -120,7 +127,7 @@ public class ModrinthVersionUploader{
continue;
}
futures[i] = api.versions().createProjectVersion(request).whenComplete(((projectVersion, throwable) -> {
futures[i] = api.versions().createProjectVersion(builder.build()).whenComplete(((projectVersion, throwable) -> {
if(throwable != null){
LOGGER.warn("Encountered an exception while uploading a new release to Modrinth!", throwable);
return;