Skip to content

Instantly share code, notes, and snippets.

@killjoy1221
Created January 29, 2019 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save killjoy1221/62001acff36826fe7648c7ecd8cba5bb to your computer and use it in GitHub Desktop.
Save killjoy1221/62001acff36826fe7648c7ecd8cba5bb to your computer and use it in GitHub Desktop.
package org.spongepowered.api.client;
import org.spongepowered.api.text.Text;
import java.time.Instant;
public interface ChatManager {
/**
* Sends a raw message to the server. Any client commands will be processed
* before the message is sent.
*
* @param msg The message
*/
void send(String msg);
/**
* Prints a
*
* @param message
*/
default void print(Text message) {
print(message, 0);
}
/**
* Prints a {@link Text chat message} to the chat gui. If id is non-zero,
* the previous entry with that id is removed.
*
* @param message The message.
* @param id
*/
void print(Text message, int id);
ChatEntry get(int index);
boolean remove(int index);
boolean remove(ChatEntry entry);
/**
* Clears all the {@link ChatEntry entries} from the chat buffer.
*/
void clear();
interface ChatEntry {
/**
* Gets the {@link Text} which is represented by this entry.
*
* @return
*/
Text getText();
/**
* Gets the id of the chat entry. Entries with a non-zero id will be
* removed when another of the same id is added.
*
* @return
*/
int getId();
/**
* Gets the {@link Instant} this chat entry was printed to chat.
*
* @return
*/
Instant getTimestamp();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment