Minecraft Blogs / Article

Automation For Server Owners

  • 881 views, 1 today
  • 3
  • 0
  • 2
SilverMoon Network's Avatar SilverMoon Network
Level 12 : Journeyman Network
7

Bots Attack SilverMoon Pixelmon
Automation For Minecraft Server Owners

When we hear the word "bots", especially in the gaming community, we tend to think about evil software that ruins people's fun/lives. When I hear the word "bots", I think about productive software that was designed for simplification rather than malicious intent.

I recently started running a server and there were so many tasks starting to pile on. I'm new, so I can't afford help, what am I to do? The worst part of it all was that I never ran a server with mods before. I had always been a vanilla player, started back in the beta days. First month running the server, I knew nothing about our core mod, that's how bad it was.

Well, that's where my passion for writing automation tools came into play. I personally hate java, but I really love python! I know that I can build a lot of nice plugins and stuff for my server, but I stuck with what I felt more comfortable with.


Bots Hanging with Pinguin of SilverMoon Pixelmon
The First Trials

When we first started, we were so ecstatic to see players coming to our server. It was rough, especially not being to help as much with my co-owner as I knew nothing about mods or the minecraft server in general. As players came, the server would start to lag.

My co-owner and I spent many dedicated hours, taking sleep shifts, to help monitor and engage with this new community. It was pretty tiresome and as a result, we would have moments where the server would just crash because of how long it was up.

Due to our bad sleeping patterns, sometimes when we were passed out, the server would crash and it would be offline til one of us manually started it up again. Instead of searching for some auto restart plugin, I came up with a python script that would auto restart the server.

That became the stepping stone for my python automation, wrapping around a java instance and reading the stdout information. I didn't think of anything of this script at first when I created it, but it later started to evolve.


Staying Notified By Knowing What Goes On In Your Community

With our core mod, I noticed that some players were cheating on our server. We had been banning these players when we got reports but we couldn't figure out a way to stop it completely. That is when I went back to my auto restart script and began writing the next part of the beast.

Minecraft servers have logs and are created upon startup of the server. Since this script knows when the server is starting up, I made it scan the log files for players who logged in with the mod we didn't want on our server and then make it report back to me.

The question became, "Okay great, now I have this data, how can I see it asap?". If you haven't noticed by now, I'm an avid fan of automation, so there is this awesome platform called IFTTT where it connects to different services and you can create small little applets that get triggered by certain platform events and can send data grabbed by that trigger and send it to another platform.
Common things seen with that platform are things like Twitter Re-Tweet bots and such. But what I wanted to use it for was for it's platform called "Maker". Which allows me to use python for my trigger and send data to whatever platform I wanted. They recently added in Skype, so I made that my choice.

Now every time the server restarts, my script sends me a message on skype telling me that it has rebooted. It then tells me about any players it thinks it found cheating. The script proceeds to upload the log files to my Google Drive and sends me the drive links on Skype.SilverMoon Pixelmon Skype Bot
The last part was to use another fun automation language out there is: "AutoHotKey". It's basically quick scripts to do some sort of macro. I tend to use it for always on top overlays, but this time I was going to use AHK to help me send a message to that user who was caught cheating via mail.

The AHK script that gets ran, looks at the current open applications and opens the server console process running and automatically types in whatever command string I want to pass. Thus making it as if I physically was at that machine and I actually typed in that command. This makes it great for what we want to do, which is take data from an outside source and input it directly into our console.

Later, I had created yet another script that would scan my ports to count the connections to my server. When it reached a high level of players, I had it warn me on skype. And in events of DDoS attempts, it would notify me on skype. I also used that IFTTT maker platform take the player count from my script and send it to twitter by uploading an image created by a php script of mine.

Engage Your Community

Now I have it setup to inform me on various events, I need to take this automation to my players somehow. One of the best ideas I thought of was using Discord. Discord is a wonderful chat application for gaming communities, and I feel like it's even better for server owners.

The reason for this, is that people are already used to seeing bots on Discord, but many are basic clones of each other. Different types of music bots, different types of welcomers, etc... What we needed was a bot for the game server. So I pulled out that good ol Python and started to write a discord bot.

The question then becomes, what do you create for a bot that interfaces with the community in a respectable way? What unique points can I give this bot that other servers don't have and I can use that as my gain. What if we did a bot that was able to mimic some of the other features of your server and in return allow players to earn in-game items through interacting with this bot.

I found a basic feature that our server had that was being majorly used by my players and made my bot do that. At that point, all the data was being saved and was working correctly. Now I needed to build some sort of reward system and make it send that data from the Discord chat to the Minecraft Server.

And here we are back to that AHK script that did my cheater mailing, this time we are just going to use it as a template and have our discord bot rewrite the script and run it as when players interact with the bot, as commands will vary.

I mentioned that we are still fairly new, so currently this is where my story ends for you. But I hope that this article can help other owners out there have some extra sparks of maybe their own automation solutions. Also to shed light on newbie developers who get lost in plugins that there is always a few different ways to get what you want done, you just have to think creatively sometimes.
CreditStyxnyx
Tags

Create an account or sign in to comment.

NoobDad
11/13/2016 2:46 pm
Level 40 : Master Engineer
NoobDad's Avatar
This is a great article and inspiring. Thanks!
1
SilverMoon Network
11/13/2016 6:37 pm
Level 12 : Journeyman Network
SilverMoon Network's Avatar
Haha thank you so much, I am glad you found it useful :)
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome