Skip to content

Commit aebe941

Browse files
committed
Little changes and started commenting stuff
1 parent 737c218 commit aebe941

File tree

5 files changed

+39
-12
lines changed

5 files changed

+39
-12
lines changed

Main Plugin/pom.xml

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

1212
<name>PlayerBalancer Plugin</name>
1313
<artifactId>playerbalancer-plugin</artifactId>
14-
<version>2.1.2.2</version>
14+
<version>2.1.3</version>
1515

1616
<build>
1717
<finalName>PlayerBalancer</finalName>

Main Plugin/src/main/java/com/jaimemartz/playerbalancer/ping/PingTactic.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void ping(ServerInfo server, Callback<ServerStatus> callback, PlayerBalan
3737
try {
3838
server.ping((ping, throwable) -> {
3939
if (ping != null) {
40-
//using deprecated method for 1.8 compatibility
40+
//using deprecated method for bungee 1.8 compatibility
4141
callback.done(new ServerStatus(
4242
ping.getDescription(),
4343
ping.getPlayers().getOnline(),

Main Plugin/src/main/java/com/jaimemartz/playerbalancer/ping/ServerStatus.java

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,49 @@
22

33
import net.md_5.bungee.api.config.ServerInfo;
44

5-
public final class ServerStatus {
5+
public class ServerStatus {
66
private final String description;
77
private final int players, maximum;
8-
private boolean outdated = true;
98
private final boolean online;
9+
private final boolean fabricated;
10+
private boolean outdated = true;
1011

12+
/**
13+
* Constructor when cannot ping the server
14+
*/
1115
public ServerStatus() {
12-
this("Server Unreachable", 0, 0);
16+
this.description = "Server Unreachable";
17+
this.players = 0;
18+
this.maximum = 0;
19+
this.online = false;
20+
this.fabricated = true;
1321
}
1422

23+
/**
24+
* Constructor when we have to return defaults
25+
* Defaulting to be accessible as this is used when the server checker is disabled
26+
* @param server the server for providing basic info about itself
27+
*/
1528
public ServerStatus(ServerInfo server) {
16-
this(server.getMotd(), server.getPlayers().size(), Integer.MAX_VALUE);
29+
this.description = server.getMotd();
30+
this.players = server.getPlayers().size();
31+
this.maximum = Integer.MAX_VALUE;
32+
this.online = true;
33+
this.fabricated = true;
1734
}
1835

36+
/**
37+
* Constructor when we have to store ping results
38+
* @param description the description (aka MOTD) from the ping result
39+
* @param players the count of players online from the ping result
40+
* @param maximum the maximum amount of players possible from the ping result
41+
*/
1942
public ServerStatus(String description, int players, int maximum) {
2043
this.description = description;
2144
this.players = players;
2245
this.maximum = maximum;
2346
this.online = maximum != 0 && players < maximum;
47+
this.fabricated = false;
2448
}
2549

2650
public String getDescription() {
@@ -35,15 +59,19 @@ public int getMaximum() {
3559
return maximum;
3660
}
3761

62+
public boolean isOnline() {
63+
return online;
64+
}
65+
66+
public boolean isFabricated() {
67+
return fabricated;
68+
}
69+
3870
public boolean isOutdated() {
3971
return outdated;
4072
}
4173

4274
public void setOutdated(boolean outdated) {
4375
this.outdated = outdated;
4476
}
45-
46-
public boolean isOnline() {
47-
return online;
48-
}
4977
}

Main Plugin/src/main/java/com/jaimemartz/playerbalancer/ping/StatusManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public void start() {
5656
}
5757
}
5858
}
59-
6059
}, 0L, props.getInterval(), TimeUnit.MILLISECONDS);
6160
}
6261

Spigot Addon/src/main/java/com/jaimemartz/playerbalanceraddon/MainCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
9494
sender.sendMessage(ChatColor.AQUA + "/spb setbypass [player]" + ChatColor.GRAY + " - " + ChatColor.RED + "Sets a bypass for you or the specified player");
9595
sender.sendMessage(ChatColor.AQUA + "/spb clearbypass [player]" + ChatColor.GRAY + " - " + ChatColor.RED + "Clears the bypass for you or the specified player");
9696
sender.sendMessage(ChatColor.AQUA + "/spb overridestatus <server> <status>" + ChatColor.GRAY + " - " + ChatColor.RED + "Overrides the accessible status of a specific server, over anything else");
97-
sender.sendMessage(ChatColor.AQUA + "/spb clearoverride <server> <status>" + ChatColor.GRAY + " - " + ChatColor.RED + "Clears the overriden status of a specific server");
97+
sender.sendMessage(ChatColor.AQUA + "/spb clearoverride <server>" + ChatColor.GRAY + " - " + ChatColor.RED + "Clears the overridden status of a specific server");
9898
sender.sendMessage(ChatColor.STRIKETHROUGH + ChatColor.GRAY.toString() + Strings.repeat("-", 53));
9999
}
100100
}

0 commit comments

Comments
 (0)