commit
c67ce889a1
4 changed files with 79 additions and 0 deletions
@ -0,0 +1,25 @@ |
|||||||
|
import time |
||||||
|
|
||||||
|
from mcrcon import MCRcon |
||||||
|
|
||||||
|
IP = '127.0.0.1' |
||||||
|
PASS = 'jean-qot' |
||||||
|
|
||||||
|
empty_count = 0 |
||||||
|
|
||||||
|
def check_empty(): |
||||||
|
with MCRcon(IP, PASS) as mcr: |
||||||
|
resp = mcr.command('/list') |
||||||
|
return 'There are 0 of a max' in resp |
||||||
|
|
||||||
|
while True: |
||||||
|
if check_empty(): |
||||||
|
empty_count += 1 |
||||||
|
else: |
||||||
|
empty_count = 0 |
||||||
|
|
||||||
|
if empty_count >= 15: |
||||||
|
print('shutdown server!') |
||||||
|
break |
||||||
|
|
||||||
|
time.sleep(60) |
@ -0,0 +1,2 @@ |
|||||||
|
mcrcon==0.5.2 |
||||||
|
pkg-resources==0.0.0 |
@ -0,0 +1,50 @@ |
|||||||
|
import math |
||||||
|
import time |
||||||
|
|
||||||
|
from itertools import count |
||||||
|
from mcrcon import MCRcon |
||||||
|
|
||||||
|
IP = '127.0.0.1' |
||||||
|
PASS = 'jean-qot' |
||||||
|
PLAYER = '_Wreckinq_' |
||||||
|
STEP = 32 |
||||||
|
SLEEP = 2 |
||||||
|
START = 31895 |
||||||
|
|
||||||
|
def spiral(n): |
||||||
|
k = math.ceil((math.sqrt(n)-1)/2) |
||||||
|
t = 2 * k + 1 |
||||||
|
m = t**2 |
||||||
|
t = t - 1 |
||||||
|
if n >= m-t: |
||||||
|
return k-(m-n), -k |
||||||
|
else: |
||||||
|
m = m-t |
||||||
|
|
||||||
|
if n >= m-t: |
||||||
|
return -k, -k+(m-n) |
||||||
|
else: |
||||||
|
m = m-t |
||||||
|
|
||||||
|
if n >= m-t: |
||||||
|
return -k+(m-n), k |
||||||
|
else: |
||||||
|
return k, k-(m-n-t) |
||||||
|
|
||||||
|
def gen_chunks(): |
||||||
|
with MCRcon(IP, PASS) as mcr: |
||||||
|
resp = mcr.command('/gamemode creative {}'.format(PLAYER)) |
||||||
|
if resp == 'No player was found': |
||||||
|
print(resp) |
||||||
|
return |
||||||
|
|
||||||
|
for step in count(START): |
||||||
|
chunk = spiral(step) |
||||||
|
coords = [STEP*x + STEP//2 for x in chunk] |
||||||
|
|
||||||
|
print('Step {}: {}'.format(str(step), str(coords))) |
||||||
|
mcr.command('/tp {} {} 150 {}'.format(PLAYER, *coords)) |
||||||
|
|
||||||
|
time.sleep(SLEEP) |
||||||
|
|
||||||
|
gen_chunks() |
@ -0,0 +1,2 @@ |
|||||||
|
mcrcon==0.5.2 |
||||||
|
pkg-resources==0.0.0 |
Loading…
Reference in new issue