mirror of
https://codeberg.org/Andre601/AdvancedServerList.git
synced 2026-11-05 17:02:34 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0892f5cd1d | ||
|
|
452a7e6dcf | ||
|
|
162dd10a73 | ||
|
|
35120c5364 | ||
|
|
6c828171d2 | ||
|
|
dcc51f8458 | ||
|
|
1287ca62fe |
No files matched your search
+2
@@ -85,6 +85,8 @@ public class BungeeServerPlaceholders extends PlaceholderProvider{
|
||||
|
||||
if(args.length == 2){
|
||||
ServerInfo info = proxy.getServers().get(args[1]);
|
||||
if(info == null)
|
||||
yield null;
|
||||
|
||||
yield String.valueOf(((InetSocketAddress)info.getSocketAddress()).getHostString());
|
||||
}
|
||||
|
||||
+6
@@ -98,6 +98,9 @@ public class ExpressionEngine{
|
||||
.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, "-|"))
|
||||
.tokenReader(new PatternTokenReader(DefaultTokens.CONTAINS, "<_"))
|
||||
.tokenReader(new PatternTokenReader(DefaultTokens.GREATER_OR_EQUAL_THAN, ">="))
|
||||
.tokenReader(new PatternTokenReader(DefaultTokens.LESSER_OR_EQUAL_THAN, "<="))
|
||||
.tokenReader(new PatternTokenReader(DefaultTokens.OPENING_PARENTHESIS, "("))
|
||||
@@ -125,6 +128,9 @@ public class ExpressionEngine{
|
||||
.operator(DefaultTokens.NOT_EQUAL, Operator.of(25, ExpressionTemplates::notEqual))
|
||||
.operator(DefaultTokens.EQUAL_IGNORE_CASE, Operator.of(25, ExpressionTemplates::equalIgnoreCase))
|
||||
.operator(DefaultTokens.NOT_EQUAL_IGNORE_CASE, Operator.of(25, ExpressionTemplates::notEqualIgnoreCase))
|
||||
.operator(DefaultTokens.STARTS_WITH, Operator.of(25, ExpressionTemplates::startsWith))
|
||||
.operator(DefaultTokens.ENDS_WITH, Operator.of(25, ExpressionTemplates::endsWith))
|
||||
.operator(DefaultTokens.CONTAINS, Operator.of(25, ExpressionTemplates::contains))
|
||||
.operator(DefaultTokens.GREATER_THAN, Operator.of(25, ExpressionTemplates::greater))
|
||||
.operator(DefaultTokens.GREATER_OR_EQUAL_THAN, Operator.of(25, ExpressionTemplates::greaterOrEqual))
|
||||
.operator(DefaultTokens.LESSER_THAN, Operator.of(25, ExpressionTemplates::less))
|
||||
|
||||
+44
-17
@@ -32,7 +32,7 @@ import java.util.Collection;
|
||||
public class Expressions{
|
||||
|
||||
public static ToBooleanExpression negate(ToBooleanExpression expression){
|
||||
return new AbstractUnaryToBooleanExpression<>(expression) {
|
||||
return new AbstractUnaryToBooleanExpression<>(expression){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return !delegate.evaluate();
|
||||
@@ -41,7 +41,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToBooleanExpression and(Collection<ToBooleanExpression> operands){
|
||||
return new AbstractToBooleanExpression<>(operands) {
|
||||
return new AbstractToBooleanExpression<>(operands){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
for(ToBooleanExpression operand : operands){
|
||||
@@ -55,7 +55,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToBooleanExpression or(Collection<ToBooleanExpression> operands){
|
||||
return new AbstractToBooleanExpression<>(operands) {
|
||||
return new AbstractToBooleanExpression<>(operands){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
for(ToBooleanExpression operand : operands){
|
||||
@@ -69,7 +69,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToStringExpression concat(Collection<ToStringExpression> operands){
|
||||
return new AbstractToStringExpression<>(operands) {
|
||||
return new AbstractToStringExpression<>(operands){
|
||||
@Override
|
||||
public String evaluate(){
|
||||
StringBuilder result = new StringBuilder();
|
||||
@@ -83,7 +83,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToBooleanExpression equal(ToStringExpression a, ToStringExpression b){
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b) {
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return a.evaluate().equals(b.evaluate());
|
||||
@@ -92,7 +92,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToBooleanExpression notEqual(ToStringExpression a, ToStringExpression b){
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b) {
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return !a.evaluate().equals(b.evaluate());
|
||||
@@ -101,7 +101,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToBooleanExpression equalIgnoreCase(ToStringExpression a, ToStringExpression b){
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b) {
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return a.evaluate().equalsIgnoreCase(b.evaluate());
|
||||
@@ -110,7 +110,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToBooleanExpression notEqualIgnoreCase(ToStringExpression a, ToStringExpression b){
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b) {
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return !a.evaluate().equalsIgnoreCase(b.evaluate());
|
||||
@@ -118,8 +118,35 @@ public class Expressions{
|
||||
};
|
||||
}
|
||||
|
||||
public static ToBooleanExpression startsWith(ToStringExpression a, ToStringExpression b){
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return a.evaluate().startsWith(b.evaluate());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static ToBooleanExpression endsWith(ToStringExpression a, ToStringExpression b){
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return a.evaluate().endsWith(b.evaluate());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static ToBooleanExpression contains(ToStringExpression a, ToStringExpression b){
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return a.evaluate().contains(b.evaluate());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static ToBooleanExpression greaterThan(ToDoubleExpression a, ToDoubleExpression b){
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b) {
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return a.evaluate() > b.evaluate();
|
||||
@@ -128,7 +155,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToBooleanExpression greaterOrEqualThan(ToDoubleExpression a, ToDoubleExpression b){
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b) {
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return a.evaluate() >= b.evaluate();
|
||||
@@ -137,7 +164,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToBooleanExpression lessThan(ToDoubleExpression a, ToDoubleExpression b){
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b) {
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return a.evaluate() < b.evaluate();
|
||||
@@ -146,7 +173,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToBooleanExpression lessOrEqualThan(ToDoubleExpression a, ToDoubleExpression b){
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b) {
|
||||
return new AbstractBinaryToBooleanExpression<>(a, b){
|
||||
@Override
|
||||
public boolean evaluate(){
|
||||
return a.evaluate() <= b.evaluate();
|
||||
@@ -155,7 +182,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToDoubleExpression sum(Collection<ToDoubleExpression> operands){
|
||||
return new AbstractToDoubleExpression<>(operands) {
|
||||
return new AbstractToDoubleExpression<>(operands){
|
||||
@Override
|
||||
public double evaluate(){
|
||||
double result = 0;
|
||||
@@ -169,7 +196,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToDoubleExpression product(Collection<ToDoubleExpression> operands){
|
||||
return new AbstractToDoubleExpression<>(operands) {
|
||||
return new AbstractToDoubleExpression<>(operands){
|
||||
@Override
|
||||
public double evaluate(){
|
||||
double result = 1;
|
||||
@@ -183,7 +210,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToDoubleExpression sub(ToDoubleExpression a, ToDoubleExpression b){
|
||||
return new AbstractBinaryToDoubleExpression<>(a, b) {
|
||||
return new AbstractBinaryToDoubleExpression<>(a, b){
|
||||
@Override
|
||||
public double evaluate(){
|
||||
return a.evaluate() - b.evaluate();
|
||||
@@ -192,7 +219,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToDoubleExpression div(ToDoubleExpression a, ToDoubleExpression b){
|
||||
return new AbstractBinaryToDoubleExpression<>(a, b) {
|
||||
return new AbstractBinaryToDoubleExpression<>(a, b){
|
||||
@Override
|
||||
public double evaluate(){
|
||||
return a.evaluate() / b.evaluate();
|
||||
@@ -201,7 +228,7 @@ public class Expressions{
|
||||
}
|
||||
|
||||
public static ToDoubleExpression negateNumber(ToDoubleExpression a){
|
||||
return new AbstractUnaryToDoubleExpression<>(a) {
|
||||
return new AbstractUnaryToDoubleExpression<>(a){
|
||||
@Override
|
||||
public double evaluate(){
|
||||
return -delegate.evaluate();
|
||||
|
||||
+60
@@ -66,6 +66,18 @@ public class ExpressionTemplates{
|
||||
return new NotEqualIgnoreCase(a, b);
|
||||
}
|
||||
|
||||
public static ExpressionTemplate startsWith(ExpressionTemplate a, ExpressionTemplate b){
|
||||
return new StartsWith(a, b);
|
||||
}
|
||||
|
||||
public static ExpressionTemplate endsWith(ExpressionTemplate a, ExpressionTemplate b){
|
||||
return new EndsWith(a, b);
|
||||
}
|
||||
|
||||
public static ExpressionTemplate contains(ExpressionTemplate a, ExpressionTemplate b){
|
||||
return new Contains(a, b);
|
||||
}
|
||||
|
||||
public static ExpressionTemplate greater(ExpressionTemplate a, ExpressionTemplate b){
|
||||
return new Greater(a, b);
|
||||
}
|
||||
@@ -222,6 +234,54 @@ public class ExpressionTemplates{
|
||||
}
|
||||
}
|
||||
|
||||
private static class StartsWith extends AbstractBooleanExpressionTemplate{
|
||||
|
||||
private final ExpressionTemplate a;
|
||||
private final ExpressionTemplate b;
|
||||
|
||||
private StartsWith(ExpressionTemplate a, ExpressionTemplate b){
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToBooleanExpression instantiateWithBooleanResult(){
|
||||
return Expressions.startsWith(a.instantiateWithStringResult(), b.instantiateWithStringResult());
|
||||
}
|
||||
}
|
||||
|
||||
private static class EndsWith extends AbstractBooleanExpressionTemplate{
|
||||
|
||||
private final ExpressionTemplate a;
|
||||
private final ExpressionTemplate b;
|
||||
|
||||
private EndsWith(ExpressionTemplate a, ExpressionTemplate b){
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToBooleanExpression instantiateWithBooleanResult(){
|
||||
return Expressions.endsWith(a.instantiateWithStringResult(), b.instantiateWithStringResult());
|
||||
}
|
||||
}
|
||||
|
||||
private static class Contains extends AbstractBooleanExpressionTemplate{
|
||||
|
||||
private final ExpressionTemplate a;
|
||||
private final ExpressionTemplate b;
|
||||
|
||||
private Contains(ExpressionTemplate a, ExpressionTemplate b){
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToBooleanExpression instantiateWithBooleanResult(){
|
||||
return Expressions.contains(a.instantiateWithStringResult(), b.instantiateWithStringResult());
|
||||
}
|
||||
}
|
||||
|
||||
private static class Greater extends AbstractBooleanExpressionTemplate{
|
||||
|
||||
private final ExpressionTemplate a;
|
||||
|
||||
+3
@@ -34,6 +34,9 @@ public class DefaultTokens{
|
||||
public static final Token NOT_EQUAL = new Token("NOT_EQUAL");
|
||||
public static final Token EQUAL_IGNORE_CASE = new Token("EQUAL_IGNORE_CASE");
|
||||
public static final Token NOT_EQUAL_IGNORE_CASE = new Token("NOT_EQUAL_IGNORE_CASE");
|
||||
public static final Token STARTS_WITH = new Token("STARTS_WITH");
|
||||
public static final Token ENDS_WITH = new Token("ENDS_WITH");
|
||||
public static final Token CONTAINS = new Token("CONTAINS");
|
||||
public static final Token NEGATION = new Token("NEGATION");
|
||||
public static final Token GREATER_THAN = new Token("GREATER_THAN");
|
||||
public static final Token GREATER_OR_EQUAL_THAN = new Token("GREATER_OR_EQUAL_THAN");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
icon: octicons/arrow-right-24
|
||||
---
|
||||
|
||||
# < 3.7.0 to 3.7.0
|
||||
# < v3.7.0 to v3.7.0
|
||||
|
||||
Version 3.7.0 of AdvancedServerList brought significant changes to its conditions system.
|
||||
Namely, the `conditions` option is now deprecated and planned for removal in a future release of the Plugin, and the new [`condition`](../profiles/index.md#condition) option should now be used instead.
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
icon: octicons/arrow-right-24
|
||||
---
|
||||
|
||||
# v3.7.0 to v3.8.0
|
||||
|
||||
v3.8.0 brought a small yet important change to the condition system, which is the change of the "contains" operand from `<-` to `<_` to avoid possible issues with numbers.
|
||||
|
||||
## Migration
|
||||
|
||||
To migrate, switch any appearances of `<-` with `<_`
|
||||
|
||||
## Example
|
||||
|
||||
Here is a before and after example to help visualize the change:
|
||||
|
||||
/// tab | Before
|
||||
```yaml
|
||||
priority: 0
|
||||
|
||||
conditions: '${server host} <- "survival"'
|
||||
|
||||
motd:
|
||||
- 'Welcome ${player name}!'
|
||||
```
|
||||
///
|
||||
|
||||
/// tab | After
|
||||
```yaml
|
||||
priority: 0
|
||||
|
||||
# The text can all be in one line. This is only for better readability.
|
||||
condition: '${server host} <_ "survival"'
|
||||
|
||||
motd:
|
||||
- 'Welcome ${player name}!'
|
||||
```
|
||||
///
|
||||
|
||||
/// tab | Diff View
|
||||
```diff
|
||||
priority: 0
|
||||
|
||||
-condition: '${server host} <- "survival"'
|
||||
+condition: '${server host} <_ "survival"'
|
||||
|
||||
motd:
|
||||
- 'Welcome ${player name}!'
|
||||
```
|
||||
///
|
||||
@@ -77,18 +77,21 @@ ${server host}
|
||||
|
||||
The following binary operators can be used for boolean evaluation:
|
||||
|
||||
| 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 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` / <code>||</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>|-</code> | Left expression starts with right expression. |
|
||||
| <code>-|</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. |
|
||||
|
||||
Additionally can these additional binary operators used for specific actions:
|
||||
|
||||
|
||||
+109
-115
@@ -2,92 +2,77 @@
|
||||
icon: octicons/note-24
|
||||
---
|
||||
|
||||
# Profiles { #profiles-settings }
|
||||
# Profiles { #profiles-file }
|
||||
|
||||
AdvancedServerList allows the creation of multiple profiles.
|
||||
A profile is a single YAML file located in the plugin's `profiles` directory containing multiple settings including [Conditions](#conditions) and [Priority](#priority).
|
||||
AdvancedServerList allows you to create multiple so called Server List Profiles.
|
||||
A Server List Profile is a YAML file located in the plugin's `profiles` folder. Each Server List Profile allows you to modify one or multiple aspects of your server's display in a Multiplayer Server list.
|
||||
|
||||
/// info | Important
|
||||
In order for a profile to be considered "valid" by AdvancedServerList will it need to meet the following conditions:
|
||||
Additionally can [Conditions](#condition) and a [Priority](#priority) be set to set when a specific profile should be displayed to a player.
|
||||
|
||||
- Have a [`Priority`](#priority) set to a valid, whole number (i.e. `1`)
|
||||
- Have **at least one** of the following options set:
|
||||
- [`Profiles`](#profiles) with at least one entry containing one of the below option
|
||||
- [`Motd`](#motd) set with at least one line of text
|
||||
- [`Favicon`](#favicon) set with a non-empty String
|
||||
- [`HidePlayers`](#hideplayers) set to `true`
|
||||
- [`Hover`](#hover) set with at least one line of text
|
||||
- [`Text`](#text) set with a non-empty String
|
||||
///
|
||||
## Required Options
|
||||
|
||||
For a Server List Profile to be valid, will it require the following options to be set:
|
||||
|
||||
- A valid [`priority`](#priority) option with a single, whole number.
|
||||
- **At least** one of the following options:
|
||||
- [`profiles`](#profiles) with at least one of the below options set.
|
||||
- [`motd`](#motd) with at least one line to display.
|
||||
- [`favicon`](#favicon) with a non-empty String.
|
||||
- [`playerCount -> hidePlayers`](#hideplayers) with value `true`.
|
||||
- [`playerCount -> hover`](#hover) with at least one line to display.
|
||||
- [`playerCount -> text`](#text) with a non-empty String.
|
||||
|
||||
## Priority
|
||||
|
||||
The priority option determines the order in which the profiles are checked by AdvancedServerList, starting with the highest number.
|
||||
The Priority option allows you to define what Server List Profile should be chosen first.
|
||||
The plugin will go highest value to lowest value and will select the first Profile that has a [`condition`](#condition) returning `true`.
|
||||
|
||||
It will go through each file until it finds one with [`condition`](#condition) returning true (Default if no conditions are set).
|
||||
This means that a profile with no conditions and a priority of `1` will be used before a profile with a condition and priority `0` even if the player is meeting the condition.
|
||||
Should AdvancedServerList not find any profile with a positive condition will it not modify the server list for the players.
|
||||
|
||||
/// note
|
||||
It is important to note that should no [`condition`](#condition) option be set will it default to `true`, meaning that a profile with priority 1 and no condition will be chosen over a profile with priority 0 and a condition, even if said condition also returns true.
|
||||
///
|
||||
|
||||
## Condition
|
||||
|
||||
<!-- admo:tip Surround any text that is not an operand or placeholder in single or double quotes to avoid parsing errors. -->
|
||||
The `condition` option allows you to define specific requirements that need to be met to display the profile in question.
|
||||
Not setting this option, or setting it to an empty String (`condition: ''`), will result in `true` being returned.
|
||||
|
||||
String containing one or multiple expressions to evaluate.
|
||||
A description about possible expressions, including available operands, is available on the [Expressions page](expressions.md).
|
||||
The condition option can hold one or multiple expressions. The Expression system is explained on the [Expressions page](expressions.md).
|
||||
|
||||
/// details | Example
|
||||
type: example
|
||||
## Conditions :octicons-trash-24:{ style="color: #FF5252;" title="Deprecated" }
|
||||
|
||||
```yaml title="YAML file"
|
||||
priority: 0
|
||||
<!-- admo:deprecated Deprecated in favour of the new condition option. Will be removed in a future version. -->
|
||||
|
||||
# Checks if the player is using 1.20 or newer AND is whitelisted
|
||||
condition: |
|
||||
${player protocol} >= 763 and
|
||||
${player isWhitelisted}
|
||||
The `conditions` option - not to be confused with the new [`condition`](#condition) option - allows you to define one or multiple conditions/expressions that all need to return `true` in order for the profile to be used.
|
||||
Not setting this option, or setting it to an empty list (`conditions: []`), will result in `true` being returned.
|
||||
|
||||
motd:
|
||||
- 'Welcome ${player name}!'
|
||||
```
|
||||
///
|
||||
Each condition can use [placeholders](placeholders.md) to further customize it. PlaceholderAPI placeholders are **not** supported!
|
||||
|
||||
## Conditions :octicons-trash-24:{ title="Deprecated" style="color: #ff5252;" }
|
||||
### Operands
|
||||
|
||||
<!-- admo:deprecated This option was deprecated in favour of the new condition option! -->
|
||||
<!-- admo:warning Each condition can only hold one operand -->
|
||||
|
||||
A list of conditions can be set that need to be met in order to have this profile shown to the player.
|
||||
[Placeholders](formatting.md#placeholders) can be used to further customize the conditions (PlaceholderAPI placeholders are **not** supported).
|
||||
Each condition can use operands to compare values with each other.
|
||||
Note that if Operands are used that compare sizes (i.e. `>`) while the values are Text and not numbers will the text length be used as number.
|
||||
|
||||
Only when **all** conditions defined return true will the profile be displayed.
|
||||
|
||||
You can remove this option, or set it to an empty list (`conditions: []`) to always return true.
|
||||
|
||||
### Operands { #conditions-operands }
|
||||
|
||||
The following operants are available and can be used in the conditions.
|
||||
|
||||
<!-- admo:warning For conditions option can you only use one operand per condition. -->
|
||||
|
||||
| Operand | Description |
|
||||
|---------------|-------------------------------------------------------------------------|
|
||||
| `<` | Checks if the left value is less than the right one.[^1] |
|
||||
| `<=` | Checks if the left value is less than or equal to the right one.[^1] |
|
||||
| `>` | Checks if the left value is more than the right one.[^1] |
|
||||
| `>=` | Checks if the left value is more than or equal to the right one.[^1] |
|
||||
| `=` | Checks if the left value is equal to the right one. |
|
||||
| `!=` | Checks if the left value is not equal to the right one. |
|
||||
| `~=` | Checks if the left value is equal to the right one, ignoring case. |
|
||||
| `!~` | Checks if the left value is not equal to the right one, ignoring case. |
|
||||
|
||||
[^1]:
|
||||
Should the provided value not be a number, will AdvancedServerList use the text length to compare.
|
||||
Example: `SomeString > String` would be translated to `10 > 6`.
|
||||
| Operand | What it does |
|
||||
|---------|----------------------------------------------------------------------------|
|
||||
| `<` | Returns true if the left value is less than the right value. |
|
||||
| `<=` | Returns true if the left value is less than, or equal to, the right value. |
|
||||
| `>` | Returns true if the left value is more than the right value. |
|
||||
| `>=` | Returns true if the left value is less than, or equal to, the right value. |
|
||||
| `=` | Returns true if both values are equal (Case sensitive). |
|
||||
| `!=` | Returns true if both values are not equal (Case sensitive). |
|
||||
| `~=` | Returns true if both values are equal (Not case sensitive). |
|
||||
| `!~` | Returns true if both values are not equal (Not case sensitive). |
|
||||
|
||||
## Profiles
|
||||
|
||||
<!-- admo:warning Priority and Conditions can NOT be used within profiles -->
|
||||
The `profile` option allows you to define a list of all other options, with the exception of [`priority`](#priority), [`condition`](#condition) or itself.
|
||||
|
||||
The `profiles` option allows you to set multiple MOTDs, player counts, etc. which the plugin would randomly choose from.
|
||||
If an option such as motd is not present in an entry will it check the file for the option and use that if present.
|
||||
When multiple entries are defined will AdvancedServerList randomly select one.
|
||||
Should an option exist in the file itself (i.e. [`motd`](#motd)) but not in the selected profiles entry will it be used. This allows you to randomize only one aspect of a Server List Profile while keeping all other options the same.
|
||||
|
||||
/// details | Example
|
||||
type: example
|
||||
@@ -96,7 +81,7 @@ If an option such as motd is not present in an entry will it check the file for
|
||||
priority: 0
|
||||
|
||||
profiles:
|
||||
- motd:
|
||||
- motd: # You can also use ['<rainbow>Line1</rainbow>','<rainbow:!>Line 2</rainbow>']
|
||||
- '<rainbow>Line 1</rainbow>'
|
||||
- '<rainbow:!>Line 2</rainbow>'
|
||||
playerCount:
|
||||
@@ -104,6 +89,7 @@ profiles:
|
||||
- playerCount:
|
||||
text: '<yellow><bold>Also Awesome!'
|
||||
|
||||
# This MOTD is used when the second profiles entry is selected.
|
||||
motd:
|
||||
- '<rainbow:2>Line A</rainbow>'
|
||||
- '<rainbow:!2>Line B</rainbow>'
|
||||
@@ -118,10 +104,10 @@ motd:
|
||||
|
||||
## Motd
|
||||
|
||||
The motd option allows to set up to two lines to be displayed in an MOTD.
|
||||
Normal colour and formatting codes such as `<aqua>` or `<bold>` are supported. On 1.16 and newer can you also use HEX colours using either `<#rrggbb>` or `<color:#rrggbb>`.
|
||||
The `motd` option allows you to alter the "Message of the day" that is being displayed on a server in the multiplayer screen.
|
||||
Please see the [Formatting](formatting.md) for all supported formatting options.
|
||||
|
||||
If you want to display multiple MOTDs will you need to use the [`Profiles` option](#profiles)
|
||||
Multiple, randomly selected, MOTDs can be displayed by using the [`profiles`](#profiles) option.
|
||||
|
||||
/// details | Example
|
||||
type: example
|
||||
@@ -130,7 +116,7 @@ If you want to display multiple MOTDs will you need to use the [`Profiles` optio
|
||||
priority: 0
|
||||
|
||||
motd:
|
||||
- '<rainbow:2>Rainbow Gradients</rainbow>'
|
||||
- '<rainbow:2>Rainbow Gradient</rainbow>'
|
||||
- '<rainbow:!2>|||||||||||||||||||||||||||||||||||||</rainbow>'
|
||||
```
|
||||
<div class="result" markdown>
|
||||
@@ -142,53 +128,60 @@ motd:
|
||||
|
||||
## Favicon
|
||||
|
||||
The favicon option allows you to customize the favicon and display one or multiple different images.
|
||||
<!-- admo:info Images will be resized to 64x64 pixels. -->
|
||||
|
||||
This option currently supports the following values:
|
||||
The `favicon` option can be used to define an image to display in the server list.
|
||||
|
||||
- A URL pointing to a `64x64` PNG image.
|
||||
- A name with `.png` extension that matches a PNG file in the `favicons` folder.
|
||||
- `${player uuid}` (or alternatively `${player name}`) to display the head of the player. The UUID/Name resolving is handled by https://mc-heads.net
|
||||
The Value can be one of three possible options, each being checked for in order:
|
||||
|
||||
Please note that AdvancedServerList will rescale the image to be 64x64 pixels, so be sure to provide images at that particular scale.
|
||||
- A URL pointing to an image file. The URL needs to start with `https://` to work.
|
||||
- A PNG filename, including `.png` file extension, matching a PNG file in the `favicons` folder.
|
||||
- A player name or UUID, or a [placeholder](placeholders.md) that resolves into one.
|
||||
|
||||
Note that for the name/UUID, the site https://mc-heads.net is being used.
|
||||
Use the URL option with the `${player uuid}` placeholder if you want to use another service.
|
||||
|
||||
/// details | Example
|
||||
type: example
|
||||
|
||||
```yaml title="YAML file"
|
||||
priority: 0
|
||||
|
||||
# We use just colour to hide the MOTD
|
||||
# Hides the MOTD for demonstration purposes
|
||||
motd:
|
||||
- '<grey>'
|
||||
- '<grey>'
|
||||
|
||||
# Player is Andre_601
|
||||
favicon: ${player uuid}
|
||||
# Placeholder resolves to UUID of Andre_601
|
||||
favicon: '${player uuid}'
|
||||
```
|
||||
<div class="result" markdown>
|
||||
|
||||
{ loading="lazy" }
|
||||
{ loading="lazy" }
|
||||
|
||||
</div>
|
||||
///
|
||||
|
||||
## PlayerCount
|
||||
|
||||
The `playerCount` option contains multiple different options all about the Player count itself.
|
||||
The `playerCount` option contains various other options that are used to modify the player count (The text next to the ping icon that shows the online and max players of a server).
|
||||
|
||||
### HidePlayers
|
||||
|
||||
Boolean option to set whether AdvancedServerList should hide the player count or not. When set to `true` will the player count be replaced with `???`.
|
||||
Additionally will the [`Text`](#text) and [`Hover`](#hover) option be ignored.
|
||||
The `playerCount -> hidePlayers` option takes a boolean (`true` or `false`) to set whether the player count should be hidden or not.
|
||||
|
||||
When set to true will the player count be replaced with `???`.
|
||||
In addition are the [`playerCount -> text`](#text) and [`playerCount -> hover`](#hover) options ignored.
|
||||
|
||||
If you want to not show any text at all, set this option to `false` (or remove it) and instead use the [`playerCount -> text`](#text) option.
|
||||
|
||||
/// details | Example
|
||||
type: example
|
||||
|
||||
```yaml title="YAML file"
|
||||
priority: 0
|
||||
|
||||
# We use just colour to hide the MOTD
|
||||
# Hides the MOTD for demonstration purposes
|
||||
motd:
|
||||
- '<grey>'
|
||||
- '<grey>'
|
||||
@@ -205,17 +198,17 @@ playerCount:
|
||||
|
||||
### Hover
|
||||
|
||||
This option allows to override the hover text usually displaying the players on the server when hovering over the player count.
|
||||
|
||||
You can either remove this option or set to an empty list (`hover: []`) to not override the hover.
|
||||
The `playerCount -> hover` option allows you to define lines of text to show when a player hovers over the player count with their cursor.
|
||||
|
||||
Note that this option only accepts basic colors such as `<blue>` or `<grey>` and that HEX colors are not supported.
|
||||
|
||||
/// details | Example
|
||||
type: example
|
||||
|
||||
```yaml title="YAML file"
|
||||
priority: 0
|
||||
|
||||
# We use just colour to hide the MOTD
|
||||
# Hides the MOTD for demonstration purposes
|
||||
motd:
|
||||
- '<grey>'
|
||||
- '<grey>'
|
||||
@@ -235,23 +228,24 @@ playerCount:
|
||||
|
||||
### Text
|
||||
|
||||
This option allows to override the text usually displaying the online players and total players that can join.
|
||||
Note that AdvancedServerList will not add the `<online>/<max>` text to the player count. Instead will you need to use [`${server playersOnline}`](placeholders.md#server) and [`${server playersMax}`](placeholders.md#server)
|
||||
The `playerCount -> text` option allows you to define a custom text to display instead of the usual `<online>/<max>`.
|
||||
|
||||
/// info | Note
|
||||
This feature works by changing the "outdated server" message followed by altering the protocol version of the server.
|
||||
Due to this will your server appear as "outdated" to the client (Have the ping icon crossed out). This is nothing that can be changed unfortunately.
|
||||
///
|
||||
Please take note of the following caveats:
|
||||
|
||||
To not override the player count, remove this option or set it to an empty String (`text: ''`).
|
||||
- The plugin won't automatically add the `<online>/<max>` back to the text you set. Instead you'll have to use `${server playersOnline}/${server playersMax}` to recreate this.
|
||||
- The override is done by using the "outdated server" text displayed when a client pings a server that is not compatible. This means that the ping icon will appear crossed out and your server will be seen as "outdated" by the client (When hovering over the ping icon). This can't be avoided nor fixed by the plugin.
|
||||
|
||||
If you want to not show any text, just use a single color (i.e. `text: '<grey>'`) to do so.
|
||||
|
||||
This option only supports basic colors and no HEX colors.
|
||||
|
||||
/// details | Example
|
||||
type: example
|
||||
|
||||
```yaml title="YAML file"
|
||||
priority: 0
|
||||
|
||||
# We use just colour to hide the MOTD
|
||||
# Hides the MOTD for demonstration purposes
|
||||
motd:
|
||||
- '<grey>'
|
||||
- '<grey>'
|
||||
@@ -261,35 +255,37 @@ playerCount:
|
||||
```
|
||||
<div class="result" markdown>
|
||||
|
||||
{ loading="lazy" }
|
||||
{ loading="lazy" }
|
||||
|
||||
</div>
|
||||
///
|
||||
|
||||
### ExtraPlayers
|
||||
|
||||
Contains options to modify how the `<max>` number in the player count should look like.
|
||||
<!-- admo:warning Using this option overrides the output of the <code>${server playersMax}</code> placeholder (Except in condition). -->
|
||||
|
||||
<!-- admo:warning Using this option will modify the <code>${server playersMax}</code> placeholder (Except when used in conditions) -->
|
||||
The `playerCount -> extraPlayers` option contains settings for the "extra players" feature, which adds X to the current online player count and sets it as the server's max player count.
|
||||
|
||||
#### Enabled { #extraplayers-enabled }
|
||||
|
||||
Boolean option to set whether the extra players feature should be used or not.
|
||||
When set to `true` will the max amount of players be modified by taking the current amount of online players, add [`Amount`](#amount) more to it and use it.
|
||||
Enables the extraPlayers feature.
|
||||
Use the [`playerCount -> extraPlayers -> amount`](#extraplayers-amount) option to set how much to add to the max players count.
|
||||
|
||||
#### Amount { #extraplayers-amount }
|
||||
|
||||
Sets the number to add to the current online players to then use as the new max players count.
|
||||
<!-- admo:info This option does nothing when <code>playerCount -> hidePlayers</code> is enabled. -->
|
||||
|
||||
As an example, setting this to `1` while `10` players are online will display `11`, while `-1` would display `9`.
|
||||
The `playerCount -> extraPlayers -> amount` option defines how much should be added to the current online player count to then use as max player count.
|
||||
|
||||
Example: Setting this option to `1` while currently 10 players are online will result in `10/11` being displayed on the player count (Assuming it is not being overriden by the [`playerCount -> text`](#text) option).
|
||||
|
||||
/// details | Example
|
||||
type: example
|
||||
|
||||
```yaml title="YAML file"
|
||||
priority: 0
|
||||
|
||||
# We use just colour to hide the MOTD
|
||||
# Hides the MOTD for demonstration purposes
|
||||
motd:
|
||||
- '<grey>'
|
||||
- '<grey>'
|
||||
@@ -308,32 +304,30 @@ playerCount:
|
||||
|
||||
### MaxPlayers
|
||||
|
||||
Contains options to set the max number of players allowed to join the server. This has only a visual effect and won't actually influence how many players can join your server.
|
||||
<!-- admo:info This feature is ignored should <code>playerCount -> extraPlayers</code> be enabled. -->
|
||||
<!-- admo:warning Using this option overrides the output of the <code>${server playersMax}</code> placeholder (Except in condition). -->
|
||||
|
||||
Note that this feature is ignored should [`extraPlayers`](#extraplayers) be enabled.
|
||||
|
||||
In case [`hidePlayers`](#hideplayers) is enabled will the max player count not be displayed, but still changed by this option.
|
||||
Should [`text`](#text) be set to a non-empty String will the max player count only be displayed when `${server playersMax}` is used.
|
||||
|
||||
<!-- admo:warning Using this option will modify the <code>${server playersMax}</code> placeholder (Except when used in conditions) -->
|
||||
The `playerCount -> maxPlayers` option is similar in nature to the [`playerCount -> extraPlayers`](#extraplayers) option, with the difference that the number set is being used as the max player count, instead of adding it together with the online player count first.
|
||||
|
||||
#### Enabled { #maxplayers-enabled }
|
||||
|
||||
Boolean option to set whether the max players feature should be used or not.
|
||||
When set to `true` will the value usually displaying how many players can join be changed to what you've set in the [`amount`](#maxplayers-amount) option.
|
||||
Enables the maxPlayers feature.
|
||||
Use the [`playerCount -> maxPlayers -> amount`](#maxplayers-amount) option to set the max player count itself.
|
||||
|
||||
#### Amount { #maxplayers-amount }
|
||||
|
||||
Sets the number to display as the max number of players allowed to join your server.
|
||||
Note that this will also affect the `${server playersMax}` placeholder, except when it is used inside conditions.
|
||||
<!-- admo:info This option does nothing when <code>playerCount -> hidePlayers</code> is enabled. -->
|
||||
|
||||
The `playerCount -> maxPlayers -> amount` option defines the number to use as the server's max players count.
|
||||
Unlike the [`playerCount -> extraPlayers -> amount`](#extraplayers-amount) option does this one not first add the current online player count to the number to then set.
|
||||
|
||||
/// details | Example
|
||||
type: example
|
||||
|
||||
```yaml title="YAML file"
|
||||
priority: 0
|
||||
|
||||
# We use just colour to hide the MOTD
|
||||
# Hides the MOTD for demonstration purposes
|
||||
motd:
|
||||
- '<grey>'
|
||||
- '<grey>'
|
||||
@@ -345,7 +339,7 @@ playerCount:
|
||||
```
|
||||
<div class="result" markdown>
|
||||
|
||||
{ loading="lazy" }
|
||||
{ loading="lazy" }
|
||||
|
||||
</div>
|
||||
///
|
||||
@@ -35,12 +35,12 @@ These placeholders use the player who pinged the server, to return values. They
|
||||
|
||||
These placeholders use values given by the server/proxy AdvancedServerList runs on.
|
||||
|
||||
| Placeholder | Description | Platforms |
|
||||
|------------------------------|------------------------------------------------------------|---------------------|
|
||||
| `${server playersOnline}` | The number of players online on this proxy/server.[^4] | All |
|
||||
| `${server playersMax}` | The total number of players that can join this server.[^5] | All |
|
||||
| `${server host}` | The domain/IP the player pinged.[^6] | BungeeCord/Velocity |
|
||||
| `${server whitelistEnabled}` | Whether the whitelist is enabled or not. | Paper |
|
||||
| Placeholder | Description | Platforms |
|
||||
|------------------------------|------------------------------------------------------------|-----------|
|
||||
| `${server playersOnline}` | The number of players online on this proxy/server.[^4] | All |
|
||||
| `${server playersMax}` | The total number of players that can join this server.[^5] | All |
|
||||
| `${server host}` | The domain/IP the player pinged.[^6] | All |
|
||||
| `${server whitelistEnabled}` | Whether the whitelist is enabled or not. | Paper |
|
||||
|
||||
[^4]:
|
||||
A comma-separated list of world (On Paper) or Server (On BungeeCord/Velocity) names can be provided to display the added numbers of players in these worlds/servers.
|
||||
@@ -49,7 +49,7 @@ These placeholders use values given by the server/proxy AdvancedServerList runs
|
||||
Using either the [extraPlayers' `amount`](index.md#extraplayers-amount) or [maxPlayers' `amount`](index.md#maxplayers-amount) option will make this placeholder return the modified max players count.
|
||||
Only exception to this rule is when the placeholder is used in the [`condition`](index.md#condition) option in which case it returns the actual max player count of the proxy/server.
|
||||
[^6]:
|
||||
An optional server name can be provided to display the IP/Domain associated with that server.
|
||||
An optional server name can be provided to display the IP/Domain associated with that server. This only works on BungeeCord or Velocity.
|
||||
**Example:** `${server host survival}` would display the IP/Domain associated with the `survival` server.
|
||||
|
||||
## PlaceholderAPI
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.commit/>
|
||||
|
||||
<plugin.version>3.7.0-b3</plugin.version>
|
||||
<plugin.version>3.8.0</plugin.version>
|
||||
<plugin.description>Create multiple Server lists based on conditions.</plugin.description>
|
||||
|
||||
<api.version>v3.1.0</api.version>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
mkdocs-material==9.5.6
|
||||
mkdocs-material==9.5.7
|
||||
mkdocs-glightbox==0.3.7
|
||||
mkdocs-awesome-pages-plugin==2.9.2
|
||||
git+https://github.com/Andre601/mkdocs-pagenav-generator
|
||||
Reference in new issue
Block a user