Implemented PrivateMessage class.
This commit is contained in:
parent
723e5d712c
commit
07944f6530
3 changed files with 91 additions and 16 deletions
|
@ -44,6 +44,7 @@ public class Message {
|
|||
private String color = Colors.NORMAL;
|
||||
private boolean isError;
|
||||
private boolean isNotice;
|
||||
private boolean isPrivate;
|
||||
private String msg = "";
|
||||
|
||||
/**
|
||||
|
@ -56,36 +57,44 @@ public class Message {
|
|||
/**
|
||||
* Creates a new message.
|
||||
*
|
||||
* @param message The message.
|
||||
* @param isNotice The notice flag.
|
||||
* @param isError The error flag.
|
||||
* @param message The message.
|
||||
* @param isNotice The notice flag.
|
||||
* @param isError The error flag.
|
||||
* @param isPrivate The Private message
|
||||
*/
|
||||
public Message(final String message, final boolean isNotice, final boolean isError) {
|
||||
public Message(final String message, final boolean isNotice, final boolean isError, final boolean isPrivate) {
|
||||
msg = message;
|
||||
this.isNotice = isNotice;
|
||||
this.isError = isError;
|
||||
this.isPrivate = isPrivate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new message.
|
||||
*
|
||||
* @param message The message.
|
||||
* @param isNotice The notice flag.
|
||||
* @param isError The error flag
|
||||
* @param color The color.
|
||||
* @param message The message.
|
||||
* @param isNotice The notice flag.
|
||||
* @param isError The error flag.
|
||||
* @param isPrivate The Private message
|
||||
* @param color The color.
|
||||
*/
|
||||
public Message(final String message, final boolean isNotice, final boolean isError, final String color) {
|
||||
public Message(final String message,
|
||||
final boolean isNotice,
|
||||
final boolean isError,
|
||||
final boolean isPrivate,
|
||||
final String color) {
|
||||
msg = message;
|
||||
this.isNotice = isNotice;
|
||||
this.isError = isError;
|
||||
this.isPrivate = isPrivate;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the color.
|
||||
* Returns the message color.
|
||||
*
|
||||
* @return The color,
|
||||
* @return The color.
|
||||
*/
|
||||
public String getColor() {
|
||||
return color;
|
||||
|
@ -119,7 +128,7 @@ public class Message {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the error flag.
|
||||
* Returns the message error flag.
|
||||
*
|
||||
* @return The error flag.
|
||||
*/
|
||||
|
@ -128,7 +137,7 @@ public class Message {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the error flag.
|
||||
* Sets the message error flag.
|
||||
*
|
||||
* @param error The error flag.
|
||||
*/
|
||||
|
@ -146,11 +155,29 @@ public class Message {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the message notice flag.
|
||||
* Sets the message notice flag.
|
||||
*
|
||||
* @param isNotice The notice flag.
|
||||
*/
|
||||
public void setNotice(final boolean isNotice) {
|
||||
this.isNotice = isNotice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the message private flag.
|
||||
*
|
||||
* @return The private flag.
|
||||
*/
|
||||
public boolean isPrivate() {
|
||||
return isPrivate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message private flag.
|
||||
*
|
||||
* @param aPrivate The private flag.
|
||||
*/
|
||||
public void setPrivate(boolean aPrivate) {
|
||||
isPrivate = aPrivate;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* PrivateMessage.java
|
||||
*
|
||||
* Copyright (c) 2004-2019, Erik C. Thauvin (erik@thauvin.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of this project nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.thauvin.erik.mobibot.msg;
|
||||
|
||||
/**
|
||||
* The <code>PrivateMessage</code> class.
|
||||
*
|
||||
* @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a>
|
||||
* @created 2019-04-09
|
||||
* @since 1.0
|
||||
*/
|
||||
public class PrivateMessage extends Message {
|
||||
public PrivateMessage(final String message) {
|
||||
this.setMessage(message);
|
||||
}
|
||||
|
||||
public PrivateMessage(final String message, final String color) {
|
||||
this.setMessage(message);
|
||||
this.setColor(color);
|
||||
}
|
||||
}
|
|
@ -41,12 +41,10 @@ package net.thauvin.erik.mobibot.msg;
|
|||
public class PublicMessage extends Message {
|
||||
public PublicMessage(final String message) {
|
||||
this.setMessage(message);
|
||||
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