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


Java ChatColor.stripColor方法代码示例

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


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

示例1: getAttributeDoubleValue

import org.bukkit.ChatColor; //导入方法依赖的package包/类
private static double getAttributeDoubleValue(String lore, String prefix) {
    if (lore.contains(":") && lore.split(":").length == 2) {
        if (lore.split(":")[0].equalsIgnoreCase(prefix)) {
            lore = ChatColor.stripColor(lore);
            lore = lore.split(":")[1].trim();
            if (lore.matches("[+\\-]?[0-9]*(\\.[0-9]*)?")) {
                return Double.parseDouble(lore);
            } else if (lore.matches("[+\\-]?[0-9]*(\\.[0-9]*)?-[+\\-]?[0-9]*(\\.[0-9]*)?")) {
                double first = Double.parseDouble(lore.startsWith("-")
                        ? "-" + lore.substring(1).split("-")[0]
                        : lore.split("-")[0]);
                double last = Double.parseDouble(lore.startsWith("-")
                        ? lore.substring(1).substring(lore.substring(1).indexOf("-") + 1)
                        : lore.substring(lore.indexOf("-") + 1));
                return RandomUtil.random(first, last);
            } else if (lore.matches("[0-9]*[Dd][0-9]*")) {
                return RandomUtil.rollDice(lore);
            }
        }
    }
    return 0;
}
 
开发者ID:IzzelAliz,项目名称:TalentZzzz,代码行数:23,代码来源:LoreUtils.java

示例2: onClick

import org.bukkit.ChatColor; //导入方法依赖的package包/类
@EventHandler
public void onClick(InventoryClickEvent e){
    Player p = (Player) e.getWhoClicked();
    WCUser user = new WCUser(p.getUniqueId());
    Inventory inv = e.getClickedInventory();
    ItemStack i = e.getCurrentItem();

    switch (ChatColor.stripColor(inv.getName())){
        case "Servidores":
            switch (e.getSlot()){
                case 21:
                    user.sendToServer("survival");
                    break;

                default:
                    break;
            }
            break;
    }
}
 
开发者ID:cadox8,项目名称:WC,代码行数:21,代码来源:InventoryEvent.java

示例3: getData

