How to Lock ip plugin??

Discussion in 'Spigot Plugin Development' started by guyguyko, Jul 14, 2018.

  1. How to Lock ip plugin??

    Check ip if not disablepluign
  2. plugin.getServer().getIp(), plugin.getServer().getPort()
  3. This gets a local IP, not a public one.
    Code (Java):
    private String getIP() throws IOException{

            URL whatismyip = new URL("");
            BufferedReader in = new BufferedReader(new InputStreamReader(

            String ip = in.readLine();
            return ip;
    Get the public IP with this code (public IP meaning the IP you type into your minecraft client to connect to the server). Port can be obtained with what @xMrPoi said. However, I don't get what it is that you want. What do you mean by you want to "Lock ip plugin"?
  4. he basically wants to lock the plugin to a single vps by retrieving the ip address.. OP, unless you add some other tricks this is piece of cake to remove.
  5. I have no idea how he meant that lol. Are you certain? And like how does the disabling part fall in after just checking the ip?
  6. just before loading
    if(ip == "whatever){
    //nothing or spooky message
  7. i think he wants to prevent leaks by disabling if not an associated ip
  8. Might as well just set a password to be keyed in in config and check if the hashed password is the same when enabling the plugin
  9. I don't think you should be worrying about locking your plugin to one IP Address... This really doesn't seem like it would be worth doing.
    • Agree Agree x 1