Advertisement
jcgru

SkycadePlayerCountData

Jul 9th, 2019
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. from mcstatus import MinecraftServer
  2. import datetime
  3. import random
  4. import matplotlib.pyplot as plt
  5. import time
  6.  
  7.  
  8. server_ip = "play.skycade.net"
  9. player_count_array = []
  10. time_array = []
  11.  
  12. def check_player():
  13.     server = MinecraftServer.lookup(server_ip)
  14.     status = server.status()
  15.     return status.players.online
  16.  
  17.  
  18. def main():
  19.     for x in range(0, 4000):
  20.         server_count = check_player()
  21.         player_count_array.append(server_count)
  22.         time_array.append(datetime.datetime.strftime(datetime.datetime.now(), "%H:%M:%S"))
  23.         print("Current_Count: " + str(server_count) + " -" + str(x))
  24.     #     plt.plot(time_array, player_count_array)
  25.     #     plt.gcf().autofmt_xdate()
  26.     #     plt.pause(0.05)
  27.     # plt.plot()
  28.  
  29.  
  30. if __name__ == '__main__':
  31.     main()
  32.     # dump to file
  33.     with open('data.txt', 'w+') as file:
  34.         for x in range(0, len(player_count_array)):
  35.             file.writelines(str(time_array[x]) + " " + str(player_count_array[x]) + "\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement