Merge branch 'dev' into 'master'
2.0.4 See merge request ajg0702/ajqueue!22
This commit is contained in:
+2
-1
@@ -7,4 +7,5 @@ dependency-reduced-pom.xml
|
|||||||
build
|
build
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.nosync
|
.nosync
|
||||||
libs/**.*
|
libs/private/*
|
||||||
|
!libs/private/README.md
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
image: gradle:6.8.2-jdk8
|
image: gradle:7.2.0-jdk8
|
||||||
|
|
||||||
# Cache downloaded dependencies and plugins between builds.
|
# Cache downloaded dependencies and plugins between builds.
|
||||||
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
|
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
|
||||||
@@ -9,10 +9,10 @@ cache:
|
|||||||
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
retry: 2
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- rm -rf build
|
- gradle clean :free:shadowJar
|
||||||
- gradle :free:shadowJar
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- free/build/libs
|
- free/build/libs
|
||||||
|
|||||||
@@ -5,11 +5,17 @@
|
|||||||
[Spigot (premium)](https://www.spigotmc.org/resources/ajqueueplus.79123/)
|
[Spigot (premium)](https://www.spigotmc.org/resources/ajqueueplus.79123/)
|
||||||
|
|
||||||
ajQueue is (as far as I can tell) the best queue plugin out there.
|
ajQueue is (as far as I can tell) the best queue plugin out there.
|
||||||
It was made because I wasn't satisfied with the existing queue plugins, all of them either being massively overpriced,
|
It was made because I wasn't satisfied with the existing queue plugins,
|
||||||
or lacking basic features
|
all of them either being massively overpriced, or lacking basic features
|
||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
As long as you don't break anything, i'll probably accept any merge requests you submit.
|
As long as you don't break anything,
|
||||||
I like to have the least number of steps possible for server owners updating my plugin.
|
i'll probably accept any merge requests you submit.
|
||||||
|
I like to have the least number of steps possible for server owners
|
||||||
|
updating my plugin.
|
||||||
|
|
||||||
If you need *any* help making your changes, feel free to contact me on discord. The invite link is on the plugin page ;)
|
If you need *any* help making your changes, feel free to contact me
|
||||||
|
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
|
||||||
@@ -7,9 +7,10 @@ group = "us.ajg0702.queue.api"
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
//mavenLocal()
|
//mavenLocal()
|
||||||
mavenCentral()
|
|
||||||
|
|
||||||
maven { url = uri("https://repo.ajg0702.us") }
|
maven { url = uri("https://repo.ajg0702.us") }
|
||||||
|
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -17,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.9")
|
compileOnly("us.ajg0702:ajUtils:1.1.10")
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ public interface QueueManager {
|
|||||||
*/
|
*/
|
||||||
void sendActionBars();
|
void sendActionBars();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends queue status titles to players in queues
|
||||||
|
*/
|
||||||
|
void sendTitles();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell the spigot sides to call the queue scoreboard event
|
* Tell the spigot sides to call the queue scoreboard event
|
||||||
*/
|
*/
|
||||||
|
|||||||
+7
-1
@@ -1,4 +1,4 @@
|
|||||||
package us.ajg0702.queue.api;
|
package us.ajg0702.queue.api.premium;
|
||||||
|
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
import us.ajg0702.queue.api.players.QueuePlayer;
|
import us.ajg0702.queue.api.players.QueuePlayer;
|
||||||
@@ -26,4 +26,10 @@ public interface Logic {
|
|||||||
* @return true if the player has been disconnected for too long and should be removed from the queue
|
* @return true if the player has been disconnected for too long and should be removed from the queue
|
||||||
*/
|
*/
|
||||||
boolean playerDisconnectedTooLong(QueuePlayer player);
|
boolean playerDisconnectedTooLong(QueuePlayer player);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the permissionGetter. Only available on ajQueuePlus
|
||||||
|
* @return the permission getter
|
||||||
|
*/
|
||||||
|
PermissionGetter getPermissionGetter();
|
||||||
}
|
}
|
||||||
+4
-1
@@ -1,6 +1,8 @@
|
|||||||
package us.ajg0702.queue.api;
|
package us.ajg0702.queue.api.premium;
|
||||||
|
|
||||||
|
import us.ajg0702.queue.api.AliasManager;
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
|
import us.ajg0702.queue.api.premium.Logic;
|
||||||
import us.ajg0702.utils.common.Config;
|
import us.ajg0702.utils.common.Config;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -10,4 +12,5 @@ public interface LogicGetter {
|
|||||||
Logic constructLogic();
|
Logic constructLogic();
|
||||||
AliasManager constructAliasManager(Config config);
|
AliasManager constructAliasManager(Config config);
|
||||||
List<String> getPermissions(AdaptedPlayer player);
|
List<String> getPermissions(AdaptedPlayer player);
|
||||||
|
PermissionGetter getPermissionGetter();
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package us.ajg0702.queue.api.premium;
|
||||||
|
|
||||||
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
|
import us.ajg0702.queue.api.premium.PermissionHook;
|
||||||
|
|
||||||
|
public interface PermissionGetter {
|
||||||
|
PermissionHook getSelected();
|
||||||
|
|
||||||
|
int getMaxOfflineTime(AdaptedPlayer player);
|
||||||
|
|
||||||
|
int getPriority(AdaptedPlayer player);
|
||||||
|
|
||||||
|
int getServerPriotity(String server, AdaptedPlayer player);
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package us.ajg0702.queue.logic.permissions;
|
package us.ajg0702.queue.api.premium;
|
||||||
|
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
|
|
||||||
+3
-2
@@ -5,13 +5,14 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
version = "2.0.3"
|
version = "2.0.4"
|
||||||
group = "us.ajg0702"
|
group = "us.ajg0702"
|
||||||
|
|
||||||
plugins.apply("java")
|
plugins.apply("java")
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ group = "us.ajg0702.queue.common"
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
//mavenLocal()
|
//mavenLocal()
|
||||||
mavenCentral()
|
|
||||||
maven { url = uri("https://repo.ajg0702.us") }
|
maven { url = uri("https://repo.ajg0702.us") }
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -16,7 +16,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.9")
|
compileOnly("us.ajg0702:ajUtils:1.1.10")
|
||||||
|
|
||||||
compileOnly("org.slf4j:slf4j-log4j12:1.7.29")
|
compileOnly("org.slf4j:slf4j-log4j12:1.7.29")
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public class ManageCommand extends BaseCommand {
|
|||||||
if(args.length > 1) {
|
if(args.length > 1) {
|
||||||
for(ISubCommand subCommand : subCommands) {
|
for(ISubCommand subCommand : subCommands) {
|
||||||
if(args[0].equalsIgnoreCase(subCommand.getName()) || subCommand.getAliases().contains(args[0].toLowerCase(Locale.ROOT))) {
|
if(args[0].equalsIgnoreCase(subCommand.getName()) || subCommand.getAliases().contains(args[0].toLowerCase(Locale.ROOT))) {
|
||||||
|
if(!sender.hasPermission(subCommand.getPermission())) continue;
|
||||||
return subCommand.autoComplete(sender, Arrays.copyOfRange(args, 1, args.length));
|
return subCommand.autoComplete(sender, Arrays.copyOfRange(args, 1, args.length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,6 +92,7 @@ public class ManageCommand extends BaseCommand {
|
|||||||
List<String> commands = new ArrayList<>();
|
List<String> commands = new ArrayList<>();
|
||||||
for(ISubCommand subCommand : subCommands) {
|
for(ISubCommand subCommand : subCommands) {
|
||||||
if(!subCommand.showInTabComplete()) continue;
|
if(!subCommand.showInTabComplete()) continue;
|
||||||
|
if(!sender.hasPermission(subCommand.getPermission())) continue;
|
||||||
commands.add(subCommand.getName());
|
commands.add(subCommand.getName());
|
||||||
commands.addAll(subCommand.getAliases());
|
commands.addAll(subCommand.getAliases());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import us.ajg0702.utils.common.Messages;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Pause extends SubCommand {
|
public class Pause extends SubCommand {
|
||||||
@@ -47,26 +48,36 @@ public class Pause extends SubCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueServer server = main.getQueueManager().findServer(args[0]);
|
List<QueueServer> servers;
|
||||||
if(server == null) {
|
QueueServer queueServer = main.getQueueManager().findServer(args[0]);
|
||||||
|
if(queueServer == null && !args[0].equalsIgnoreCase("all")) {
|
||||||
sender.sendMessage(getMessages().getComponent("commands.pause.no-server", "SERVER:"+args[1]));
|
sender.sendMessage(getMessages().getComponent("commands.pause.no-server", "SERVER:"+args[1]));
|
||||||
return;
|
return;
|
||||||
}
|
} else if(queueServer == null && args[0].equalsIgnoreCase("all")) {
|
||||||
if(args.length == 1) {
|
servers = main.getQueueManager().getServers();
|
||||||
server.setPaused(!server.isPaused());
|
|
||||||
} else {
|
} else {
|
||||||
server.setPaused(args[1].equalsIgnoreCase("on") || args[1].equalsIgnoreCase("true"));
|
servers = Collections.singletonList(queueServer);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(QueueServer server : servers) {
|
||||||
|
if(args.length == 1) {
|
||||||
|
server.setPaused(!server.isPaused());
|
||||||
|
} else {
|
||||||
|
server.setPaused(args[1].equalsIgnoreCase("on") || args[1].equalsIgnoreCase("true"));
|
||||||
|
}
|
||||||
|
sender.sendMessage(getMessages().getComponent("commands.pause.success",
|
||||||
|
"SERVER:"+server.getName(),
|
||||||
|
"PAUSED:"+getMessages().getString("commands.pause.paused."+server.isPaused())
|
||||||
|
));
|
||||||
}
|
}
|
||||||
sender.sendMessage(getMessages().getComponent("commands.pause.success",
|
|
||||||
"SERVER:"+server.getName(),
|
|
||||||
"PAUSED:"+getMessages().getString("commands.pause.paused."+server.isPaused())
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> autoComplete(ICommandSender sender, String[] args) {
|
public List<String> autoComplete(ICommandSender sender, String[] args) {
|
||||||
if(args.length == 1) {
|
if(args.length == 1) {
|
||||||
return main.getQueueManager().getServerNames();
|
List<String> servers = new ArrayList<>(main.getQueueManager().getServerNames());
|
||||||
|
servers.add("all");
|
||||||
|
return servers;
|
||||||
}
|
}
|
||||||
if(args.length == 2) {
|
if(args.length == 2) {
|
||||||
return Arrays.asList("on", "off", "true", "false");
|
return Arrays.asList("on", "off", "true", "false");
|
||||||
|
|||||||
+5
@@ -65,6 +65,11 @@ public class PermissionList extends SubCommand {
|
|||||||
if(!s.toLowerCase(Locale.ROOT).contains("ajqueue")) return;
|
if(!s.toLowerCase(Locale.ROOT).contains("ajqueue")) return;
|
||||||
sender.sendMessage(Component.text(s));
|
sender.sendMessage(Component.text(s));
|
||||||
});
|
});
|
||||||
|
sender.sendMessage(
|
||||||
|
Component.text(
|
||||||
|
"Using: "+main.getLogicGetter().getPermissionGetter().getSelected().getName())
|
||||||
|
.color(NamedTextColor.GOLD)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package us.ajg0702.queue.common;
|
||||||
|
|
||||||
|
import us.ajg0702.queue.api.AliasManager;
|
||||||
|
import us.ajg0702.queue.api.EventHandler;
|
||||||
|
import us.ajg0702.queue.api.PlatformMethods;
|
||||||
|
import us.ajg0702.queue.api.QueueManager;
|
||||||
|
import us.ajg0702.queue.api.premium.Logic;
|
||||||
|
import us.ajg0702.queue.api.premium.LogicGetter;
|
||||||
|
import us.ajg0702.queue.api.util.QueueLogger;
|
||||||
|
import us.ajg0702.utils.common.Config;
|
||||||
|
import us.ajg0702.utils.common.Messages;
|
||||||
|
|
||||||
|
public abstract class AjQueueAPI {
|
||||||
|
|
||||||
|
public static AjQueueAPI INSTANCE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the instance of the ajQueue API
|
||||||
|
* @return the ajQueue API
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public static AjQueueAPI getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the time that ajQueue will wait between sending players. In seconds
|
||||||
|
* @return The time, in seconds, ajQueue will wait between attempting to send players
|
||||||
|
*/
|
||||||
|
public abstract double getTimeBetweenPlayers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the time between players. Takes it from the config.
|
||||||
|
*/
|
||||||
|
public abstract void setTimeBetweenPlayers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ajQueue config
|
||||||
|
* @return the ajQueue config
|
||||||
|
*/
|
||||||
|
public abstract Config getConfig();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ajQueue messages manager
|
||||||
|
* @return the messages manager
|
||||||
|
*/
|
||||||
|
public abstract Messages getMessages();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the alias manager. Used to get aliases of servers set in ajqueue's config.
|
||||||
|
* Note that the alias manager on the free version will just return the server's name
|
||||||
|
* @return The alias manager
|
||||||
|
*/
|
||||||
|
public abstract AliasManager getAliasManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the priority logic. Note that the priority logic for the free version does nothing.
|
||||||
|
* @return The priority logic
|
||||||
|
*/
|
||||||
|
public abstract Logic getLogic();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the plugin is the premium version or not.
|
||||||
|
* @return True if ajQueuePlus, false if ajQueue
|
||||||
|
*/
|
||||||
|
public abstract boolean isPremium();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the PlatformMethods for the platform (e.g. bungee, velocity)
|
||||||
|
* The methods in this class do things that the code for each is different on the platform.
|
||||||
|
* @return the PlatformMethods
|
||||||
|
*/
|
||||||
|
public abstract PlatformMethods getPlatformMethods();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ajQueue logger. If you are using this, please add your own prefix to it.
|
||||||
|
* @return The ajQueue logger
|
||||||
|
*/
|
||||||
|
public abstract QueueLogger getLogger();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the repeating task manager
|
||||||
|
* @return The TaskManager
|
||||||
|
*/
|
||||||
|
public abstract TaskManager getTaskManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the event handler.
|
||||||
|
*
|
||||||
|
* This class will probably be replaced in the future with an actual event system
|
||||||
|
* @return the EventHandler
|
||||||
|
*/
|
||||||
|
public abstract EventHandler getEventHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the queue manager. Most things you do interacting with queues will be through this.
|
||||||
|
* @return the QueueManager
|
||||||
|
*/
|
||||||
|
public abstract QueueManager getQueueManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the logic getter.
|
||||||
|
* @return The logic getter
|
||||||
|
*/
|
||||||
|
public abstract LogicGetter getLogicGetter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells ajQueue to shut down.
|
||||||
|
*/
|
||||||
|
public abstract void shutdown();
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@ package us.ajg0702.queue.common;
|
|||||||
|
|
||||||
import org.spongepowered.configurate.ConfigurateException;
|
import org.spongepowered.configurate.ConfigurateException;
|
||||||
import us.ajg0702.queue.api.*;
|
import us.ajg0702.queue.api.*;
|
||||||
|
import us.ajg0702.queue.api.premium.Logic;
|
||||||
|
import us.ajg0702.queue.api.premium.LogicGetter;
|
||||||
import us.ajg0702.queue.api.util.QueueLogger;
|
import us.ajg0702.queue.api.util.QueueLogger;
|
||||||
import us.ajg0702.queue.common.utils.LogConverter;
|
import us.ajg0702.queue.common.utils.LogConverter;
|
||||||
import us.ajg0702.queue.logic.LogicGetterImpl;
|
import us.ajg0702.queue.logic.LogicGetterImpl;
|
||||||
@@ -11,7 +13,7 @@ import us.ajg0702.utils.common.Messages;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
public class QueueMain {
|
public class QueueMain extends AjQueueAPI {
|
||||||
|
|
||||||
private static QueueMain instance;
|
private static QueueMain instance;
|
||||||
public static QueueMain getInstance() {
|
public static QueueMain getInstance() {
|
||||||
@@ -19,67 +21,81 @@ public class QueueMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private double timeBetweenPlayers;
|
private double timeBetweenPlayers;
|
||||||
|
@Override
|
||||||
public double getTimeBetweenPlayers() {
|
public double getTimeBetweenPlayers() {
|
||||||
return timeBetweenPlayers;
|
return timeBetweenPlayers;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void setTimeBetweenPlayers() {
|
public void setTimeBetweenPlayers() {
|
||||||
this.timeBetweenPlayers = config.getDouble("wait-time");
|
this.timeBetweenPlayers = config.getDouble("wait-time");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Config config;
|
private Config config;
|
||||||
|
@Override
|
||||||
public Config getConfig() {
|
public Config getConfig() {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Messages messages;
|
private Messages messages;
|
||||||
|
@Override
|
||||||
public Messages getMessages() {
|
public Messages getMessages() {
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AliasManager aliasManager;
|
private AliasManager aliasManager;
|
||||||
|
@Override
|
||||||
public AliasManager getAliasManager() {
|
public AliasManager getAliasManager() {
|
||||||
return aliasManager;
|
return aliasManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Logic logic;
|
private Logic logic;
|
||||||
|
@Override
|
||||||
public Logic getLogic() {
|
public Logic getLogic() {
|
||||||
return logic;
|
return logic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isPremium() {
|
public boolean isPremium() {
|
||||||
return getLogic().isPremium();
|
return getLogic().isPremium();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final PlatformMethods platformMethods;
|
private final PlatformMethods platformMethods;
|
||||||
|
@Override
|
||||||
public PlatformMethods getPlatformMethods() {
|
public PlatformMethods getPlatformMethods() {
|
||||||
return platformMethods;
|
return platformMethods;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final QueueLogger logger;
|
private final QueueLogger logger;
|
||||||
|
@Override
|
||||||
public QueueLogger getLogger() {
|
public QueueLogger getLogger() {
|
||||||
return logger;
|
return logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final TaskManager taskManager = new TaskManager(this);
|
private final TaskManager taskManager = new TaskManager(this);
|
||||||
|
@Override
|
||||||
public TaskManager getTaskManager() {
|
public TaskManager getTaskManager() {
|
||||||
return taskManager;
|
return taskManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandlerImpl(this);
|
private final EventHandler eventHandler = new EventHandlerImpl(this);
|
||||||
|
@Override
|
||||||
public EventHandler getEventHandler() {
|
public EventHandler getEventHandler() {
|
||||||
return eventHandler;
|
return eventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueueManager queueManager;
|
private QueueManager queueManager;
|
||||||
|
@Override
|
||||||
public QueueManager getQueueManager() {
|
public QueueManager getQueueManager() {
|
||||||
return queueManager;
|
return queueManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final LogicGetter logicGetter;
|
private final LogicGetter logicGetter;
|
||||||
|
@Override
|
||||||
public LogicGetter getLogicGetter() {
|
public LogicGetter getLogicGetter() {
|
||||||
return logicGetter;
|
return logicGetter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
taskManager.shutdown();
|
taskManager.shutdown();
|
||||||
}
|
}
|
||||||
@@ -101,6 +117,8 @@ public class QueueMain {
|
|||||||
}
|
}
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
|
AjQueueAPI.INSTANCE = this;
|
||||||
|
|
||||||
|
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.platformMethods = platformMethods;
|
this.platformMethods = platformMethods;
|
||||||
@@ -175,6 +193,9 @@ public class QueueMain {
|
|||||||
d.put("placeholders.queued.none", "None");
|
d.put("placeholders.queued.none", "None");
|
||||||
d.put("placeholders.position.none", "None");
|
d.put("placeholders.position.none", "None");
|
||||||
|
|
||||||
|
d.put("title.title", "");
|
||||||
|
d.put("title.subtitle", "<gold>You are <green>#{POS} <gold>in the queue!");
|
||||||
|
|
||||||
d.put("commands.leave.more-args", "&cPlease specify which queue you want to leave! &7You are in these queues: {QUEUES}");
|
d.put("commands.leave.more-args", "&cPlease specify which queue you want to leave! &7You are in these queues: {QUEUES}");
|
||||||
d.put("commands.leave.queues-list-format", "&f{NAME}&7, ");
|
d.put("commands.leave.queues-list-format", "&f{NAME}&7, ");
|
||||||
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}");
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package us.ajg0702.queue.common;
|
package us.ajg0702.queue.common;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.title.Title;
|
||||||
import us.ajg0702.queue.api.QueueManager;
|
import us.ajg0702.queue.api.QueueManager;
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
import us.ajg0702.queue.api.players.QueuePlayer;
|
import us.ajg0702.queue.api.players.QueuePlayer;
|
||||||
@@ -11,6 +13,7 @@ import us.ajg0702.queue.common.queues.QueueServerImpl;
|
|||||||
import us.ajg0702.utils.common.Messages;
|
import us.ajg0702.utils.common.Messages;
|
||||||
import us.ajg0702.utils.common.TimeUtils;
|
import us.ajg0702.utils.common.TimeUtils;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -309,6 +312,45 @@ public class QueueManagerImpl implements QueueManager {
|
|||||||
"TIME:"+ TimeUtils.timeString(time, msgs.getString("format.time.mins"), msgs.getString("format.time.secs"))
|
"TIME:"+ TimeUtils.timeString(time, msgs.getString("format.time.mins"), msgs.getString("format.time.secs"))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendTitles() {
|
||||||
|
if(!main.getConfig().getBoolean("send-title")) return;
|
||||||
|
|
||||||
|
for(QueueServer server : servers) {
|
||||||
|
String status = server.getStatusString();
|
||||||
|
for(QueuePlayer queuePlayer : server.getQueue()) {
|
||||||
|
|
||||||
|
int pos = queuePlayer.getPosition();
|
||||||
|
if(pos == 0) {
|
||||||
|
server.removePlayer(queuePlayer);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
AdaptedPlayer player = queuePlayer.getPlayer();
|
||||||
|
if(player == null) continue;
|
||||||
|
|
||||||
|
if(!getSingleServer(player).equals(server)) continue;
|
||||||
|
|
||||||
|
Component titleMessage = msgs.getComponent("title.title",
|
||||||
|
"POS:"+pos,
|
||||||
|
"LEN:"+server.getQueue().size(),
|
||||||
|
"SERVER:"+server.getAlias(),
|
||||||
|
"STATUS:"+status
|
||||||
|
);
|
||||||
|
Component subTitleMessage = msgs.getComponent("title.subtitle",
|
||||||
|
"POS:"+pos,
|
||||||
|
"LEN:"+server.getQueue().size(),
|
||||||
|
"SERVER:"+server.getAlias(),
|
||||||
|
"STATUS:"+status
|
||||||
|
);
|
||||||
|
|
||||||
|
Title title = Title.title(titleMessage, subTitleMessage, Title.Times.of(Duration.ZERO, Duration.ofSeconds(2L), Duration.ZERO));
|
||||||
|
player.showTitle(title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class TaskManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String taskStatus() {
|
public String taskStatus() {
|
||||||
List<ScheduledFuture<?>> tasks = Arrays.asList(sendTask, updateTask, messageTask, actionBarTask, queueEventTask, reloadServerTask);
|
List<ScheduledFuture<?>> tasks = Arrays.asList(sendTask, updateTask, messageTask, actionBarTask, titleTask, queueEventTask, reloadServerTask);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for(ScheduledFuture<?> task : tasks) {
|
for(ScheduledFuture<?> task : tasks) {
|
||||||
sb.append(task == null ? "null" : task.isDone() ? "canceled/done" : "running");
|
sb.append(task == null ? "null" : task.isDone() ? "canceled/done" : "running");
|
||||||
@@ -37,6 +37,7 @@ public class TaskManager {
|
|||||||
ScheduledFuture<?> updateTask;
|
ScheduledFuture<?> updateTask;
|
||||||
ScheduledFuture<?> messageTask;
|
ScheduledFuture<?> messageTask;
|
||||||
ScheduledFuture<?> actionBarTask;
|
ScheduledFuture<?> actionBarTask;
|
||||||
|
ScheduledFuture<?> titleTask;
|
||||||
ScheduledFuture<?> queueEventTask;
|
ScheduledFuture<?> queueEventTask;
|
||||||
ScheduledFuture<?> reloadServerTask;
|
ScheduledFuture<?> reloadServerTask;
|
||||||
public void rescheduleTasks() {
|
public void rescheduleTasks() {
|
||||||
@@ -67,6 +68,12 @@ public class TaskManager {
|
|||||||
TimeUnit.MILLISECONDS
|
TimeUnit.MILLISECONDS
|
||||||
);
|
);
|
||||||
|
|
||||||
|
titleTask = scheduleAtFixedRate(
|
||||||
|
main.getQueueManager()::sendTitles,
|
||||||
|
1500L,
|
||||||
|
TimeUnit.MILLISECONDS
|
||||||
|
);
|
||||||
|
|
||||||
queueEventTask = scheduleAtFixedRate(
|
queueEventTask = scheduleAtFixedRate(
|
||||||
main.getQueueManager()::sendQueueEvents,
|
main.getQueueManager()::sendQueueEvents,
|
||||||
1500L,
|
1500L,
|
||||||
@@ -96,6 +103,9 @@ public class TaskManager {
|
|||||||
if(actionBarTask != null && !actionBarTask.isCancelled()) {
|
if(actionBarTask != null && !actionBarTask.isCancelled()) {
|
||||||
actionBarTask.cancel(true);
|
actionBarTask.cancel(true);
|
||||||
}
|
}
|
||||||
|
if(titleTask != null && !titleTask.isCancelled()) {
|
||||||
|
titleTask.cancel(true);
|
||||||
|
}
|
||||||
if(queueEventTask != null && !queueEventTask.isCancelled()) {
|
if(queueEventTask != null && !queueEventTask.isCancelled()) {
|
||||||
queueEventTask.cancel(true);
|
queueEventTask.cancel(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package us.ajg0702.queue.logic;
|
package us.ajg0702.queue.logic;
|
||||||
|
|
||||||
import us.ajg0702.queue.api.Logic;
|
import us.ajg0702.queue.api.premium.Logic;
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
import us.ajg0702.queue.api.players.QueuePlayer;
|
import us.ajg0702.queue.api.players.QueuePlayer;
|
||||||
|
import us.ajg0702.queue.api.premium.PermissionGetter;
|
||||||
import us.ajg0702.queue.api.queues.QueueServer;
|
import us.ajg0702.queue.api.queues.QueueServer;
|
||||||
|
|
||||||
public class FreeLogic implements Logic {
|
public class FreeLogic implements Logic {
|
||||||
@@ -20,4 +21,9 @@ public class FreeLogic implements Logic {
|
|||||||
public boolean playerDisconnectedTooLong(QueuePlayer player) {
|
public boolean playerDisconnectedTooLong(QueuePlayer player) {
|
||||||
return player.getMaxOfflineTime() < player.getTimeSinceOnline()*1000;
|
return player.getMaxOfflineTime() < player.getTimeSinceOnline()*1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PermissionGetter getPermissionGetter() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
package us.ajg0702.queue.logic;
|
package us.ajg0702.queue.logic;
|
||||||
|
|
||||||
import us.ajg0702.queue.api.AliasManager;
|
import us.ajg0702.queue.api.AliasManager;
|
||||||
import us.ajg0702.queue.api.Logic;
|
import us.ajg0702.queue.api.premium.Logic;
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
|
import us.ajg0702.queue.api.premium.LogicGetter;
|
||||||
|
import us.ajg0702.queue.api.premium.PermissionGetter;
|
||||||
import us.ajg0702.utils.common.Config;
|
import us.ajg0702.utils.common.Config;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class LogicGetterImpl implements us.ajg0702.queue.api.LogicGetter {
|
public class LogicGetterImpl implements LogicGetter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Logic constructLogic() {
|
public Logic constructLogic() {
|
||||||
@@ -23,4 +25,9 @@ public class LogicGetterImpl implements us.ajg0702.queue.api.LogicGetter {
|
|||||||
public List<String> getPermissions(AdaptedPlayer player) {
|
public List<String> getPermissions(AdaptedPlayer player) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PermissionGetter getPermissionGetter() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Dont touch this number please
|
# Dont touch this number please
|
||||||
config-version: 24
|
config-version: 25
|
||||||
|
|
||||||
# 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
|
||||||
@@ -31,9 +31,7 @@ kick-reasons:
|
|||||||
|
|
||||||
|
|
||||||
# Should we remove a player from the queue if they move servers?
|
# Should we remove a player from the queue if they move servers?
|
||||||
# If they join another queue, they will be removed from the previous one no matter what
|
# This will remove the player from if they switch to any other server
|
||||||
# This is more meant for if you have multiple lobbies if you want to let the player switch
|
|
||||||
# between them without losing their queue position
|
|
||||||
# Default: false
|
# Default: false
|
||||||
remove-player-on-server-switch: false
|
remove-player-on-server-switch: false
|
||||||
|
|
||||||
@@ -53,17 +51,19 @@ 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
|
||||||
|
# Default: 0
|
||||||
reload-servers-interval: 0
|
reload-servers-interval: 0
|
||||||
|
|
||||||
|
|
||||||
# Should we require permissions for players to be able to join queues?
|
# 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>
|
# If enabled, players will be required to have the permission ajqueue.queue.<server> to be able to join queues
|
||||||
# Default: false
|
# Default: false
|
||||||
require-permission: false
|
require-permission: false
|
||||||
|
|
||||||
|
|
||||||
# Should we let players join more than one queue?
|
# Should we let players join more than one queue?
|
||||||
# If enabled, players will be able to be in multiple queues at once.
|
# If enabled, players will be able to be in multiple queues at once.
|
||||||
|
# If disabled, players will be removed from the previous queue when joining a new queue
|
||||||
# Default: true
|
# Default: true
|
||||||
allow-multiple-queues: true
|
allow-multiple-queues: true
|
||||||
|
|
||||||
@@ -163,6 +163,7 @@ priority-queue-debug: false
|
|||||||
auto-add-to-queue-on-kick: false
|
auto-add-to-queue-on-kick: false
|
||||||
# The delay for the above option.
|
# The delay for the above option.
|
||||||
# In seconds, decimals supported.
|
# In seconds, decimals supported.
|
||||||
|
# Default: 1
|
||||||
auto-add-to-queue-on-kick-delay: 1
|
auto-add-to-queue-on-kick-delay: 1
|
||||||
|
|
||||||
# With what kick reasons should we auto-add the player to the queue
|
# With what kick reasons should we auto-add the player to the queue
|
||||||
@@ -176,10 +177,12 @@ auto-add-kick-reasons:
|
|||||||
# Should we enable the server command being a queue command?
|
# Should we enable the server command being a queue command?
|
||||||
# This may require extra setup on bungeecord. See the wiki:
|
# This may require extra setup on bungeecord. See the wiki:
|
||||||
# https://wiki.ajg0702.us/ajqueue/setup/replacing-server-command
|
# https://wiki.ajg0702.us/ajqueue/setup/replacing-server-command
|
||||||
|
# Default: false
|
||||||
enable-server-command: false
|
enable-server-command: false
|
||||||
|
|
||||||
# Should we enable priority messages?
|
# Should we enable priority messages?
|
||||||
# Configure the priority messages in the option below.
|
# Configure the priority messages in the option below.
|
||||||
|
# Default: false
|
||||||
enable-priority-messages: false
|
enable-priority-messages: false
|
||||||
|
|
||||||
# Messages we send to players with priority queue when they join the queue
|
# Messages we send to players with priority queue when they join the queue
|
||||||
@@ -189,4 +192,9 @@ enable-priority-messages: false
|
|||||||
# Example: 1:You have a priority of 1!
|
# Example: 1:You have a priority of 1!
|
||||||
priority-messages:
|
priority-messages:
|
||||||
- "*:<green>Joining the queue with a priority of {PRIORITY}!"
|
- "*:<green>Joining the queue with a priority of {PRIORITY}!"
|
||||||
- "100:<yellow>Wow! You have a priority of 100!"
|
- "100:<yellow>Wow! You have a priority of 100!"
|
||||||
|
|
||||||
|
# Should the plugin send a title to the player?
|
||||||
|
# The title shows what position the player is in the queue
|
||||||
|
# Default: false
|
||||||
|
send-title: false
|
||||||
@@ -7,10 +7,9 @@ plugins {
|
|||||||
group = "us.ajg0702.queue"
|
group = "us.ajg0702.queue"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
//mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -18,7 +17,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.9")
|
implementation("us.ajg0702:ajUtils:1.1.10")
|
||||||
|
|
||||||
implementation(project(":platforms:velocity"))
|
implementation(project(":platforms:velocity"))
|
||||||
implementation(project(":platforms:bungeecord"))
|
implementation(project(":platforms:bungeecord"))
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
If you want to compile ajQueuePlus, you will need to put the UltraPermissions jar here.
|
||||||
|
|
||||||
|
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
|
||||||
Binary file not shown.
@@ -7,15 +7,15 @@ group = "us.ajg0702.queue.platforms.bungeecord"
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
//mavenLocal()
|
//mavenLocal()
|
||||||
mavenCentral()
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
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.9")
|
compileOnly("us.ajg0702:ajUtils:1.1.10")
|
||||||
|
|
||||||
compileOnly("net.md-5:bungeecord-api:1.16-R0.4")
|
compileOnly("net.md-5:bungeecord-api:1.16-R0.4")
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -5,6 +5,7 @@ import com.google.common.io.ByteStreams;
|
|||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
import net.md_5.bungee.api.connection.Server;
|
||||||
import us.ajg0702.queue.api.PlatformMethods;
|
import us.ajg0702.queue.api.PlatformMethods;
|
||||||
import us.ajg0702.queue.api.commands.IBaseCommand;
|
import us.ajg0702.queue.api.commands.IBaseCommand;
|
||||||
import us.ajg0702.queue.api.commands.ICommandSender;
|
import us.ajg0702.queue.api.commands.ICommandSender;
|
||||||
@@ -40,13 +41,15 @@ public class BungeeMethods implements PlatformMethods {
|
|||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
out.writeUTF(channel);
|
out.writeUTF(channel);
|
||||||
out.writeUTF(player.getName());
|
out.writeUTF(player.getName());
|
||||||
int length = data.length;
|
|
||||||
|
|
||||||
for (String s : data) {
|
for (String s : data) {
|
||||||
out.writeUTF(s);
|
out.writeUTF(s);
|
||||||
}
|
}
|
||||||
|
ProxiedPlayer proxiedPlayer = ((BungeePlayer) player).getHandle();
|
||||||
((BungeePlayer) player).getHandle().getServer().sendData("ajqueue:tospigot", out.toByteArray());
|
if(proxiedPlayer == null) return;
|
||||||
|
Server server = proxiedPlayer.getServer();
|
||||||
|
if(server == null) return;
|
||||||
|
server.sendData("ajqueue:tospigot", out.toByteArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
@@ -2,11 +2,16 @@ package us.ajg0702.queue.platforms.bungeecord;
|
|||||||
|
|
||||||
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
|
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
|
import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
|
||||||
|
import net.kyori.adventure.title.Title;
|
||||||
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.event.*;
|
import net.md_5.bungee.api.event.*;
|
||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
|
import net.md_5.bungee.chat.BaseComponentSerializer;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
import org.bstats.bungeecord.Metrics;
|
import org.bstats.bungeecord.Metrics;
|
||||||
import org.bstats.charts.SimplePie;
|
import org.bstats.charts.SimplePie;
|
||||||
@@ -24,6 +29,7 @@ import us.ajg0702.queue.platforms.bungeecord.players.BungeePlayer;
|
|||||||
import us.ajg0702.queue.platforms.bungeecord.server.BungeeServer;
|
import us.ajg0702.queue.platforms.bungeecord.server.BungeeServer;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
+66
-3
@@ -1,8 +1,13 @@
|
|||||||
package us.ajg0702.queue.platforms.bungeecord.players;
|
package us.ajg0702.queue.platforms.bungeecord.players;
|
||||||
|
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
|
import net.kyori.adventure.bossbar.BossBar;
|
||||||
|
import net.kyori.adventure.sound.Sound;
|
||||||
|
import net.kyori.adventure.sound.SoundStop;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.ComponentLike;
|
||||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||||
|
import net.kyori.adventure.title.Title;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
@@ -15,6 +20,60 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class BungeePlayer implements AdaptedPlayer, Audience {
|
public class BungeePlayer implements AdaptedPlayer, Audience {
|
||||||
|
@Override
|
||||||
|
public void sendActionBar(@NotNull ComponentLike message) {
|
||||||
|
getAudience().sendActionBar(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showTitle(@NotNull Title title) {
|
||||||
|
getAudience().showTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearTitle() {
|
||||||
|
getAudience().clearTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetTitle() {
|
||||||
|
getAudience().resetTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showBossBar(@NotNull BossBar bar) {
|
||||||
|
getAudience().showBossBar(bar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hideBossBar(@NotNull BossBar bar) {
|
||||||
|
getAudience().hideBossBar(bar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playSound(@NotNull Sound sound) {
|
||||||
|
getAudience().playSound(sound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playSound(@NotNull Sound sound, double x, double y, double z) {
|
||||||
|
getAudience().playSound(sound, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopSound(@NotNull Sound sound) {
|
||||||
|
getAudience().stopSound(sound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playSound(@NotNull Sound sound, Sound.@NotNull Emitter emitter) {
|
||||||
|
getAudience().playSound(sound, emitter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopSound(@NotNull SoundStop stop) {
|
||||||
|
getAudience().stopSound(stop);
|
||||||
|
}
|
||||||
|
|
||||||
final ProxiedPlayer handle;
|
final ProxiedPlayer handle;
|
||||||
|
|
||||||
@@ -30,19 +89,19 @@ public class BungeePlayer implements AdaptedPlayer, Audience {
|
|||||||
@Override
|
@Override
|
||||||
public void sendMessage(@NotNull Component message) {
|
public void sendMessage(@NotNull Component message) {
|
||||||
if(PlainTextComponentSerializer.plainText().serialize(message).isEmpty()) return;
|
if(PlainTextComponentSerializer.plainText().serialize(message).isEmpty()) return;
|
||||||
BungeeQueue.adventure().player(handle).sendMessage(message);
|
getAudience().sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendActionBar(@NotNull Component message) {
|
public void sendActionBar(@NotNull Component message) {
|
||||||
if(PlainTextComponentSerializer.plainText().serialize(message).isEmpty()) return;
|
if(PlainTextComponentSerializer.plainText().serialize(message).isEmpty()) return;
|
||||||
BungeeQueue.adventure().player(handle).sendActionBar(message);
|
getAudience().sendActionBar(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
if(message.isEmpty()) return;
|
if(message.isEmpty()) return;
|
||||||
BungeeQueue.adventure().player(handle).sendMessage(Component.text(message));
|
getAudience().sendMessage(Component.text(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -79,4 +138,8 @@ public class BungeePlayer implements AdaptedPlayer, Audience {
|
|||||||
public ProxiedPlayer getHandle() {
|
public ProxiedPlayer getHandle() {
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Audience getAudience() {
|
||||||
|
return BungeeQueue.adventure().player(handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,15 @@ plugins {
|
|||||||
group = "us.ajg0702.queue.platforms.velocity"
|
group = "us.ajg0702.queue.platforms.velocity"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
//mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
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.9")
|
compileOnly("us.ajg0702:ajUtils:1.1.10")
|
||||||
|
|
||||||
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")
|
||||||
|
|||||||
+53
@@ -4,8 +4,12 @@ import com.velocitypowered.api.proxy.Player;
|
|||||||
import com.velocitypowered.api.proxy.ServerConnection;
|
import com.velocitypowered.api.proxy.ServerConnection;
|
||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
|
import net.kyori.adventure.bossbar.BossBar;
|
||||||
|
import net.kyori.adventure.sound.Sound;
|
||||||
|
import net.kyori.adventure.sound.SoundStop;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||||
|
import net.kyori.adventure.title.Title;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
import us.ajg0702.queue.api.server.AdaptedServer;
|
import us.ajg0702.queue.api.server.AdaptedServer;
|
||||||
@@ -16,6 +20,55 @@ import java.util.Optional;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class VelocityPlayer implements AdaptedPlayer, Audience {
|
public class VelocityPlayer implements AdaptedPlayer, Audience {
|
||||||
|
@Override
|
||||||
|
public void showTitle(@NotNull Title title) {
|
||||||
|
handle.showTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearTitle() {
|
||||||
|
handle.clearTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetTitle() {
|
||||||
|
handle.resetTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showBossBar(@NotNull BossBar bar) {
|
||||||
|
handle.showBossBar(bar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hideBossBar(@NotNull BossBar bar) {
|
||||||
|
handle.hideBossBar(bar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playSound(@NotNull Sound sound) {
|
||||||
|
handle.playSound(sound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playSound(@NotNull Sound sound, double x, double y, double z) {
|
||||||
|
handle.playSound(sound, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopSound(@NotNull Sound sound) {
|
||||||
|
handle.stopSound(sound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playSound(@NotNull Sound sound, Sound.@NotNull Emitter emitter) {
|
||||||
|
handle.playSound(sound, emitter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopSound(@NotNull SoundStop stop) {
|
||||||
|
handle.stopSound(stop);
|
||||||
|
}
|
||||||
|
|
||||||
final Player handle;
|
final Player handle;
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,9 @@ group = "us.ajg0702.queue"
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
//mavenLocal()
|
//mavenLocal()
|
||||||
mavenCentral()
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -22,11 +21,12 @@ 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.9")
|
compileOnly("us.ajg0702:ajUtils:1.1.10")
|
||||||
|
|
||||||
compileOnly("net.kyori:adventure-api:4.8.1")
|
compileOnly("net.kyori:adventure-api:4.8.1")
|
||||||
|
|
||||||
compileOnly(fileTree(mapOf("dir" to "../libs", "include" to listOf("*.jar"))))
|
compileOnly(fileTree(mapOf("dir" to "../libs/private", "include" to listOf("*.jar"))))
|
||||||
|
compileOnly(fileTree(mapOf("dir" to "../libs/public", "include" to listOf("*.jar"))))
|
||||||
|
|
||||||
compileOnly("net.luckperms:api:5.0")
|
compileOnly("net.luckperms:api:5.0")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package us.ajg0702.queue.logic;
|
package us.ajg0702.queue.logic;
|
||||||
|
|
||||||
import us.ajg0702.queue.api.AliasManager;
|
import us.ajg0702.queue.api.AliasManager;
|
||||||
import us.ajg0702.queue.api.Logic;
|
import us.ajg0702.queue.api.premium.Logic;
|
||||||
import us.ajg0702.queue.api.LogicGetter;
|
import us.ajg0702.queue.api.premium.LogicGetter;
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
|
import us.ajg0702.queue.api.premium.PermissionGetter;
|
||||||
import us.ajg0702.queue.common.QueueMain;
|
import us.ajg0702.queue.common.QueueMain;
|
||||||
import us.ajg0702.queue.logic.permissions.PermissionGetter;
|
|
||||||
import us.ajg0702.utils.common.Config;
|
import us.ajg0702.utils.common.Config;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -31,4 +31,9 @@ public class LogicGetterImpl implements LogicGetter {
|
|||||||
if(logic == null) return null;
|
if(logic == null) return null;
|
||||||
return logic.getPermissionGetter().getSelected().getPermissions(player);
|
return logic.getPermissionGetter().getSelected().getPermissions(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PermissionGetter getPermissionGetter() {
|
||||||
|
return logic.getPermissionGetter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package us.ajg0702.queue.logic;
|
package us.ajg0702.queue.logic;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import us.ajg0702.queue.api.Logic;
|
import us.ajg0702.queue.api.premium.Logic;
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
import us.ajg0702.queue.api.players.QueuePlayer;
|
import us.ajg0702.queue.api.players.QueuePlayer;
|
||||||
import us.ajg0702.queue.api.queues.QueueServer;
|
import us.ajg0702.queue.api.queues.QueueServer;
|
||||||
import us.ajg0702.queue.api.util.QueueLogger;
|
import us.ajg0702.queue.api.util.QueueLogger;
|
||||||
import us.ajg0702.queue.common.QueueMain;
|
import us.ajg0702.queue.common.QueueMain;
|
||||||
import us.ajg0702.queue.common.players.QueuePlayerImpl;
|
import us.ajg0702.queue.common.players.QueuePlayerImpl;
|
||||||
import us.ajg0702.queue.logic.permissions.PermissionGetter;
|
import us.ajg0702.queue.api.premium.PermissionGetter;
|
||||||
|
import us.ajg0702.queue.logic.permissions.PermissionGetterImpl;
|
||||||
|
|
||||||
public class PremiumLogic implements Logic {
|
public class PremiumLogic implements Logic {
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ public class PremiumLogic implements Logic {
|
|||||||
|
|
||||||
private final PermissionGetter permissionGetter;
|
private final PermissionGetter permissionGetter;
|
||||||
public PremiumLogic(QueueMain main) {
|
public PremiumLogic(QueueMain main) {
|
||||||
permissionGetter = new PermissionGetter(main);
|
permissionGetter = new PermissionGetterImpl(main);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+11
-3
@@ -1,28 +1,33 @@
|
|||||||
package us.ajg0702.queue.logic.permissions;
|
package us.ajg0702.queue.logic.permissions;
|
||||||
|
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
|
import us.ajg0702.queue.api.premium.PermissionGetter;
|
||||||
|
import us.ajg0702.queue.api.premium.PermissionHook;
|
||||||
import us.ajg0702.queue.common.QueueMain;
|
import us.ajg0702.queue.common.QueueMain;
|
||||||
|
import us.ajg0702.queue.logic.permissions.hooks.AquaCoreHook;
|
||||||
import us.ajg0702.queue.logic.permissions.hooks.BuiltInHook;
|
import us.ajg0702.queue.logic.permissions.hooks.BuiltInHook;
|
||||||
import us.ajg0702.queue.logic.permissions.hooks.LuckPermsHook;
|
import us.ajg0702.queue.logic.permissions.hooks.LuckPermsHook;
|
||||||
import us.ajg0702.queue.logic.permissions.hooks.UltraPermissionsHook;
|
import us.ajg0702.queue.logic.permissions.hooks.UltraPermissionsHook;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class PermissionGetter {
|
public class PermissionGetterImpl implements PermissionGetter {
|
||||||
|
|
||||||
private final List<PermissionHook> hooks;
|
private final List<PermissionHook> hooks;
|
||||||
|
|
||||||
private final QueueMain main;
|
private final QueueMain main;
|
||||||
public PermissionGetter(QueueMain main) {
|
public PermissionGetterImpl(QueueMain main) {
|
||||||
hooks = Arrays.asList(
|
hooks = Arrays.asList(
|
||||||
new BuiltInHook(main),
|
new BuiltInHook(main),
|
||||||
new LuckPermsHook(main),
|
new LuckPermsHook(main),
|
||||||
new UltraPermissionsHook(main)
|
new UltraPermissionsHook(main),
|
||||||
|
new AquaCoreHook(main)
|
||||||
);
|
);
|
||||||
this.main = main;
|
this.main = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PermissionHook selected;
|
private PermissionHook selected;
|
||||||
|
@Override
|
||||||
public PermissionHook getSelected() {
|
public PermissionHook getSelected() {
|
||||||
if(selected != null) return selected;
|
if(selected != null) return selected;
|
||||||
if(hooks == null) {
|
if(hooks == null) {
|
||||||
@@ -40,14 +45,17 @@ public class PermissionGetter {
|
|||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getMaxOfflineTime(AdaptedPlayer player) {
|
public int getMaxOfflineTime(AdaptedPlayer player) {
|
||||||
return getHighestPermission(player, "ajqueue.stayqueued.");
|
return getHighestPermission(player, "ajqueue.stayqueued.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getPriority(AdaptedPlayer player) {
|
public int getPriority(AdaptedPlayer player) {
|
||||||
return getHighestPermission(player, "ajqueue.priority.");
|
return getHighestPermission(player, "ajqueue.priority.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getServerPriotity(String server, AdaptedPlayer player) {
|
public int getServerPriotity(String server, AdaptedPlayer player) {
|
||||||
return getHighestPermission(player, "ajqueue.serverpriority."+server+".");
|
return getHighestPermission(player, "ajqueue.serverpriority."+server+".");
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package us.ajg0702.queue.logic.permissions.hooks;
|
||||||
|
|
||||||
|
import me.activated.core.plugin.AquaCoreAPI;
|
||||||
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
|
import us.ajg0702.queue.common.QueueMain;
|
||||||
|
import us.ajg0702.queue.api.premium.PermissionHook;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AquaCoreHook implements PermissionHook {
|
||||||
|
|
||||||
|
private final QueueMain main;
|
||||||
|
public AquaCoreHook(QueueMain main) {
|
||||||
|
this.main = main;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "AquaCore";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUse() {
|
||||||
|
if(!main.getPlatformMethods().hasPlugin("AquaProxy") ) return false;
|
||||||
|
try {
|
||||||
|
if(AquaCoreAPI.INSTANCE == null) {
|
||||||
|
main.getLogger().warn("AquaCore is installed, but its INSTANCE returned null! Unable to hook into it.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch(NoClassDefFoundError e) {
|
||||||
|
main.getLogger().warning("AquaCore seems to be installed, but its api doesnt seem to be!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getPermissions(AdaptedPlayer player) {
|
||||||
|
AquaCoreAPI api = AquaCoreAPI.INSTANCE;
|
||||||
|
|
||||||
|
List<String> permissions = new ArrayList<>();
|
||||||
|
|
||||||
|
api.getPlayerData(player.getUniqueId()).getActiveGrants().forEach(grant -> {
|
||||||
|
if(!grant.isActiveSomewhere() || grant.hasExpired()) return;
|
||||||
|
permissions.addAll(grant.getRank().getAvailablePermissions());
|
||||||
|
});
|
||||||
|
|
||||||
|
return permissions;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ package us.ajg0702.queue.logic.permissions.hooks;
|
|||||||
|
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
import us.ajg0702.queue.common.QueueMain;
|
import us.ajg0702.queue.common.QueueMain;
|
||||||
import us.ajg0702.queue.logic.permissions.PermissionHook;
|
import us.ajg0702.queue.api.premium.PermissionHook;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import net.luckperms.api.node.NodeType;
|
|||||||
import net.luckperms.api.query.QueryOptions;
|
import net.luckperms.api.query.QueryOptions;
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
import us.ajg0702.queue.common.QueueMain;
|
import us.ajg0702.queue.common.QueueMain;
|
||||||
import us.ajg0702.queue.logic.permissions.PermissionHook;
|
import us.ajg0702.queue.api.premium.PermissionHook;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ import me.TechsCode.UltraPermissions.UltraPermissionsAPI;
|
|||||||
import me.TechsCode.UltraPermissions.storage.objects.User;
|
import me.TechsCode.UltraPermissions.storage.objects.User;
|
||||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||||
import us.ajg0702.queue.common.QueueMain;
|
import us.ajg0702.queue.common.QueueMain;
|
||||||
import us.ajg0702.queue.logic.permissions.PermissionHook;
|
import us.ajg0702.queue.api.premium.PermissionHook;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -27,7 +27,7 @@ public class UltraPermissionsHook implements PermissionHook {
|
|||||||
public boolean canUse() {
|
public boolean canUse() {
|
||||||
if(!main.getPlatformMethods().hasPlugin("UltraPermissions") ) return false;
|
if(!main.getPlatformMethods().hasPlugin("UltraPermissions") ) return false;
|
||||||
if(UltraPermissions.getAPI() == null) {
|
if(UltraPermissions.getAPI() == null) {
|
||||||
main.getLogger().warn("UltraPermissions getApi() method returned null! Unable to hook into it.");
|
main.getLogger().warn("UltraPermissions is installed, but its getApi() method returned null! Unable to hook into it.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -7,13 +7,15 @@ group = "us.ajg0702.queue.spigot"
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
//mavenLocal()
|
//mavenLocal()
|
||||||
mavenCentral()
|
|
||||||
|
|
||||||
maven { url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/") }
|
maven { url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/") }
|
||||||
|
|
||||||
maven { url = uri("https://repo.codemc.io/repository/nms/") }
|
maven { url = uri("https://repo.codemc.io/repository/nms/") }
|
||||||
|
|
||||||
maven { url = uri("https://repo.ajg0702.us") }
|
maven { url = uri("https://repo.ajg0702.us") }
|
||||||
|
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -22,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.9")
|
compileOnly("us.ajg0702:ajUtils:1.1.10")
|
||||||
|
|
||||||
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")
|
||||||
|
|||||||
Reference in New Issue
Block a user