Checking if a player has a premium or cracked account?

Discussion in 'BungeeCord Plugin Development' started by SkillCode, Feb 29, 2020.

Thread Status:
Not open for further replies.
  1. Hey guys, is there any way to check if a player has a premium or cracked account?
     
  2. You can check if player is cracked:

    Code (Java):
    public boolean isCracked(ProxiedPlayer player) {
     
        String name = player.getName();
        UUID actualUUID = player.getUniqueId();
        String actualUUIDStr = uuid.toString();
        String offlineUUIDStr = getMd5("OfflinePlayer:"+name);
     
        if(offlineUUIDStr.equals(actualUUIDStr)) {
            return true;
        }
        return false;

    }

    // Taken from https://www.geeksforgeeks.org/md5-hash-in-java/
    public static String getMd5(String input)
        {
            try {
                // Static getInstance method is called with hashing MD5
                MessageDigest md = MessageDigest.getInstance("MD5");
                // digest() method is called to calculate message digest
                //  of an input digest() return array of byte
                byte[] messageDigest = md.digest(input.getBytes());
                // Convert byte array into signum representation
                BigInteger no = new BigInteger(1, messageDigest);
                // Convert message digest into hex value
                String hashtext = no.toString(16);
                while (hashtext.length() < 32) {
                    hashtext = "0" + hashtext;
                }
                return hashtext;
            }
            // For specifying wrong message digest algorithms
            catch (NoSuchAlgorithmException e) {
                throw new RuntimeException(e);
            }
        }
    }
     
    • Like Like x 1
  3. Remember to put the thread as solved if your problem is solved
     
Thread Status:
Not open for further replies.