How to best connect plugin with C# application

Discussion in 'Plugin Development' started by Caedus, Dec 9, 2016.

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

    Caedus

    Hi,

    Essentially, I want to create an application in C# that allows remote administration of a Minecraft server. I will also write a plugin for bukkit that enables the application to have control of the server. My question, is how best to do this? I'm sure theres a concept that i'm not aware of in which the server listens for commands from an address or something. The only way i've theorized it possible is by having the server continuously query a database for new commands(sent by the C# application) that the plugin then interprets accordingly, but that strikes me as a REALLY poor way of doing it. Again, I'm sure this has been done before but I don't know what such a concept might be called so I can't research it properly.

    Any thoughts/ideas/concepts would be most welcome.

    Cheers
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Caedus What kind of information do you want to share between the server and controller?
     
  3. Offline

    Caedus

    @timtower Well basic stuff like player count, player list, etc I can do via query, for which I don't need a special plugin.

    But if I wanted the application to kick/ban/send messages/change map/change gamemode etc, i'd need a plugin that can interpret those commands, correct?
     
  4. Offline

    timtower Administrator Administrator Moderator

    @Caedus Or you run the server from the c# application and handle that by using the input and output streams
     
  5. Offline

    Caedus

    @timtower It's my intent to have the application run as a remote admin tool. Where the server runs on someones vps/whatever and I can login from across the world and administrate it without the server needing a copy of the application.

    That's why, I think, I need a means of the server listening for commands from the application.
     
  6. Offline

    timtower Administrator Administrator Moderator

    @Caedus Then I still go for my approach, but then with a second application that connects to the first one.
    First one will just be a console proxy.
     
  7. Offline

    Caedus

    @timtower Okay, but then how do I go about connecting the console proxy to the other application? That's the part that gets me :p
     
  8. Offline

    timtower Administrator Administrator Moderator

    @Caedus That is a discussion for offtopic or a c# forum.
     
  9. Offline

    Caedus

    @timtower Okay, but given that i'm content with doing it via a bukkit plugin instead of making a proxy console, it's a viable discussion here right?
     
  10. Offline

    timtower Administrator Administrator Moderator

    @Caedus Then I suggest plain Sockets
     
  11. Offline

    mythbusterma

    @Caedus

    You'll have to create a connection between your application and the Bukkit server it's controlling. To do this remotely, you would need to establish a TCP connection between the two. After that, you're going to have to exchange messages between the applications. I would recommend scrapping the C# and just writing both the Bukkit plugin and console application in Java, allowing them to share code. This way, you could use the networking library NeTTY to design a protocol to use for sending the messages, actually sending them, and receiving them, greatly simplifying your application. Alternatively, you can use the Google messaging protocol to design a protocol as well, although the handler will be your responsible. Using both together is also a good idea.

    There's really no reason to use C#, as Java is more cross platform, and is of course the language of choice for Minecraft. As far as difficulty, readability, and features, they're almost identical, if you're writing this to be cross platform (C# does have the benefit of the common language interface, but doesn't mean much when you're developing cross platform).
     
Thread Status:
Not open for further replies.

Share This Page