import org.bukkit.ChatColor; //导入方法依赖的package包/类
public EventKeyData getData(List<String> itemLore) {
    if (itemLore.size() < 2) {
        return null;
    }

    String first = ChatColor.stripColor(itemLore.get(1));
    if (first == null)
        return null;

    for (EventType eventType : EventType.values()) {
        if (first.contains(eventType.getDisplayName())) {
            return new EventKeyData(eventType, Character.getNumericValue(first.charAt(first.length() - 1)));
        }
    }

    return null;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:18,代码来源:EventKey.java

示例4: onInteractEntity

import org.bukkit.ChatColor; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onInteractEntity(PlayerInteractEntityEvent e) {
    TOAUser u = TOA.getPlayer(e.getPlayer());

    e.setCancelled(true);

    if (e.getRightClicked() instanceof Villager) {
        Villager v = (Villager) e.getRightClicked();
        if (v.getCustomName().equalsIgnoreCase("") || v.getCustomName() == null) return;

        switch (ChatColor.stripColor(v.getCustomName())) {
            case "Comprador Variado":
                TOAMenu.openMenu(u, TOAMenu.MenuType.VARIADO);
                break;
            case "Comprador Armas":
                TOAMenu.openMenu(u, TOAMenu.MenuType.ARMAS);
                break;
        }
    }
}
 
开发者ID:cadox8,项目名称:PA,代码行数:21,代码来源:PlayerEvents.java

示例5: constructPrefix

import org.bukkit.ChatColor; //导入方法依赖的package包/类
/**
 * Constructs a prefix from the given source
 *
 * @param source source
 * @return prefix
 */
private String constructPrefix(String source) {
    final StringBuilder b = new StringBuilder();
    for (int i = 0; i < source.length(); i++) {
        final char t = source.charAt(i);
        if (t != '%') {
            b.append(t);
        } else {
            return ChatColor.stripColor(b.toString());
        }
    }
    return ChatColor.stripColor(b.toString());
}
 
开发者ID:Shynixn,项目名称:PetBlocks,代码行数:19,代码来源:PetDataListener.java

示例6: upgrade

import org.bukkit.ChatColor; //导入方法依赖的package包/类
public ItemStack upgrade() {
	List<String> lore = new ArrayList<String>();
	lore.add("&7&oEnder Infused");
	lore.add("");
	for (String line: getItem().getItemMeta().getLore()) {
		lore.add(line);
	}
	ItemStack item = new CustomItem(getItem().getType(), "&5Ender " + ChatColor.stripColor(getItem().getItemMeta().getDisplayName()), getItem().getDurability(), lore.toArray(new String[lore.size()]));
	return item;
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:11,代码来源:Talisman.java

示例7: getMessage

import org.bukkit.ChatColor; //导入方法依赖的package包/类
public String getMessage(String key, boolean stripColor, Object... args) {
    if (!this.messageCache.containsKey(key)) {
        this.messageCache.put(key, new MessageFormat(
                ChatColor.translateAlternateColorCodes(
                        '&', this.language.getProperty(key, "Unknown localization key: \"" + key + "\"")
                )
        ));
    }
    String out = this.messageCache.get(key).format(args);
    return stripColor ? ChatColor.stripColor(out) : out;
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:12,代码来源:FileLanguage.java

示例8: pm

import org.bukkit.ChatColor; //导入方法依赖的package包/类
/**
 * Sends a plugin message.
 * @param msg
 */
public void pm(String msg) {
	msg = "[" + ChatColor.DARK_PURPLE + "PSPS" + ChatColor.RESET + "] " + msg;
	if (getConfig().getBoolean("logging.disable-colors", false)) {
		msg = ChatColor.stripColor(msg);
	}
	getServer().getConsoleSender().sendMessage(msg);
}
 
开发者ID:ProtocolSupport,项目名称:ProtocolSupportPocketStuff,代码行数:12,代码来源:ProtocolSupportPocketStuff.java

示例9: debug

import org.bukkit.ChatColor; //导入方法依赖的package包/类
/**
 * Sends a debug plugin message.
 * @param msg
 */
public void debug(String msg) {
	if (!getConfig().getBoolean("logging.enable-debug", false)) { return; }
	msg = "[" + ChatColor.RED + "PSPS" + ChatColor.RESET + "] " + msg;
	if (getConfig().getBoolean("logging.disable-colors", false)) {
		msg = ChatColor.stripColor(msg);
	}
	getServer().getConsoleSender().sendMessage(msg);
}
 
开发者ID:ProtocolSupport,项目名称:ProtocolSupportPocketStuff,代码行数:13,代码来源:ProtocolSupportPocketStuff.java

示例10: createHomes

import org.bukkit.ChatColor; //导入方法依赖的package包/类
public Map<String, TempMarker> createHomes() {
    Map<String, TempMarker> ret = new HashMap<>();

    // Loop current factions
    for (Faction faction : factions.getActive()) {
        Location ps = faction.getHome();
        if (ps == null) {
            continue;
        }

        DynmapStyle style = faction.getDynmapStyle();

        String markerId = factionsHome + faction.getId();

        TempMarker temp = new TempMarker();
        temp.label = ChatColor.stripColor(faction.getName());
        temp.world = ps.getWorld().toString();
        temp.x = ps.getX();
        temp.y = ps.getY();
        temp.z = ps.getZ();
        temp.iconName = style.getHomeMarker();
        temp.description = getDescription(faction);

        ret.put(markerId, temp);
    }

    return ret;
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:29,代码来源:FactionMap.java

示例11: sendDeathMessage

import org.bukkit.ChatColor; //导入方法依赖的package包/类
private void sendDeathMessage(PlayerDeathEvent event) {
    if(!safeToSend(event))
        return;
    boolean bc = configsManager.getModChannelConfig().getBoolean("See_Player_Death");
    String msg = ChatColor.stripColor(event.getDeathMessage());
    messenger.sendMessageToAllBoundChannel("```css" + "\n[" + msg + "]\n```");
    if (bc)
        messenger.sendMessageToAllModChannel("```css" + "\n[" + msg + "]\n```");
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:10,代码来源:DeathListener.java

示例12: onBroadcastCommand

import org.bukkit.ChatColor; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onBroadcastCommand(ServerCommandEvent event) {
    String cmd = ChatColor.stripColor(event.getCommand());
    if (cmd.equals("broadcast ") || cmd.equals("bc ")) {
        String msg = cmd.split(" ", 2)[1];
        messenger.sendMessageToAllBoundChannel("\uD83D\uDCE2 " + msg);
        boolean seeBc = configsManager.getModChannelConfig().getBoolean("See_Broadcast");
        if(seeBc) {
            messenger.sendMessageToAllModChannel("\uD83D\uDCE2 " + msg );
        }
    }
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:13,代码来源:BroadcastCommandListener.java

示例13: onPlayerAsyncChatEvent2

import org.bukkit.ChatColor; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerAsyncChatEvent2(PlayerChatEvent event) {
    if (!Config.getInstance().isAsyncChat() && !Config.getInstance().isHighpriority()) {
        if (this.pages.containsKey(event.getPlayer())) {
            event.setCancelled(true);
            final String message = ChatColor.stripColor(event.getMessage());
            this.handleChatMessage(event.getPlayer(), message);
        }
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:11,代码来源:SChatMenuManager.java

示例14: playerChatEvent

import org.bukkit.ChatColor; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void playerChatEvent(AsyncPlayerChatEvent event) {
    if (Config.getInstance().isAsyncChat() && Config.getInstance().isHighpriority()) {
        if (this.pages.containsKey(event.getPlayer())) {
            event.setCancelled(true);
            final String message = ChatColor.stripColor(event.getMessage());
            final Player player = event.getPlayer();
            this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () -> SChatMenuManager.this.handleChatMessage(player, message), 1L);
        }
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:12,代码来源:SChatMenuManager.java

示例15: shorten

import org.bukkit.ChatColor; //导入方法依赖的package包/类
public static String shorten(String string, String string2) {
	if (ChatColor.stripColor(string + string2).length() > 19) return (string + ChatColor.stripColor(string2)).substring(0, 18) + "...";
	else return (string + ChatColor.stripColor(string2));
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:5,代码来源:SlimefunGuide.java


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