1.4.7 & 1.4.8

This commit is contained in:
ajgeiss0702
2020-07-02 16:09:11 -07:00
parent ea765a5619
commit 1192ed9172
8 changed files with 50 additions and 16 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
<groupId>us.ajg0702</groupId> <groupId>us.ajg0702</groupId>
<artifactId>ajQueue</artifactId> <artifactId>ajQueue</artifactId>
<name>ajQueue</name> <name>ajQueue</name>
<version>1.4.6</version> <version>1.4.8</version>
<build> <build>
<resources> <resources>
<resource> <resource>
+1 -1
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>us.ajg0702</groupId> <groupId>us.ajg0702</groupId>
<artifactId>ajQueue</artifactId> <artifactId>ajQueue</artifactId>
<version>1.4.6</version> <version>1.4.8</version>
<name>ajQueue</name> <name>ajQueue</name>
<repositories> <repositories>
+11 -2
View File
@@ -3,10 +3,12 @@ package us.ajg0702.queue;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
@@ -41,6 +43,8 @@ public class Main extends Plugin implements Listener {
boolean isp; boolean isp;
MoveCommand moveCommand;
@Override @Override
public void onEnable() { public void onEnable() {
plugin = this; plugin = this;
@@ -90,7 +94,8 @@ public class Main extends Plugin implements Listener {
config = new BungeeConfig(this); config = new BungeeConfig(this);
checkConfig(); checkConfig();
this.getProxy().getPluginManager().registerCommand(this, new MoveCommand(this)); moveCommand = new MoveCommand(this);
this.getProxy().getPluginManager().registerCommand(this, moveCommand);
this.getProxy().getPluginManager().registerCommand(this, new ManageCommand(this)); this.getProxy().getPluginManager().registerCommand(this, new ManageCommand(this));
this.getProxy().getPluginManager().registerCommand(this, new LeaveCommand(this)); this.getProxy().getPluginManager().registerCommand(this, new LeaveCommand(this));
@@ -218,7 +223,11 @@ public class Main extends Plugin implements Listener {
if(subchannel.equals("queue")) { if(subchannel.equals("queue")) {
String data = in.readUTF(); String data = in.readUTF();
man.addToQueue(player, data); String[] args = new String[1];
args[0] = data;
moveCommand.execute((CommandSender) player, args);
//man.addToQueue(player, data);
} }
if(subchannel.equals("queuename")) { if(subchannel.equals("queuename")) {
BungeeUtils.sendCustomData(player, "queuename", man.getQueuedName(player)); BungeeUtils.sendCustomData(player, "queuename", man.getQueuedName(player));
+1 -1
View File
@@ -40,7 +40,7 @@ public class Manager {
public void run() { public void run() {
reloadServers(); reloadServers();
} }
}, 0, TimeUnit.SECONDS); }, pl.config.getInt("wait-to-load-servers-delay"), TimeUnit.MILLISECONDS);
} }
} }
@@ -81,17 +81,14 @@ public class ManageCommand extends Command {
} }
if(args.length == 2) { if(args.length == 2) {
List<String> playerNames = new ArrayList<>();
for(ProxiedPlayer ply : pl.getProxy().getPlayers()) {
if(ply == null || !ply.isConnected()) continue;
playerNames.add(ply.getName().toLowerCase());
}
if(playerNames.contains(args[0].toLowerCase())) {
if(!sender.hasPermission("ajqueue.send")) { if(!sender.hasPermission("ajqueue.send")) {
sender.sendMessage(msgs.getBC("noperm")); sender.sendMessage(msgs.getBC("noperm"));
return; return;
} }
List<String> playerNames = getNameList();
if(playerNames.contains(args[0].toLowerCase())) {
ProxiedPlayer ply = pl.getProxy().getPlayer(args[0]); ProxiedPlayer ply = pl.getProxy().getPlayer(args[0]);
Manager.getInstance().addToQueue(ply, args[1]); Manager.getInstance().addToQueue(ply, args[1]);
sender.sendMessage(Main.formatMessage( sender.sendMessage(Main.formatMessage(
@@ -104,4 +101,14 @@ public class ManageCommand extends Command {
} }
sender.sendMessage(Main.formatMessage("/ajqueue <reload|list|player>")); sender.sendMessage(Main.formatMessage("/ajqueue <reload|list|player>"));
}} }
private List<String> getNameList() {
List<String> playerNames = new ArrayList<>();
for(ProxiedPlayer ply : pl.getProxy().getPlayers()) {
if(ply == null || !ply.isConnected()) continue;
playerNames.add(ply.getName().toLowerCase());
}
return playerNames;
}
}
@@ -23,7 +23,12 @@ public class MoveCommand extends Command {
return; return;
} }
ProxiedPlayer p = (ProxiedPlayer) sender; ProxiedPlayer p = (ProxiedPlayer) sender;
if(args.length > 0) { if(args.length > 0) {
if(plugin.getConfig().getBoolean("require-permission") && !p.hasPermission("ajqueue.queue."+args[0])) {
sender.sendMessage(msgs.getBC("noperm"));
return;
}
Manager.getInstance().addToQueue(p, args[0]); Manager.getInstance().addToQueue(p, args[0]);
} else if(args.length == 0) { } else if(args.length == 0) {
sender.sendMessage(msgs.getBC("commands.joinqueue.usage")); sender.sendMessage(msgs.getBC("commands.joinqueue.usage"));
@@ -90,6 +90,7 @@ public class BungeeMessages {
d.put("spigot.actionbar.offline", "&7You are queued for &f{SERVER}&7. &7You are in position &f{POS}&7 of &f{LEN}&7."); d.put("spigot.actionbar.offline", "&7You are queued for &f{SERVER}&7. &7You are in position &f{POS}&7 of &f{LEN}&7.");
d.put("send", "&aAdded &f{PLAYER}&a to the queue for &f{SERVER}"); d.put("send", "&aAdded &f{PLAYER}&a to the queue for &f{SERVER}");
d.put("remove", "&aRemoved &f{PLAYER} from all queues they were in.");
d.put("placeholders.queued.none", "None"); d.put("placeholders.queued.none", "None");
d.put("placeholders.position.none", "None"); d.put("placeholders.position.none", "None");
+13 -1
View File
@@ -1,5 +1,5 @@
# Dont touch this number please # Dont touch this number please
config-version: 6 config-version: 8
# The time the server will wait between sending people in the queue # The time the server will wait between sending people in the queue
# Default: 5 # Default: 5
@@ -43,8 +43,20 @@ remove-player-on-server-switch: true
# Default: false # Default: false
wait-to-load-servers: false wait-to-load-servers: false
# How long should we wait after the server finishes loading to load the server list?
# Only works if the above is enabled.
# This is in miliseconds so 1000 = 1 second
# Default: 500
wait-to-load-servers-delay: 500
# How often (in seconds) we should check for new servers to add queues for. # How often (in seconds) we should check for new servers to add queues for.
# If you dynamicly add servers, set this to something other than 0. # If you dynamicly add servers, set this to something other than 0.
# To disable, set to 0 # To disable, set to 0
reload-servers-interval: 0 reload-servers-interval: 0
# Should we require permissions for players to be able to join queues?
# If enabled, players will be required to have the permission ajqueue.queue.<server>
# Default: false
require-permission: false