org.json.simple.parser.ContainerFactory#org.bukkit.ChatColor源码实例Demo

下面列出了org.json.simple.parser.ContainerFactory#org.bukkit.ChatColor 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: BedwarsRel   文件: SetLobbyCommand.java
@Override
public boolean execute(CommandSender sender, ArrayList<String> args) {
  if (!super.hasPermission(sender)) {
    return false;
  }

  Player player = (Player) sender;

  Game game = this.getPlugin().getGameManager().getGame(args.get(0));
  if (game == null) {
    player.sendMessage(ChatWriter.pluginMessage(ChatColor.RED
        + BedwarsRel
        ._l(player, "errors.gamenotfound", ImmutableMap.of("game", args.get(0).toString()))));
    return false;
  }

  if (game.getState() != GameState.STOPPED) {
    sender.sendMessage(
        ChatWriter.pluginMessage(ChatColor.RED + BedwarsRel
            ._l(sender, "errors.notwhilegamerunning")));
    return false;
  }

  game.setLobby(player);
  return true;
}
 
源代码2 项目: SkyWarsReloaded   文件: MatchManager.java
public void start(final GameMap gameMap) {
	debug = SkyWarsReloaded.getCfg().debugEnabled();
	if (debug) {
     	debugName = ChatColor.RED + "SWR[" + gameMap.getName() + "] ";
    }
    if (gameMap == null) {
        return;
    }
	gameMap.removeDMSpawnBlocks();
    this.setWaitTime(SkyWarsReloaded.getCfg().getWaitTimer());
    this.setGameTime();
    gameMap.setMatchState(MatchState.WAITINGSTART);
    gameMap.update();
    gameMap.getGameBoard().updateScoreboard();
    this.waitStart(gameMap);
}
 
源代码3 项目: MineTinker   文件: TinkerListener.java
@EventHandler
public void onModifierApply(ModifierApplyEvent event) {
	Player player = event.getPlayer();
	ItemStack tool = event.getTool();
	Modifier mod = event.getMod();

	if (MineTinker.getPlugin().getConfig().getBoolean("Sound.OnModding")) {
		player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 1.0F, 0.5F);
	}

	ChatWriter.sendActionBar(player,
			LanguageManager.getString("TinkerListener.ModifierApply", player)
					.replace("%tool", ChatWriter.getDisplayName(tool) + ChatColor.WHITE)
					.replace("%mod", mod.getColor() + mod.getName() + ChatColor.WHITE)
					.replace("%slots", String.valueOf(event.getSlotsRemaining())));
	ChatWriter.log(false, player.getDisplayName() + " modded " + ChatWriter.getDisplayName(tool)
			+ ChatColor.GRAY + " (" + tool.getType().toString() + ") with " + mod.getColor() + mod.getName()
			+ ChatColor.GRAY + " " + modManager.getModLevel(tool, mod) + "!");
}
 
源代码4 项目: ProRecipes   文件: RecipeBuilder.java
private void openShaped(final Player p) {
	final ItemStack i = p.getOpenInventory().getItem(0).clone();
	
	ItemBuilder.close(p);
	p.setMetadata("closed", new FixedMetadataValue(ProRecipes.getPlugin(), ""));
	ItemBuilder.sendMessage(p, m.getMessage("Recipe_Builder_Title", ChatColor.GOLD + "Recipe Builder") ,  m.getMessage("Recipe_Builder_Add", ChatColor.DARK_GREEN + "Add your ingredients! Close to save recipe."));
	ProRecipes.getPlugin().getServer().getScheduler().runTaskLater(ProRecipes.getPlugin(), new Runnable(){

		@Override
		public void run() {
			p.setMetadata("recipeBuilder", new FixedMetadataValue(ProRecipes.getPlugin(), "craftRecipeShaped"));
			p.openWorkbench(null, true);
			//p.removeMetadata("closed", RPGRecipes.getPlugin());
			p.getOpenInventory().setItem(0, i);
			//Inventory i = RPGRecipes.getPlugin().getServer().createInventory(p, InventoryType.WORKBENCH, "ItemBuilder");
			//p.openInventory(i);
		}
		
	}, ProRecipes.getPlugin().wait);
	
}
 
