@@ -11,17 +11,16 @@ public class PlayerUtils {
1111    private  PlayerUtils () {
1212    }
1313
14-     public  enum  InputTypes  {
15-         VALID_USERNAME , VALID_UUID , INVALID_USERNAME , INVALID_UUID , INVALID 
16-     }
17- 
1814    @ Nullable 
1915    public  static  Player  getFromAll (final  String  uuidOrPlayer ) {
2016        if  (uuidOrPlayer .matches ("^\\ w{3,16}$" )) {
2117            return  Bukkit .getPlayer (uuidOrPlayer );
2218        }
2319        if  (uuidOrPlayer .matches ("[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}" )) {
24-             final  UUID  uuid  = UUID .fromString (uuidOrPlayer );
20+             final  UUID  uuid  = UUIDUtils .getFromString (uuidOrPlayer );
21+             if  (uuid  == null ) {
22+                 return  null ;
23+             }
2524            return  Bukkit .getPlayer (uuid );
2625        }
2726        return  null ;
@@ -32,28 +31,6 @@ public static Player getFromAll(final UUID uuid) {
3231        return  Bukkit .getPlayer (uuid );
3332    }
3433
35-     @ NotNull 
36-     public  static  InputTypes  getInputType (final  String  uuidOrPlayer ) {
37-         if  (uuidOrPlayer .matches ("^\\ w{3,16}$" )) {
38-             final  Player  player  = Bukkit .getPlayer (uuidOrPlayer );
39-             if  (player  != null ) {
40-                 return  InputTypes .VALID_USERNAME ;
41-             }
42-             return  InputTypes .INVALID_USERNAME ;
43-         }
44-         if  (uuidOrPlayer .matches ("[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}" )) {
45-             final  UUID  uuid  = UUID .fromString (uuidOrPlayer );
46-             final  Player  player  = Bukkit .getPlayer (uuid );
47-             if  (player  != null ) {
48-                 return  InputTypes .VALID_UUID ;
49-             }
50-         }
51-         if  (uuidOrPlayer .matches ("[0-9a-fA-F]{32}" )) {
52-             return  InputTypes .INVALID_UUID ;
53-         }
54-         return  InputTypes .INVALID ;
55-     }
56- 
5734    @ Nullable 
5835    public  static  Player  getPlayerFromUsername (final  String  username ) {
5936        if  (username .matches ("^\\ w{3,16}$" )) {
@@ -63,8 +40,11 @@ public static Player getPlayerFromUsername(final String username) {
6340    }
6441
6542    @ Nullable 
66-     public  static  Player  getPlayerFromUUID (final  String  StringUUID ) {
67-         final  UUID  uuid  = UUID .fromString (StringUUID );
43+     public  static  Player  getPlayerFromUUID (final  String  stringUUID ) {
44+         final  UUID  uuid  = UUIDUtils .getFromString (stringUUID );
45+         if  (uuid  == null ) {
46+             return  null ;
47+         }
6848        return  Bukkit .getPlayer (uuid );
6949    }
7050
0 commit comments