mirror of
https://github.com/BGHDDevelopment/PlayerBalancer.git
synced 2024-09-11 07:08:05 +02:00
Fixed infinite queue of data to fake servers
This commit is contained in:
parent
124ebaeb41
commit
b19e51cf56
@ -11,7 +11,7 @@
|
||||
|
||||
<name>PlayerBalancer Plugin</name>
|
||||
<artifactId>playerbalancer-plugin</artifactId>
|
||||
<version>2.1.5.3</version>
|
||||
<version>2.1.5.4</version>
|
||||
|
||||
<build>
|
||||
<finalName>PlayerBalancer</finalName>
|
||||
@ -65,13 +65,17 @@
|
||||
<id>bstats-repo</id>
|
||||
<url>http://repo.bstats.org/content/repositories/releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-proxy</artifactId>
|
||||
<version>local</version>
|
||||
<version>LATEST</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -2,12 +2,21 @@ package com.jaimemartz.playerbalancer.section;
|
||||
|
||||
import com.jaimemartz.playerbalancer.settings.props.features.BalancerProps;
|
||||
import net.md_5.bungee.BungeeServerInfo;
|
||||
import net.md_5.bungee.api.Callback;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.ServerPing;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import javax.xml.soap.Text;
|
||||
import java.awt.*;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Queue;
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SectionServer extends BungeeServerInfo {
|
||||
@ -35,4 +44,45 @@ public class SectionServer extends BungeeServerInfo {
|
||||
.collect(Collectors.toList());
|
||||
} else return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(String channel, byte[] data) {
|
||||
this.sendData(channel, data, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendData(String channel, byte[] data, boolean queue) {
|
||||
//Nothing to do
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ping(Callback<ServerPing> callback) {
|
||||
this.ping(callback, ProxyServer.getInstance().getProtocolVersion());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ping(Callback<ServerPing> callback, int protocolVersion) {
|
||||
ServerPing ping = new ServerPing();
|
||||
|
||||
ping.setDescriptionComponent(new TextComponent(
|
||||
TextComponent.fromLegacyText(this.getMotd())
|
||||
));
|
||||
|
||||
ping.setVersion(new ServerPing.Protocol(
|
||||
ProxyServer.getInstance().getName(),
|
||||
protocolVersion
|
||||
));
|
||||
|
||||
Collection<ProxiedPlayer> players = getPlayers();
|
||||
ping.setPlayers(new ServerPing.Players(
|
||||
Integer.MAX_VALUE,
|
||||
players.size(),
|
||||
players.stream().map(
|
||||
player -> new ServerPing.PlayerInfo(player.getName(), player.getUniqueId())
|
||||
).toArray(ServerPing.PlayerInfo[]::new)
|
||||
));
|
||||
|
||||
callback.done(ping, null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user