Hello, I am trying to make a bungeecord plugin with the command /L, so if you did /L it would send you to the Lobby server, and if you did /L skyblock it would send you to the skyblock server, I got the /L to work but I can get the args to work any help please! Error I get in console will be down the under the code. Code (Java): package best.ashton.bungee.Commands; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.plugin.Command; import java.lang.reflect.Proxy; public class ServerCommand extends Command { public ServerCommand() { super("l", "dev.lobby"); } @Override public void execute(CommandSender sender, String[] args) { if (args.length == 0) { ProxiedPlayer p = (ProxiedPlayer) sender; p.connect(ProxyServer.getInstance().getServerInfo("Lobby")); return; } else if (args.length == 1) { if (args[1].equalsIgnoreCase("Skyblock")) { ProxiedPlayer p = (ProxiedPlayer) sender; p.connect(ProxyServer.getInstance().getServerInfo("Skyblock")); } } } } Code (Java): 19:56:31 [WARNING] Error in dispatching command java.lang.ArrayIndexOutOfBoundsException: 1 at best.ashton.Commands.ServerCommand.execute(ServerCommand.java:31) at net.md_5.bungee.api.plugin.PluginManager.dispatchCommand(PluginManager.java:192) at net.md_5.bungee.api.plugin.PluginManager.dispatchCommand(PluginManager.java:142) at net.md_5.bungee.connection.UpstreamBridge.handle(UpstreamBridge.java:148) at net.md_5.bungee.protocol.packet.Chat.handle(Chat.java:50) at net.md_5.bungee.netty.HandlerBoss.channelRead(HandlerBoss.java:104) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:321) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:295) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.lang.Thread.run(Unknown Source)
Code (Text): } else if (args.length == 1) { if (args[1].equalsIgnoreCase("Skyblock")) { Array index starts from 0, so you should be checking args[0] if the length of the array is 1.
He mean you have to do this: Code (Text): } else if(args.length == 1) { if(args[0].equalsIgnoreCase("Skyblock")) { An argument always start with 0 not with 1.
Then you lack the Java knowledge to create basic plugins https://www.spigotmc.org/threads/beginner-programming-mistakes-and-why-youre-making-them.278876/ https://www.spigotmc.org/threads/read-me-for-everyone-asking-questions-on-here.72946/ Consider learning some more Java first, because you're making basic mistakes.