Add support for Redis messaging, close #50

This commit is contained in:
William committed 2021-10-02 21:49:28 +01:00
1 parent 48906c018b
commit 4cdb39ba65
16 files changed
+526 -291

No files matched your search

@@ -0,0 +1,126 @@
package me.william278.huskhomes2.data.message;
import me.william278.huskhomes2.HuskHomes;
import me.william278.huskhomes2.MessageManager;
import me.william278.huskhomes2.data.DataManager;
import me.william278.huskhomes2.data.message.pluginmessage.PluginMessage;
import me.william278.huskhomes2.data.message.redis.RedisMessage;
import me.william278.huskhomes2.integrations.VanishChecker;
import me.william278.huskhomes2.teleport.TeleportManager;
import me.william278.huskhomes2.teleport.TeleportRequest;
import me.william278.huskhomes2.teleport.TeleportRequestHandler;
import me.william278.huskhomes2.teleport.points.TeleportationPoint;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.StringJoiner;
import java.util.logging.Level;
public class CrossServerMessageHandler {
private static final HuskHomes plugin = HuskHomes.getInstance();
public static void handlePluginMessage(Message receivedMessage, Player recipient) {
Connection connection = HuskHomes.getConnection();
switch (receivedMessage.getMessageType()) {
case SET_TP_DESTINATION -> Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
try {
DataManager.setPlayerDestinationLocation(receivedMessage.getMessageData(),
new TeleportationPoint(recipient.getLocation(), HuskHomes.getSettings().getServerID()), connection);
new PluginMessage(receivedMessage.getMessageData(), Message.MessageType.CONFIRM_DESTINATION_SET, "confirmed").send(recipient);
} catch (SQLException e) {
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred responding to a plugin message teleport destination update");
}
});
case CONFIRM_DESTINATION_SET -> {
if (receivedMessage.getMessageData().equals("confirmed")) {
TeleportManager.teleportPlayer(recipient);
}
}
case TPA_REQUEST -> {
if (!VanishChecker.isVanished(recipient)) {
if (!HuskHomes.isIgnoringTeleportRequests(recipient.getUniqueId())) {
TeleportRequestHandler.teleportRequests.put(recipient, new TeleportRequest(receivedMessage.getMessageData(), TeleportRequest.RequestType.TPA));
MessageManager.sendMessage(recipient, "tpa_request_ask", receivedMessage.getMessageData());
MessageManager.sendMessage(recipient, "teleport_request_options");
}
}
}
case TPA_HERE_REQUEST -> {
if (!VanishChecker.isVanished(recipient)) {
if (!HuskHomes.isIgnoringTeleportRequests(recipient.getUniqueId())) {
TeleportRequestHandler.teleportRequests.put(recipient, new TeleportRequest(receivedMessage.getMessageData(), TeleportRequest.RequestType.TPA_HERE));
MessageManager.sendMessage(recipient, "tpahere_request_ask", receivedMessage.getMessageData());
MessageManager.sendMessage(recipient, "teleport_request_options");
}
}
}
case TPA_REQUEST_REPLY -> {
final String tpaReplierName = receivedMessage.getMessageDataItems()[0];
final boolean tpaAccepted = Boolean.parseBoolean(receivedMessage.getMessageDataItems()[1]);
if (tpaAccepted) {
MessageManager.sendMessage(recipient, "tpa_has_accepted", tpaReplierName);
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
try {
TeleportManager.queueTimedTeleport(recipient, tpaReplierName, connection);
} catch (SQLException e) {
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred responding to a plugin message teleport request reply");
}
});
} else {
MessageManager.sendMessage(recipient, "tpa_has_declined", tpaReplierName);
}
}
case TPA_HERE_REQUEST_REPLY -> {
final String tpaHereReplierName = receivedMessage.getMessageDataItems()[0];
final boolean tpaHereAccepted = Boolean.parseBoolean(receivedMessage.getMessageDataItems()[1]);
if (tpaHereAccepted) {
MessageManager.sendMessage(recipient, "tpa_has_accepted", tpaHereReplierName);
} else {
MessageManager.sendMessage(recipient, "tpa_has_declined", tpaHereReplierName);
}
}
case TELEPORT_TO_ME -> Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
try {
TeleportManager.teleportPlayer(recipient, receivedMessage.getMessageData(), connection);
} catch (SQLException e) {
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred responding to a plugin message teleport-to-me request");
}
});
case GET_PLAYER_LIST -> {
final String requestingServer = receivedMessage.getMessageData();
StringJoiner playerList = new StringJoiner("£");
for (Player p : Bukkit.getOnlinePlayers()) {
playerList.add(p.getName());
}
if (playerList.toString().equals("")) {
return;
}
CrossServerMessageHandler.getMessage(Message.MessageType.RETURN_PLAYER_LIST, playerList.toString()).sendToServer(recipient, requestingServer);
}
case RETURN_PLAYER_LIST -> {
final String[] returningPlayers = receivedMessage.getMessageData().split("£");
HuskHomes.getPlayerList().addPlayers(returningPlayers);
}
default -> HuskHomes.getInstance().getLogger().log(Level.WARNING, "Received a HuskHomes plugin message with an unrecognised type. Is your version of HuskHomes up to date?");
}
}
public static Message getMessage(String targetPlayerName, Message.MessageType pluginMessageType, String... messageData) {
return switch (HuskHomes.getSettings().getMessengerType().toLowerCase()) {
case "pluginmessage" -> new PluginMessage(targetPlayerName, pluginMessageType, messageData);
case "redis" -> new RedisMessage(targetPlayerName, pluginMessageType, messageData);
default -> null;
};
}
public static Message getMessage(Message.MessageType pluginMessageType, String... messageData) {
return switch (HuskHomes.getSettings().getMessengerType().toLowerCase()) {
case "pluginmessage" -> new PluginMessage(pluginMessageType, messageData);
case "redis" -> new RedisMessage(pluginMessageType, messageData);
default -> null;
};
}
}
@@ -0,0 +1,93 @@
package me.william278.huskhomes2.data.message;
import me.william278.huskhomes2.HuskHomes;
import org.bukkit.entity.Player;
import java.util.Locale;
import java.util.StringJoiner;
public abstract class Message {
private static final String MESSAGE_DATA_SEPARATOR = "$";
private final int clusterId;
private final Message.MessageType messageType;
private final String targetPlayerName;
private final String messageData;
public Message(String targetPlayerName, MessageType pluginMessageType, String... messageData) {
this.clusterId = HuskHomes.getSettings().getClusterId();
this.messageType = pluginMessageType;
StringJoiner newMessageData = new StringJoiner(MESSAGE_DATA_SEPARATOR);
for (String dataItem : messageData) {
newMessageData.add(dataItem);
}
this.messageData = newMessageData.toString();
this.targetPlayerName = targetPlayerName;
}
public Message(MessageType pluginMessageType, String... messageData) {
this.clusterId = HuskHomes.getSettings().getClusterId();
this.messageType = pluginMessageType;
StringJoiner newMessageData = new StringJoiner(MESSAGE_DATA_SEPARATOR);
for (String dataItem : messageData) {
newMessageData.add(dataItem);
}
this.messageData = newMessageData.toString();
this.targetPlayerName = null;
}
public Message(int clusterId, String targetPlayerName, String pluginMessageType, String... messageData) {
this.clusterId = clusterId;
this.messageType = MessageType.valueOf(pluginMessageType.toUpperCase(Locale.ENGLISH));
StringJoiner newMessageData = new StringJoiner(MESSAGE_DATA_SEPARATOR);
for (String dataItem : messageData) {
newMessageData.add(dataItem);
}
this.messageData = newMessageData.toString();
this.targetPlayerName = targetPlayerName;
}
// Get the string version of the plugin message type
protected String getPluginMessageString(Message.MessageType type) {
return type.name().toLowerCase(Locale.ENGLISH);
}
public int getClusterId() {
return clusterId;
}
public Message.MessageType getMessageType() {
return messageType;
}
public String getTargetPlayerName() {
return targetPlayerName;
}
public String getMessageData() {
return messageData;
}
public String[] getMessageDataItems() {
return messageData.split("\\" + MESSAGE_DATA_SEPARATOR);
}
public abstract void send(Player sender);
public abstract void sendToAllServers(Player sender);
public abstract void sendToServer(Player sender, String server);
public enum MessageType {
SET_TP_DESTINATION,
CONFIRM_DESTINATION_SET,
TPA_REQUEST,
TPA_HERE_REQUEST,
TPA_REQUEST_REPLY,
TPA_HERE_REQUEST_REPLY,
TELEPORT_TO_ME,
GET_PLAYER_LIST,
RETURN_PLAYER_LIST
}
}
@@ -0,0 +1,95 @@
package me.william278.huskhomes2.data.message.pluginmessage;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import me.william278.huskhomes2.HuskHomes;
import me.william278.huskhomes2.data.message.Message;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class PluginMessage extends Message {
private static final HuskHomes plugin = HuskHomes.getInstance();
public PluginMessage(String targetPlayerName, MessageType pluginMessageType, String... messageData) {
super(targetPlayerName, pluginMessageType, messageData);
}
public PluginMessage(MessageType pluginMessageType, String... messageData) {
super(pluginMessageType, messageData);
}
public PluginMessage(int clusterID, String targetPlayerName, String pluginMessageType, String... messageData) {
super(clusterID, targetPlayerName, pluginMessageType, messageData);
}
@SuppressWarnings("UnstableApiUsage")
public void send(Player sender) {
Bukkit.getScheduler().runTask(plugin, () -> {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
// Send a plugin message to the specified player name
out.writeUTF("ForwardToPlayer");
out.writeUTF(getTargetPlayerName());
// Send the HuskHomes message with a specific type
out.writeUTF("HuskHomes:" + getClusterId() + ":" + getPluginMessageString(getMessageType()));
ByteArrayOutputStream messageBytes = new ByteArrayOutputStream();
DataOutputStream messageOut = new DataOutputStream(messageBytes);
// Send the message data; output an exception if there's an error
try {
messageOut.writeUTF(getMessageData());
} catch (IOException e) {
plugin.getLogger().warning("An error occurred trying to send a plugin message (" + e.getCause() + ")");
e.printStackTrace();
}
// Write the messages to the output packet
out.writeShort(messageBytes.toByteArray().length);
out.write(messageBytes.toByteArray());
// Send the constructed plugin message packet
sender.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
});
}
public void sendToAllServers(Player sender) {
sendToServer(sender, "ALL");
}
@SuppressWarnings("UnstableApiUsage")
public void sendToServer(Player sender, String server) {
Bukkit.getScheduler().runTask(plugin, () -> {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
// Send a plugin message to the specified player name
out.writeUTF("Forward");
out.writeUTF(server);
// Send the HuskHomes message with a specific type
out.writeUTF("HuskHomes:" + getClusterId() + ":" + getPluginMessageString(getMessageType()));
ByteArrayOutputStream messageBytes = new ByteArrayOutputStream();
DataOutputStream messageOut = new DataOutputStream(messageBytes);
// Send the message data; output an exception if there's an error
try {
messageOut.writeUTF(getMessageData());
} catch (IOException e) {
plugin.getLogger().warning("An error occurred trying to send a plugin message to a server (" + e.getCause() + ")");
e.printStackTrace();
}
// Write the messages to the output packet
out.writeShort(messageBytes.toByteArray().length);
out.write(messageBytes.toByteArray());
// Send the constructed plugin message packet
sender.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
});
}
}
@@ -0,0 +1,68 @@
package me.william278.huskhomes2.data.message.pluginmessage;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;
import me.william278.huskhomes2.HuskHomes;
import me.william278.huskhomes2.data.message.CrossServerMessageHandler;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import org.jetbrains.annotations.NotNull;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
public class PluginMessageReceiver implements PluginMessageListener {
@Override @SuppressWarnings("UnstableApiUsage")
public void onPluginMessageReceived(String channel, @NotNull Player player, byte[] message) {
// Return if the message is not a Bungee message
if (!channel.equals("BungeeCord")) {
return;
}
ByteArrayDataInput input = ByteStreams.newDataInput(message);
// Plugin messages are formatted as such:
// HuskHomes:<cluster_id>:<message_type>, followed by the message arguments and data.
String messageType = input.readUTF();
int clusterID;
// Return if the message was not sent by HuskHomes
if (!messageType.contains("HuskHomes:")) {
return;
}
// Ensure the cluster ID matches
try {
clusterID = Integer.parseInt(messageType.split(":")[1]);
} catch (Exception e) {
// In case the message is malformed or the cluster ID is invalid
HuskHomes.getInstance().getLogger().warning("Received a HuskHomes plugin message with an invalid server Cluster ID! \n" +
"Please ensure that the cluster ID is set to a valid integer on all servers.");
return;
}
if (HuskHomes.getSettings().getClusterId() != clusterID) {
return;
}
// Get the message data packets
String messageData = "";
short messageLength = input.readShort();
byte[] messageBytes = new byte[messageLength];
input.readFully(messageBytes);
DataInputStream messageIn = new DataInputStream(new ByteArrayInputStream(messageBytes));
// Get the message data string from the packets received
try {
messageData = messageIn.readUTF();
} catch (IOException e) {
Bukkit.getLogger().warning("An error occurred trying to read a plugin message (" + e.getCause() + ")");
e.printStackTrace();
}
// Handle the plugin message appropriately
CrossServerMessageHandler.handlePluginMessage(new PluginMessage(clusterID, player.getName(), messageType.split(":")[2], messageData), player);
}
}
@@ -0,0 +1,52 @@
package me.william278.huskhomes2.data.message.redis;
import me.william278.huskhomes2.HuskHomes;
import me.william278.huskhomes2.data.message.Message;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import redis.clients.jedis.Jedis;
public class RedisMessage extends Message {
private static final HuskHomes plugin = HuskHomes.getInstance();
public RedisMessage(String targetPlayerName, MessageType pluginMessageType, String... messageData) {
super(targetPlayerName, pluginMessageType, messageData);
}
public RedisMessage(MessageType pluginMessageType, String... messageData) {
super(pluginMessageType, messageData);
}
public RedisMessage(int clusterId, String targetPlayerName, String pluginMessageType, String... messageData) {
super(clusterId, targetPlayerName, pluginMessageType, messageData);
}
private void dispatchRedisMessage(String target) {
Bukkit.getScheduler().runTask(plugin, () -> {
try (Jedis publisher = new Jedis(HuskHomes.getSettings().getRedisHost(), HuskHomes.getSettings().getRedisPort())) {
final String jedisPassword = HuskHomes.getSettings().getRedisPassword();
if (!jedisPassword.equals("")) {
publisher.auth(jedisPassword);
}
publisher.connect();
publisher.publish(RedisReceiver.REDIS_CHANNEL, "HuskHomes:" + getClusterId() + ":" + getPluginMessageString(getMessageType()) + ":" + target);
}
});
}
@Override
public void send(Player sender) {
dispatchRedisMessage(getTargetPlayerName());
}
@Override
public void sendToAllServers(Player sender) {
dispatchRedisMessage("-all-");
}
@Override
public void sendToServer(Player sender, String server) {
dispatchRedisMessage("server-" + server + "");
}
}
@@ -0,0 +1,93 @@
package me.william278.huskhomes2.data.message.redis;
import me.william278.huskhomes2.HuskHomes;
import me.william278.huskhomes2.data.message.CrossServerMessageHandler;
import me.william278.huskhomes2.data.message.pluginmessage.PluginMessage;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;
import java.util.ArrayList;
import java.util.Collections;
public class RedisReceiver {
public static final String REDIS_CHANNEL = "HuskHomes";
public static Player getRandomReceiver() {
ArrayList<Player> players = new ArrayList<>(Bukkit.getOnlinePlayers());
if (players.isEmpty()) {
return null;
}
Collections.shuffle(players);
return players.get(0);
}
public static void listen() {
Jedis jedis = new Jedis(HuskHomes.getSettings().getRedisHost(), HuskHomes.getSettings().getRedisPort());
final String jedisPassword = HuskHomes.getSettings().getRedisPassword();
if (!jedisPassword.equals("")) {
jedis.auth(jedisPassword);
}
jedis.connect();
new Thread(() -> jedis.subscribe(new JedisPubSub() {
@Override
public void onMessage(String channel, String message) {
if (!channel.equals(REDIS_CHANNEL)) {
return;
}
// Redis messages are formatted as such:
// HuskHomes:<cluster_id>:<message_type>:<target_player>£ followed by the message arguments and data.
final String[] splitMessage = message.split("£");
final String messageType = splitMessage[0];
int clusterID;
// Return if the message was not sent by HuskHomes
if (!messageType.contains("HuskHomes:")) {
return;
}
// Ensure the cluster ID matches
try {
clusterID = Integer.parseInt(messageType.split(":")[1]);
} catch (Exception e) {
// In case the message is malformed or the cluster ID is invalid
HuskHomes.getInstance().getLogger().warning("Received a HuskHomes redis message with an invalid server Cluster ID! \n" +
"Please ensure that the cluster ID is set to a valid integer on all servers.");
return;
}
if (HuskHomes.getSettings().getClusterId() != clusterID) {
return;
}
// Get the player targeted by the message and make sure they are online
final String target = messageType.split(":")[3];
Player receiver = Bukkit.getPlayerExact(target);
// If the redis message was targeting this server
if (target.equalsIgnoreCase("-all-")) {
receiver = getRandomReceiver();
} else if (target.contains("server-")) { //todo In the future, allow redis messages to execute without a player online. For now it's duplicating the behaviour of plugin messages for consistency.
if (target.split("-")[1].equalsIgnoreCase(HuskHomes.getSettings().getServerID())) {
receiver = getRandomReceiver();
} else {
return; // The message was targeting another server
}
}
// Return if the target is not available
if (receiver == null) {
return;
}
if (!receiver.isOnline()) {
return;
}
final String messageData = splitMessage[1];
CrossServerMessageHandler.handlePluginMessage(new PluginMessage(clusterID, receiver.getName(), messageType.split(":")[2], messageData), receiver);
}
}, REDIS_CHANNEL), "Redis Subscriber").start();
}
}
@@ -1,168 +0,0 @@
package me.william278.huskhomes2.data.pluginmessage;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import me.william278.huskhomes2.HuskHomes;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Locale;
public class PluginMessage {
private static final HuskHomes plugin = HuskHomes.getInstance();
// Move a player to a different server in the bungee network
@SuppressWarnings("UnstableApiUsage")
public static void sendPlayer(Player p, String targetServer) {
Bukkit.getScheduler().runTask(plugin, () -> {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF(targetServer);
p.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
});
}
private static final String MESSAGE_DATA_SEPARATOR = "$";
private final int clusterID;
private final PluginMessageType messageType;
private final String targetPlayerName;
private final String messageData;
/**
* Creates a Plugin Message ready to be sent
* @param targetPlayerName Name of the player the message will be sent to over Bungee
* @param pluginMessageType Type of the plugin message
* @param messageData Associated message data
*/
public PluginMessage(String targetPlayerName, PluginMessageType pluginMessageType, String... messageData) {
this.clusterID = HuskHomes.getSettings().getClusterID();
this.messageType = pluginMessageType;
StringBuilder newMessageData = new StringBuilder();
for (String s : messageData) {
newMessageData.append(s).append(MESSAGE_DATA_SEPARATOR);
}
this.messageData = newMessageData.substring(0, newMessageData.toString().length()-1);
this.targetPlayerName = targetPlayerName;
}
public PluginMessage(PluginMessageType pluginMessageType, String... messageData) {
this.clusterID = HuskHomes.getSettings().getClusterID();
this.messageType = pluginMessageType;
StringBuilder newMessageData = new StringBuilder();
for (String s : messageData) {
newMessageData.append(s).append(MESSAGE_DATA_SEPARATOR);
}
this.messageData = newMessageData.substring(0, newMessageData.toString().length()-1);
this.targetPlayerName = null;
}
public PluginMessage(int clusterID, String targetPlayerName, String pluginMessageType, String... messageData) {
this.clusterID = clusterID;
this.messageType = PluginMessageType.valueOf(pluginMessageType.toUpperCase(Locale.ENGLISH));
StringBuilder newMessageData = new StringBuilder();
for (String s : messageData) {
newMessageData.append(s).append(MESSAGE_DATA_SEPARATOR);
}
this.messageData = newMessageData.substring(0, newMessageData.toString().length()-1);
this.targetPlayerName = targetPlayerName;
}
// Get the string version of the plugin message type
private String getPluginMessageString(PluginMessageType type) {
return type.name().toLowerCase(Locale.ENGLISH);
}
/**
* Send the plugin message
* @param sender The player to send the message
*/
@SuppressWarnings("UnstableApiUsage")
public void send(Player sender) {
Bukkit.getScheduler().runTask(plugin, () -> {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
// Send a plugin message to the specified player name
out.writeUTF("ForwardToPlayer");
out.writeUTF(targetPlayerName);
// Send the HuskHomes message with a specific type
out.writeUTF("HuskHomes:" + clusterID + ":" + getPluginMessageString(messageType));
ByteArrayOutputStream messageBytes = new ByteArrayOutputStream();
DataOutputStream messageOut = new DataOutputStream(messageBytes);
// Send the message data; output an exception if there's an error
try {
messageOut.writeUTF(messageData);
} catch (IOException e) {
plugin.getLogger().warning("An error occurred trying to send a plugin message (" + e.getCause() + ")");
e.printStackTrace();
}
// Write the messages to the output packet
out.writeShort(messageBytes.toByteArray().length);
out.write(messageBytes.toByteArray());
// Send the constructed plugin message packet
sender.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
});
}
public void sendToServer(Player sender) {
sendToServer(sender, "ALL");
}
@SuppressWarnings("UnstableApiUsage")
public void sendToServer(Player sender, String server) {
Bukkit.getScheduler().runTask(plugin, () -> {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
// Send a plugin message to the specified player name
out.writeUTF("Forward");
out.writeUTF(server);
// Send the HuskHomes message with a specific type
out.writeUTF("HuskHomes:" + clusterID + ":" + getPluginMessageString(messageType));
ByteArrayOutputStream messageBytes = new ByteArrayOutputStream();
DataOutputStream messageOut = new DataOutputStream(messageBytes);
// Send the message data; output an exception if there's an error
try {
messageOut.writeUTF(messageData);
} catch (IOException e) {
plugin.getLogger().warning("An error occurred trying to send a plugin message to a server (" + e.getCause() + ")");
e.printStackTrace();
}
// Write the messages to the output packet
out.writeShort(messageBytes.toByteArray().length);
out.write(messageBytes.toByteArray());
// Send the constructed plugin message packet
sender.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
});
}
public int getClusterID() {
return clusterID;
}
public PluginMessageType getMessageType() {
return messageType;
}
public String getTargetPlayerName() {
return targetPlayerName;
}
public String getMessageData() {
return messageData;
}
public String[] getMessageDataItems() {
return messageData.split("\\" + MESSAGE_DATA_SEPARATOR);
}
}
@@ -1,13 +0,0 @@
package me.william278.huskhomes2.data.pluginmessage;
public enum PluginMessageType {
SET_TP_DESTINATION,
CONFIRM_DESTINATION_SET,
TPA_REQUEST,
TPA_HERE_REQUEST,
TPA_REQUEST_REPLY,
TPA_HERE_REQUEST_REPLY,
TELEPORT_TO_ME,
GET_PLAYER_LIST,
RETURN_PLAYER_LIST
}