源代码5 项目: NeuralNetworkAPI   文件: PrimeNumberBot.java
@Override
public String update() {
	boolean[] thought = tickAndThink();
	float accuracy = 0;

	// If it isprime:

	boolean[] booleanBase = new boolean[10];
	for (int i = 0; i < 10; i++) {
		booleanBase[i] = binary.getNumberAt(0, i) != 0;
	}
	int number = binaryBooleansToNumber(booleanBase);
	boolean result = ifNumberIsPrime.get(number);

	return ((thought[0] ? ChatColor.DARK_GREEN : ChatColor.DARK_RED) + "|=" + number + "|WasPrime-Score "
			+ ((int) (100 * (ai.getNeuronFromId(0).getTriggeredStength()))));

}
 
源代码6 项目: PerWorldInventory   文件: HelpCommand.java
@Override
public void executeCommand(CommandSender sender, List<String> args) {
    if (sender instanceof Player) {
        // Send the pretty version
        sender.sendMessage(ChatColor.DARK_GRAY + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
        sender.sendMessage(ChatColor.DARK_GRAY + "                [ " + ChatColor.BLUE + "PerWorldInventory Commands" + ChatColor.DARK_GRAY + " ]");
        sender.sendMessage(ChatColor.GRAY + "Commands may be run using either " + ChatColor.WHITE + "/perworldinventory" + ChatColor.GRAY + " or " + ChatColor.WHITE + "/pwi");
        sender.sendMessage("");
        sender.sendMessage(ChatColor.BLUE + "» " + ChatColor.WHITE + "/perworldinventory convert multiverse" + ChatColor.BLUE + " - " + ChatColor.GRAY + "Convert data from Multiverse-Inventories");
        sender.sendMessage(ChatColor.BLUE + "» " + ChatColor.WHITE + "/perworldinventory help" + ChatColor.BLUE + " - " + ChatColor.GRAY + "Shows this help page");
        sender.sendMessage(ChatColor.BLUE + "» " + ChatColor.WHITE + "/perworldinventory reload" + ChatColor.BLUE + " - " + ChatColor.GRAY + "Reloads all configuration files");
        sender.sendMessage(ChatColor.BLUE + "» " + ChatColor.WHITE + "/perworldinventory version" + ChatColor.BLUE + " - " + ChatColor.GRAY + "Shows the version and authors of the server");
        sender.sendMessage(ChatColor.BLUE + "» " + ChatColor.WHITE + "/perworldinventory setworlddefault [group|serverDefault]" + ChatColor.BLUE + " - " + ChatColor.GRAY + "Set the default inventory loadout for a world, or the server default." + '\n' + ChatColor.YELLOW + "The group you are standing in will be used if no group is specified.");
        sender.sendMessage(ChatColor.DARK_GRAY + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
    } else {
        // Sender is the console, no pretty stuff for you!
        sender.sendMessage("-----------------------------------------------------");
        sender.sendMessage("PerWorldInventory commands:");
        sender.sendMessage("/perworldinventory convert - Convert MultiVerse-Inventories data");
        sender.sendMessage("/perworldinventory help - Displays this help");
        sender.sendMessage("/perworldinventory version - Shows the version of the server");
        sender.sendMessage("/perworldinventory reload - Reload config and world files");
        sender.sendMessage("-----------------------------------------------------");
    }
}
 
源代码7 项目: Survival-Games   文件: BandageUse.java
@SuppressWarnings("deprecation")
@EventHandler
public void onBandageUse(PlayerInteractEvent e) {
	   Player p = e.getPlayer();
	   Boolean active = GameManager.getInstance().isPlayerActive(p);
	   if (!active) {
	      return;
	   }
	   
	if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
		if (e.getPlayer().getItemInHand().getType() == Material.PAPER) {
			e.getPlayer().getInventory().removeItem(new ItemStack(Material.PAPER, 1));
			double newhealth = e.getPlayer().getHealth() + 10;
			if((newhealth > 20.0) || (newhealth < 0 )) { newhealth = 20.0; }
			e.getPlayer().setHealth(newhealth);
			e.getPlayer().sendMessage(ChatColor.GREEN + "You used a bandage and got 5 hearts.");
	        }
		}
	}
 
源代码8 项目: civcraft   文件: CivTutorial.java
public static ItemStack getInfoBookForItem(String matID) {
	LoreCraftableMaterial loreMat = LoreCraftableMaterial.getCraftMaterialFromId(matID);
	ItemStack stack = LoreMaterial.spawn(loreMat);
						
	if (!loreMat.isCraftable()) {
		return null;
	}
	
	AttributeUtil attrs = new AttributeUtil(stack);
	attrs.removeAll(); /* Remove all attribute modifiers to prevent them from displaying */
	LinkedList<String> lore = new LinkedList<String>();
	
	lore.add(""+ChatColor.RESET+ChatColor.BOLD+ChatColor.GOLD+"Click For Recipe");
	
	attrs.setLore(lore);				
	stack = attrs.getStack();
	return stack;
}
 
源代码9 项目: Civs   文件: FallEffect.java
public boolean meetsRequirement() {
    Object target = getTarget();
    Entity origin = getOrigin();
    if (!(target instanceof LivingEntity)) {
        return false;
    }

    LivingEntity livingEntity = (LivingEntity) target;

    if (livingEntity.getFallDistance() < this.distance) {
        if (!this.silent && origin instanceof Player) {
            ((Player) origin).sendMessage(ChatColor.RED + Civs.getPrefix() + " target isn't hasn't fallen " + this.distance + " blocks.");
        }
        return false;
    }
    return true;
}
 
源代码10 项目: EchoPet   文件: SpawnUtil.java
@Override
public EntityPet spawn(IPet pet, Player owner) {
    Location l = owner.getLocation();
    PetPreSpawnEvent spawnEvent = new PetPreSpawnEvent(pet, l);
    EchoPet.getPlugin().getServer().getPluginManager().callEvent(spawnEvent);
    if (spawnEvent.isCancelled()) {
        owner.sendMessage(EchoPet.getPrefix() + ChatColor.YELLOW + "Pet spawn was cancelled externally.");
        EchoPet.getManager().removePet(pet, true);
        return null;
    }
    l = spawnEvent.getSpawnLocation();
    World mcWorld = ((CraftWorld) l.getWorld()).getHandle();
    EntityPet entityPet = (EntityPet) pet.getPetType().getNewEntityPetInstance(mcWorld, pet);

    entityPet.setLocation(new Location(mcWorld.getWorld(), l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch()));
    if (!l.getChunk().isLoaded()) {
        l.getChunk().load();
    }
    if (!mcWorld.addEntity(entityPet, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
        owner.sendMessage(EchoPet.getPrefix() + ChatColor.YELLOW + "Failed to spawn pet entity.");
        EchoPet.getManager().removePet(pet, true);
    } else {
        Particle.MAGIC_RUNES.builder().at(l).show();
    }
    return entityPet;
}
 
源代码11 项目: ProtocolSupport   文件: LegacyChat.java
protected void writeAllFormatCodes(Modifier modifier) {
	if (Boolean.TRUE.equals(modifier.isBold())) {
		out.append(ChatColor.BOLD);
	}
	if (Boolean.TRUE.equals(modifier.isItalic())) {
		out.append(ChatColor.ITALIC);
	}
	if (Boolean.TRUE.equals(modifier.isUnderlined())) {
		out.append(ChatColor.UNDERLINE);
	}
	if (Boolean.TRUE.equals(modifier.isStrikethrough())) {
		out.append(ChatColor.STRIKETHROUGH);
	}
	if (Boolean.TRUE.equals(modifier.isRandom())) {
		out.append(ChatColor.MAGIC);
	}
}
 
源代码12 项目: MineTinker   文件: ChatWriter.java
public static List<String> splitString(String msg, int lineSize) {
	if (msg == null) return new ArrayList<>();
	List<String> res = new ArrayList<>();

	String[] str = msg.split(" ");
	int index = 0;
	while (index < str.length) {
		StringBuilder line = new StringBuilder();
		do {
			index++;
			line.append(str[index - 1]);
			line.append(" ");
		} while (index < str.length && line.length() + str[index].length() < lineSize);
		res.add(ChatColor.WHITE + line.toString().substring(0, line.length() - 1));
	}

	return res;
}
 
源代码13 项目: SonarPet   文件: EchoPetPlugin.java
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    if (commandLabel.equalsIgnoreCase("echopet")) {
        if (sender.hasPermission("echopet.petadmin")) {
            PluginDescriptionFile pdFile = this.getDescription();
            sender.sendMessage(ChatColor.RED + "-------- SonarPet --------");
            sender.sendMessage(ChatColor.GOLD + "Author: " + ChatColor.YELLOW + "DSH105");
            sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.YELLOW + pdFile.getVersion());
            sender.sendMessage(ChatColor.GOLD + "Website: " + ChatColor.YELLOW + pdFile.getWebsite());
            sender.sendMessage(ChatColor.GOLD + "Commands are registered at runtime to provide you with more dynamic control over the command labels.");
            sender.sendMessage(ChatColor.GOLD + "" + ChatColor.UNDERLINE + "Command Registration:");
            sender.sendMessage(ChatColor.GOLD + "Main: " + OPTIONS.getCommandString());
            sender.sendMessage(ChatColor.GOLD + "Admin: " + OPTIONS.getCommandString() + "admin");
        } else {
            Lang.sendTo(sender, Lang.NO_PERMISSION.toString().replace("%perm%", "echopet.petadmin"));
            return true;
        }
    }
    return false;
}
 
