package io.github.dead_i.bungeerelay.commands;

import io.github.dead_i.bungeerelay.IRC;
import io.github.dead_i.bungeerelay.Util;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.plugin.Command;

public class PMReplyCommand extends Command {
    public PMReplyCommand() {
        super("pmreply");
    }

    @Override
    public void execute(CommandSender sender, String[] args) {
        if (args.length == 0) {
            Util.sendError(sender, "Usage: /pmreply <message ...>");
            return;
        }
        if (!IRC.sock.isConnected()) {
            Util.sendError(sender, "The proxy is not connected to IRC.");
            return;
        }
        if (!IRC.replies.containsKey(sender)) {
            Util.sendError(sender, "You must be engaged within a conversation to use this.");
            return;
        }
        String to = IRC.replies.get(sender);
        String uid = Util.getUidByNick(to);
        if (uid == null) {
            Util.sendError(sender, to + " is no longer on IRC.");
            return;
        }

        StringBuilder msg = new StringBuilder();
        for (String a : args) msg.append(a).append(" ");

        IRC.out.println(":" + IRC.uids.get(sender) + " PRIVMSG " + uid + " :" + msg);
        sender.sendMessage(new TextComponent(ChatColor.translateAlternateColorCodes('&', IRC.config.getString("formats.privatemsg")
                .replace("{SENDER}", sender.getName())
                .replace("{MESSAGE}", msg.toString().trim()))));
    }
}

@@ -156,105 +156,20 @@
 pi.C
-hatColor;%0Aimport net.md_5.bungee.api.CommandSender;%0Aimport net.md_5.bungee.api.chat.TextComponent
+ommandSender
 ;%0Aim
@@ -834,32 +834,33 @@
 turn;%0A        %7D%0A
+%0A
         String t
@@ -861,253 +861,93 @@
 ring
- to = IRC.replies.get(sender);%0A        String uid = Util.getUidByNick(to);%0A        if (uid == null) %7B%0A            Util.sendError(sender, to + %22 is no longer on IRC.%22);%0A            return;%0A        %7D%0A%0A        StringBuilder msg = new StringBuil
+%5B%5D newargs = new String%5Bargs.length + 1%5D;%0A        newargs%5B0%5D = IRC.replies.get(sen
 der
-(
 );%0A 
@@ -962,388 +962,136 @@
 or (
-String a : args) msg.append(a).append(%22 %22);%0A%0A        IRC.out.println(%22:%22 + IRC.uids.get(sender) + %22 PRIVMSG %22 + uid + %22 :%22 + msg);%0A        sender.sendMessage(new TextComponent(ChatColor.translateAlternateColorCodes('&', IRC.config.getString(%22formats.privatemsg%22)%0A                .replace(%22%7BSENDER%7D%22, sender.getName())%0A                .replace(%22%7BMESSAGE%7D%22, msg.toString().trim())))
+int i = 0; i %3C args.length; i++) %7B%0A            newargs%5Bi+1%5D = args%5Bi%5D;%0A        %7D%0A        new PMCommand().execute(sender, newargs
 );%0A 

Make PMReplyCommand a wrapper around PMCommand