Fix kyori, add permissionlist command, fix luckperms getting wrong context
This commit is contained in:
@@ -6,7 +6,7 @@ plugins {
|
||||
group = "us.ajg0702.queue.common"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
//mavenLocal()
|
||||
mavenCentral()
|
||||
maven { url = uri("https://repo.ajg0702.us") }
|
||||
}
|
||||
|
||||
@@ -31,6 +31,11 @@ public class BaseCommand implements IBaseCommand {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInTabComplete() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Messages getMessages() {
|
||||
return null;
|
||||
|
||||
@@ -27,6 +27,11 @@ public class ISP extends SubCommand {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInTabComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermission() {
|
||||
return null;
|
||||
|
||||
@@ -27,6 +27,7 @@ public class ManageCommand extends BaseCommand {
|
||||
addSubCommand(new ISP(main));
|
||||
addSubCommand(new QueueList(main));
|
||||
addSubCommand(new Send(main));
|
||||
addSubCommand(new PermissionList(main));
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +88,7 @@ public class ManageCommand extends BaseCommand {
|
||||
}
|
||||
List<String> commands = new ArrayList<>();
|
||||
for(ISubCommand subCommand : subCommands) {
|
||||
if(!subCommand.showInTabComplete()) continue;
|
||||
commands.add(subCommand.getName());
|
||||
commands.addAll(subCommand.getAliases());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package us.ajg0702.queue.commands.commands.manage;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.kyori.adventure.text.Component;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class PermissionList extends SubCommand {
|
||||
|
||||
final QueueMain main;
|
||||
public PermissionList(QueueMain main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "permissionlist";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableList<String> getAliases() {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInTabComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermission() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Messages getMessages() {
|
||||
return main.getMessages();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(ICommandSender sender, String[] args) {
|
||||
if(!checkPermission(sender)) return;
|
||||
List<String> permissions = main.getLogicGetter().getPermissions(main.getPlatformMethods().senderToPlayer(sender));
|
||||
if(permissions == null) {
|
||||
sender.sendMessage(Component.text("no permission handler"));
|
||||
return;
|
||||
}
|
||||
permissions.forEach(s -> {
|
||||
if(!s.toLowerCase(Locale.ROOT).contains("ajqueue")) return;
|
||||
sender.sendMessage(Component.text(s));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> autoComplete(ICommandSender sender, String[] args) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,11 @@ public class Tasks extends SubCommand {
|
||||
return "ajqueue.manage.tasks";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInTabComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Messages getMessages() {
|
||||
return main.getMessages();
|
||||
|
||||
@@ -75,6 +75,10 @@ public class QueueMain {
|
||||
return queueManager;
|
||||
}
|
||||
|
||||
private final LogicGetter logicGetter;
|
||||
public LogicGetter getLogicGetter() {
|
||||
return logicGetter;
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
taskManager.shutdown();
|
||||
@@ -86,6 +90,8 @@ public class QueueMain {
|
||||
|
||||
public QueueMain(QueueLogger logger, PlatformMethods platformMethods, File dataFolder) {
|
||||
|
||||
logicGetter = new LogicGetterImpl();
|
||||
|
||||
if(instance != null) {
|
||||
try {
|
||||
throw new Exception("ajQueue QueueMain is being initialized when there is already one! Still initializing it, but this can cause issues.");
|
||||
@@ -114,8 +120,8 @@ public class QueueMain {
|
||||
|
||||
queueManager = new QueueManagerImpl(this);
|
||||
|
||||
logic = new LogicGetterImpl().constructLogic();
|
||||
aliasManager = new LogicGetterImpl().constructAliasManager(config);
|
||||
logic = logicGetter.constructLogic();
|
||||
aliasManager = logicGetter.constructAliasManager(config);
|
||||
|
||||
taskManager.rescheduleTasks();
|
||||
|
||||
|
||||
@@ -2,8 +2,11 @@ package us.ajg0702.queue.logic;
|
||||
|
||||
import us.ajg0702.queue.api.AliasManager;
|
||||
import us.ajg0702.queue.api.Logic;
|
||||
import us.ajg0702.queue.api.players.AdaptedPlayer;
|
||||
import us.ajg0702.utils.common.Config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LogicGetterImpl implements us.ajg0702.queue.api.LogicGetter {
|
||||
|
||||
@Override
|
||||
@@ -15,4 +18,9 @@ public class LogicGetterImpl implements us.ajg0702.queue.api.LogicGetter {
|
||||
public AliasManager constructAliasManager(Config config) {
|
||||
return new FreeAliasManager(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getPermissions(AdaptedPlayer player) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user