源代码14 项目: BedwarsRel   文件: Game.java
private void updateSignConfig() {
  try {
    File config = new File(
        BedwarsRel.getInstance().getDataFolder() + "/" + GameManager.gamesPath + "/"
            + this.name + "/sign.yml");

    YamlConfiguration cfg = new YamlConfiguration();
    if (config.exists()) {
      cfg = YamlConfiguration.loadConfiguration(config);
    }

    List<Map<String, Object>> locList = new ArrayList<Map<String, Object>>();
    for (Location loc : this.joinSigns.keySet()) {
      locList.add(Utils.locationSerialize(loc));
    }

    cfg.set("signs", locList);
    cfg.save(config);
  } catch (Exception ex) {
    BedwarsRel.getInstance().getBugsnag().notify(ex);
    BedwarsRel.getInstance().getServer().getConsoleSender()
        .sendMessage(ChatWriter.pluginMessage(ChatColor.RED + BedwarsRel
            ._l(BedwarsRel.getInstance().getServer().getConsoleSender(), "errors.savesign")));
  }
}
 
源代码15 项目: civcraft   文件: AdminCivCommand.java
public void bankrupt_cmd() throws CivException {
	Civilization civ = getNamedCiv(1);
	
	if (args.length < 3) {
		CivMessage.send(sender, CivColor.Yellow+ChatColor.BOLD+"Are you absolutely sure you want to wipe ALL COINS from ALL RESIDENTS and ALL TOWNS of this civ?");
		CivMessage.send(sender, "use /civ bankrupt yes if you do.");
	}
	
	civ.getTreasury().setBalance(0);
	
	for (Town town : civ.getTowns()) {
		town.getTreasury().setBalance(0);
		town.save();
		
		for (Resident resident : town.getResidents()) {
			resident.getTreasury().setBalance(0);
			resident.save();
		}
	}
	
	civ.save();
	CivMessage.sendSuccess(sender, "Bankrupted "+civ.getName());
}
 
