summaryrefslogtreecommitdiff
path: root/spawnplayer.py
diff options
context:
space:
mode:
authorjomo <github@jomo.tv>2015-01-06 23:38:42 +0100
committerjomo <github@jomo.tv>2015-01-06 23:38:42 +0100
commit9a916ed2cd9440d46079f9b7db421a7b9fcbf6ee (patch)
tree3af33b3ddc2fa3159f9243b0ade09b3e3cc96425 /spawnplayer.py
parent3435e994326b14f700777741a76dd990a2bc703f (diff)
change indentation from 2 spaces to 4, fix #5
Diffstat (limited to 'spawnplayer.py')
-rw-r--r--spawnplayer.py76
1 files changed, 38 insertions, 38 deletions
diff --git a/spawnplayer.py b/spawnplayer.py
index 374c6e3..e584e0b 100644
--- a/spawnplayer.py
+++ b/spawnplayer.py
@@ -18,45 +18,45 @@ upmul = 0.95 # multiplicate with goup each row
def spawn(dispname, sender, x, y, z):
- """
- Sends the actual player to sender
- """
- server = bukkit.getServer().getServer()
- world = server.getWorldServer(0) # main world
- profile = GameProfile(dispname, dispname) # set player details
- manager = PlayerInteractManager(world)
- entity = EntityPlayer(server, world, profile, manager) # create Player's entity
- entity.setPosition(x, y, z)
- packet = PacketPlayOutNamedEntitySpawn(entity) # create packet for entity spawn
- sender.getHandle().playerConnection.sendPacket(packet) # send packet
+ """
+ Sends the actual player to sender
+ """
+ server = bukkit.getServer().getServer()
+ world = server.getWorldServer(0) # main world
+ profile = GameProfile(dispname, dispname) # set player details
+ manager = PlayerInteractManager(world)
+ entity = EntityPlayer(server, world, profile, manager) # create Player's entity
+ entity.setPosition(x, y, z)
+ packet = PacketPlayOutNamedEntitySpawn(entity) # create packet for entity spawn
+ sender.getHandle().playerConnection.sendPacket(packet) # send packet
@hook.command("spawnplayer")
def on_spawnplayer_command(sender, args):
- global amount, row, ground, goup
-
- # X and Z position
- xpos = sender.getLocation().add(-float(row-1 * shift + (amount * margin) / 2), 0, 0).getX()
- row = sender.getLocation().add(0, 0, -row).getZ()
-
- count = 0
- stop = False
- while not stop:
- for i in range(amount):
- player = players[count]
- x = int(xpos + i*margin)
- spawn(player, sender, x, ground, row)
- print(player, x, ground, row)
- count += 1
- if count >= len(players):
- stop = True
- print "breaking"
- break
- print("next row")
- row -= 1 # next row (-z)
- xpos -= shift # shift left
- amount += int(shift*margin*2) # add players left and right
- if abs(row) % int(goup) == 0:
- goup *= upmul
- ground += 1
- print "Going up by 1: %s" % ground \ No newline at end of file
+ global amount, row, ground, goup
+
+ # X and Z position
+ xpos = sender.getLocation().add(-float(row-1 * shift + (amount * margin) / 2), 0, 0).getX()
+ row = sender.getLocation().add(0, 0, -row).getZ()
+
+ count = 0
+ stop = False
+ while not stop:
+ for i in range(amount):
+ player = players[count]
+ x = int(xpos + i*margin)
+ spawn(player, sender, x, ground, row)
+ print(player, x, ground, row)
+ count += 1
+ if count >= len(players):
+ stop = True
+ print "breaking"
+ break
+ print("next row")
+ row -= 1 # next row (-z)
+ xpos -= shift # shift left
+ amount += int(shift*margin*2) # add players left and right
+ if abs(row) % int(goup) == 0:
+ goup *= upmul
+ ground += 1
+ print "Going up by 1: %s" % ground \ No newline at end of file