Java Code Examples for org.bukkit.craftbukkit.util.CraftChatMessage#fromString()
The following examples show how to use
org.bukkit.craftbukkit.util.CraftChatMessage#fromString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CraftPlayer.java From Kettle with GNU General Public License v3.0 | 5 votes |
@Override public void sendRawMessage(String message) { if (getHandle().connection == null) { return; } for (ITextComponent component : CraftChatMessage.fromString(message)) { getHandle().connection.sendPacket(new SPacketChat(component)); } }
Example 2
Source File: CraftPlayer.java From Kettle with GNU General Public License v3.0 | 5 votes |
@Override public void setPlayerListName(String name) { if (name == null) { name = getName(); } getHandle().listName = name.equals(getName()) ? null : CraftChatMessage.fromString(name)[0]; for (EntityPlayerMP player : server.getHandle().getPlayers()) { if (player.getBukkitEntity().canSee(this)) { player.connection.sendPacket(new SPacketPlayerListItem(SPacketPlayerListItem.Action.UPDATE_DISPLAY_NAME, getHandle())); } } }
Example 3
Source File: CraftPlayer.java From Kettle with GNU General Public License v3.0 | 5 votes |
@Override public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) { SPacketTitle times = new SPacketTitle(fadeIn, stay, fadeOut); getHandle().connection.sendPacket(times); if (title != null) { SPacketTitle packetTitle = new SPacketTitle(SPacketTitle.Type.TITLE, CraftChatMessage.fromString(title)[0]); getHandle().connection.sendPacket(packetTitle); } if (subtitle != null) { SPacketTitle packetSubtitle = new SPacketTitle(SPacketTitle.Type.SUBTITLE, CraftChatMessage.fromString(subtitle)[0]); getHandle().connection.sendPacket(packetSubtitle); } }
Example 4
Source File: CraftSign.java From Kettle with GNU General Public License v3.0 | 5 votes |
public static ITextComponent[] sanitizeLines(String[] lines) { ITextComponent[] components = new ITextComponent[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 TextComponentString(""); } } return components; }
Example 5
Source File: CraftBossBar.java From Kettle with GNU General Public License v3.0 | 5 votes |
public CraftBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) { this.flags = flags.length > 0 ? EnumSet.of(flags[0], flags) : EnumSet.noneOf(BarFlag.class); this.color = color; this.style = style; handle = new BossInfoServer( CraftChatMessage.fromString(title, true)[0], convertColor(color), convertStyle(style) ); updateFlags(); }
Example 6
Source File: CraftPlayer.java From Thermos with GNU General Public License v3.0 | 5 votes |
@Override public void sendRawMessage(String message) { if (getHandle().playerNetServerHandler == null) return; for (net.minecraft.util.IChatComponent component : CraftChatMessage.fromString(message)) { getHandle().playerNetServerHandler.sendPacket(new net.minecraft.network.play.server.S02PacketChat(component)); } }
Example 7
Source File: InventoryWrapper.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public ITextComponent getDisplayName() { return CraftChatMessage.fromString(getName())[0]; }
Example 8
Source File: CraftBossBar.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public void setTitle(String title) { handle.name = CraftChatMessage.fromString(title, true)[0]; handle.sendUpdate(SPacketUpdateBossInfo.Operation.UPDATE_NAME); }
Example 9
Source File: CraftBlockCommandSender.java From Kettle with GNU General Public License v3.0 | 4 votes |
public void sendMessage(String message) { for (ITextComponent component : CraftChatMessage.fromString(message)) { block.sendMessage(component); } }
Example 10
Source File: CraftFunctionCommandSender.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public void sendMessage(String message) { for (ITextComponent component : CraftChatMessage.fromString(message)) { handle.sendMessage(component); } }