源代码16 项目: ChestCommands   文件: FormatUtils.java
public static List<String> colorizeLore(List<String> input) {
	if (input == null || input.isEmpty()) return input;

	for (int i = 0; i < input.size(); i++) {

		String line = input.get(i);

		if (line.isEmpty()) continue;

		if (line.charAt(0) != ChatColor.COLOR_CHAR) {
			input.set(i, ChestCommands.getSettings().default_color__lore + addColors(line));
		} else {
			input.set(i, addColors(line));
		}
	}
	return input;
}
 
源代码17 项目: GriefDefender   文件: SignUtil.java
private static Consumer<CommandSender> createSaleConfirmationConsumer(CommandSender src, Claim claim, Sign sign, double price) {
    return confirm -> {
        claim.getEconomyData().setSalePrice(price);
        claim.getEconomyData().setForSale(true);
        claim.getEconomyData().setSaleSignPosition(VecHelper.toVector3i(sign.getLocation()));
        claim.getData().save();
        List<String> lines = new ArrayList<>(4);
        lines.add(ChatColor.translateAlternateColorCodes('&', "&7[&bGD&7-&1sell&7]"));
        lines.add(ChatColor.translateAlternateColorCodes('&', LegacyComponentSerializer.legacy().serialize(MessageCache.getInstance().ECONOMY_SIGN_SELL_DESCRIPTION)));
        lines.add(ChatColor.translateAlternateColorCodes('&', "&4$" + String.format("%.2f", price)));
        lines.add(ChatColor.translateAlternateColorCodes('&', LegacyComponentSerializer.legacy().serialize(MessageCache.getInstance().ECONOMY_SIGN_SELL_FOOTER)));

        for (int i = 0; i < lines.size(); i++) {
            sign.setLine(i, lines.get(i));
        }
        sign.update();
        final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_CLAIM_SALE_CONFIRMED,
                ImmutableMap.of("amount", price));
        GriefDefenderPlugin.sendMessage(src, message);
    };
}
 
