Get IP of server

Discussion in 'Plugin Development' started by GeorgeeeHD, Nov 26, 2015.

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

    GeorgeeeHD

    How would you get the IP of the server the plugin is running on? Bukkit.getServer().getIp() returns the IP found in the config file, which most of the time is blank. Is there an alternate way to get the ip? Thanks
     
  2. Offline

    567legodude

    @GeorgeeeHD You mean getServer().getAddress() ?
    (Well, it doesn't exist, but someone else thought it did)
     
  3. Offline

    GeorgeeeHD

  4. Offline

    567legodude

    @GeorgeeeHD Lots of people were saying that's the answer, but apparently that method doesn't exist anymore.
     
  5. Offline

    GeorgeeeHD

  6. Offline

    Xerox262

    Why do you want to get the IP of the server? Asking because there might be a better way to do what you want.
     
  7. Offline

    GeorgeeeHD

    @Xerox262 I want to make it so only IPs I choose can run the plugin. Eg in the onEnable() if server ip is not in the list of allowed ips it will just not enable
     
  8. Offline

    Xerox262

    If it's to stop people leaking your plugin it wont work, someone would just de-compile it and remove the check or they could use your code to access the database then leak the server IP or they could enter IPs that they want to be able to use it. It sucks that it's true but it is true.
     
    PeterXonwiiXx likes this.
  9. Offline

    GeorgeeeHD

    @Xerox262 yeah i know that but the people buying the plugin might not, i dont mind spending a bit more time on coding this to decrease the chance of the plugin being leaked
     
  10. Offline

    Xerox262

    You're saying that, but someone could leak the secure version then another person could de-compile it and/or leak the IP addresses. It just means more people will have access to your storage, and if anything were to happen and your storage was accessed you would most likely have to refund all the people that bought it.
     
  11. Offline

    567legodude

    @GeorgeeeHD @Xerox262 Yeah that's really the only downside to Java, is that even if you put in tons of checks to make sure someone bought it, they can be removed if you know how.
     
  12. Offline

    Scimiguy

    As far as i was aware, you aren't allowed to sell plugins, because the content, and by extension the server and the api aren't owned by you, and are non-resaleable
     
  13. Offline

    Xerox262

    And there's plenty of people online with the know how. Right now we're on a forum full of them, he'd be uploading the plugin on a site full of them, The worst part is knowing that the people that would do it are developers too.

    But to stay on topic, @GeorgeeeHD there's no way to securely do it, it's better to just hope that people will not leak it when you release it. Or to ask for donations rather than have people pay for the plugin itself.
     
  14. Offline

    GeorgeeeHD

    RIP ok thanks guys
     
  15. Offline

    567legodude

    @Scimiguy Maybe not here on bukkit, but anywhere else, people are doing it a ton.
    Take the Spigot Premium Resources section for example.
     
  16. Offline

    mythbusterma

    It doesn't matter the language, time, or product. DRM does not work. Java just makes it even easier than usual, especially when the checks are so poorly implemented.


    @Xerox262

    There's no reason that they would be able to modify the data on who has it and who doesn't. You can create an application that would just respond with a specially crafted packet when you ask it if the user is valid. Even checking an SQL database, you can give a user permission for nothing but "SELECT" on a single table.
     
  17. Offline

    DoggyCode™

    I agree with @Xerox262 . Even plugins like CustomCrates doesn't use the special thing just because they want it to not function on servers that didn't buy it.
     
  18. Offline

    luckdonald

    Okey, maybe we can get back to the topic, as I am not trying to do anti-theft?

    I'd like to display the ip the user has entered to joined the server with.

    Have a example use case:
    I run my server on IP 203.0.113.1
    I have 2 DNS records pointing to that: mc.example.com and mc.example.org

    So a user joins the server using either of those three.
    How to get them?

    I want to display a link to some additional resources the user can download from the same ip as the minecraft server, using the same url he is already familiar with.
     
  19. Offline

    mythbusterma

    @luckdonald

    It was never off-topic, as DRM was the OP's topic. If you have a different topic, make a separate thread.

    There is no way of knowing whether the user connected using the IP itself or the URL, as the URL is simply resolved to the IP and that is used.

    Just display the URL version, the idea of a URL is to be human readable and easy to remember.
     
  20. Offline

    Zombie_Striker

    @luckdonald
    First, this thread is over a month old. Don't necro old, solved threads.

    Secondly,
    You cant. This information is not sent.

    [ninja'd]
     
Thread Status:
Not open for further replies.

Share This Page