2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.minecraft.internal.message;
15 import com.google.gson.JsonElement;
18 * Message used for communicating with Minecraft server.
19 * Used both for sending and receiving messages.
21 * @author Mattias Markehed - Initial contribution
23 public class OHMessage {
25 public static final int MESSAGE_TYPE_PLAYERS = 1;
26 public static final int MESSAGE_TYPE_SERVERS = 2;
27 public static final int MESSAGE_TYPE_SIGNS = 4;
28 public static final int MESSAGE_TYPE_PLAYER_COMMANDS = 3;
29 public static final int MESSAGE_TYPE_SIGN_COMMANDS = 5;
31 private int messageType;
32 private JsonElement message;
35 * Creates a message of type.
37 * @param messageType the message type.
38 * @param message message data.
40 public OHMessage(int messageType, JsonElement message) {
41 this.messageType = messageType;
42 this.message = message;
46 * Get the type of message
48 * @return type of message
50 public int getMessageType() {
57 * @param messageType the type of message
59 public void setMessageType(int messageType) {
60 this.messageType = messageType;
68 public JsonElement getMessage() {
73 * Set the message to send.
77 public void setMessage(JsonElement message) {
78 this.message = message;