源代码18 项目: LagMonitor   文件: PingCommand.java
private void displayPingOther(CommandSender sender, Command command, String playerName) {
    if (sender.hasPermission(command.getPermission() + ".other")) {
        RollingOverHistory sampleHistory = plugin.getPingManager().getHistory(playerName);
        if (sampleHistory == null || !canSee(sender, playerName)) {
            sendError(sender, "No data for that player " + playerName);
            return;
        }

        int lastPing = (int) sampleHistory.getLastSample();

        sender.sendMessage(ChatColor.WHITE + playerName + PRIMARY_COLOR + "'s ping is: "
                + ChatColor.DARK_GREEN + lastPing + "ms");

        float pingAverage = LagUtils.round(sampleHistory.getAverage());
        sender.sendMessage(PRIMARY_COLOR + "Average: " + ChatColor.DARK_GREEN + pingAverage + "ms");
    } else {
        sendError(sender, "You don't have enough permission");
    }
}
 
源代码19 项目: ChestCommands   文件: ErrorLoggerTask.java
@Override
public void run() {

	List<String> lines = Utils.newArrayList();

	lines.add(" ");
	lines.add(ChatColor.RED + "#------------------- Chest Commands Errors -------------------#");
	int count = 1;
	for (String error : errorLogger.getErrors()) {
		lines.add(ChatColor.GRAY + "" + (count++) + ") " + ChatColor.WHITE + error);
	}
	lines.add(ChatColor.RED + "#-------------------------------------------------------------#");

	String output = StringUtils.join(lines, "\n");

	if (ChestCommands.getSettings().use_console_colors) {
		Bukkit.getConsoleSender().sendMessage(output);
	} else {
		System.out.println(ChatColor.stripColor(output));
	}
}
 
源代码20 项目: CardinalPGM   文件: SettingCommands.java
@Command(aliases = {"settings"}, desc = "List all settings.", usage = "[page]")
public static void settings(final CommandContext cmd, CommandSender sender) throws CommandException {
    if (cmd.argsLength() == 0) {
        Bukkit.dispatchCommand(sender, "settings 1");
    } else {
        int page = cmd.getInteger(0);
        if (page > (Settings.getSettings().size() + 7) / 8) {
            throw new CommandException(new LocalizedChatMessage(ChatConstant.ERROR_INVALID_PAGE_NUMBER, "" + (Settings.getSettings().size() + 7) / 8).getMessage(ChatUtil.getLocale(sender)));
        }
        sender.sendMessage(ChatColor.RED + "" + ChatColor.STRIKETHROUGH + "--------------" + ChatColor.YELLOW + " Settings (Page " + page + " of " + ((Settings.getSettings().size() + 7) / 8) + ") " + ChatColor.RED + "" + ChatColor.STRIKETHROUGH + "--------------");
        for (int i = (page - 1) * 8; i < page * 8; i++) {
            if (i < Settings.getSettings().size()) {
                sender.sendMessage(ChatColor.YELLOW + Settings.getSettings().get(i).getNames().get(0) + ": " + ChatColor.WHITE + Settings.getSettings().get(i).getDescription());
            }
        }
    }
}
 
源代码21 项目: Survival-Games   文件: TeleportEvent.java
@EventHandler
public void playerTeleport(PlayerTeleportEvent event) {
    Player p = event.getPlayer();
    int id = GameManager.getInstance().getPlayerGameId(p);
    if(id == -1) return;
    if(GameManager.getInstance().getGame(id).isPlayerActive(p) && event.getCause() == PlayerTeleportEvent.TeleportCause.COMMAND){
        p.sendMessage(ChatColor.RED +" Cannot teleport while ingame!");
        event.setCancelled(true);
    }
}
 
