blob: 5af5292291a1e5529649b9f1bf0d3f6b297f6d5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
#Snowbrawl
from helpers import *
arenas = {}
"""
ArenaName
PlayersPerGame
Objective
PlayersInQue
"""
@hook.event("org.bukkit.event.entity.ProjectileHitEvent", "high")
def onHit(event):
print "thrown"
if event.getEntity().getType() != EntityType.SNOWBALL:
print "Not a snowball?"
return
if event.getWorld().getName() != "minigames":
print "Not in minigames"
return
print "all good."
event.getWorld().createExplosion(event.getLocation(),1)
@hook.event("PlayerInteractEvent")
def onClick(event):
if (event.getAction() != Action.RIGHT_CLICK_BLOCK):
return
block = event.getClickedBlock()
if not block.getMaterial() in [Material.SIGN_POST, Material.WALL_SIGN]:
return
sign_state = block.getState()
lines = bukkit.block.Sign.getLines(sign_state)
class Queue(Object):
queue = []
def __init__(self):
def add(name):
queue.append(name)
def rem(names):
for name in names:
queue.remove(name)
def shrink():
queue.remove(0)
class Arena(Object):
queue = Queue()
size = 0
coordinate = Coordinate(0, 0)
def __init__(self, coordinate, size):
self.coordinate = coordinate
self.size = size
def getLocation():
return coordinate
def getSize():
return size
def getQueue():
return queue
class Coordinate(Object):
x = 0
z = 0
def __init__(self, x, z):
self.x = x
self.z = z
def getX():
return x
def getZ():
return z
def inRange(location, range):
xd = location.getBlockX() - getX()
zd = location.getBlockZ() - getZ()
return xd >= 0 and xd <= range_ and zd >= 0 and zd <= range_
"""
class Match(Object):
names = []
def __init__(self, ):
"""
def getArena(location):
for name in arenas:
arena = arenas.get(name)
if arena.getLocation().inRange(location, arena.getSize() - 1)
return arena
return None
|