当前位置: 首页>>代码示例>>Java>>正文


Java Colors.removeFormattingAndColors方法代码示例

本文整理汇总了Java中org.pircbotx.Colors.removeFormattingAndColors方法的典型用法代码示例。如果您正苦于以下问题:Java Colors.removeFormattingAndColors方法的具体用法?Java Colors.removeFormattingAndColors怎么用?Java Colors.removeFormattingAndColors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pircbotx.Colors的用法示例。


在下文中一共展示了Colors.removeFormattingAndColors方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMessage

import org.pircbotx.Colors; //导入方法依赖的package包/类
@Override
public void onMessage(MessageEvent event) throws Exception
{
    User user = event.getUser();
    if (user == null)
        return;

    // Ignore own messages
    if ( user.equals( bot.getUserBot() ) )
        return;

    // Don't bother with IRC formatting
    String message = Colors.removeFormattingAndColors( event.getMessage() );

    LOG.trace("Message from {}: {}", user.getNick(), message);
    BRIDGE.onIRCMessage(user, message);
}
 
开发者ID:Gamealition,项目名称:JDiscordIRC,代码行数:18,代码来源:IRCManager.java

示例2: onAction

import org.pircbotx.Colors; //导入方法依赖的package包/类
@Override
public void onAction(ActionEvent event) throws Exception
{
    User user = event.getUser();
    if (user == null)
        return;

    // Ignore own messages
    if ( user.equals( bot.getUserBot() ) )
        return;

    // Don't bother with IRC formatting
    String action = Colors.removeFormattingAndColors( event.getAction() );

    LOG.trace("Action from {}: {}", user.getNick(), action);
    BRIDGE.onIRCAction(user, action);
}
 
开发者ID:Gamealition,项目名称:JDiscordIRC,代码行数:18,代码来源:IRCManager.java

示例3: handleLink

import org.pircbotx.Colors; //导入方法依赖的package包/类
/**
 * Takes actions when specific links are sent
 * @param message The message containing links
 * @param channel The channel the message got sent in
 * @param user The user the message got sent by
 */
public static void handleLink(String message, String channel, String user) throws Exception
{
	outer:
	for(String s : message.split(" "))
	{
		s = Colors.removeFormattingAndColors(s);

		if(s.contains("www.") || s.contains("http://") || s.contains("https://"))
		{
			for(LinkAction la : linkActions)
			{
				if(la.isValid(channel, s))
				{
					la.handle(channel, user, s);
					continue outer;
				}
			}
		}
	}
}
 
开发者ID:bl4ckscor3,项目名称:bl4ckb0t,代码行数:27,代码来源:LinkManager.java

示例4: onPrivateMessage

import org.pircbotx.Colors; //导入方法依赖的package包/类
@Override
public void onPrivateMessage(PrivateMessageEvent e) {
    if (!e.getMessage().trim().split(" ")[0].equalsIgnoreCase("message")) return;
    final User u = e.getUser();
    String[] args = e.getMessage().split(" ");
    args = (String[]) ArrayUtils.subarray(args, 1, args.length);
    if (args.length < 2) {
        e.respond("Usage: message [name] [message]");
        return;
    }
    final String target = args[0];
    String message = StringUtils.join(args, " ", 1, args.length);
    final Player t = plugin.getServer().getPlayer(target);
    if (t == null) {
        e.respond("No such player.");
        return;
    }
    if (Config.allowColors) message = RUtils.ircColorsToMinecraftColors(message);
    else message = Colors.removeFormattingAndColors(message);
    String send = Config.ituMessage;
    send = send.replace("{server}", e.getBot().getServerInfo().getServerName());
    send = send.replace("{name}", u.getNick());
    send = send.replace("{message}", message);
    t.sendMessage(send);
}
 
开发者ID:RoyalDev,项目名称:RoyalIRC,代码行数:26,代码来源:IPCmdMessage.java

示例5: ircColorsToMinecraftColors

