How to stop your plugin working on cracked servers!

Discussion in 'Resources' started by Hoolean, Oct 16, 2012.

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

    Hoolean

    Hello, add this into your onEnable() to stop your plugin working on cracked servers :D :

    Code:java
    1. if(!getServer().getOnlineMode()) {
    2. this.setEnabled(false);
    3. }


    This will disable your plugin if it is being run on an offline server!
     
  2. Why?? Why would you do this??
    [​IMG]
     
  3. Offline

    Gravity

    Because they don't support offline mode.. clearly..
    It's a smart thing to do if you don't want to get bug reports from idiots
     
  4. Offline

    McLuke500

    What if you run a legitimate offline server such as at home with family members?
    Jk like 99.999% of cracked servers are illegal ones D:
     
  5. Offline

    xGhOsTkiLLeRx

    Hmm, I guess I could include it, why not?
    I won't support offline mode, so why don't block it? :D
     
  6. Offline

    Icyene

    Oh god why... Imagine something like Vault did this. Then you'd have to get 2 or more accounts just to test a plugin with a dependency on Vault, instead of offline mode with one legitimate account and one cracked. /dislike

    Add this code in your plugin to make it make plugins using this that the server is online!

    Code:Java
    1.  
    2. Field mode = MinecraftServer.class.getDeclaredField("onlineMode");
    3. mode.setAccessible(true);
    4. Field con = CraftServer.class.getDeclaredField("console");
    5. con.setAccessible(true);
    6. mode.set(con, true);
    7.  

    Then again that might actually turn online mode on... Regardless, /me strongly disagrees with this.
     
  7. Offline

    ShootToMaim

    Then all the people using your plugin would be gone, I can bet that 1/2 of them are cracked users.
     
    1mpre55, MrBluebear3 and Icyene like this.
  8. Offline

    p000ison

    Hmm how about using this to generate statistics with mcstats? (Metrics) Would be very interresting :p
     
    JWhy, kroltan and MrBluebear3 like this.
  9. Offline

    McLuke500

    D: that's a great idea! You can have the graphs visible to just admin(I think)
     
  10. Offline

    Hoolean

    Code:java
    1. public class OfflineChecker {
    2.  
    3. @EventHandler
    4. public void onPlayerLogin(PlayerLoginEvent event) {
    5. String name = event.getPlayer().getName();
    6. if(!name.equals("Player") {//Dev isn't testing
    7. if(!checkIfURLExists("[URL]http://s3.amazonaws.com/MinecraftSkins/[/URL]"+name+".png")) {
    8. event.setKickMessage("Disconnect: Bad login! (fool)");
    9. event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
    10. }
    11. }
    12. }
    13.  
    14. public static boolean checkIfURLExists(String targetUrl) {
    15. HttpURLConnection httpUrlConn;
    16. try {
    17. httpUrlConn = (HttpURLConnection) new URL(targetUrl)
    18. .openConnection();
    19.  
    20. // A HEAD request is just like a GET request, except that it asks
    21. // the server to return the response headers only, and not the
    22. // actual resource (i.e. no message body).
    23. // This is useful to check characteristics of a resource without
    24. // actually downloading it,thus saving bandwidth. Use HEAD when
    25. // you don't actually need a file's contents.
    26. httpUrlConn.setRequestMethod("HEAD");
    27.  
    28. // Set timeouts in milliseconds
    29. httpUrlConn.setConnectTimeout(30000);
    30. httpUrlConn.setReadTimeout(30000);
    31.  
    32. // Print HTTP status code/message for your information.
    33. System.out.println("Response Code: "
    34. + httpUrlConn.getResponseCode());
    35. System.out.println("Response Message: "
    36. + httpUrlConn.getResponseMessage());
    37.  
    38. return (httpUrlConn.getResponseCode() == HttpURLConnection.HTTP_OK);
    39. } catch (Exception e) {
    40. System.out.println("Error: " + e.getMessage());
    41. return false;
    42. }
    43. }
    44.  
    45. }
    46.  


    Just thought of this! If the player does not have a skin (they are not a real player) they are kicked, apart from if they are called 'Player' in which case a dev is testing.

    I just wrote this code on the website code box and got the url checker online, so I have no idea if it works!

    http://s3.amazonaws.com/MinecraftSkins/

    should just be http://s3.amazonaws.com/MinecraftSkins/

    Bukkit gives you no choice but to turn it into a link -.-

    EDIT: Now Bukkit's formatting has gone weird -.-

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
    kroltan and hawkfalcon like this.
  11. Offline

    one4me

    Well, I almost never test with the name "Player" (also I think I saw somewhere saying in 1.4 Minecraft will stop defaulting names to "Player"), and what if someone logs in with a name that does have a valid skin?

    And, couldn't someone just have another plugin unregister your listener, or just cancel the kick event?

    That, and I still don't agree with what you're trying to get people to do, just because a server is not in online mode doesn't mean it's a "cracked server". For example, my test server almost always has online mode off (partly because my internet connection is terrible).

    But just like the ways people have thought of to try and stop modded clients, it's almost always possible to come up with a way to counter it. The same thing applies to what you're trying to do.
     
    ZeusAllMighty11, jtjj222 and 1mpre55 like this.
  12. Offline

    Hoolean

    Then they have bought Minecraft :D

    I do see your point and I was just suggesting one method of trying to combat this problem! I do understand it is not perfect, there is no need to tell me!
     
  13. Offline

    WarmakerT

    No, they haven't.
     
  14. Offline

    Hoolean

    Oh I see your point... If they are using somebody elses account! Ah...
     
  15. Offline

    WarmakerT

    No, if they're using someone else's username.
     
  16. Offline

    McLuke500

    Exactly that code does nothing except kick people who don't take someone else's username which is bad as then it's forcing someone to steal someone's username...
     
    wowlover6877 and WarmakerT like this.
  17. Offline

    Comphenix

    The only way you could do this properly is to double-check the client's authenticity by intercepting the packets sent and received during login.

    But of course, if the plugin it popular enough, it'll simply be cracked like CraftBukkit. So - it's probably not worth the effort.
     
  18. Offline

    Hoolean

    That's what I meant :p

    :D

    Indeed... DAMN PIRACY!!! :mad:

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  19. Offline

    SirTyler

    I say let them do it; I for one am very against cracked servers and people Pirating minecraft, but they will do it no matter what we do. So the question is are we going to go to the lengths of making a DRM or similar addition to bukkit and minecraft to try and stop it? I understand the want and need for it but there is no way to stop pirates, why make it harder for legitimate uses to use our plugins?
     
  20. Offline

    CommunistBlock

    I honestly don't see why people are so agensed piracy in minecraft, I came in as a pirate, the game was in alpha at the time and there wasn't much out there in terms of reviews and stuff so I got the cracked version, I joined a minecraft site dedicated to cracked servers and stuff. I've been there for almost 3 years now and I've gotten my account, and I can say, most people who pirate minecraft end up buying it; about 10% of the people there don't. Plus Notch said he doesn't mind that there's a cracked version out there.
     
    1mpre55 and kroltan like this.
  21. Offline

    Gravity

    Well, to address your actual comment, no, most people don't buy it who pirate it. Not really.

    In any case, it's less about morality here and more about the amount of [email protected]*& we have to go through to deal with cracked servers. Using it presents security issues as well as other unforseen exploits/bugs, and dealing with support tickets made by people who run cracked servers are usually:
    A) Ridiculously stupid
    B) Even more stupid
     
    Tehmaker, Rprrr, lol768 and 5 others like this.
  22. I started as a pirate, but i had to have the official version too, so i bought it...
    As did everyone else i know who played minecraft cracked before, they all bought the game...
    I though can understand that stupid questions like that are really annoying.
     
  23. Offline

    MrMag518

    Stop calling the offline mode servers "illegal", they are entirely legitimate. It's the players who use a cracked client, which does something "illegitimate" here.

    If you would like to argument about this, ask yourself first; “What has the server itself done to be defined illegal, other than switching one single entirely legitimate option coded by Mojang? “

    I’m not saying that I support those who do piracy, because I don’t.
     
  24. Offline

    McLuke500

    ;(
     
  25. Offline

    ZeusAllMighty11

    Not that I support piracy, but I don't have a problem with offline-servers.

    If someone chooses to allow everyone to play, I'd rather not make their server even harder to run by not allowing my plugins to work on them.


    I was a cracked user once, bought the game about a month later. Well worth the money, and that's the only game I've pirated....



    The reason I use an offline server (even though I pay for a dedicated one), is because that they are very useful when developing. You can easily switch to another username to test permissions and such. (can be easier than constantly opping and deopping yourself.) And yes, I am also a person who uses Nodus Client for my server; it's way easier to moderate and such, flying and watching people (freecam) and you can easily switch your username just by disconnecting, pressing a button, typing a name, and logging back in.


    Again, I don't support piracy. I support development, and I support people's decisions beit they know the action that can be taken against them if necessary.
     
  26. Offline

    DrAgonmoray

    i have a newfound sense of respect for the staff
     
    wowlover6877 and h31ix like this.
  27. Offline

    Scizzr

  28. Offline

    JOPHESTUS

    This can be easily bypassed. They just need to set their name as someone who's bought the game.
     
  29. Offline

    Scizzr

    The same could be said about the OP's way of doing this. :D
     
  30. Offline

    bob7

    I'm not saying i support the idea of cracked servers!

    Yes that statement up there was necessary before attempting to help the opposing party!

    Anyways, I truly do not believe minecraft should cost $25. It's simply not a stable game! They've made so much money off this game; but how? How would someone make so much money of a game that seems so boring? Mods! The dev minecraft community has been developing extremely fun mods that add thousands of hours of gameplay to the lonely world of minecraft. Mods are the main reason minecraft is so largely known! The worse part is, mojang doesn't even give their community a mods loader, you actually have to download a mod to load a mod.

    I believe this game should be $5 at most, the amount of money they pull in is just outstanding; instead of raising the price why don't they lower it!


    This is simply my opinion, I'm not looking to start anything and hope you see my side!
     
Thread Status:
Not open for further replies.

Share This Page