|
26 | 26 |
|
27 | 27 | import org.spongepowered.api.Server; |
28 | 28 | import org.spongepowered.api.block.tileentity.EnderChest; |
| 29 | +import org.spongepowered.api.command.CommandManager; |
| 30 | +import org.spongepowered.api.command.CommandSource; |
| 31 | +import org.spongepowered.api.event.message.MessageChannelEvent; |
| 32 | +import org.spongepowered.api.text.channel.MessageReceiver; |
| 33 | +import org.spongepowered.api.text.chat.ChatType; |
29 | 34 | import org.spongepowered.api.command.source.RemoteSource; |
30 | 35 | import org.spongepowered.api.data.key.Keys; |
31 | 36 | import org.spongepowered.api.data.manipulator.mutable.DisplayNameData; |
@@ -130,6 +135,26 @@ default boolean isViewingInventory() { |
130 | 135 | */ |
131 | 136 | boolean isChatColorsEnabled(); |
132 | 137 |
|
| 138 | + /** |
| 139 | + * Simulates a chat message from a player. |
| 140 | + * |
| 141 | + * <p>This method sends a message as if it came from this player. |
| 142 | + * To send a message to this player instead, see |
| 143 | + * {@link MessageReceiver#sendMessage(Text)} or |
| 144 | + * {@link ChatTypeMessageReceiver#sendMessage(ChatType, Text)}.</p> |
| 145 | + * |
| 146 | + * <p>Commands cannot be sent using this method. To send commands, use |
| 147 | + * {@link CommandManager#process(CommandSource, String)}.</p> |
| 148 | + * |
| 149 | + * <p>If text formatting is not supported in the implementation |
| 150 | + * it will be displayed as plain text.</p> |
| 151 | + * |
| 152 | + * @param message The message to send |
| 153 | + * @param cause The cause for the message |
| 154 | + * @return The event that was thrown from sending the message |
| 155 | + */ |
| 156 | + MessageChannelEvent.Chat simulateChat(Text message, Cause cause); |
| 157 | + |
133 | 158 | /** |
134 | 159 | * Gets the skin parts that this player has allowed to render. |
135 | 160 | * |
|
0 commit comments