Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/usr/bin/python2.4
- import random
- import math
- import re
- direction = random.randint(1,360)
- distance = random.randint(200,500)
- xshift = int(round (distance * math.sin(direction)))
- yshift = int(round (distance * math.cos(direction)))
- fob=open('/home/minecraft/Minecraft/plugins/RandomSpawn/worlds.yml','r')
- config = fob.readlines()
- fob.close()
- for i, linedata in enumerate(config) :
- if i == 8 :
- xmin = re.findall(r"[-+]?\d*\.\d+|[-+]?\d+", linedata)
- if i == 9 :
- xmax = re.findall(r"[-+]?\d*\.\d+|[-+]?\d+", linedata)
- if i == 10 :
- ymin = re.findall(r"[-+]?\d*\.\d+|[-+]?\d+", linedata)
- if i == 11 :
- ymax = re.findall(r"[-+]?\d*\.\d+|[-+]?\d+", linedata)
- xmin = int(xmin[0]) + xshift
- xmax = int(xmax[0]) + xshift
- ymin = int(ymin[0]) + yshift
- ymax = int(ymax[0]) + yshift
- config[8] = ' x-min: ' + str(xmin) + '\n'
- config[9] = ' x-max: ' + str(xmax) + '\n'
- config[10] = ' y-min: ' + str(ymin) + '\n'
- config[11] = ' y-max: ' + str(ymax) + '\n'
- fob=open('/home/minecraft/Minecraft/plugins/RandomSpawn/worlds.yml','w')
- fob.writelines(config)
- fob.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement