Added plus-level-fallback to allow some leveled permissions on ajQueuePlus to work without a supported permission plugin
This commit is contained in:
@@ -350,6 +350,12 @@ include-server-switch-in-cooldown: false
|
||||
# If ajQueue is pinging your backend servers too often, raise this number
|
||||
minimum-ping-time: 1.0
|
||||
|
||||
# In ajQueuePlus, if your permission plugin isn't yet supported, you can use this workaround to
|
||||
# be able to use levels 1-10 for priority, or 15, 30, 60, and 120 for stayqueued
|
||||
# If you want more levels than that, contact aj to add support for your permission plugin if possible.
|
||||
# Does nothing if you are not on ajQueuePlus, or if you have a supported permission plugin
|
||||
plus-level-fallback: false
|
||||
|
||||
# Should we print some extra stuff to the console that might help aj diagnose some issues?
|
||||
debug: false
|
||||
|
||||
@@ -364,5 +370,5 @@ debug: false
|
||||
|
||||
|
||||
|
||||
# Dont touch this number please
|
||||
config-version: 36
|
||||
# Don't touch this number please
|
||||
config-version: 37
|
||||
|
||||
@@ -5,6 +5,8 @@ import us.ajg0702.queue.common.QueueMain;
|
||||
import us.ajg0702.queue.api.premium.PermissionHook;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BuiltInHook implements PermissionHook {
|
||||
@@ -26,9 +28,41 @@ public class BuiltInHook implements PermissionHook {
|
||||
|
||||
@Override
|
||||
public List<String> getPermissions(AdaptedPlayer player) {
|
||||
if(main.getPlatformMethods().getImplementationName().equals("velocity")) {
|
||||
return new ArrayList<>();
|
||||
if(main.getConfig().getBoolean("plus-level-fallback")) {
|
||||
List<String> hasPermissions = new ArrayList<>();
|
||||
for (String fallbackPermission : fallbackPermissions) {
|
||||
if(player.hasPermission(fallbackPermission)) {
|
||||
hasPermissions.add(fallbackPermission);
|
||||
}
|
||||
}
|
||||
if(!main.getPlatformMethods().getImplementationName().equals("velocity")) {
|
||||
hasPermissions.addAll(player.getPermissions());
|
||||
}
|
||||
return hasPermissions;
|
||||
}
|
||||
|
||||
|
||||
if(main.getPlatformMethods().getImplementationName().equals("velocity")) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return player.getPermissions();
|
||||
}
|
||||
|
||||
private final List<String> fallbackPermissions = Arrays.asList(
|
||||
"ajqueue.priority.1",
|
||||
"ajqueue.priority.2",
|
||||
"ajqueue.priority.3",
|
||||
"ajqueue.priority.4",
|
||||
"ajqueue.priority.5",
|
||||
"ajqueue.priority.6",
|
||||
"ajqueue.priority.7",
|
||||
"ajqueue.priority.8",
|
||||
"ajqueue.priority.9",
|
||||
"ajqueue.priority.10",
|
||||
"ajqueue.stayqueued.15",
|
||||
"ajqueue.stayqueued.30",
|
||||
"ajqueue.stayqueued.60",
|
||||
"ajqueue.stayqueued.120"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user