源代码22 项目: CratesPlus   文件: Crate.java
private void loadCrateBase() {
    CratesPlus cratesPlus = configHandler.getCratesPlus();
    if (cratesPlus.getConfig().isSet("Crates." + name + ".Hide Percentages"))
        this.hidePercentages = cratesPlus.getConfig().getBoolean("Crates." + name + ".Hide Percentages");
    if (cratesPlus.getConfig().isSet("Crates." + name + ".Color"))
        this.color = ChatColor.valueOf(cratesPlus.getConfig().getString("Crates." + name + ".Color").toUpperCase());
    if (cratesPlus.getConfig().isSet("Crates." + name + ".Block"))
        this.block = Material.valueOf(cratesPlus.getConfig().getString("Crates." + name + ".Block").toUpperCase());
    if (cratesPlus.getConfig().isSet("Crates." + name + ".Block Data"))
        this.blockData = cratesPlus.getConfig().getInt("Crates." + name + ".Block Data", 0);
    if (cratesPlus.getConfig().isSet("Crates." + name + ".Permission"))
        this.permission = cratesPlus.getConfig().getString("Crates." + name + ".Permission");
    if (cratesPlus.getConfig().isSet("Crates." + name + ".Firework"))
        this.firework = cratesPlus.getConfig().getBoolean("Crates." + name + ".Firework");
    if (cratesPlus.getConfig().isSet("Crates." + name + ".Broadcast"))
        this.broadcast = cratesPlus.getConfig().getBoolean("Crates." + name + ".Broadcast");
    if (cratesPlus.getConfig().isSet("Crates." + name + ".Opener"))
        this.opener = cratesPlus.getConfig().getString("Crates." + name + ".Opener");
    if (cratesPlus.getConfig().isSet("Crates." + name + ".Cooldown"))
        this.cooldown = cratesPlus.getConfig().getInt("Crates." + name + ".Cooldown");

    if (!cratesPlus.getConfig().isSet("Crates." + name + ".Winnings"))
        return;

    if (cratesPlus.getConfig().getConfigurationSection("Crates." + name + ".Winnings") != null) {
        for (String id : cratesPlus.getConfig().getConfigurationSection("Crates." + name + ".Winnings").getKeys(false)) {
            String path = "Crates." + name + ".Winnings." + id;
            Winning winning = new Winning(this, path, cratesPlus, null);
            if (!winning.isValid()) {
                Bukkit.getLogger().warning(path + " is an invalid winning.");
                continue;
            }
            totalPercentage = totalPercentage + winning.getPercentage();
            winnings.add(winning);
        }
    }
}
 
源代码23 项目: ce   文件: Firecracker.java
public Firecracker(String originalName, ChatColor color, String lDescription, long lCooldown, Material mat) {
	super(originalName, color, lDescription, lCooldown, mat);
	triggers.add(Trigger.PROJECTILE_HIT);
	triggers.add(Trigger.PROJECTILE_THROWN);
	triggers.add(Trigger.DAMAGE_GIVEN);

}
 
源代码24 项目: ce   文件: Bandage.java
public Bandage(String originalName, ChatColor color, String lDescription, long lCooldown, Material mat) {
	super(originalName, color, lDescription, lCooldown, mat);
	this.configEntries.put("TotalHealAmount", 10);
	this.configEntries.put("TotalHealTime", 200);
	this.configEntries.put("StopAtFullHealth", true);
	triggers.add(Trigger.INTERACT_RIGHT);
	triggers.add(Trigger.INTERACT_ENTITY);
	triggers.add(Trigger.DAMAGE_GIVEN);
}
 
源代码25 项目: HeavySpleef   文件: SignLayoutConfiguration.java
public String getOption(String key, String def) {
	if (options == null) {
		return def;
	}
	
	return ChatColor.translateAlternateColorCodes('&', options.getString(key, def));
}
 
