Merge branch 'dev' into 'master'

2.0.7

See merge request ajg0702/ajqueue!27
This commit is contained in:
ajgeiss0702
2021-09-07 22:50:55 +00:00
22 changed files with 187 additions and 31 deletions
+9 -2
View File
@@ -13,12 +13,17 @@ build:
stage: build stage: build
script: script:
- gradle clean :free:shadowJar - gradle clean :free:shadowJar
- mkdir jars
- cp free/build/libs/ajQueue*.jar jars/
- gradle :premium:shadowJar
- cp premium/build/libs/ajQueue*.jar jars/
artifacts: artifacts:
untracked: true untracked: true
paths: paths:
- free/build/libs - jars
pages: pages:
retry: 2
stage: build stage: build
image: gradle:6.8.3-jdk15 image: gradle:6.8.3-jdk15
only: only:
@@ -31,6 +36,7 @@ pages:
- public - public
test: test:
retry: 2
stage: test stage: test
dependencies: dependencies:
- build - build
@@ -54,6 +60,7 @@ upload to updater:
dependencies: dependencies:
- build - build
script: script:
- cd free/build/libs - cd jars
- files=(*) - files=(*)
- curl -i -F "submit=true" -F "secret=$UPLOAD_SECRET" -F "file=@${files[0]}" https://ajg0702.us/pl/updater/upload.php - curl -i -F "submit=true" -F "secret=$UPLOAD_SECRET" -F "file=@${files[0]}" https://ajg0702.us/pl/updater/upload.php
- curl -i -F "submit=true" -F "secret=$UPLOAD_SECRET" -F "file=@${files[1]}" https://ajg0702.us/pl/updater/upload.php
-3
View File
@@ -16,6 +16,3 @@ updating my plugin.
If you need *any* help making your changes, feel free to contact me If you need *any* help making your changes, feel free to contact me
on discord. The invite link is on the plugin page ;) on discord. The invite link is on the plugin page ;)
# Note on compiling ajQueuePlus
If you want to compile ajQueuePlus, please read the readme file that is in libs/private
+1 -1
View File
@@ -18,7 +18,7 @@ dependencies {
implementation("net.kyori:adventure-text-serializer-plain:4.0.0-SNAPSHOT") implementation("net.kyori:adventure-text-serializer-plain:4.0.0-SNAPSHOT")
compileOnly("com.google.guava:guava:30.1.1-jre") compileOnly("com.google.guava:guava:30.1.1-jre")
compileOnly("us.ajg0702:ajUtils:1.1.10") compileOnly("us.ajg0702:ajUtils:1.1.16")
} }
publishing { publishing {
@@ -1,6 +1,8 @@
package us.ajg0702.queue.api.util; package us.ajg0702.queue.api.util;
public interface QueueLogger { import us.ajg0702.utils.common.UtilsLogger;
public interface QueueLogger extends UtilsLogger {
void warn(String message); void warn(String message);
void warning(String message); void warning(String message);
void info(String message); void info(String message);
+1 -1
View File
@@ -12,7 +12,7 @@ repositories {
} }
allprojects { allprojects {
version = "2.0.6" version = "2.0.7"
group = "us.ajg0702" group = "us.ajg0702"
plugins.apply("java") plugins.apply("java")
+1 -1
View File
@@ -18,7 +18,7 @@ dependencies {
compileOnly("net.kyori:adventure-text-serializer-plain:4.0.0-SNAPSHOT") compileOnly("net.kyori:adventure-text-serializer-plain:4.0.0-SNAPSHOT")
compileOnly("com.google.guava:guava:30.1.1-jre") compileOnly("com.google.guava:guava:30.1.1-jre")
compileOnly("us.ajg0702:ajUtils:1.1.10") compileOnly("us.ajg0702:ajUtils:1.1.16")
compileOnly("org.slf4j:slf4j-log4j12:1.7.29") compileOnly("org.slf4j:slf4j-log4j12:1.7.29")
@@ -7,7 +7,10 @@ import us.ajg0702.queue.api.commands.ICommandSender;
import us.ajg0702.queue.api.commands.ISubCommand; import us.ajg0702.queue.api.commands.ISubCommand;
import us.ajg0702.utils.common.Messages; import us.ajg0702.utils.common.Messages;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Locale;
public class BaseCommand implements IBaseCommand { public class BaseCommand implements IBaseCommand {
@Override @Override
@@ -64,4 +67,10 @@ public class BaseCommand implements IBaseCommand {
public List<String> autoComplete(ICommandSender sender, String[] args) { public List<String> autoComplete(ICommandSender sender, String[] args) {
return null; return null;
} }
public List<String> filterCompletion(List<String> in, String current) {
List<String> out = new ArrayList<>(in);
out.removeIf(t -> !t.toLowerCase(Locale.ROOT).contains(current.toLowerCase(Locale.ROOT)));
return out;
}
} }
@@ -30,6 +30,7 @@ public class ManageCommand extends BaseCommand {
addSubCommand(new Send(main)); addSubCommand(new Send(main));
addSubCommand(new PermissionList(main)); addSubCommand(new PermissionList(main));
addSubCommand(new Whitelist(main)); addSubCommand(new Whitelist(main));
addSubCommand(new Update(main));
} }
@@ -55,6 +55,8 @@ public class Reload extends SubCommand {
main.getQueueManager().reloadServers(); main.getQueueManager().reloadServers();
main.getMessages().reload(); main.getMessages().reload();
main.getUpdater().setEnabled(main.getConfig().getBoolean("enable-updater"));
sender.sendMessage(getMessages().getComponent("commands.reload")); sender.sendMessage(getMessages().getComponent("commands.reload"));
} }
@@ -0,0 +1,66 @@
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.commands.SubCommand;
import us.ajg0702.queue.common.QueueMain;
import us.ajg0702.utils.common.Messages;
import us.ajg0702.utils.common.Updater;
import java.util.ArrayList;
import java.util.List;
public class Update extends SubCommand {
final QueueMain main;
public Update(QueueMain main) {
this.main = main;
}
@Override
public String getName() {
return "update";
}
@Override
public ImmutableList<String> getAliases() {
return ImmutableList.of();
}
@Override
public String getPermission() {
return "ajqueue.manage.update";
}
@Override
public Messages getMessages() {
return main.getMessages();
}
@Override
public void execute(ICommandSender sender, String[] args) {
if(!checkPermission(sender)) return;
Updater updater = main.getUpdater();
if(updater.isAlreadyDownloaded()) {
sender.sendMessage(getMessages().getComponent("updater.already-downloaded"));
return;
}
if(!updater.isUpdateAvailable()) {
sender.sendMessage(getMessages().getComponent("updater.no-update"));
return;
}
if(updater.downloadUpdate()) {
sender.sendMessage(getMessages().getComponent("updater.success"));
} else {
sender.sendMessage(getMessages().getComponent("updater.fail"));
}
}
@Override
public List<String> autoComplete(ICommandSender sender, String[] args) {
return new ArrayList<>();
}
}
@@ -75,7 +75,7 @@ public class QueueCommand extends BaseCommand {
return new ArrayList<>(); return new ArrayList<>();
} }
if(args.length == 1) { if(args.length == 1) {
return main.getQueueManager().getServerNames(); return filterCompletion(main.getQueueManager().getServerNames(), args[0]);
} }
return new ArrayList<>(); return new ArrayList<>();
} }
@@ -103,6 +103,16 @@ public class EventHandlerImpl implements EventHandler {
@Override @Override
public void onPlayerJoin(AdaptedPlayer player) { public void onPlayerJoin(AdaptedPlayer player) {
new Thread(() -> {
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException ignored) {
}
if (main.getUpdater().isUpdateAvailable() && player.hasPermission("ajqueue.manage.update")) {
player.sendMessage(main.getMessages().getComponent("updater.update-available"));
}
}).start();
ImmutableList<QueuePlayer> queues = main.getQueueManager().findPlayerInQueues(player); ImmutableList<QueuePlayer> queues = main.getQueueManager().findPlayerInQueues(player);
for(QueuePlayer queuePlayer : queues) { for(QueuePlayer queuePlayer : queues) {
queuePlayer.setPlayer(player); queuePlayer.setPlayer(player);
@@ -9,6 +9,7 @@ import us.ajg0702.queue.common.utils.LogConverter;
import us.ajg0702.queue.logic.LogicGetterImpl; import us.ajg0702.queue.logic.LogicGetterImpl;
import us.ajg0702.utils.common.Config; import us.ajg0702.utils.common.Config;
import us.ajg0702.utils.common.Messages; import us.ajg0702.utils.common.Messages;
import us.ajg0702.utils.common.Updater;
import java.io.File; import java.io.File;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@@ -100,9 +101,15 @@ public class QueueMain extends AjQueueAPI {
return protocolNameManager; return protocolNameManager;
} }
private Updater updater;
public Updater getUpdater() {
return updater;
}
@Override @Override
public void shutdown() { public void shutdown() {
taskManager.shutdown(); taskManager.shutdown();
updater.shutdown();
} }
@@ -150,6 +157,8 @@ public class QueueMain extends AjQueueAPI {
taskManager.rescheduleTasks(); taskManager.rescheduleTasks();
updater = new Updater(logger, platformMethods.getPluginVersion(), isPremium() ? "ajQueuePlus" : "ajQueue", config.getBoolean("enable-updater"), isPremium() ? 79123 : 78266, dataFolder.getParentFile(), "ajQueue update");
} }
private void constructMessages() { private void constructMessages() {
@@ -225,6 +234,20 @@ public class QueueMain extends AjQueueAPI {
d.put("max-tries-reached", "&cUnable to connect to {SERVER}. Max retries reached."); d.put("max-tries-reached", "&cUnable to connect to {SERVER}. Max retries reached.");
d.put("auto-queued", "&aYou've been auto-queued for {SERVER} because you were kicked."); d.put("auto-queued", "&aYou've been auto-queued for {SERVER} because you were kicked.");
d.put("velocity-kick-message", "<red>You were kicked while trying to join {SERVER}: <white>{REASON}");
d.put("updater.update-available",
"<gray><strikethrough> <reset>\n" +
" <green>An update is available for ajQueue!\n" +
" <dark_green>You can download it by " +
"<click:run_command:/ajqueue update><bold>clicking here</bold>\n or running <gray>/ajQueue update</click>\n" +
"<gray><strikethrough> <reset>"
);
d.put("updater.no-update", "<red>There is not an update available");
d.put("updater.success", "<green>The update has been downloaded! Now just restart the server");
d.put("updater.fail", "<red>An error occurred while downloading the update. Check the console for more info.");
d.put("updater.already-downloaded", "<red>The update has already been downloaded.");
messages = new Messages(dataFolder, new LogConverter(logger), d); messages = new Messages(dataFolder, new LogConverter(logger), d);
} }
} }
@@ -176,7 +176,7 @@ public class QueueManagerImpl implements QueueManager {
boolean sendInstant = main.getConfig().getStringList("send-instantly").contains(server.getName()) || server.isJoinable(player); boolean sendInstant = main.getConfig().getStringList("send-instantly").contains(server.getName()) || server.isJoinable(player);
boolean sendInstantp = list.size() <= 1 && server.isJoinable(player); boolean sendInstantp = list.size() <= 1 && server.isJoinable(player);
boolean timeGood = !main.getConfig().getBoolean("check-last-player-sent-time") || System.currentTimeMillis() - server.getLastSentTime() > Math.floor(main.getConfig().getDouble("wait-time") * 1000); boolean timeGood = !main.getConfig().getBoolean("check-last-player-sent-time") || server.getLastSentTime() > Math.floor(main.getTimeBetweenPlayers() * 1000);
if((sendInstant && (sendInstantp && timeGood))) { if((sendInstant && (sendInstantp && timeGood))) {
sendPlayers(server); sendPlayers(server);
+12 -3
View File
@@ -1,5 +1,5 @@
# Dont touch this number please # Dont touch this number please
config-version: 26 config-version: 28
# This is the main config for ajQueue. # This is the main config for ajQueue.
@@ -22,9 +22,10 @@ offline-time: 120
message-time: 10 message-time: 10
# If a player is in a server, you can have the plugin make them automatically join a queue for another server # If a player is in a server, you can have the plugin make them automatically join a queue for another server
# Example with the default values: Player joins survivalqueue server, they will auto-join the queue for survival # Example with the default values: Player joins the limbo server, they will auto-join the queue for the lobbys group
# Note that you dont have to use groups. Just put the name of a server to use a single server instead.
queue-servers: queue-servers:
- 'survivalqueue:survival' - 'limbo:lobbys'
# Should the plugin send an actionbar to the player? # Should the plugin send an actionbar to the player?
# The actionbar contains some info such as which server they are queued for, what position they are in, estimated time remaining, etc. # The actionbar contains some info such as which server they are queued for, what position they are in, estimated time remaining, etc.
@@ -253,3 +254,11 @@ protocol-names:
- "107:1.9" - "107:1.9"
- "47:1.8.9" - "47:1.8.9"
- "5:1.7.10" - "5:1.7.10"
# On velocity, should we end a player a message when they are kicked while trying to connect to a server with the queue?
# This has no effect on bungee, because the message is sent from bungee and theres no way to change that in ajQueue
# Default: false
velocity-kick-message: false
# Should the updater be enabled?
enable-updater: true
+2 -1
View File
@@ -7,6 +7,7 @@ plugins {
group = "us.ajg0702.queue" group = "us.ajg0702.queue"
repositories { repositories {
//mavenLocal()
maven { url = uri("https://repo.ajg0702.us") } maven { url = uri("https://repo.ajg0702.us") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
mavenCentral() mavenCentral()
@@ -17,7 +18,7 @@ dependencies {
compileOnly("com.google.guava:guava:30.1.1-jre") compileOnly("com.google.guava:guava:30.1.1-jre")
compileOnly("org.spongepowered:configurate-yaml:4.0.0") compileOnly("org.spongepowered:configurate-yaml:4.0.0")
implementation("us.ajg0702:ajUtils:1.1.10") implementation("us.ajg0702:ajUtils:1.1.16")
implementation(project(":platforms:velocity")) implementation(project(":platforms:velocity"))
implementation(project(":platforms:bungeecord")) implementation(project(":platforms:bungeecord"))
+1 -6
View File
@@ -1,6 +1 @@
If you want to compile ajQueuePlus, you will need to put the UltraPermissions jar here. This is where premium dependencies would go. Currently there is none required.
Either that, or remove the UltraPermissionsHook and its 1 reference
eventually I will make a fake dependency with just the class structure so you dont have to do this,
but i havent done that yet :p
+2 -2
View File
@@ -15,11 +15,11 @@ repositories {
dependencies { dependencies {
compileOnly("net.kyori:adventure-api:4.8.1") compileOnly("net.kyori:adventure-api:4.8.1")
compileOnly("com.google.guava:guava:30.1.1-jre") compileOnly("com.google.guava:guava:30.1.1-jre")
compileOnly("us.ajg0702:ajUtils:1.1.10") compileOnly("us.ajg0702:ajUtils:1.1.16")
compileOnly("net.md-5:bungeecord-api:1.16-R0.4") compileOnly("net.md-5:bungeecord-api:1.16-R0.4")
compileOnly("net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT") implementation("net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT")
implementation("net.kyori:adventure-platform-bungeecord:4.0.0-SNAPSHOT") implementation("net.kyori:adventure-platform-bungeecord:4.0.0-SNAPSHOT")
compileOnly("net.kyori:adventure-text-serializer-plain:4.0.0-SNAPSHOT") compileOnly("net.kyori:adventure-text-serializer-plain:4.0.0-SNAPSHOT")
+3 -2
View File
@@ -6,6 +6,7 @@ plugins {
group = "us.ajg0702.queue.platforms.velocity" group = "us.ajg0702.queue.platforms.velocity"
repositories { repositories {
//mavenLocal()
maven { url = uri("https://repo.ajg0702.us") } maven { url = uri("https://repo.ajg0702.us") }
maven { url = uri("https://nexus.velocitypowered.com/repository/maven-public/") } maven { url = uri("https://nexus.velocitypowered.com/repository/maven-public/") }
mavenCentral() mavenCentral()
@@ -14,11 +15,11 @@ repositories {
dependencies { dependencies {
compileOnly("net.kyori:adventure-api:4.8.1") compileOnly("net.kyori:adventure-api:4.8.1")
compileOnly("com.google.guava:guava:30.1.1-jre") compileOnly("com.google.guava:guava:30.1.1-jre")
compileOnly("us.ajg0702:ajUtils:1.1.10") compileOnly("us.ajg0702:ajUtils:1.1.16")
compileOnly("com.velocitypowered:velocity-api:3.0.0") compileOnly("com.velocitypowered:velocity-api:3.0.0")
annotationProcessor("com.velocitypowered:velocity-api:3.0.0") annotationProcessor("com.velocitypowered:velocity-api:3.0.0")
compileOnly("net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT") implementation("net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT")
implementation("org.bstats:bstats-velocity:2.2.1") implementation("org.bstats:bstats-velocity:2.2.1")
@@ -94,7 +94,7 @@ public class VelocityPlayer implements AdaptedPlayer, Audience {
@Override @Override
public void sendMessage(String message) { public void sendMessage(String message) {
handle.sendMessage(Component.text().content(message)); sendMessage(Component.text().content(message));
} }
@Override @Override
@@ -120,10 +120,41 @@ public class VelocityPlayer implements AdaptedPlayer, Audience {
handle.createConnectionRequest((RegisteredServer) server.getHandle()).connect().thenAcceptAsync( handle.createConnectionRequest((RegisteredServer) server.getHandle()).connect().thenAcceptAsync(
result -> { result -> {
if(!result.isSuccessful()) { if(!result.isSuccessful()) {
QueueMain.getInstance().getEventHandler().onServerKick( QueueMain main = QueueMain.getInstance();
Component reason = result.getReasonComponent().orElse(null);
if(reason == null) {
switch (result.getStatus()) {
case SUCCESS:
reason = Component.text("Success");
break;
case ALREADY_CONNECTED:
reason = Component.text("Already connected");
break;
case CONNECTION_IN_PROGRESS:
reason = Component.text("Already connecting");
break;
case CONNECTION_CANCELLED:
reason = Component.text("Connection canceled");
break;
case SERVER_DISCONNECTED:
reason = Component.text("Connection failed with unknown reason");
break;
}
}
if(main.getConfig().getBoolean("velocity-kick-message")) {
handle.sendMessage(
main.getMessages().getComponent(
"velocity-kick-message",
"SERVER:"+server.getName(),
"REASON:"+reason
)
);
}
main.getEventHandler().onServerKick(
this, this,
server, server,
result.getReasonComponent().orElseGet(() -> Component.text("Connection failed")), reason,
false false
); );
} }
+3 -1
View File
@@ -21,7 +21,9 @@ dependencies {
compileOnly("com.google.guava:guava:30.1.1-jre") compileOnly("com.google.guava:guava:30.1.1-jre")
compileOnly("us.ajg0702:ajUtils:1.1.10") compileOnly("me.TechsCode:FakeUltraPerms:1.0.2")
compileOnly("us.ajg0702:ajUtils:1.1.16")
compileOnly("net.kyori:adventure-api:4.8.1") compileOnly("net.kyori:adventure-api:4.8.1")
+1 -1
View File
@@ -24,7 +24,7 @@ dependencies {
compileOnly("org.spongepowered:configurate-yaml:4.0.0") compileOnly("org.spongepowered:configurate-yaml:4.0.0")
compileOnly("us.ajg0702:ajUtils:1.1.10") compileOnly("us.ajg0702:ajUtils:1.1.16")
compileOnly(group = "org.spigotmc", name = "spigot", version = "1.16.5-R0.1-SNAPSHOT") compileOnly(group = "org.spigotmc", name = "spigot", version = "1.16.5-R0.1-SNAPSHOT")
compileOnly("me.clip:placeholderapi:2.10.4") compileOnly("me.clip:placeholderapi:2.10.4")