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


Java EFormatString类代码示例

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


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

示例1: getList

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
public EMessageBuilder getList(String name, EMessageBuilder builder, ConfigurationNode node, boolean prefix) {
  	try {
	List<String> messages = node.getList(TypeToken.of(String.class));
	if (!messages.isEmpty()) {
  			if (this.plugin.getChat() != null) {
  				builder.chat(new EFormatListString(this.plugin.getChat().replace(messages)), prefix);
  			} else {
  				builder.chat(new EFormatListString(node.getList(TypeToken.of(String.class))), prefix);
  			}
	}
} catch (ObjectMappingException e) {
	this.plugin.getELogger().warn("Impossible de charger la liste des messages : '" + name + "'");
	builder.chat(new EFormatString(name), false);
}
return builder;
  }
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:17,代码来源:EMessage.java

示例2: getFormatString

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
public Optional<EFormatString> getFormatString(ConfigurationNode node) {
  	if (!node.getString("").isEmpty()) {
	if (this.plugin.getChat() != null) {
		return Optional.of(new EFormatString(this.plugin.getChat().replace(node.getString(""))));
  		} else {
  			return Optional.of(new EFormatString(node.getString("")));
  		}
}
  	return Optional.empty();
  }
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:11,代码来源:EMessage.java

示例3: getDisplayNameHover

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
public Text getDisplayNameHover(Set<Context> contexts) {
	Builder builder = EFormatString.of(this.getDisplayName(contexts))
			.toText(this.getReplaces()).toBuilder()
			.onShiftClick(TextActions.insertText(this.getName()));
	
	this.getSuggest(contexts).ifPresent(suggest -> builder.onClick(TextActions.suggestCommand(suggest)));
	this.getHover(contexts).ifPresent(hover -> builder.onHover(TextActions.showText(hover)));
	return builder.build();
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:10,代码来源:EPlayer.java

示例4: getHover

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
public Optional<Text> getHover(Set<Context> contexts) {
	Optional<String> optHover = this.getOption(contexts, "hover");
	if (optHover.isPresent()) {
		return Optional.of(EFormatString.of(optHover.get()).toText(this.getReplaces()));
	}
	return Optional.empty();
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:8,代码来源:EPlayer.java

示例5: getSuggest

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
public Optional<String> getSuggest(Set<Context> contexts) {
	Optional<String> optSuggest = this.getOption(contexts, "suggest");
	if (optSuggest.isPresent()) {
		return Optional.of(EFormatString.of(optSuggest.get()).toString(this.getReplaces()));
	}
	return Optional.empty();
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:8,代码来源:EPlayer.java

示例6: deserialize

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
@Override
public EFormat deserialize(TypeToken<?> type, ConfigurationNode node) throws ObjectMappingException {
	if (node.getValue() instanceof List) {
		return new EFormatListString(node.getList(TypeToken.of(String.class)));
	} else if (node.getValue() instanceof String) {
		return new EFormatString(node.getString(""));
	} else {
		return new EFormatTemplate(node.getValue(TypeToken.of(TextTemplate.class)));
	}
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:11,代码来源:EFormatSerializer.java

示例7: serialize

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
@Override
public void serialize(TypeToken<?> type, EFormat format, ConfigurationNode node) throws ObjectMappingException {
	if (format instanceof EFormatListString) {
		node.setValue(((EFormatListString) format).getMessage());
	} else if (format instanceof EFormatString) {
		node.setValue(((EFormatString) format).getMessage());
	} else if (format instanceof EFormatTemplate) {
		node.setValue(((EFormatTemplate) format).getMessage());
	} else {
		throw new ObjectMappingException();
	}
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:13,代码来源:EFormatSerializer.java

示例8: replace

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
public CompletableFuture<Boolean> replace(final CommandSource source) {
	List<Text> list = new ArrayList<Text>();
	for(EReplacesServer value : EReplacesServer.values()) {
		if (value.getFunction().isPresent()) {
			list.add(EFormatString.of("&c" + value.name() + " : &r" + value.getName())
				.toText(this.plugin.getChat().getReplaceServer()));
		}
	}
	this.plugin.getManagerService().getEPagination().sendTo(Text.of("Replace Server"), list, source);
	return CompletableFuture.completedFuture(true);
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:12,代码来源:EAReplace.java

示例9: replaceMessage

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
public static String replaceMessage(final EChat chat, final Subject player, String message) {
	Map<Pattern, EReplace<?>> replaces = new HashMap<Pattern, EReplace<?>>();
	
	if (!player.hasPermission(EEPermissions.MSG_COLOR.get())) {
		message = message.replaceAll(ChatService.REGEX_COLOR, "");
	}
	if (!player.hasPermission(EEPermissions.MSG_FORMAT.get())) {
		message = message.replaceAll(ChatService.REGEX_FORMAT, "");
	}
	if (!player.hasPermission(EEPermissions.MSG_MAGIC.get())) {
		message = message.replaceAll(ChatService.REGEX_MAGIC, "");
	}
	if (player.hasPermission(EEPermissions.MSG_CHARACTER.get())) {
		replaces.putAll(chat.getReplaceCharacters());
	}
	if (player.hasPermission(EEPermissions.MSG_COMMAND.get())) {
		replaces.putAll(chat.getReplaceCommand());
	}
	if (player.hasPermission(EEPermissions.MSG_ICONS.get())) {
		replaces.putAll(chat.getReplaceIcons());
	}
	if (player.hasPermission(EEPermissions.MSG_URL.get())) {
		replaces.putAll(chat.getReplaceUrl());
	}
	
	if (replaces.isEmpty()) return message;
	return EFormatString.of(message).toString(replaces);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:29,代码来源:EEMsg.java

示例10: sendMessage

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
public Text sendMessage(final EPlayer player, String original) {
	String format = this.getFormat(player.getPlayer().get());
	Map<Pattern, EReplace<?>> replaces = player.getReplaces();
	
	if (!player.hasPermission(ECPermissions.COLOR.get())) {
		original = original.replaceAll(ChatService.REGEX_COLOR, "");
	}
	if (!player.hasPermission(ECPermissions.FORMAT.get())) {
		original = original.replaceAll(ChatService.REGEX_FORMAT, "");
	}
	if (!player.hasPermission(ECPermissions.MAGIC.get())) {
		original = original.replaceAll(ChatService.REGEX_MAGIC, "");
	}
	if (player.hasPermission(ECPermissions.CHARACTER.get())) {
		replaces.putAll(this.getReplaceCharacters());
	}
	if (player.hasPermission(ECPermissions.COMMAND.get())) {
		replaces.putAll(this.getReplaceCommand());
	}
	if (player.hasPermission(ECPermissions.ICONS.get())) {
		replaces.putAll(this.getReplaceIcons());
	}
	if (player.hasPermission(ECPermissions.URL.get())) {
		replaces.putAll(this.getReplaceUrl());
	}
	
	replaces.put(Pattern.compile("\\{MESSAGE}"), EReplace.of(EFormatString.of(original).toText(replaces)));
	
	return EFormatString.of(format).toText(replaces);
}
 
开发者ID:EverCraft,项目名称:EverChat,代码行数:31,代码来源:EChatService.java

示例11: format

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
@Override
public Text format(final BigDecimal amount, final int numFractionDigits) {
	Map<Pattern, EReplace<?>> replaces = new HashMap<Pattern, EReplace<?>>();
	
	replaces.put(Pattern.compile("\\{amount}"), EReplace.of(amount.setScale(numFractionDigits, BigDecimal.ROUND_HALF_UP).toString()));
	replaces.put(Pattern.compile("\\{symbol}"), EReplace.of(this.symbol));
	
	if (amount.compareTo(BigDecimal.ONE) <= 0) {
		replaces.put(Pattern.compile("\\{currency}"), EReplace.of(this.singular));
	} else {
		replaces.put(Pattern.compile("\\{currency}"), EReplace.of(this.plural));
	}
	
	return EFormatString.of(this.format).toText(replaces);
}
 
开发者ID:EverCraft,项目名称:EverEconomy,代码行数:16,代码来源:ECurrency.java

示例12: EKMessages

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
private EKMessages(final String french) {   	
	this(EMessageFormat.builder().chat(new EFormatString(french), true));
}
 
开发者ID:EverCraft,项目名称:EverKits,代码行数:4,代码来源:EKMessage.java

示例13: replace

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
public String replace(final String message) {
	Preconditions.checkNotNull(message, "message");
	
	return EFormatString.of(message).toString(this.getReplaceVariables());
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:6,代码来源:EChat.java

示例14: getFormat

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
public default EFormat getFormat() {
	if (this.getMessage().getChat().isPresent()) {
		return this.getMessage().getChat().get().getMessage();
	}
	return new EFormatString("");
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:7,代码来源:EnumMessage.java

示例15: getPrefix

import fr.evercraft.everapi.message.format.EFormatString; //导入依赖的package包/类
public EFormat getPrefix() {
	return this.prefix.isPresent() ? this.prefix.get().getFormat() : new EFormatString("");
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:4,代码来源:EMessageFormat.java


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