源代码26 项目: HoloAPI   文件: EditCommand.java
@Command(
        command = "edit <id> <line> <content...>",
        description = "Edit a line of an existing hologram",
        permission = "holoapi.holo.edit",
        help = "The content can be more than one word"
)
public boolean editWithContent(CommandEvent event) {
    final Hologram hologram = HoloAPI.getManager().getHologram(event.variable("id"));
    if (hologram == null) {
        event.respond(Lang.HOLOGRAM_NOT_FOUND.getValue("id", event.variable("id")));
        return true;
    }

    int lineNumber;
    try {
        lineNumber = GeneralUtil.toInteger(event.variable("line_number"));
    } catch (NumberFormatException e) {
        event.respond(Lang.INT_ONLY.getValue("string", event.variable("line_number")));
        return true;
    }

    if (lineNumber > hologram.getLines().length) {
        event.respond(Lang.LINE_INDEX_TOO_BIG.getValue("index", event.variable("line_number")));
        return true;
    }

    hologram.updateLine(lineNumber - 1, event.variable("content"));
    event.respond(Lang.HOLOGRAM_UPDATE_LINE.getValue("index", lineNumber, "input", ChatColor.translateAlternateColorCodes('&', event.variable("content"))));
    return true;
}
 
源代码27 项目: Slimefun4   文件: TestBackpackListener.java
@Test
public void testSetId() throws InterruptedException {
    Player player = server.addPlayer();
    ItemStack item = new CustomItem(Material.CHEST, "&cA mocked Backpack", "", "&7Size: &e" + BACKPACK_SIZE, "&7ID: <ID>", "", "&7&eRight Click&7 to open");

    PlayerProfile profile = TestUtilities.awaitProfile(player);
    int id = profile.createBackpack(BACKPACK_SIZE).getId();

    listener.setBackpackId(player, item, 2, id);
    Assertions.assertEquals(ChatColor.GRAY + "ID: " + player.getUniqueId() + "#" + id, item.getItemMeta().getLore().get(2));

    PlayerBackpack backpack = awaitBackpack(item);
    Assertions.assertEquals(player.getUniqueId(), backpack.getOwner().getUUID());
    Assertions.assertEquals(id, backpack.getId());
}
 
源代码28 项目: Statz   文件: DependencyManager.java
/**
 * Loads all dependencies used for Statz. <br>
 * Statz will check for dependencies and shows the output on the console.
 */
public void loadDependencies() {

    // Make seperate loading bar

    plugin.debugMessage(ChatColor.YELLOW + "---------------[Statz Dependencies]---------------");
    plugin.debugMessage(ChatColor.GREEN + "Searching dependencies...");

    // Load all dependencies
    for (final DependencyHandler depHandler : handlers.values()) {
        // Make sure to respect settings
        boolean succeeded = depHandler.setup(true);

        if (succeeded) {
            StatzDependency dependency = this.getDependencyByHandler(depHandler);

            if (dependency == null)
                continue;

            plugin.debugMessage(ChatColor.GREEN + dependency.getInternalString()
                    + " was found and Statz now tracks its data!");
        }
    }

    // Make seperate stop loading bar
    plugin.debugMessage(ChatColor.YELLOW + "---------------[Statz Dependencies]---------------");

    plugin.debugMessage("Loaded libraries and dependencies");
}
 
源代码29 项目: BedwarsRel   文件: BedwarsRel.java
public void startMetricsIfEnabled() {
  if (this.metricsEnabled()) {
    new BStatsMetrics(this);
    try {
      McStatsMetrics mcStatsMetrics = new McStatsMetrics(this);
      mcStatsMetrics.start();
    } catch (Exception ex) {
      BedwarsRel.getInstance().getBugsnag().notify(ex);
      this.getServer().getConsoleSender().sendMessage(ChatWriter
          .pluginMessage(ChatColor.RED + "Metrics are enabled, but couldn't send data!"));
    }
  }
}
 
源代码30 项目: AuthMeReloaded   文件: CommandHandler.java
private void showHelpForCommand(CommandSender sender, FoundCommandResult result) {
    sender.sendMessage(ChatColor.DARK_RED + "Incorrect command arguments!");
    helpProvider.outputHelp(sender, result, HelpProvider.SHOW_ARGUMENTS);

    List<String> labels = result.getLabels();
    String childLabel = labels.size() >= 2 ? labels.get(1) : "";
    sender.sendMessage(ChatColor.GOLD + "Detailed help: " + ChatColor.WHITE
        + "/" + labels.get(0) + " help " + childLabel);
}