stuff
This commit is contained in:
@@ -99,6 +99,9 @@ public class Main extends Plugin implements Listener {
|
|||||||
d.put("commands.leave.not-queued", "&cYou are not queued for that server! &7You are in these queues: {QUEUES}");
|
d.put("commands.leave.not-queued", "&cYou are not queued for that server! &7You are in these queues: {QUEUES}");
|
||||||
d.put("commands.leave.no-queues", "&cYou are not queued!");
|
d.put("commands.leave.no-queues", "&cYou are not queued!");
|
||||||
|
|
||||||
|
d.put("commands.pause.more-args", "&cUsage: /ajqueue pause <server>");
|
||||||
|
d.put("commands.pause.no-server", "&cThat server does not exist!");
|
||||||
|
|
||||||
msgs = BungeeMessages.getInstance(this, d);
|
msgs = BungeeMessages.getInstance(this, d);
|
||||||
//msgs = BungeeMessages.getInstance(this);
|
//msgs = BungeeMessages.getInstance(this);
|
||||||
|
|
||||||
@@ -125,12 +128,7 @@ public class Main extends Plugin implements Listener {
|
|||||||
|
|
||||||
|
|
||||||
metrics = new BungeeStats(this, 7404);
|
metrics = new BungeeStats(this, 7404);
|
||||||
metrics.addCustomChart(new BungeeStats.SimplePie("premium", new Callable<String>() {
|
metrics.addCustomChart(new BungeeStats.SimplePie("premium", () -> isp+""));
|
||||||
@Override
|
|
||||||
public String call() throws Exception {
|
|
||||||
return isp+"";
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +230,7 @@ public class Main extends Plugin implements Listener {
|
|||||||
String data = in.readUTF();
|
String data = in.readUTF();
|
||||||
String[] args = new String[1];
|
String[] args = new String[1];
|
||||||
args[0] = data;
|
args[0] = data;
|
||||||
moveCommand.execute((CommandSender) player, args);
|
moveCommand.execute(player, args);
|
||||||
//man.addToQueue(player, data);
|
//man.addToQueue(player, data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,18 @@ public class Manager {
|
|||||||
return servers;
|
return servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of all servers
|
||||||
|
* @return The names of all servers
|
||||||
|
*/
|
||||||
|
public List<String> getServerNames() {
|
||||||
|
List<String> names = new ArrayList<>();
|
||||||
|
for(Server s : servers) {
|
||||||
|
names.add(s.getName());
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int sendId = -1;
|
int sendId = -1;
|
||||||
@@ -384,6 +396,7 @@ public class Manager {
|
|||||||
String name = s.getName();
|
String name = s.getName();
|
||||||
if(server != null && !server.equals(name)) continue;
|
if(server != null && !server.equals(name)) continue;
|
||||||
if(!s.isOnline()) continue;
|
if(!s.isOnline()) continue;
|
||||||
|
if(s.isPaused()) continue;
|
||||||
if(s.getQueue().size() <= 0) continue;
|
if(s.getQueue().size() <= 0) continue;
|
||||||
|
|
||||||
ProxiedPlayer nextplayer = s.getQueue().get(0);
|
ProxiedPlayer nextplayer = s.getQueue().get(0);
|
||||||
|
|||||||
@@ -98,7 +98,11 @@ public class Server {
|
|||||||
return queue;
|
return queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the player can access the server. (Bungeecord's restricted servers)
|
||||||
|
* @param ply The player
|
||||||
|
* @return if the player can join based on bungeecord's restricted servers system
|
||||||
|
*/
|
||||||
public boolean canAccess(ProxiedPlayer ply) {
|
public boolean canAccess(ProxiedPlayer ply) {
|
||||||
return info.canAccess(ply);
|
return info.canAccess(ply);
|
||||||
}
|
}
|
||||||
@@ -121,4 +125,27 @@ public class Server {
|
|||||||
public List<String> getWhitelistedPlayers() {
|
public List<String> getWhitelistedPlayers() {
|
||||||
return whitelistedplayers;
|
return whitelistedplayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the server is joinable as a player
|
||||||
|
* @param p The player
|
||||||
|
* @return If the player can join the server
|
||||||
|
*/
|
||||||
|
public boolean isJoinable(ProxiedPlayer p) {
|
||||||
|
return (!whitelisted || whitelistedplayers.contains(p.getName())) &&
|
||||||
|
this.isOnline() &&
|
||||||
|
this.canAccess(p) &&
|
||||||
|
this.isFull() &&
|
||||||
|
!this.isPaused();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
boolean paused = false;
|
||||||
|
public boolean isPaused() {
|
||||||
|
return paused;
|
||||||
|
}
|
||||||
|
public void setPaused(boolean to) {
|
||||||
|
paused = to;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package us.ajg0702.queue.commands;
|
package us.ajg0702.queue.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.plugin.Command;
|
import net.md_5.bungee.api.plugin.Command;
|
||||||
@@ -11,6 +8,9 @@ import us.ajg0702.queue.Manager;
|
|||||||
import us.ajg0702.queue.Server;
|
import us.ajg0702.queue.Server;
|
||||||
import us.ajg0702.utils.bungee.BungeeMessages;
|
import us.ajg0702.utils.bungee.BungeeMessages;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ManageCommand extends Command {
|
public class ManageCommand extends Command {
|
||||||
|
|
||||||
Main pl;
|
Main pl;
|
||||||
@@ -78,8 +78,29 @@ public class ManageCommand extends Command {
|
|||||||
sender.sendMessage(Main.formatMessage(pl.getDescription().getVersion()));
|
sender.sendMessage(Main.formatMessage(pl.getDescription().getVersion()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(args[0].equalsIgnoreCase("pause")) {
|
||||||
|
if(!sender.hasPermission("ajqueue.pause")) {
|
||||||
|
sender.sendMessage(msgs.getBC("noperm"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sender.sendMessage(msgs.getBC("commands.pause.more-args"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(args.length == 2) {
|
if(args.length == 2) {
|
||||||
|
if(args[0].equalsIgnoreCase("pause")) {
|
||||||
|
if(!sender.hasPermission("ajqueue.pause")) {
|
||||||
|
sender.sendMessage(msgs.getBC("noperm"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!Manager.getInstance().getServerNames().contains(args[1])) {
|
||||||
|
sender.sendMessage(msgs.getBC(""));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!sender.hasPermission("ajqueue.send")) {
|
if(!sender.hasPermission("ajqueue.send")) {
|
||||||
sender.sendMessage(msgs.getBC("noperm"));
|
sender.sendMessage(msgs.getBC("noperm"));
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ wait-after-online: 1
|
|||||||
|
|
||||||
|
|
||||||
# This is for helping with finding issues with the server pinged
|
# This is for helping with finding issues with the server pinged
|
||||||
# This will spam the console when ehabled
|
# This will spam the console when enabled
|
||||||
# When this enabled, if servers are offline then it will spam errors. You can ignore them.
|
# When this enabled, if servers are offline then it will spam errors. You can ignore them.
|
||||||
# Default: false
|
# Default: false
|
||||||
pinger-debug: false
|
pinger-debug: false
|
||||||
|
|||||||
Reference in New Issue
Block a user