Added color property.
This commit is contained in:
parent
3a2954b2cf
commit
f5863f88ac
4 changed files with 63 additions and 7 deletions
|
@ -39,9 +39,15 @@ package net.thauvin.erik.mobibot.msg;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class ErrorMessage extends Message {
|
public class ErrorMessage extends Message {
|
||||||
public ErrorMessage(String message) {
|
public ErrorMessage(final String message) {
|
||||||
this.setMessage(message);
|
this.setMessage(message);
|
||||||
this.setError(true);
|
this.setError(true);
|
||||||
this.setNotice(true);
|
this.setNotice(true);
|
||||||
}
|
}
|
||||||
|
public ErrorMessage(final String message, final String color) {
|
||||||
|
this.setMessage(message);
|
||||||
|
this.setError(true);
|
||||||
|
this.setNotice(true);
|
||||||
|
this.setColor(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
*/
|
*/
|
||||||
package net.thauvin.erik.mobibot.msg;
|
package net.thauvin.erik.mobibot.msg;
|
||||||
|
|
||||||
|
import org.jibble.pircbot.Colors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <code>Message</code> class.
|
* The <code>Message</code> class.
|
||||||
*
|
*
|
||||||
|
@ -39,6 +41,7 @@ package net.thauvin.erik.mobibot.msg;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class Message {
|
public class Message {
|
||||||
|
private String color = Colors.NORMAL;
|
||||||
private boolean isError;
|
private boolean isError;
|
||||||
private boolean isNotice;
|
private boolean isNotice;
|
||||||
private String msg = "";
|
private String msg = "";
|
||||||
|
@ -55,13 +58,48 @@ public class Message {
|
||||||
*
|
*
|
||||||
* @param message The message.
|
* @param message The message.
|
||||||
* @param isNotice The notice flag.
|
* @param isNotice The notice flag.
|
||||||
|
* @param isError The error flag.
|
||||||
*/
|
*/
|
||||||
public Message(String message, boolean isNotice, boolean isError) {
|
public Message(final String message, final boolean isNotice, final boolean isError) {
|
||||||
msg = message;
|
msg = message;
|
||||||
this.isNotice = isNotice;
|
this.isNotice = isNotice;
|
||||||
this.isError = isError;
|
this.isError = isError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new message.
|
||||||
|
*
|
||||||
|
* @param message The message.
|
||||||
|
* @param isNotice The notice flag.
|
||||||
|
* @param isError The error flag
|
||||||
|
* @param color The color.
|
||||||
|
*/
|
||||||
|
public Message(final String message, final boolean isNotice, final boolean isError, final String color) {
|
||||||
|
msg = message;
|
||||||
|
this.isNotice = isNotice;
|
||||||
|
this.isError = isError;
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the color.
|
||||||
|
*
|
||||||
|
* @return The color,
|
||||||
|
*/
|
||||||
|
public String getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the color
|
||||||
|
*
|
||||||
|
* @param color The new color.
|
||||||
|
*/
|
||||||
|
public void setColor(final String color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the message.
|
* Returns the message.
|
||||||
*
|
*
|
||||||
|
@ -76,7 +114,7 @@ public class Message {
|
||||||
*
|
*
|
||||||
* @param message The new message.
|
* @param message The new message.
|
||||||
*/
|
*/
|
||||||
public void setMessage(String message) {
|
public void setMessage(final String message) {
|
||||||
msg = message;
|
msg = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +132,7 @@ public class Message {
|
||||||
*
|
*
|
||||||
* @param error The error flag.
|
* @param error The error flag.
|
||||||
*/
|
*/
|
||||||
public void setError(boolean error) {
|
public void setError(final boolean error) {
|
||||||
isError = error;
|
isError = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +150,7 @@ public class Message {
|
||||||
*
|
*
|
||||||
* @param isNotice The notice flag.
|
* @param isNotice The notice flag.
|
||||||
*/
|
*/
|
||||||
public void setNotice(boolean isNotice) {
|
public void setNotice(final boolean isNotice) {
|
||||||
this.isNotice = isNotice;
|
this.isNotice = isNotice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,14 @@ package net.thauvin.erik.mobibot.msg;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class NoticeMessage extends Message {
|
public class NoticeMessage extends Message {
|
||||||
public NoticeMessage(String message) {
|
public NoticeMessage(final String message) {
|
||||||
this.setMessage(message);
|
this.setMessage(message);
|
||||||
this.setNotice(true);
|
this.setNotice(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NoticeMessage(final String message, final String color) {
|
||||||
|
this.setMessage(message);
|
||||||
|
this.setNotice(true);
|
||||||
|
this.setColor(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,14 @@ package net.thauvin.erik.mobibot.msg;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class PublicMessage extends Message {
|
public class PublicMessage extends Message {
|
||||||
public PublicMessage(String message) {
|
public PublicMessage(final String message) {
|
||||||
this.setMessage(message);
|
this.setMessage(message);
|
||||||
this.setNotice(false);
|
this.setNotice(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PublicMessage(final String message, final String color) {
|
||||||
|
this.setMessage(message);
|
||||||
|
this.setNotice(false);
|
||||||
|
this.setColor(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue