Added 'IncorrectRequestMessage' class.
Added the 'IncorrectRequestMessage' class to this project. It will be used to send the client an incorrect request message to show they did something wrong.
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package pp.mdga.message.server;
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
|
||||
@Serializable
|
||||
public class IncorrectRequestMessage extends ServerMessage {
|
||||
/**
|
||||
* Create IncorrectRequestMessage attributes.
|
||||
*/
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param id as the id of the error message as an Integer.
|
||||
*/
|
||||
public IncorrectRequestMessage(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public IncorrectRequestMessage() {
|
||||
this.id = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepts a visitor to process this message.
|
||||
*
|
||||
* @param interpreter the visitor to process this message
|
||||
*/
|
||||
@Override
|
||||
public void accept(ServerInterpreter interpreter) {
|
||||
interpreter.process(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bundle key of the informational text to be shown at the client.
|
||||
* This key is used to retrieve the appropriate localized text for display.
|
||||
*
|
||||
* @return the bundle key of the informational text
|
||||
*/
|
||||
@Override
|
||||
public String getInfoTextKey() {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return necessary class information in a more readable format.
|
||||
*
|
||||
* @return information as a String.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IncorrectRequestMessage with id: %d".formatted(this.id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user