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


Java ChatColor类代码示例

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


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

示例1: attach

import org.bukkit.ChatColor; //导入依赖的package包/类
public static ItemStack attach(ItemStack it, String id) {
	ItemStack i = it.clone();
	ItemMeta m = i.getItemMeta();
	
	List<String> lore = new ArrayList<String>();
	
	lore.addAll(Arrays.asList(new String[] {ChatColor.RESET + "" + ChatColor.DARK_GRAY + id}));
	if (m.getLore() != null && !m.getLore().isEmpty()) {
		lore.add("");
		lore.addAll(m.getLore());
	}
	
	m.setLore(lore);
	i.setItemMeta(m);
	
	return i;
}
 
开发者ID:GigaGamma,项目名称:McLink,代码行数:18,代码来源:ItemId.java

示例2: start

import org.bukkit.ChatColor; //导入依赖的package包/类
@Command(aliases = {"start"}, desc = "Start the match.")
@CommandPermissions({"tgm.start"})
public static void start(CommandContext cmd, CommandSender sender) {
    MatchStatus matchStatus = TGM.get().getMatchManager().getMatch().getMatchStatus();
    if (matchStatus == MatchStatus.PRE) {
        int time = StartCountdown.START_TIME;
        if (cmd.argsLength() > 0) {
            try {
                time = cmd.getInteger(0);
            } catch (CommandNumberFormatException e) {
                sender.sendMessage(ChatColor.RED + "Unknown time \"" + cmd.getString(0) + "\"");
            }
        }
        TGM.get().getModule(StartCountdown.class).start(time);
    } else {
        sender.sendMessage(ChatColor.RED + "The match cannot be started at this time.");
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:19,代码来源:CycleCommands.java

示例3: veto

import org.bukkit.ChatColor; //导入依赖的package包/类
@Command(
   aliases = {"veto"},
   desc = "Veto the current poll.",
   min = 0,
   max = 0
)
@CommandPermissions("poll.veto")
public static void veto(CommandContext args, CommandSender sender) throws CommandException {
    PollManager pollManager = PGM.getPollManager();
    if(pollManager.isPollRunning()) {
        pollManager.endPoll(PollEndReason.Cancelled);
        Bukkit.getServer().broadcastMessage(ChatColor.RED + "Poll vetoed by " + sender.getName());
    } else {
        throw new CommandException("There is currently no poll running.");
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:17,代码来源:PollCommands.java

示例4: addItems

import org.bukkit.ChatColor; //导入依赖的package包/类
@Override
public void addItems() {
    for (int i = 0; i < cutscene.getStages().size(); i++) {
        CutsceneStage stage = cutscene.getStages().get(i);
        ItemWrapper iw = addItem(Material.PAPER, ChatColor.YELLOW + "Stage " + (i + 1),
                "Actions: " + ChatColor.YELLOW + stage.getActions().size(), "")
                .leftClick(ce -> new GUIStageEditor(ce.getPlayer(), stage)).rightClick(ce -> {
                    cutscene.getStages().remove(stage);
                    reconstruct();
                });
        stage.getActions().stream().map(a -> a.getName() + " (" + a + a.getColor() + ")").forEach(iw::addLore);
        iw.addLoreAction("Left", "Edit Stage").addLoreAction("Right", "Remove Stage");
    }

    toRight(1);
    addItem(Material.WOOL, ChatColor.GREEN + "Add Stage", "Click here to add a stage.").leftClick(ce -> {
        cutscene.getStages().add(new CutsceneStage());
        reconstruct();
    });
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:21,代码来源:GUICutsceneEditor.java

示例5: makeRemainingPowders

import org.bukkit.ChatColor; //导入依赖的package包/类
private ItemStack makeRemainingPowders()
{
    int remaining = this.getRemainingPowders();

    ItemStack stack = new ItemStack(Material.SUGAR, remaining);
    ItemMeta meta = stack.getItemMeta();
    meta.setDisplayName(ChatColor.YELLOW + "" + remaining + " poussières d'\u272F");

    List<String> lore = new ArrayList<>();
    lore.add(ChatColor.DARK_GRAY + "Poussières restantes");
    lore.add("");
    lore.add(ChatColor.GRAY + "Vous devez encore placer " + ChatColor.AQUA + remaining);
    lore.add(ChatColor.AQUA + "poussières d'\u272F" + ChatColor.GRAY + " avant de");
    lore.add(ChatColor.GRAY + "pouvoir valider.");

    meta.setLore(lore);

    stack.setItemMeta(meta);

    return stack;
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:22,代码来源:GuiWellCraft.java

示例6: dispatch

import org.bukkit.ChatColor; //导入依赖的package包/类
public static int dispatch(CommandSender sender, String commandLine)
{
    int pos = commandLine.indexOf( ' ' );
    if ( pos == -1 )
    {
        pos = commandLine.length();
    }
    String name = commandLine.substring( 0, pos );
    if ( !allowedCommands.contains( name ) )
    {
        return -1;
    }
    if ( !sender.hasPermission( "bukkit.command." + name ) )
    {
        sender.sendMessage( ChatColor.RED + "You do not have permission for this command" );
        return 0;
    }
    net.minecraft.command.ICommandSender listener = getListener( sender );
    if ( listener == null )
    {
        return -1;
    }
    return net.minecraft.server.MinecraftServer.getServer().getCommandManager().executeCommand( listener, commandLine );
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:25,代码来源:VanillaCommandWrapper.java

示例7: checkPluginUpToDateAndPrintMessage

import org.bukkit.ChatColor; //导入依赖的package包/类
/**
 * Checks if the given plugin version and spigot resource Id is the same by doing and webRequest and printing the result into the console
 *
 * @param resourceId spigot resourceId
 * @param prefix     prefix
 * @param pluginName pluginName
 * @param plugin     plugin
 * @throws IOException exception
 */
public static void checkPluginUpToDateAndPrintMessage(long resourceId, String prefix, String pluginName, Plugin plugin) throws IOException {
    if (!isPluginUpToDate(resourceId, plugin)) {
        if (plugin.getDescription().getVersion().endsWith("SNAPSHOT")) {
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================");
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "You are using a snapshot of " + pluginName);
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "Please check regularly if there is a new version");
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================");
        } else {
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================");
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + pluginName + " is outdated");
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "Please download the latest version from spigotmc.org");
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================");
        }
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:25,代码来源:UpdateUtils.java

示例8: end

import org.bukkit.ChatColor; //导入依赖的package包/类
@Command(aliases = {"end"}, desc = "End the match.")
@CommandPermissions({"tgm.end"})
public static void end(CommandContext cmd, CommandSender sender) {
    MatchStatus matchStatus = TGM.get().getMatchManager().getMatch().getMatchStatus();
    if (matchStatus == MatchStatus.MID) {
        if (cmd.argsLength() > 0) {
            MatchTeam matchTeam = TGM.get().getModule(TeamManagerModule.class).getTeamFromInput(cmd.getJoinedStrings(0));
            if (matchTeam == null) {
                sender.sendMessage(ChatColor.RED + "Unable to find team \"" + cmd.getJoinedStrings(0) + "\"");
                return;
            }
            TGM.get().getMatchManager().endMatch(matchTeam);
        } else {
            TGM.get().getMatchManager().endMatch(TGM.get().getModule(TeamManagerModule.class).getTeams().get(1));
        }
    } else {
        sender.sendMessage(ChatColor.RED + "No match in progress.");
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:20,代码来源:CycleCommands.java

示例9: onCommand

import org.bukkit.ChatColor; //导入依赖的package包/类
@Override
protected void onCommand(CommandSender sender, String[] args) {
    Player player = (Player) sender;
    KCPlayer kcPlayer = KCPlayer.getWrapper(player);

    if (args[0].equalsIgnoreCase("bed")) {
        player.sendMessage(ChatColor.RED + "You can't remove this home.");
        return;
    }

    if (!kcPlayer.getHomes().containsKey(args[0])) {
        player.sendMessage(ChatColor.RED + "You do not have a home set with this name.");
        return;
    }

    sender.sendMessage(ChatColor.GREEN + "Removed home '" + args[0] + "'.");
    kcPlayer.getHomes().remove(args[0]);
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:19,代码来源:CommandDelHome.java

示例10: parseDefinition

import org.bukkit.ChatColor; //导入依赖的package包/类
public static ProximityAlarmDefinition parseDefinition(MapModuleContext context, Element elAlarm) throws InvalidXMLException {
    ProximityAlarmDefinition definition = new ProximityAlarmDefinition();
    FilterParser filterParser = context.needModule(FilterParser.class);
    definition.detectFilter = filterParser.parseProperty(elAlarm, "detect");
    definition.alertFilter = filterParser.property(elAlarm, "notify").optionalGet(() -> new InverseFilter(definition.detectFilter));
    definition.detectRegion = context.needModule(RegionParser.class).property(elAlarm, "region").required();
    definition.alertMessage = elAlarm.getAttributeValue("message"); // null = no message

    if(definition.alertMessage != null) {
        definition.alertMessage = ChatColor.translateAlternateColorCodes('`', definition.alertMessage);
    }
    Attribute attrFlareRadius = elAlarm.getAttribute("flare-radius");
    definition.flares = attrFlareRadius != null;
    if(definition.flares) {
        definition.flareRadius = XMLUtils.parseNumber(attrFlareRadius, Double.class);
    }

    return definition;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:20,代码来源:ProximityAlarmModule.java

示例11: setupGUI

import org.bukkit.ChatColor; //导入依赖的package包/类
private void setupGUI() {
    gui = Bukkit.createInventory(null, 27, FMessage.TRADE_RESOURCE_TITLE.getMessage(resource.getName(), faction.getName()));
    ItemStack banner = faction.getBannerStack();
    ItemMeta meta = banner.getItemMeta();
    meta.setDisplayName(ChatColor.GOLD + faction.getName());
    meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
    banner.setItemMeta(meta);
    gui.setItem(0, BACK);
    gui.setItem(1, banner);
    gui.setItem(2, banner);
    gui.setItem(3, banner);
    gui.setItem(5, banner);
    gui.setItem(6, banner);
    gui.setItem(7, banner);
    gui.setItem(8, banner);
    gui.setItem(13, importButton);
    gui.setItem(22, exportButton);
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:19,代码来源:ResourceMenu.java

示例12: demote

import org.bukkit.ChatColor; //导入依赖的package包/类
public static void demote(Player executor, Player target)throws SQLException, ClassNotFoundException{
    int exR = getGuildRanking(executor);
    int plR = getGuildRanking(target);
    if(getGuildId(executor) != getGuildId(target)){
        executor.sendMessage(ChatColor.RED + "You can not demote players in other guilds!");
        return;
    }
    if(exR == 4 && plR != 1){
        setGuildRanking(target, plR - 1);
        sendGuildMessage(getGuildId(target), ChatColor.DARK_RED + target.getName() + ChatColor.RED + " has been demoted to " + (getGuildRanking(target) == 2 ? ChatColor.GOLD + "MODERATOR!" : getGuildRanking(target) == 1 ? ChatColor.GOLD + "MEMBER!" : ChatColor.DARK_RED + "ERROR: CONTACT SERVER ADMIN."), false);
    } else if(exR == 4){
        executor.sendMessage(ChatColor.RED + "This player is already a member! To remove them from the guild, type /kick <player>");
    } else if(exR == 3 && plR == 2){
        setGuildRanking(target, plR - 1);
        sendGuildMessage(getGuildId(target), ChatColor.DARK_RED + target.getName() + ChatColor.RED + " has been demoted to " + (getGuildRanking(target) == 2 ? ChatColor.GOLD + "MODERATOR!" : getGuildRanking(target) == 1 ? ChatColor.GOLD + "MEMBER!" : ChatColor.DARK_RED + "ERROR: CONTACT SERVER ADMIN."), false);
    } else if (exR == 3 && (plR == 3 || plR == 4)){
        executor.sendMessage(ChatColor.RED + "You can not demote this player!");
    } else if (exR == 2 || exR == 1 || exR == 0){
        executor.sendMessage(ChatColor.RED + "You can not demote players!");
    }
}
 
开发者ID:Warvale,项目名称:Scorch,代码行数:22,代码来源:Guilds.java

示例13: onCommand

import org.bukkit.ChatColor; //导入依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, String label, String[] arguments)
{
    if (!hasPermission(sender, "api.game.start"))
        return true;

    if(SamaGamesAPI.get().getGameManager().getGame() == null)
    {
        sender.sendMessage(ChatColor.RED + "Ceci n'est pas un serveur de jeu.");
        return true;
    }

    SamaGamesAPI.get().getGameManager().getGame().startGame();
    Bukkit.broadcastMessage(ChatColor.GREEN + "Le jeu a été démarré par " + sender.getName());

    return true;
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:18,代码来源:CommandStart.java

示例14: show

import org.bukkit.ChatColor; //导入依赖的package包/类
@Override
public void show() {
    this.player.sendMessage("");
    this.player.sendMessage(HEADER_STANDARD);
    this.player.sendMessage("");
    this.player.sendMessage(Language.PREFIX + "1 - Set match time");
    this.player.sendMessage(Language.PREFIX + "2 - Set lobby time");
    this.player.sendMessage(Language.PREFIX + "3 - Set lobby spawnpoint");
    this.player.sendMessage(Language.PREFIX + "4 - Set redteam sign");
    this.player.sendMessage(Language.PREFIX + "5 - Set blueteam sign");
    this.player.sendMessage(Language.PREFIX + "6 - Set leaving sign");
    this.player.sendMessage(Language.PREFIX + "7 - Set game countdowntitle");
    this.player.sendMessage(Language.PREFIX + "8 - Set game countdownsubtitle");
    this.player.sendMessage(Language.PREFIX + "9 - Reset this page");
    this.player.sendMessage(Language.PREFIX + "10 - Save settings");
    this.player.sendMessage(Language.PREFIX + ChatColor.GREEN + MENU_BACK);
    this.player.sendMessage(Language.PREFIX + ChatColor.RED + MENU_EXIT);
    this.player.sendMessage("");
    this.player.sendMessage(FOOTER_STANDARD);
    this.player.sendMessage("");
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:22,代码来源:ArenaCommandExecutor.java

示例15: onChat

import org.bukkit.ChatColor; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
void onChat(AsyncPlayerChatEvent event) {
	if (!event.getPlayer().hasPermission("emojichat.use") || !event.getPlayer().hasPermission("emojichat.use.chat"))
		return; // Don't do anything if they don't have permission
	
	String message = event.getMessage();
	
	// Checks if the user disabled shortcuts via /emojichat toggle
	if (!plugin.getEmojiHandler().hasShortcutsOff(event.getPlayer())) {
		message = plugin.getEmojiHandler().translateShorthand(message);
	}
	
	// Replace shortcuts with emojis
	message = plugin.getEmojiHandler().toEmojiFromChat(message);
	
	// If the message contains a disabled character
	if (plugin.getEmojiHandler().containsDisabledCharacter(message)) {
		event.setCancelled(true);
		event.getPlayer().sendMessage(ChatColor.RED + "Oops! You can't use disabled emoji characters!");
		return;
	}
	
	event.setMessage(message);
}
 
开发者ID:RadBuilder,项目名称:EmojiChat,代码行数:25,代码来源:EmojiChatListener.java


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