Website service through java

Discussion in 'Spigot Plugin Development' started by jeussa, May 21, 2015.

  1. Hi dere all,

    there's these plugins such as dynmap or banmanager which most of you will probably know. Both plugins support a feature which can be used through a web browser.

    My question in this case is how is this done? How can you host a website from a java-based (in this case Minecraft) server?

    Thanks for your time!!!
     
  2. I want to do this badly.
     
  3. Nothing to do with the web based delivery is handled via Java. They use the data they get from the server, and apply it to things (BanManager does through SQL for example) that websites can then understand and serve. They probably have a set of functions that create directories and files, but those files and directories will be ones that are understood by web delivery, not a Java VM serving web pages.
     
  4. Well honestly, I'm a webdummy.

    But how exactly can I achieve such a thing rather than having a website hosted elsewhere? (would like my server to be able to directly interact with my website and the other way around as well)
     
  5. @jeussa, not exactly sure what you're asking. For some things, you need a MySQL database. The plugin will store data to that database (i.e. BanManager), and the webserver can then read and understand that data from the database, as well.

    So for example, BanManager:

    ~ Install the plugin
    ~ Let it generate the files
    ~ Set the database information in the configuration
    ~ Then, in your web browser, go to <Your IP>:<port>. That should work in most cases.

    So for example, Dynmap:

    ~ Install the plugin
    ~ Let it generate the files
    ~ Set the port you wish to use in the configuration file
    ~ Then, in your web browser, go to <your IP>:<port> -- It then should show your Dynmap.
     
    • Like Like x 2
  6. All ban manager does is syncs the Banned Players file to a MySQL database. You then have to install the webfront, from their GitHub, which uses a mixture of PHP, Java, HTML/CSS to make make the webpage. This then grabs the data from the specified database and displays it visually. Unless you have a decent knowledge of web and plugin development it can be quite difficult to sync things between the website and server. If you want this feature I suggest using Enjin or something
     
    • Agree Agree x 2
  7. Actually this is pretty simplistic. Like the others said, download MySQL and the java library to access it. Create a database "MC" or whatever and then a table with whatever data you want in it. Then create a php file that gets the data from your MYSQL table, along with whatever other webpages to display the data from the php file. As far as the MC server side goes, basically just insert data into the table when whatever happens. If you want the webpages hosted locally, then put them all in a folder somewhere and whenever you want to view them send your Player a link to those files. If you want anybody from the server to view it. Create a LAMP web server (look it up) and place your web files in the designated folder. Then if your IP is covered by a domain, go to the settings for your domain on your domain provider's website and add the http port as a viable option so that people on your server don't have to go to "192.168..." but instead could go to "exampleserver.com". Sounds complicated but actually shouldn't take too long. I can explain further about it if you want me to. I might post a TUT on it if I decide to try it myself too.
     
  8. Enjin sucks, I use XenForo.
     
    • Agree Agree x 1
    • Like Like x 1
  9. BanManager puts every ban, mute or kick in a mysql database.
    You install the webinterface / webfront on a webserver and link the mysql database there.
    It would show everything of that mysql database in a nice site.
     
  10. I've been working with Java sockets for some time. Would it be possible to use these to generate a webpage by sending data to a client?
     
    • Like Like x 1
  11. You are a life saver, thanks!!!
     
    • Like Like x 1
  12. I need one as a jar file.
     
  13. Why?
     
  14. Maven shading exists for that reason. I'm sure IntelliJ and Netbeans (or rather, Ant, as that's what Netbeans uses afaik) have their own solutions as well. No clue if Eclipse does, but a quick google search should answer that in my stead.
     
  15. Compile the code in a IDE and export it.
     
  16. Nothing to say here. Try Jetty
     
    • Like Like x 1