4444import com .laytonsmith .core .constructs .CString ;
4545import com .laytonsmith .core .constructs .CVoid ;
4646import com .laytonsmith .core .constructs .Construct ;
47+ import com .laytonsmith .core .constructs .InstanceofUtil ;
4748import com .laytonsmith .core .constructs .NativeTypeList ;
4849import com .laytonsmith .core .constructs .Target ;
4950import com .laytonsmith .core .constructs .Variable ;
@@ -844,6 +845,9 @@ public static UUID GetUUID(Mixed subject, Target t) {
844845 return GetUUID (subject .val (), t );
845846 }
846847
848+ /**
849+ * @deprecated Use {@link #GetUser(Mixed, Target, Environment)} instead.
850+ */
847851 @ Deprecated
848852 @ AggressiveDeprecation (deprecationDate = "2022-04-06" , removalVersion = "3.3.7" , deprecationVersion = "3.3.6" )
849853 public static MCOfflinePlayer GetUser (Mixed search , Target t ) {
@@ -854,6 +858,9 @@ public static MCOfflinePlayer GetUser(Mixed search, Target t, Environment env) {
854858 return GetUser (search .val (), t , env );
855859 }
856860
861+ /**
862+ * @deprecated Use {@link #GetUser(String, Target, Environment)} instead.
863+ */
857864 @ Deprecated
858865 @ AggressiveDeprecation (deprecationDate = "2022-04-06" , removalVersion = "3.3.7" , deprecationVersion = "3.3.6" )
859866 public static MCOfflinePlayer GetUser (String search , Target t ) {
@@ -867,6 +874,7 @@ public static MCOfflinePlayer GetUser(String search, Target t) {
867874 *
868875 * @param search The text to be searched, can be between 1 and 16 characters, or 32 or 36 characters
869876 * @param t
877+ * @param env
870878 * @return
871879 */
872880 public static MCOfflinePlayer GetUser (String search , Target t , Environment env ) {
@@ -904,6 +912,9 @@ public static MCOfflinePlayer GetUser(String search, Target t, Environment env)
904912 * @deprecated This method doesn't work with user classes, and will cause errors once those are introduced. This
905913 * will be removed once those are added, instead, use the version with the environment.
906914 */
915+ /**
916+ * @deprecated Use {@link #GetPlayer(String, Target, Environment)} instead.
917+ */
907918 @ AggressiveDeprecation (deprecationDate = "2022-04-06" , removalVersion = "3.3.7" , deprecationVersion = "3.3.6" )
908919 @ Deprecated
909920 public static MCPlayer GetPlayer (String player , Target t ) throws ConfigRuntimeException {
@@ -945,9 +956,9 @@ public static MCPlayer GetPlayer(Mixed player, Target t, Environment env) throws
945956 }
946957
947958 /**
948- * Returns the player specified by name. Injected players also are returned in this list. If provided a string
959+ * Returns the player specified by name or UUID. Injected players are also returned in this list. If provided a string
949960 * between 1 and 16 characters, the lookup will be name-based. If provided a string that is 32 or 36 characters, the
950- * lookup will be uuid -based.
961+ * lookup will be UUID -based. Throws CREPlayerOfflineException if the player is not online .
951962 *
952963 * @param player
953964 * @param t
@@ -956,8 +967,6 @@ public static MCPlayer GetPlayer(Mixed player, Target t, Environment env) throws
956967 * @throws ConfigRuntimeException
957968 */
958969 public static MCPlayer GetPlayer (String player , Target t , Environment env ) throws ConfigRuntimeException {
959- MCCommandSender m ;
960-
961970 if (player == null ) {
962971 throw new CREPlayerOfflineException ("No player was specified!" , t );
963972 }
@@ -990,6 +999,8 @@ public static MCPlayer GetPlayer(String player, Target t, Environment env) throw
990999 return p ;
9911000 }
9921001
1002+
1003+
9931004 /**
9941005 * Returns the specified command sender by name. Players are supported, as is the special ~console user. The special
9951006 * ~console user will always return a user. Throws CREPlayerOfflineException if the player is not online or injected.
@@ -1727,6 +1738,14 @@ public String getString(CResource res) {
17271738 }
17281739 }
17291740
1741+ /**
1742+ * @deprecated Use {@link #getJavaObject(Mixed, Environment)} instead.
1743+ */
1744+ @ Deprecated
1745+ public static Object getJavaObject (Mixed construct ) {
1746+ return getJavaObject (construct , null );
1747+ }
1748+
17301749 /**
17311750 * Given a MethodScript object, returns a java object.
17321751 *
@@ -1745,7 +1764,7 @@ public static Object getJavaObject(Mixed construct, Environment env) {
17451764 return ((CInt ) construct ).getInt ();
17461765 } else if (construct instanceof CDouble ) {
17471766 return ((CDouble ) construct ).getDouble ();
1748- } else if (construct instanceof CString ) {
1767+ } else if (InstanceofUtil . isInstanceof ( construct , CString . class , env ) ) {
17491768 return construct .val ();
17501769 } else if (construct instanceof CByteArray ) {
17511770 return ((CByteArray ) construct ).asByteArrayCopy ();
@@ -1815,7 +1834,7 @@ public static Object getJavaObject(Mixed construct, Environment env) {
18151834 }
18161835 }
18171836 } else {
1818- return construct ;
1837+ throw new ClassCastException ( construct . getClass (). getName () + " cannot be cast to a POJO" ) ;
18191838 }
18201839 }
18211840
0 commit comments