package com.campmongoose.serversaturday.common.command;

import com.campmongoose.serversaturday.common.submission.AbstractBuild;
import com.campmongoose.serversaturday.common.submission.AbstractSubmissions;
import com.campmongoose.serversaturday.common.submission.AbstractSubmitter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.function.BiFunction;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public abstract class AbstractCommand<A extends AbstractCommandArgument<M>, B extends AbstractBuild<T, L, Q>,
        C extends AbstractCommand<A, B, C, I, L, M, P, Q, R, S, T, U, Y, Z>, I, L, M, P,
        Q extends AbstractSubmitter<B, T, L>, R, S extends AbstractSubmissions<P, Q>, T,
        U extends AbstractCommandUsage<A, M, Z>, Y extends AbstractCommandPermissions<Z>, Z> {

    @Nonnull
    protected M description;
    protected BiFunction<Z, List<String>, R> executor;
    @Nonnull
    protected String name;
    protected Y permissions;
    protected U usage;

    public AbstractCommand(@Nonnull String name, @Nonnull M description) {
        this.name = name;
        this.description = description;
    }

    @Nonnull
    public M getDescription() {
        return description;
    }

    @Nonnull
    protected abstract M getHelp();

    @Nonnull
    public String getName() {
        return name;
    }

    @Nonnull
    public Y getPermissions() {
        return permissions;
    }

    @Nonnull
    protected abstract I getPluginInstance();

    @Nonnull
    protected abstract S getSubmissions();

    @Nonnull
    protected abstract Q getSubmitter(@Nonnull P player);

    @Nullable
    protected abstract Q getSubmitter(@Nonnull UUID uuid);

    @Nullable
    protected abstract Q getSubmitter(@Nonnull String playerName);

    @Nonnull
    public U getUsage() {
        return usage;
    }

    protected List<String> moveArguments(List<String> args) {
        if (!args.isEmpty()) {
            args.remove(0);
        }

        return args;
    }

    protected String[] moveArguments(String[] args) {
        List<String> list = new ArrayList<>();
        Collections.addAll(list, args);
        if (!list.isEmpty()) {
            list.remove(0);
        }

        return list.toArray(new String[list.size()]);
    }
}

@@ -308,38 +308,8 @@
 st;%0A
-import java.util.Collections;%0A
 impo
@@ -1946,232 +1946,44 @@
     
-if (!args.isEmpty()) %7B%0A            args.remove(0);%0A        %7D%0A%0A        return args;%0A    %7D%0A%0A    protected String%5B%5D moveArguments(String%5B%5D args) %7B%0A        List%3CString%3E list = new ArrayList%3C%3E();%0A        Collections.addAll(list, 
+List%3CString%3E list = new ArrayList%3C%3E(
 args
@@ -2051,24 +2051,24 @@
 %0A        %7D%0A%0A
+
         retu
@@ -2078,41 +2078,8 @@
 list
-.toArray(new String%5Blist.size()%5D)
 ;%0A  

Remove old moveArguments method and fix UnsupportedOperationException in the newer one.