1.17.1 Checking if user is premium

Discussion in 'Spigot Plugin Development' started by Zen-kun, Jun 12, 2021.

Thread Status:
Not open for further replies.
  1. what I mean is offline network. is no internet to connect to mojang servers to auth
     
    • Like Like x 1
  2. https://twitter.com/notch/status/157261795139125248
     
    • Like Like x 1
    • Agree Agree x 1
  3. Of course! I won't forget to feel "bad" for having the game pirated!
     
  4. - Millions of people do criminal activities, doesn't make it more legal.

    - You said it yourself, old tweet + Notch doesn't even own the game anymore, he probably couldn't care less right now.

    - You don't need to check for these things if you're running an online mode server in the first place, which is why you're being told to turn online mode on.
     
    • Agree Agree x 1
    • Funny Funny x 1
  5. Can you all just help him? My session expires MANY TIMES and I HATE restarting the game. He did not imply piracy. You are just being unhelpful.
     
    • Agree Agree x 1
  6. Your issue is not even related to what he wants to achieve, he wants to implement a custom auth system for an offline mode server. I think it's much better to restart your game once you notice your session has expired rather than just joining offline mode servers, plus there are mods that can help you fix that like ReAuth (which is available for both Forge and Fabric).
     
    • Agree Agree x 1
  7. First, offline public server implies piracy, so that’s where you’re wrong. Second, what the hell does this have to do with this??
     
  8. Given just about everyone in this thread is being useless, I'll attempt some sort of assistance.

    I personally do not know an answer to this, but given the plugins listed you could try to find it yourself in their source code:
    https://github.com/games647/FastLogin
    https://github.com/AuthMe/AuthMeReloaded

    As some have said, you could try to create a UUID from the player's name and test that on Mojang's end to see if the usernames match, but I'm going to assume the UUID might return to the offline UUID. It is worth a try though if you haven't yet.

    Oh, maybe you can find something I am missing from here as well? This should be useful: https://wiki.vg/Mojang_API#Username_to_UUID
     
    • Agree Agree x 1
  9. I think this is not possible, because even the FastLogin plugin doesn't have feature for recognising between premium and cracked (I think). In the FastLogin plugin, you have to type command, that you in fact own a premium account. And it doesn't stop you, if you don't.
     
  10. Also I wanna say 2 other things:
    1) I found a way to do what I want but only for bungeecord instead of Spigot...
    2) You're always telling me to set my server to online-mode, but what about the other players that have an offline-mode server? I can't tell to all users to set their servers to online-mode... So please help ^^
     
  11. Where you found how to get it on bungeecord? Maybe someone who understands it will then be possible to find out how to do it in spigot
     
  12. That's not how offline mode works. If the player is a premium user, then they'll be able to join both online and offline servers - it won't matter if they use other offline servers or not.
    If they're not a premium user, they'll only be able to join offline servers, period - and if they're using a cracked version over premium in the first place, they probably don't have the premium account to join your online server with anyway.
     
    #33 Escad, Jun 14, 2021
    Last edited: Jun 14, 2021
    • Agree Agree x 1
  13. Yeah, but what about rhe UUIDs? If a premium player joins a premium server, and then an offline one, does the UUID change? Or it will everytime be the same?

    And if it will be the same, if a cracked player use my username, will him have also the same UUID as mine or not?



    -> https://www.spigotmc.org/threads/check-if-player-is-cracked.348850/

    Code:
    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);
            }
        }
    }
     
  14. But why you are overdoing things?

    Just use mojang api or external tools..

    MOJANG API (rate limited):
    premium:
    https://api.mojang.com/users/profiles/minecraft/Notch
    cracked:
    https://api.mojang.com/users/profiles/minecraft/CrackedUser69 (returns blank page as user not exists)

    External, not rate limited API:
    premium:
    https://api.ashcon.app/mojang/v2/user/Notch
    cracked:
    https://api.ashcon.app/mojang/v2/user/CrackedUser69


    https://github.com/SpigotMC/BungeeC..._5/bungee/connection/InitialHandler.java#L500

    This is how cracked / offlinemode UUIDs are created..
     
    • Useful Useful x 1
  15. If your server is an offline server, it will create a UUID from the player's username. If two different players use the same username, the UUID will also be the same, regardless of whether either is a premium or cracked player.
     
    • Agree Agree x 1
  16. So, you want allow players with same username to join server?
    Well.. This is flaw.. and pain in the ass to ban/setrank etc users with same names (you dont really know which you are banning)..
    Just DO NOT do this..

    But, if your problem is that you want allow cracked and premium players to join, just simple use API provided in my previous post. Check if user is premium (has mojang UUID) - if he is, set online mode for this connection (i'm doing this in bungee - PreLoginEvent - just fine) and cracked player will not have possibility to join on premium name o/

    Also, if API tells you that username is cracked, just allow player to join..

    No dupes UUIDs, no dupes names, no issues at all.

    Also, it's worth to mention that there are plugins for this.. Just don't open already opened door.
     
  17. microsoft owns minecraft so err that seems invalid if notch said it anyways
     
  18. I never said I thought it was a good idea.
    If two players use the same username, they'll just use the same player data. That's just how cracked works - you don't have to use sign-in information, so you can use whatever username you want. It's up to the server owner to take measures against that if they have a public offline server.
     
  19. There is no way to do what you want accurately without having access to the backend at Mojang Your idea is really good, if you could do it I'm 100% sure it would be done already. I used to be a freelance plugin dev and it was the #1 most requested plugin. But nobody took no for an answer. Here is the only real obtainable way for you to do this: You would have to make your players use a modded client that provides a way of authenticating the users session for your specific server.
     
Thread Status:
Not open for further replies.