9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-26 10:09:10 +00:00

Add information command

This commit is contained in:
William
2021-10-21 13:42:17 +01:00
parent ba8e4ee175
commit 9198cd648f
16 changed files with 159 additions and 29 deletions

View File

@@ -0,0 +1,14 @@
package me.william278.crossserversync;
public class MessageStrings {
public static final StringBuilder PLUGIN_INFORMATION = new StringBuilder().append("[CrossServerSync](#00fb9a bold) [| %proxy_brand% Version %proxy_version% | %bukkit_brand% Version %bukkit_version%](#00fb9a)\n")
.append("[%plugin_description%](gray)\n")
.append("[• Author:](white) [William278](gray show_text=&7Click to pay a visit open_url=https://youtube.com/William27528)\n")
.append("[• Help Wiki:](white) [[Link]](#00fb9a show_text=&7Click to open link open_url=https://github.com/WiIIiam278/CrossServerSync/wiki/)\n")
.append("[• Report Issues:](white) [[Link]](#00fb9a show_text=&7Click to open link open_url=https://github.com/WiIIiam278/CrossServerSync/issues)\n")
.append("[• Support Discord:](white) [[Link]](#00fb9a show_text=&7Click to join open_url=https://discord.gg/tVYhJfyDWG)");
public static final String ERROR_INVALID_SYNTAX = "[Error:](#ff3300) [Incorrect syntax. Usage: %1%](#ff7e5e)";
}

View File

@@ -23,10 +23,10 @@ public class PlayerData implements Serializable {
private final double maxHealth;
private final int hunger;
private final float saturation;
private final float saturationExhaustion;
private final int selectedSlot;
private final String serializedEffectData;
/**
* Create a new PlayerData object; a random data version UUID will be selected.
* @param playerUUID UUID of the player
@@ -39,7 +39,7 @@ public class PlayerData implements Serializable {
* @param selectedSlot Player selected slot
* @param serializedStatusEffects Serialized status effect data
*/
public PlayerData(UUID playerUUID, String serializedInventory, String serializedEnderChest, double health, double maxHealth, int hunger, float saturation, int selectedSlot, String serializedStatusEffects) {
public PlayerData(UUID playerUUID, String serializedInventory, String serializedEnderChest, double health, double maxHealth, int hunger, float saturation, float saturationExhaustion, int selectedSlot, String serializedStatusEffects) {
this.dataVersionUUID = UUID.randomUUID();
this.playerUUID = playerUUID;
this.serializedInventory = serializedInventory;
@@ -48,11 +48,12 @@ public class PlayerData implements Serializable {
this.maxHealth = maxHealth;
this.hunger = hunger;
this.saturation = saturation;
this.saturationExhaustion = saturationExhaustion;
this.selectedSlot = selectedSlot;
this.serializedEffectData = serializedStatusEffects;
}
public PlayerData(UUID playerUUID, UUID dataVersionUUID, String serializedInventory, String serializedEnderChest, double health, double maxHealth, int hunger, float saturation, int selectedSlot, String serializedStatusEffects) {
public PlayerData(UUID playerUUID, UUID dataVersionUUID, String serializedInventory, String serializedEnderChest, double health, double maxHealth, int hunger, float saturation, float saturationExhaustion, int selectedSlot, String serializedStatusEffects) {
this.playerUUID = playerUUID;
this.dataVersionUUID = dataVersionUUID;
this.serializedInventory = serializedInventory;
@@ -61,13 +62,14 @@ public class PlayerData implements Serializable {
this.maxHealth = maxHealth;
this.hunger = hunger;
this.saturation = saturation;
this.saturationExhaustion = saturationExhaustion;
this.selectedSlot = selectedSlot;
this.serializedEffectData = serializedStatusEffects;
}
public static PlayerData EMPTY_PLAYER_DATA(UUID playerUUID) {
public static PlayerData DEFAULT_PLAYER_DATA(UUID playerUUID) {
return new PlayerData(playerUUID, "", "", 20,
20, 20, 20, 0, "");
20, 20, 10, 1, 0, "");
}
public UUID getPlayerUUID() {
@@ -102,6 +104,8 @@ public class PlayerData implements Serializable {
return saturation;
}
public float getSaturationExhaustion() { return saturationExhaustion; }
public int getSelectedSlot() {
return selectedSlot;
}

View File

@@ -75,6 +75,8 @@ public class RedisMessage {
return messageData;
}
public String[] getMessageDataElements() { return messageData.split(MESSAGE_DATA_SEPARATOR); }
public MessageType getMessageType() {
return messageType;
}
@@ -100,7 +102,12 @@ public class RedisMessage {
/**
* Sent by the Proxy to reply to a {@code MessageType.PLAYER_DATA_REQUEST}, contains the latest {@link PlayerData} for the requester.
*/
PLAYER_DATA_REPLY
PLAYER_DATA_SET,
/**
* Sent by the proxy to ask the Bukkit server to send the full plugin information, contains information about the proxy brand and version
*/
SEND_PLUGIN_INFORMATION
}
/**