com.techcavern.wavetact.ircCommands.fun.Prism.java Source code

Java tutorial

Introduction

Here is the source code for com.techcavern.wavetact.ircCommands.fun.Prism.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.techcavern.wavetact.ircCommands.fun;

import com.techcavern.wavetact.annot.IRCCMD;
import com.techcavern.wavetact.objects.IRCCommand;
import com.techcavern.wavetact.utils.GeneralUtils;
import com.techcavern.wavetact.utils.IRCUtils;
import com.techcavern.wavetact.utils.Registry;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.pircbotx.Channel;
import org.pircbotx.PircBotX;
import org.pircbotx.User;

/**
 * @author jztech101
 */
@IRCCMD
public class Prism extends IRCCommand {

    public Prism() {
        super(GeneralUtils.toArray("prism"), 0, "prism [something]", "colors a string", false);
    }

    @Override
    public void onCommand(User user, PircBotX network, String prefix, Channel channel, boolean isPrivate,
            int userPermLevel, String... args) throws Exception {
        String prism = "";
        for (char c : StringUtils.join(args, " ").replace("\n", " ").toCharArray()) {
            prism += IRCUtils.prism(c);
        }
        IRCUtils.sendMessage(user, network, channel, prism, prefix);
    }
}