How to check if A MC User Name Has Paid for Minecraft Or Not

Discussion in 'Resources' started by Kodfod, Jul 21, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Kodfod

    This is FOR EDUCATIONAL REASONS ONLY

    Now what you need to do is get the users name like so:

    Code:JAVA
    1. @EventHandler
    2. public void onJoin(final PlayerLoginEvent e) {
    3. final String user = e.getPlayer().getName();


    Now to try to get the url and see if they are premium or not:

    Code:JAVA
    1. try {
    2. // Create a URL for the desired page
    3. URL url = new URL("[url]http://minecraft.net/haspaid.jsp?user=[/url]" + user);
    4. // Read all the text returned by the server
    5. BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
    6. String str;
    7. while ((str = in.readLine()) != null) {
    8. getServer().broadcastMessage("The Player has Paid: " + str);
    9. }
    10. in.close();
    11. } catch (MalformedURLException ex) {
    12. } catch (IOException ex) {
    13. }


    Please enjoy.
     
  2. Offline

    McLuke500

    Well on a premium server everyone would of paid and on a illegal cracked server you could fake a username who has paid so it's useless.
     
  3. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    This doesn't check if a player has paid, it checks if a username has paid.
     
    McLuke500 likes this.
  4. Offline

    Leo Verto

    Many managed servers running in offline-mode use authentication plugins to prevent loggin in as a different user.

    I could really use this for a plugin for my friends server, I'll just have to modify it to ask non-premium players to buy minecraft. :p
     
  5. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    How do you intend to prove a player has paid or not? It's not possible to prove anyone logging into an offline server has paid or not. The only way to secure your server is setting online mode to true, and it's the only setting we support here. Server owners running in offline mode don't find support on this site.
     
  6. Offline

    McLuke500

    Actually you could make a plugin that makes you join a online server which kicks you instantly with a unique code which you put into the offline server to authenticate. This would prove your account is premium because you get the code by joining a online server but obviously could be exploited and hacked.
     
    russjr08 likes this.
  7. Offline

    Leo Verto

    Well, I do not want to prove the player is really premium, I just want to tell those offline players (who usually use their first name as username, which is usually not registered) to buy minecraft, so the server can use online mode again.

    Unfortunately, it seems like those players are essential for the server but I really want to get off offline mode, mcbans already disabled itself as protest against it and logblock won't really provide the correct player name.

    Edit:
    Don't you need a '+' in front of the 'str' in line 8?
     
  8. Offline

    Kodfod


    Fixed. ty for seeing that.

    mbaxter This can be used among many implications. Like Leo Verto Said. Plus this is just an example from my Java & URL thread.
     
Thread Status:
Not open for further replies.

Share This Page