You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/com/rayzr522/jsonmessage/JSONMessage.java
+38-5Lines changed: 38 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -795,19 +795,31 @@ public static Object createTitleTimesPacket(int fadeIn, int stay, int fadeOut) {
795
795
796
796
}
797
797
798
-
publicstaticObjectcomponentText(Stringmsg) {
798
+
/**
799
+
* Creates a ChatComponentText from plain text
800
+
*
801
+
* @param message The text to convert to a chat component
802
+
* @return The chat component
803
+
*/
804
+
publicstaticObjectcomponentText(Stringmessage) {
799
805
if (!SETUP) {
800
806
thrownewIllegalStateException("ReflectionHelper is not set up!");
801
807
}
802
808
try {
803
-
returnchatComponentText.newInstance(msg);
809
+
returnchatComponentText.newInstance(message);
804
810
} catch (Exceptione) {
805
811
e.printStackTrace();
806
812
returnnull;
807
813
}
808
814
809
815
}
810
816
817
+
/**
818
+
* Attempts to convert a String representing a JSON message into a usable object
819
+
*
820
+
* @param json The JSON to attempt to parse
821
+
* @return The object representing the text in JSON form, or <code>null</code> if something went wrong converting the String to JSON data
822
+
*/
811
823
publicstaticObjectfromJson(Stringjson) {
812
824
if (!SETUP) {
813
825
thrownewIllegalStateException("ReflectionHelper is not set up!");
@@ -825,18 +837,39 @@ public static Object fromJson(String json) {
825
837
826
838
}
827
839
840
+
/**
841
+
* Returns a class with the given package and name. This method replaces <code>{nms}</code> with <code>net.minecraft.server.[version]</code> and <code>{obc}</code> with <code>org.bukkit.craft.[version]</code>
0 commit comments