Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from mcstatus import MinecraftServer
- import datetime
- import random
- import matplotlib.pyplot as plt
- import time
- server_ip = "play.skycade.net"
- player_count_array = []
- time_array = []
- def check_player():
- server = MinecraftServer.lookup(server_ip)
- status = server.status()
- return status.players.online
- def main():
- for x in range(0, 4000):
- server_count = check_player()
- player_count_array.append(server_count)
- time_array.append(datetime.datetime.strftime(datetime.datetime.now(), "%H:%M:%S"))
- print("Current_Count: " + str(server_count) + " -" + str(x))
- # plt.plot(time_array, player_count_array)
- # plt.gcf().autofmt_xdate()
- # plt.pause(0.05)
- # plt.plot()
- if __name__ == '__main__':
- main()
- # dump to file
- with open('data.txt', 'w+') as file:
- for x in range(0, len(player_count_array)):
- file.writelines(str(time_array[x]) + " " + str(player_count_array[x]) + "\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement