more progress
This commit is contained in:
+13
-2
@@ -1,5 +1,6 @@
|
||||
package us.ajg0702.queue.platforms.velocity;
|
||||
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -10,14 +11,15 @@ import us.ajg0702.queue.api.players.QueuePlayer;
|
||||
import us.ajg0702.queue.api.queues.QueueServer;
|
||||
import us.ajg0702.queue.platforms.velocity.players.VelocityPlayer;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class PlatformMethodImpl implements PlatformMethods {
|
||||
public class PlatformMethodsImpl implements PlatformMethods {
|
||||
|
||||
final ProxyServer proxyServer;
|
||||
final Logger logger;
|
||||
|
||||
public PlatformMethodImpl(ProxyServer proxyServer, Logger logger) {
|
||||
public PlatformMethodsImpl(ProxyServer proxyServer, Logger logger) {
|
||||
this.proxyServer = proxyServer;
|
||||
this.logger = logger;
|
||||
}
|
||||
@@ -38,4 +40,13 @@ public class PlatformMethodImpl implements PlatformMethods {
|
||||
public AdaptedPlayer senderToPlayer(ICommandSender sender) {
|
||||
return new VelocityPlayer((Player) sender.getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginVersion() {
|
||||
Optional<PluginContainer> plugin = proxyServer.getPluginManager().getPlugin("ajqueue");
|
||||
if(plugin.isEmpty()) return "?E";
|
||||
Optional<String> version = plugin.get().getDescription().getVersion();
|
||||
if(version.isEmpty()) return "?V";
|
||||
return version.get();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class VelocityQueue {
|
||||
public void onProxyInit(ProxyInitializeEvent e) {
|
||||
main = new QueueMain(
|
||||
logger,
|
||||
new PlatformMethodImpl(proxyServer, logger),
|
||||
new PlatformMethodsImpl(proxyServer, logger),
|
||||
dataFolder
|
||||
);
|
||||
main.setServerBuilder(new ServerBuilderImpl(main, proxyServer));
|
||||
|
||||
+7
-1
@@ -4,6 +4,8 @@ import com.velocitypowered.api.command.RawCommand;
|
||||
import us.ajg0702.queue.commands.BaseCommand;
|
||||
import us.ajg0702.queue.common.QueueMain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class VelocityCommand implements RawCommand {
|
||||
@@ -23,7 +25,11 @@ public class VelocityCommand implements RawCommand {
|
||||
|
||||
@Override
|
||||
public List<String> suggest(final Invocation invocation) {
|
||||
return command.autoComplete(new VelocitySender(invocation.source()), invocation.arguments().split(" "));
|
||||
List<String> args = new ArrayList<>(Arrays.asList(invocation.arguments().split(" ")));
|
||||
if(invocation.arguments().length() > 0 &&invocation.arguments().charAt(invocation.arguments().length()-1) == ' ') {
|
||||
args.add(" ");
|
||||
}
|
||||
return command.autoComplete(new VelocitySender(invocation.source()), args.toArray(new String[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user