Compare commits

...
2 Commits
Author SHA1 Message Date
Andre_601 f37813d5b7 Merge pull request #8 from Andre601/feature/xMore-option
Add xMore profile option
2022-08-17 21:26:17 +02:00
Andre601 93c2dda56b Add xMore profile option 2022-08-17 21:19:38 +02:00
7 changed files with 21 additions and 19 deletions

No files matched your search

@@ -78,8 +78,8 @@ public class PingEvent implements Listener{
if(profile == null)
return;
if(profile.isOneMore()){
max = online + 1;
if(profile.getXMore() >= 0){
max = online + profile.getXMore();
ping.getPlayers().setMax(max);
}
@@ -126,7 +126,6 @@ public class PingEvent implements Listener{
if(playerInfos.length > 0)
ping.getPlayers().setSample(playerInfos);
}
ping.setFavicon(ping.getFaviconObject());
@@ -44,7 +44,7 @@ public class ServerListProfile{
private final List<String> players;
private final String playerCount;
private final boolean hidePlayers;
private final boolean oneMore;
private final int xMore;
public ServerListProfile(ConfigurationNode node, PluginLogger logger){
this.priority = node.node("priority").getInt();
@@ -54,7 +54,7 @@ public class ServerListProfile{
this.players = getList(node, "players", false);
this.playerCount = node.node("playerCount").getString("");
this.hidePlayers = node.node("hidePlayers").getBoolean();
this.oneMore = node.node("oneMore").getBoolean();
this.xMore = node.node("xMore").getInt(-1);
}
public int getPriority(){
@@ -77,8 +77,8 @@ public class ServerListProfile{
return hidePlayers;
}
public boolean isOneMore(){
return oneMore;
public int getXMore(){
return xMore;
}
public boolean evalConditions(Map<String, Object> replacements){
+8 -5
View File
@@ -60,11 +60,14 @@ players:
playerCount: '<grey>Text'
#
# When set to true, will the ${server maxPlayers} placeholder display the online players + 1
# This means that if 20 players are online, 21 would be displayed by the placeholder with this option enabled.
# When set to 0 or higher will alter the max player count to the online count + xMore.
# Example: With 20 online players would 'xMore: 1' show 20/21 and 'xMore: 0' show 20/20
#
# Note that the placeholder will not be affected in the conditions.
# Note that this will also manipulate the ${server playersMax} placeholder when used
# in motd, players or playerCount.
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profile#onemore
# Remove this option or set it to -1 to not alter the max player count.
#
oneMore: false
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#xmore
#
xMore: -1
@@ -74,8 +74,8 @@ public class PingEvent implements Listener{
if(profile == null)
return;
if(profile.isOneMore()){
max = online + 1;
if(profile.getXMore() >= 0){
max = online + profile.getXMore();
event.setMaxPlayers(max);
}
+1 -1
View File
@@ -12,7 +12,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<plugin.version>1.3.0</plugin.version>
<plugin.version>1.4.0</plugin.version>
<plugin.description>Create multiple Server lists based on conditions.</plugin.description>
<maven.compiler.source>16</maven.compiler.source>
@@ -101,8 +101,8 @@ public class PingEvent implements Listener{
if(profile == null)
return;
if(profile.isOneMore()){
max = online + 1;
if(profile.getXMore() >= 0){
max = online + profile.getXMore();
ping.setPlayersMaximum(max);
}
@@ -77,8 +77,8 @@ public class PingEvent{
if(profile == null)
return;
if(profile.isOneMore()){
max = online + 1;
if(profile.getXMore() >= 0){
max = online + profile.getXMore();
builder.maximumPlayers(max);
}