clean some stuff up
This commit is contained in:
@@ -47,11 +47,6 @@ public class LeaveCommand extends BaseCommand {
|
||||
return main.getMessages();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSubCommand(ISubCommand subCommand) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(ICommandSender sender, String[] args) {
|
||||
System.out.println("leave command");
|
||||
|
||||
@@ -11,7 +11,6 @@ import us.ajg0702.queue.common.QueueMain;
|
||||
import us.ajg0702.utils.common.Messages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ListCommand extends BaseCommand {
|
||||
@@ -47,11 +46,6 @@ public class ListCommand extends BaseCommand {
|
||||
return main.getMessages();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSubCommand(ISubCommand subCommand) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(ICommandSender sender, String[] args) {
|
||||
if(!checkPermission(sender)) return;
|
||||
@@ -63,9 +57,7 @@ public class ListCommand extends BaseCommand {
|
||||
|
||||
|
||||
Component m = main.getMessages().getComponent("commands.listqueues.header");
|
||||
boolean none = true;
|
||||
for(QueueServer s : main.getQueueManager().getServers()) {
|
||||
none = false;
|
||||
String color = "&a";
|
||||
if(!s.isOnline()) {
|
||||
color = "&c";
|
||||
|
||||
@@ -5,7 +5,6 @@ import net.kyori.adventure.text.Component;
|
||||
import us.ajg0702.queue.api.commands.ICommandSender;
|
||||
import us.ajg0702.queue.api.commands.ISubCommand;
|
||||
import us.ajg0702.queue.commands.BaseCommand;
|
||||
import us.ajg0702.queue.commands.SubCommand;
|
||||
import us.ajg0702.queue.common.QueueMain;
|
||||
import us.ajg0702.utils.common.Messages;
|
||||
|
||||
@@ -16,7 +15,7 @@ import java.util.Locale;
|
||||
|
||||
public class ManageCommand extends BaseCommand {
|
||||
|
||||
QueueMain main;
|
||||
final QueueMain main;
|
||||
|
||||
public ManageCommand(QueueMain main) {
|
||||
this.main = main;
|
||||
@@ -36,7 +35,7 @@ public class ManageCommand extends BaseCommand {
|
||||
return ImmutableList.of("ajq");
|
||||
}
|
||||
|
||||
List<ISubCommand> subCommands = new ArrayList<>();
|
||||
final List<ISubCommand> subCommands = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public ImmutableList<ISubCommand> getSubCommands() {
|
||||
|
||||
@@ -5,7 +5,6 @@ import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.spongepowered.configurate.ConfigurateException;
|
||||
import us.ajg0702.queue.api.commands.ICommandSender;
|
||||
import us.ajg0702.queue.api.commands.ISubCommand;
|
||||
import us.ajg0702.queue.commands.SubCommand;
|
||||
import us.ajg0702.queue.common.QueueMain;
|
||||
import us.ajg0702.utils.common.Messages;
|
||||
@@ -15,7 +14,7 @@ import java.util.List;
|
||||
|
||||
public class Reload extends SubCommand {
|
||||
|
||||
QueueMain main;
|
||||
final QueueMain main;
|
||||
public Reload(QueueMain main) {
|
||||
this.main = main;
|
||||
}
|
||||
@@ -40,11 +39,6 @@ public class Reload extends SubCommand {
|
||||
return main.getMessages();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSubCommand(ISubCommand subCommand) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(ICommandSender sender, String[] args) {
|
||||
if(!checkPermission(sender)) return;
|
||||
|
||||
@@ -2,10 +2,7 @@ package us.ajg0702.queue.commands.commands.manage;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.spongepowered.configurate.ConfigurateException;
|
||||
import us.ajg0702.queue.api.commands.ICommandSender;
|
||||
import us.ajg0702.queue.api.commands.ISubCommand;
|
||||
import us.ajg0702.queue.commands.SubCommand;
|
||||
import us.ajg0702.queue.common.QueueMain;
|
||||
import us.ajg0702.utils.common.Messages;
|
||||
@@ -15,7 +12,7 @@ import java.util.List;
|
||||
|
||||
public class Tasks extends SubCommand {
|
||||
|
||||
QueueMain main;
|
||||
final QueueMain main;
|
||||
public Tasks(QueueMain main) {
|
||||
this.main = main;
|
||||
}
|
||||
@@ -40,11 +37,6 @@ public class Tasks extends SubCommand {
|
||||
return main.getMessages();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSubCommand(ISubCommand subCommand) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(ICommandSender sender, String[] args) {
|
||||
if(!checkPermission(sender)) return;
|
||||
|
||||
@@ -49,11 +49,6 @@ public class QueueCommand extends BaseCommand {
|
||||
return main.getMessages();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSubCommand(ISubCommand subCommand) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(ICommandSender sender, String[] args) {
|
||||
if(!checkPermission(sender)) return;
|
||||
|
||||
@@ -67,7 +67,7 @@ public class QueueMain {
|
||||
return taskManager;
|
||||
}
|
||||
|
||||
private List<CompletableFuture<ServerBuilder>> serverCompletableFutures = new ArrayList<>();
|
||||
private final List<CompletableFuture<ServerBuilder>> serverCompletableFutures = new ArrayList<>();
|
||||
private ServerBuilder serverBuilder;
|
||||
public ServerBuilder getServerBuilder() {
|
||||
return serverBuilder;
|
||||
@@ -94,7 +94,7 @@ public class QueueMain {
|
||||
}
|
||||
|
||||
|
||||
private File dataFolder;
|
||||
private final File dataFolder;
|
||||
|
||||
|
||||
public QueueMain(Logger logger, PlatformMethods platformMethods, File dataFolder) {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package us.ajg0702.queue.common;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import us.ajg0702.queue.api.QueueManager;
|
||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||
import us.ajg0702.queue.api.players.QueuePlayer;
|
||||
@@ -347,8 +345,8 @@ public class QueueManagerImpl implements QueueManager {
|
||||
sendPlayers(null);
|
||||
}
|
||||
|
||||
HashMap<AdaptedPlayer, Long> sendingNowAntiSpam = new HashMap<>();
|
||||
HashMap<QueuePlayer, Integer> sendingAttempts = new HashMap<>();
|
||||
final HashMap<AdaptedPlayer, Long> sendingNowAntiSpam = new HashMap<>();
|
||||
final HashMap<QueuePlayer, Integer> sendingAttempts = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void sendPlayers(QueueServer queueServer) {
|
||||
@@ -439,6 +437,7 @@ public class QueueManagerImpl implements QueueManager {
|
||||
main.getLogger().severe("Could not find ideal server for server/group '"+server.getName()+"'");
|
||||
continue;
|
||||
}
|
||||
server.setLastSentTime(System.currentTimeMillis());
|
||||
nextPlayer.connect(selected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package us.ajg0702.queue.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
@@ -10,10 +9,10 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class TaskManager {
|
||||
|
||||
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
|
||||
ScheduledExecutorService updateExecutor = Executors.newScheduledThreadPool(1);
|
||||
final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
|
||||
final ScheduledExecutorService updateExecutor = Executors.newScheduledThreadPool(1);
|
||||
|
||||
QueueMain main;
|
||||
final QueueMain main;
|
||||
public TaskManager(QueueMain main) {
|
||||
this.main = main;
|
||||
}
|
||||
@@ -39,7 +38,6 @@ public class TaskManager {
|
||||
|
||||
sendTask = scheduleAtFixedRate(
|
||||
main.getQueueManager()::sendPlayers,
|
||||
0L,
|
||||
(long) (main.getConfig().getDouble("wait-time")*1000L),
|
||||
TimeUnit.MILLISECONDS
|
||||
);
|
||||
@@ -53,21 +51,18 @@ public class TaskManager {
|
||||
|
||||
messageTask = scheduleAtFixedRate(
|
||||
main.getQueueManager()::sendMessages,
|
||||
0L,
|
||||
main.getConfig().getInt("message-time"),
|
||||
TimeUnit.SECONDS
|
||||
);
|
||||
|
||||
actionBarTask = scheduleAtFixedRate(
|
||||
main.getQueueManager()::sendActionBars,
|
||||
0L,
|
||||
2L,
|
||||
TimeUnit.SECONDS
|
||||
);
|
||||
|
||||
queueEventTask = scheduleAtFixedRate(
|
||||
main.getQueueManager()::sendQueueEvents,
|
||||
0L,
|
||||
2L,
|
||||
TimeUnit.SECONDS
|
||||
);
|
||||
@@ -75,7 +70,6 @@ public class TaskManager {
|
||||
if(main.getConfig().getInt("reload-servers-interval") > 0) {
|
||||
reloadServerTask = scheduleAtFixedRate(
|
||||
main.getQueueManager()::reloadServers,
|
||||
0L,
|
||||
main.getConfig().getInt("reload-servers-interval"),
|
||||
TimeUnit.SECONDS
|
||||
);
|
||||
@@ -105,8 +99,8 @@ public class TaskManager {
|
||||
}
|
||||
}
|
||||
|
||||
private ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) {
|
||||
return scheduleAtFixedRate(executor, command, initialDelay, period, unit);
|
||||
private ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long period, TimeUnit unit) {
|
||||
return scheduleAtFixedRate(executor, command, 0, period, unit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||
import us.ajg0702.queue.api.players.QueuePlayer;
|
||||
import us.ajg0702.queue.api.queues.QueueServer;
|
||||
import us.ajg0702.queue.api.server.AdaptedServer;
|
||||
import us.ajg0702.queue.api.server.AdaptedServerInfo;
|
||||
import us.ajg0702.queue.api.server.AdaptedServerPing;
|
||||
import us.ajg0702.queue.common.QueueMain;
|
||||
import us.ajg0702.utils.common.GenUtils;
|
||||
@@ -33,7 +32,7 @@ public class QueueServerImpl implements QueueServer {
|
||||
|
||||
private final QueueMain main;
|
||||
|
||||
private HashMap<AdaptedServer, AdaptedServerPing> pings = new HashMap<>();
|
||||
private final HashMap<AdaptedServer, AdaptedServerPing> pings = new HashMap<>();
|
||||
|
||||
private final List<AdaptedServer> servers;
|
||||
|
||||
@@ -165,7 +164,11 @@ public class QueueServerImpl implements QueueServer {
|
||||
|
||||
@Override
|
||||
public long getLastSentTime() {
|
||||
return lastSentTime;
|
||||
return System.currentTimeMillis() - lastSentTime;
|
||||
}
|
||||
@Override
|
||||
public void setLastSentTime(long lastSentTime) {
|
||||
this.lastSentTime = lastSentTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,8 @@ import us.ajg0702.queue.api.AliasManager;
|
||||
import us.ajg0702.utils.common.Config;
|
||||
|
||||
public class FreeAliasManager implements AliasManager {
|
||||
Config config;
|
||||
@SuppressWarnings("unused")
|
||||
final Config config;
|
||||
public FreeAliasManager(Config config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user