import org.pircbotx.Colors; //导入方法依赖的package包/类
public static String ircColorsToMinecraftColors(String s) {
    s = s.replace(Colors.BLACK, ChatColor.BLACK.toString());
    s = s.replace(Colors.BLUE, ChatColor.BLUE.toString());
    s = s.replace(Colors.BOLD, ChatColor.BOLD.toString());
    s = s.replace(Colors.BROWN, ChatColor.DARK_RED.toString());
    s = s.replace(Colors.CYAN, ChatColor.BLUE.toString());
    s = s.replace(Colors.DARK_BLUE, ChatColor.DARK_BLUE.toString());
    s = s.replace(Colors.DARK_GRAY, ChatColor.DARK_GRAY.toString());
    s = s.replace(Colors.DARK_GREEN, ChatColor.DARK_GREEN.toString());
    s = s.replace(Colors.GREEN, ChatColor.GREEN.toString());
    s = s.replace(Colors.LIGHT_GRAY, ChatColor.GRAY.toString());
    s = s.replace(Colors.MAGENTA, ChatColor.DARK_PURPLE.toString());
    s = s.replace(Colors.NORMAL, ChatColor.RESET.toString());
    s = s.replace(Colors.OLIVE, ChatColor.DARK_GREEN.toString());
    s = s.replace(Colors.PURPLE, ChatColor.LIGHT_PURPLE.toString());
    s = s.replace(Colors.RED, ChatColor.RED.toString());
    s = s.replace(Colors.REVERSE, "");
    s = s.replace(Colors.TEAL, ChatColor.AQUA.toString());
    s = s.replace(Colors.UNDERLINE, ChatColor.UNDERLINE.toString());
    s = s.replace(Colors.WHITE, ChatColor.WHITE.toString());
    s = s.replace(Colors.YELLOW, ChatColor.YELLOW.toString());
    s = Colors.removeFormattingAndColors(s); // catch any stragglers
    return s;
}
 
开发者ID:RoyalDev,项目名称:RoyalIRC,代码行数:25,代码来源:RUtils.java

示例6: stripFormat

import org.pircbotx.Colors; //导入方法依赖的package包/类
public static String stripFormat(String message) {
    String stripped = Colors.removeFormattingAndColors(message);
    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < stripped.length(); i++) {
        char c = stripped.charAt(i);
        if (c != '\u001d') {
            buffer.append(c);
        }
    }
    return buffer.toString();
}
 
开发者ID:likcoras,项目名称:A-Gario,代码行数:12,代码来源:Utils.java

示例7: log

import org.pircbotx.Colors; //导入方法依赖的package包/类
/**
 * Retains the original PircBotX.log() functionality, while adding the 
 * ability to output the log to a file.
 * @param line the line to add to the log
 */
@Override
public void log(String line){
    if (verbose) {
        Date time = new Date(System.currentTimeMillis());
        String output = Colors.removeFormattingAndColors(line);
        
        System.out.println(timeFormat.format(time) + "  " + output);
        try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(logFile,true)))) {
            out.println(timeFormat.format(time) + "  " + output);
        } catch(IOException e) {
            System.err.println("Error: unable to write to " + logFile);
        }
    }
}
 
开发者ID:brrr2,项目名称:irccasino,代码行数:20,代码来源:CasinoBot.java

示例8: executeCommand

import org.pircbotx.Colors; //导入方法依赖的package包/类
@Override
public BotResponse executeCommand(final IRCbutt butt, final GenericMessageEvent event, final String[] cmd) {
    return new BotResponse(BotIntention.CHAT, null, Colors.removeFormattingAndColors(StringUtils.getArgs(cmd)));
}
 
开发者ID:proxa,项目名称:IRCbutt,代码行数:5,代码来源:EchoCommand.java

示例9: removeColorsAndFormatting

import org.pircbotx.Colors; //导入方法依赖的package包/类
public static String[] removeColorsAndFormatting(String[] input) {
    for (int i = 0; i < input.length; i++) {
        input[i] = Colors.removeFormattingAndColors(input[i]);
    }
    return input;
}
 
开发者ID:TechCavern,项目名称:WaveTact,代码行数:7,代码来源:GeneralUtils.java

示例10: sendToMinecraft

import org.pircbotx.Colors; //导入方法依赖的package包/类
public void sendToMinecraft(String s) {
    if (Config.allowColors) s = RUtils.ircColorsToMinecraftColors(s);
    else s = Colors.removeFormattingAndColors(s);
    getServer().broadcastMessage(s);
}
 
开发者ID:RoyalDev,项目名称:RoyalIRC,代码行数:6,代码来源:RoyalIRC.java


注:本文中的org.pircbotx.Colors.removeFormattingAndColors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。