Check Pastebin File

Discussion in 'Plugin Development' started by MrDynamo, Dec 9, 2013.

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

    MrDynamo

    So basically I'm wondering if its possible to have your plugin check a pastebin file on startup. The pastebin will either contain true or false. Whatever is in the pastebin will set the boolean of the plugin being enable or not(Can you stop a plugin from starting with a boolean?).

    This way, if you do not want your plugin used anymore, you can set the pastebin file to false, and it will stop the plugin from initializing.
     
  2. Offline

    Gater12

    MrDynamo Like remotely disable/enable your plugin? Otherwise I'd tell you to use config files.
     
  3. Offline

    MrDynamo

    @Gater12 When the server starts the plugin checks the pastebin file, if it says false, the plugin does not enable, if it says true, it enables.
     
  4. Offline

    Compressions

    MrDynamo Assuming the first line in the Pastebin is just "true" or "false", just create the Pastebin and paste the Pastebin's raw file path.
    Code:
                URL url = new URL("pastebin raw");
                Scanner scanner = new Scanner(url.openStream());
                boolean enabled = Boolean.valueOf(scanner.nextLine());
                scanner.close();
     
  5. Offline

    MrDynamo

    Compressions

    Ok thanks. And what do think the best way to disable the plugin would be? Check the boolean on all my methods and continue if it's true?
     
  6. Offline

    Compressions

    MrDynamo Exactly.
    Code:
    if(enabled) {
    //plugin may be enabled
    } else {
    //disable plugin
    }
     
  7. Offline

    MrDynamo

    @Compressions

    Hmm. Is there any type of method that can stop the enabling of the plugin?

    I know I can do the if statement on all methods, but is that the easiest wat?
     
  8. Offline

    Compressions

    MrDynamo Call in your main method:
    Code:
    Bukkit.getServer().getPluginManager().disablePlugin(this);
     
    MrDynamo likes this.
  9. Offline

    MrDynamo

  10. Offline

    The_Doctor_123

    Errr.. don't you get HTML code from websites, or is Pastebin somehow different?
     
  11. Offline

    Compressions

  12. Offline

    The_Doctor_123

  13. Offline

    Not2EXceL

    Anyhow all of these ways of preventing the plugin from being used when you don't want it too are terrible. People can just decompile it, or if you were to obsfucate it, just bytecode edit out very easily.
     
  14. Offline

    MrDynamo

    @Not2EXceL

    Most people that I would code plugins for don't have that mental capacity.
     
  15. Offline

    NathanWolf

    Technical discussion aside (I think there could be cool/good reasons for pulling data off the web), I'd be inherently distrustful of any plugin that reaches out to an external server without an obvious reason to do so.

    You might start with an on/off switch.. but then decide maybe someone irk'd you, and now you'd like to add a "delete all worlds" flag. It could get very malicious very quickly is I guess what I'm trying to say :)

    Not to mention the implications of their server configuration- maybe they don't allow network connections on all outgoing ports, or to all addresses. Maybe they're on the other side of the world, somewhere where pastebin isn't properly mirrored.. now your plugin might stall their entire server trying to "authorize" itself.

    Anyway, that said I don't have anything useful to add to the general conversation on preventing people from stealing plugins. I think in a way, if you code a plugin for someone, you kind of have to let it go, yeah?
     
Thread Status:
Not open for further replies.

Share This Page