本文整理汇总了Java中org.spongepowered.api.text.Texts.of方法的典型用法代码示例。如果您正苦于以下问题:Java Texts.of方法的具体用法?Java Texts.of怎么用?Java Texts.of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongepowered.api.text.Texts
的用法示例。
在下文中一共展示了Texts.of方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
try {
return Texts.json().from(json.getAsString());
} catch (TextMessageException e) {
e.printStackTrace();
}
return Texts.of();
}
示例2: getName
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text getName() {
return Texts.of(TextColors.BLUE, "G",
TextColors.RED, "o",
TextColors.YELLOW, "o",
TextColors.BLUE, "g",
TextColors.GREEN, "l",
TextColors.RED, "e");
}
示例3: translateAction
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text translateAction(User user)
{
if (this.hasAttached())
{
return super.translateAction(user);
}
String delim = ChatFormat.GREY + " | " + ChatFormat.GOLD;
return Texts.of(super.translateAction(user), "\n" +
user.getTranslation(POSITIVE, " with {input#signtext} written on it", StringUtils.implode(delim,
this.oldLines)));
}
示例4: translateAction
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text translateAction(User user)
{
String delim = ChatFormat.GREY + " | " + ChatFormat.GOLD;
if (oldLines == null || oldLines.length == 0)
{
return user.getTranslation(POSITIVE, "{user} wrote {input#signtext} on a sign", this.player.name,
StringUtils.implode(delim, newLines));
}
return Texts.of(user.getTranslation(POSITIVE, "{user} wrote {input#signtext} on a sign", this.player.name,
StringUtils.implode(delim, newLines)) , "\n" ,
user.getTranslation(POSITIVE, " The old signtext was {input#signtext}", StringUtils.implode(delim,
oldLines)));
}
示例5: translateAction
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text translateAction(User user)
{
if (this.hasAttached())
{
return super.translateAction(user);
}
String delim = ChatFormat.GREY + " | " + ChatFormat.GOLD;
return Texts.of(super.translateAction(user), "\n" ,
user.getTranslation(POSITIVE, " with {input#signtext} written on it", StringUtils.implode(delim,
this.oldLines)));
}
示例6: getDescription
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
default Text getDescription() {
return Texts.of(getStringDescription());
}
示例7: textToString
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Test public void textToString() {
Text text = Texts.of("something");
assertEquals("something", new CommandTestHelper(null).toString(text));
}
示例8: get
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
public Text get(Messages message, String... strings){
return Texts.of(String.format(languageConfig.getRoot().getNode(message.name()).getString(), strings));
}
示例9: getName
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text getName() {
return Texts.of(TextColors.YELLOW, "DuckDuck", TextColors.GRAY, "Go");
}
示例10: getName
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Override
public Text getName() {
return Texts.of(TextColors.GRAY, "Bing");
}
示例11: parseValue
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
@Nullable
@Override
protected Object parseValue(CommandSource source, CommandArgs args) throws
ArgumentParseException {
if (!(source instanceof Living)) {
throw new ArgumentParseException(Texts.of("The command source is not located!"),
source.toString(), 0);
}
final Living callingEntity = (Living) source;
Location<World> location = callingEntity.getLocation();
Collection<Entity> nearby = callingEntity.getWorld().getEntities(
input -> {
if (input == null) {
return false;
}
Vector3d targetCoords = input.getLocation().getPosition();
Vector3d casterCoords = location.getPosition();
return targetCoords.distance(casterCoords)
> EntitySkillArgument.this.maxDistance;
});
Vector3d middle = callingEntity.getProperty(EyeLocationProperty.class).get().getValue();
double closestDistance = this.maxDistance;
@Nullable
E closest = null;
for (Entity entity : nearby) {
if (!this.clazz.isInstance(entity)) {
continue;
}
@SuppressWarnings("unchecked")
E ent = (E) entity;
Vector3d otherMiddle = entity.getLocation().getPosition();
if (entity instanceof Living) {
otherMiddle = entity.getProperty(EyeLocationProperty.class).get().getValue();
}
final Vector3d diff = otherMiddle.sub(middle);
// Algorithm: Make a triangle
final Vector3d doubleDirection = middle.clone();
final double b = diff.dot(doubleDirection);
final double c = middle.distanceSquared(otherMiddle);
final double a = Math.sqrt(c - b * b);
if (a < closestDistance) {
if (this.condition.test(ent)) {
closestDistance = a;
closest = ent;
}
}
}
if (closestDistance < this.maxDistance) {
return closest;
}
return null;
}
示例12: TestSkillAbstract
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
public TestSkillAbstract(RpgPlugin plugin) {
super(plugin, "TestSkill", Texts.of("This is a test skill."));
}
示例13: StandardEffect
import org.spongepowered.api.text.Texts; //导入方法依赖的package包/类
/**
* Creates a new {@link StandardEffect} with the desired operations, name and effect types.
*
* @param name The name of this standard effect
* @param applyOperations The many standard operations when the effect is applied
* @param types The various effect types
*/
public StandardEffect(String name,
Set<ApplyEffectOperation> applyOperations,
Collection<EffectType> types) {
this(name, applyOperations, types, Texts.of(""), Sets.<EffectProperty<?>>newHashSet());
}