本文整理汇总了Java中net.minecraft.server.IChatBaseComponent类的典型用法代码示例。如果您正苦于以下问题:Java IChatBaseComponent类的具体用法?Java IChatBaseComponent怎么用?Java IChatBaseComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IChatBaseComponent类属于net.minecraft.server包,在下文中一共展示了IChatBaseComponent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: serialize
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
@Override
Builder<String, Object> serialize(Builder<String, Object> builder) {
super.serialize(builder);
if (hasTitle()) {
builder.put(BOOK_TITLE.BUKKIT, title);
}
if (hasAuthor()) {
builder.put(BOOK_AUTHOR.BUKKIT, author);
}
if (hasPages()) {
List<String> pagesString = new ArrayList<String>();
for (IChatBaseComponent comp : pages) {
pagesString.add(CraftChatMessage.fromComponent(comp));
}
builder.put(BOOK_PAGES.BUKKIT, pagesString);
}
if (generation != null) {
builder.put(GENERATION.BUKKIT, generation);
}
return builder;
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:27,代码来源:CraftMetaBook.java
示例2: fromComponent
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
public static String fromComponent(IChatBaseComponent component, EnumChatFormat defaultColor) {
if (component == null) return "";
StringBuilder out = new StringBuilder();
for (IChatBaseComponent c : (Iterable<IChatBaseComponent>) component) {
ChatModifier modi = c.getChatModifier();
out.append(modi.getColor() == null ? defaultColor : modi.getColor());
if (modi.isBold()) {
out.append(EnumChatFormat.BOLD);
}
if (modi.isItalic()) {
out.append(EnumChatFormat.ITALIC);
}
if (modi.isUnderlined()) {
out.append(EnumChatFormat.UNDERLINE);
}
if (modi.isStrikethrough()) {
out.append(EnumChatFormat.STRIKETHROUGH);
}
if (modi.isRandom()) {
out.append(EnumChatFormat.OBFUSCATED);
}
out.append(c.getText());
}
return out.toString().replaceFirst("^(" + defaultColor + ")*", "");
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:27,代码来源:CraftChatMessage.java
示例3: a
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
@Override
public PacketTracer a(IChatBaseComponent chat) {
value("Chat", chat);
try {
mute = true;
super.a(chat);
} finally {
mute = false;
}
return this;
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:12,代码来源:PacketTracer.java
示例4: update
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
@Override
public boolean update(boolean force, boolean applyPhysics) {
boolean result = super.update(force, applyPhysics);
if (result) {
IChatBaseComponent[] newLines = sanitizeLines(lines);
System.arraycopy(newLines, 0, sign.lines, 0, 4);
sign.update();
}
return result;
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:13,代码来源:CraftSign.java
示例5: sanitizeLines
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
public static IChatBaseComponent[] sanitizeLines(String[] lines) {
IChatBaseComponent[] components = new IChatBaseComponent[4];
for (int i = 0; i < 4; i++) {
if (i < lines.length && lines[i] != null) {
components[i] = CraftChatMessage.fromString(lines[i])[0];
} else {
components[i] = new ChatComponentText("");
}
}
return components;
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:14,代码来源:CraftSign.java
示例6: revertComponents
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
public static String[] revertComponents(IChatBaseComponent[] components) {
String[] lines = new String[components.length];
for (int i = 0; i < lines.length; i++) {
lines[i] = revertComponent(components[i]);
}
return lines;
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:8,代码来源:CraftSign.java
示例7: applyToItem
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
@Override
void applyToItem(NBTTagCompound itemData) {
super.applyToItem(itemData, false);
if (hasTitle()) {
itemData.setString(BOOK_TITLE.NBT, this.title);
} else {
itemData.setString(BOOK_TITLE.NBT, " ");
}
if (hasAuthor()) {
itemData.setString(BOOK_AUTHOR.NBT, this.author);
} else {
itemData.setString(BOOK_AUTHOR.NBT, " ");
}
if (hasPages()) {
NBTTagList list = new NBTTagList();
for (IChatBaseComponent page : pages) {
list.add(new NBTTagString(
ChatSerializer.a(page)
));
}
itemData.set(BOOK_PAGES.NBT, list);
}
itemData.setBoolean(RESOLVED.NBT, true);
if (generation != null) {
itemData.setInt(GENERATION.NBT, generation);
} else {
itemData.setInt(GENERATION.NBT, 0);
}
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:34,代码来源:CraftMetaBookSigned.java
示例8: applyToItem
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
void applyToItem(NBTTagCompound itemData, boolean handlePages) {
super.applyToItem(itemData);
if (hasTitle()) {
itemData.setString(BOOK_TITLE.NBT, this.title);
}
if (hasAuthor()) {
itemData.setString(BOOK_AUTHOR.NBT, this.author);
}
if (handlePages) {
if (hasPages()) {
NBTTagList list = new NBTTagList();
for (IChatBaseComponent page : pages) {
list.add(new NBTTagString(CraftChatMessage.fromComponent(page)));
}
itemData.set(BOOK_PAGES.NBT, list);
}
itemData.remove(RESOLVED.NBT);
}
if (generation != null) {
itemData.setInt(GENERATION.NBT, generation);
}
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:28,代码来源:CraftMetaBook.java
示例9: getPages
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
public List<String> getPages() {
final List<IChatBaseComponent> copy = ImmutableList.copyOf(pages);
return new AbstractList<String>() {
@Override
public String get(int index) {
return CraftChatMessage.fromComponent(copy.get(index));
}
@Override
public int size() {
return copy.size();
}
};
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:16,代码来源:CraftMetaBook.java
示例10: StringMessage
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
private StringMessage(String message) {
this.message = message;
if (message == null) {
output = new IChatBaseComponent[] { currentChatComponent };
return;
}
list.add(currentChatComponent);
Matcher matcher = INCREMENTAL_PATTERN.matcher(message);
String match = null;
while (matcher.find()) {
int groupId = 0;
while ((match = matcher.group(++groupId)) == null) {
// NOOP
}
appendNewComponent(matcher.start(groupId));
switch (groupId) {
case 1:
EnumChatFormat format = formatMap.get(match.toLowerCase().charAt(1));
if (format == EnumChatFormat.RESET) {
modifier = new ChatModifier();
} else if (format.isFormat()) {
switch (format) {
case BOLD:
modifier.setBold(Boolean.TRUE);
break;
case ITALIC:
modifier.setItalic(Boolean.TRUE);
break;
case STRIKETHROUGH:
modifier.setStrikethrough(Boolean.TRUE);
break;
case UNDERLINE:
modifier.setUnderline(Boolean.TRUE);
break;
case RANDOM:
modifier.setRandom(Boolean.TRUE);
break;
default:
throw new AssertionError("Unexpected message format");
}
} else { // Color resets formatting
modifier = new ChatModifier().setColor(format);
}
break;
case 2:
currentChatComponent = null;
break;
case 3:
modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match));
appendNewComponent(matcher.end(groupId));
modifier.setChatClickable((ChatClickable) null);
}
currentIndex = matcher.end(groupId);
}
if (currentIndex < message.length()) {
appendNewComponent(message.length());
}
output = list.toArray(new IChatBaseComponent[0]);
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:63,代码来源:CraftChatMessage.java
示例11: getOutput
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
private IChatBaseComponent[] getOutput() {
return output;
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:CraftChatMessage.java
示例12: fromString
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
public static IChatBaseComponent[] fromString(String message) {
return new StringMessage(message).getOutput();
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:CraftChatMessage.java
示例13: revertComponent
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
private static String revertComponent(IChatBaseComponent component) {
return CraftChatMessage.fromComponent(component);
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:4,代码来源:CraftSign.java
示例14: getScoreboardDisplayName
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
@Override
public IChatBaseComponent getScoreboardDisplayName() {
return new ChatComponentText(title);
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:5,代码来源:CraftInventoryCustom.java
示例15: clone
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
@Override
public CraftMetaBook clone() {
CraftMetaBook meta = (CraftMetaBook) super.clone();
meta.pages = new ArrayList<IChatBaseComponent>(pages);
return meta;
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:7,代码来源:CraftMetaBook.java
示例16: getScoreboardDisplayName
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
@Override
public IChatBaseComponent getScoreboardDisplayName() {
return CraftChatMessage.fromString(getName())[0];
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:5,代码来源:InventoryWrapper.java
示例17: StringMessage
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
private StringMessage(String message, boolean keepNewlines) {
this.message = message;
if (message == null) {
output = new IChatBaseComponent[] { currentChatComponent };
return;
}
list.add(currentChatComponent);
Matcher matcher = INCREMENTAL_PATTERN.matcher(message);
String match = null;
while (matcher.find()) {
int groupId = 0;
while ((match = matcher.group(++groupId)) == null) {
// NOOP
}
appendNewComponent(matcher.start(groupId));
switch (groupId) {
case 1:
EnumChatFormat format = formatMap.get(match.toLowerCase().charAt(1));
if (format == EnumChatFormat.RESET) {
modifier = new ChatModifier();
} else if (format.isFormat()) {
switch (format) {
case BOLD:
modifier.setBold(Boolean.TRUE);
break;
case ITALIC:
modifier.setItalic(Boolean.TRUE);
break;
case STRIKETHROUGH:
modifier.setStrikethrough(Boolean.TRUE);
break;
case UNDERLINE:
modifier.setUnderline(Boolean.TRUE);
break;
case OBFUSCATED:
modifier.setRandom(Boolean.TRUE);
break;
default:
throw new AssertionError("Unexpected message format");
}
} else { // Color resets formatting
modifier = new ChatModifier().setColor(format);
}
break;
case 2:
if (keepNewlines) {
currentChatComponent.addSibling(new ChatComponentText("\n"));
} else {
currentChatComponent = null;
}
break;
case 3:
if ( !( match.startsWith( "http://" ) || match.startsWith( "https://" ) ) ) {
match = "http://" + match;
}
modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match));
appendNewComponent(matcher.end(groupId));
modifier.setChatClickable((ChatClickable) null);
}
currentIndex = matcher.end(groupId);
}
if (currentIndex < message.length()) {
appendNewComponent(message.length());
}
output = list.toArray(new IChatBaseComponent[list.size()]);
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:70,代码来源:CraftChatMessage.java
示例18: fromString
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
public static IChatBaseComponent[] fromString(String message) {
return fromString(message, false);
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:4,代码来源:CraftChatMessage.java
示例19: fixComponent
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
public static IChatBaseComponent fixComponent(IChatBaseComponent component) {
Matcher matcher = LINK_PATTERN.matcher("");
return fixComponent(component, matcher);
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:5,代码来源:CraftChatMessage.java
示例20: sendMessage
import net.minecraft.server.IChatBaseComponent; //导入依赖的package包/类
public void sendMessage(String message) {
for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
commandBlock.sendMessage(component);
}
}
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:6,代码来源:CraftBlockCommandSender.java
注:本文中的net.minecraft.server.IChatBaseComponent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论