Remove support for RedisBungee

This commit is contained in:
Jaime Martinez Rincon 2020-06-20 22:36:49 +02:00
parent 2d2a7d8f9e
commit 9c448b8a86
10 changed files with 5 additions and 50 deletions

View File

@ -66,12 +66,6 @@
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.imaginarycode.minecraft</groupId>
<artifactId>RedisBungee</artifactId>
<version>0.3.8-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ninja.leaping.configurate</groupId>
<artifactId>configurate-hocon</artifactId>

View File

@ -5,7 +5,6 @@ import com.jaimemartz.playerbalancer.commands.FallbackCommand;
import com.jaimemartz.playerbalancer.commands.MainCommand;
import com.jaimemartz.playerbalancer.commands.ManageCommand;
import com.jaimemartz.playerbalancer.connection.ServerAssignRegistry;
import com.jaimemartz.playerbalancer.helper.NetworkManager;
import com.jaimemartz.playerbalancer.helper.PasteHelper;
import com.jaimemartz.playerbalancer.helper.PlayerLocker;
import com.jaimemartz.playerbalancer.listeners.*;
@ -34,7 +33,6 @@ public class PlayerBalancer extends Plugin {
private StatusManager statusManager;
private SettingsHolder settings;
private SectionManager sectionManager;
private NetworkManager networkManager;
private ConfigurationLoader<CommentedConfigurationNode> loader;
private FallbackCommand fallbackCommand;
@ -128,8 +126,6 @@ public class PlayerBalancer extends Plugin {
getProxy().getPluginManager().registerListener(this, reloadListener);
}
networkManager = new NetworkManager(this);
sectionManager = new SectionManager(this);
sectionManager.load();
@ -284,10 +280,6 @@ public class PlayerBalancer extends Plugin {
return statusManager;
}
public NetworkManager getNetworkManager() {
return networkManager;
}
public FallbackCommand getFallbackCommand() {
return fallbackCommand;
}

View File

@ -17,7 +17,7 @@ public class ProgressiveFillerProvider extends AbstractProvider {
for (ServerInfo server : servers) {
ServerStatus status = plugin.getStatusManager().getStatus(server);
int count = plugin.getNetworkManager().getPlayers(server);
int count = server.getPlayers().size();
if (count > max && count <= status.getMaximum()) {
max = count;

View File

@ -15,7 +15,7 @@ public class ProgressiveLowestProvider extends AbstractProvider {
ServerInfo target = null;
for (ServerInfo server : servers) {
int count = plugin.getNetworkManager().getPlayers(server);
int count = server.getPlayers().size();
if (count < min) {
min = count;

View File

@ -14,7 +14,7 @@ public class ProgressiveProvider extends AbstractProvider {
public ServerInfo requestTarget(PlayerBalancer plugin, ServerSection section, List<ServerInfo> servers, ProxiedPlayer player) {
for (ServerInfo server : servers) {
ServerStatus status = plugin.getStatusManager().getStatus(server);
if (plugin.getNetworkManager().getPlayers(server) < status.getMaximum()) {
if (server.getPlayers().size() < status.getMaximum()) {
return server;
}
}

View File

@ -18,7 +18,7 @@ public class RandomFillerProvider extends AbstractProvider {
int max = Integer.MIN_VALUE;
for (ServerInfo server : servers) {
int count = plugin.getNetworkManager().getPlayers(server);
int count = server.getPlayers().size();
if (count >= max) {
if (count > max) {

View File

@ -18,7 +18,7 @@ public class RandomLowestProvider extends AbstractProvider {
int min = Integer.MAX_VALUE;
for (ServerInfo server : servers) {
int count = plugin.getNetworkManager().getPlayers(server);
int count = server.getPlayers().size();
if (count <= min) {
if (count < min) {

View File

@ -1,25 +0,0 @@
package com.jaimemartz.playerbalancer.helper;
import com.imaginarycode.minecraft.redisbungee.RedisBungee;
import com.jaimemartz.playerbalancer.PlayerBalancer;
import net.md_5.bungee.api.config.ServerInfo;
public class NetworkManager {
private final PlayerBalancer plugin;
public NetworkManager(PlayerBalancer plugin) {
this.plugin = plugin;
}
public int getPlayers(ServerInfo server) {
if (plugin.getSettings().getGeneralProps().isRedisBungee()) {
try {
return RedisBungee.getApi().getPlayersOnServer(server.getName()).size();
} catch (Exception e) {
e.printStackTrace();
}
}
return server.getPlayers().size();
}
}

View File

@ -16,9 +16,6 @@ public class GeneralProps {
@Setting(value = "auto-reload")
private boolean autoReload;
@Setting(value = "redis-bungee")
private boolean redisBungee;
@Setting(value = "plugin-messaging")
private boolean pluginMessaging;

View File

@ -11,9 +11,6 @@ general {
# When true, the plugin will reload when you execute /greload
auto-reload=true
# When true, the plugin will get player counts from RedisBungee
redis-bungee=false
# When true, this plugin will print less messages when loading
silent=false