/*
 *    Copyright 2016 5zig
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package eu.the5zig.mod.event;

/**
 * Called, when the client has received a chat message from the server.
 */
public class ChatEvent extends Event implements Cancelable {

	/**
	 * The message of the server.
	 */
	private String message;
	/**
	 * An object that represents a minecraft internal chat component. Used internally to send messages to the second chat.
	 */
	private Object chatComponent;

	/**
	 * Indicates whether the event has been cancelled.
	 */
	private boolean cancelled;

	public ChatEvent(String message, Object chatComponent) {
		this.message = message;
		this.chatComponent = chatComponent;
	}

	/**
	 * @return the chat message that has been received.
	 */
	public String getMessage() {
		return message;
	}

	/**
	 * @return the minecraft internal chat component.
	 */
	public Object getChatComponent() {
		return chatComponent;
	}

	@Override
	public boolean isCancelled() {
		return cancelled;
	}

	@Override
	public void setCancelled(boolean cancelled) {
		this.cancelled = cancelled;
	}
}

@@ -822,24 +822,98 @@
 erver.%0A%09 */%0A
+%09private String originalMessage;%0A%09/**%0A%09 * Can be changed by plugins.%0A%09 */%0A
 %09private Str
@@ -917,32 +917,32 @@
 String message;%0A
-
 %09/**%0A%09 * An obje
@@ -1243,17 +1243,25 @@
 %0A%09%09this.
-m
+originalM
 essage =
@@ -1371,24 +1371,24 @@
 eived.%0A%09 */%0A
-
 %09public Stri
@@ -1401,24 +1401,616 @@
 Message() %7B%0A
+%09%09return originalMessage;%0A%09%7D%0A%0A%09/**%0A%09 * Changes the chat message. The message will be only changed if %7B@link #isCancelled()%7D is %7B@code false%7D.%0A%09 * Note, that %7B@link #getMessage()%7D still returns the original message to maintain compatibility.%0A%09 *%0A%09 * @param message the new message.%0A%09 */%0A%09public void setMessage(String message) %7B%0A%09%09if (message == null %7C%7C !message.equals(originalMessage)) %7B%0A%09%09%09this.message = message;%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * @return the chat message that has been changed by plugins or %7B@code null%7D, if the chat message has not been changed.%0A%09 */%0A%09public String getAlteredMessage() %7B%0A
 %09%09return mes

Add setMessage to chat event