summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNEMESIS13cz <seke94@seznam.cz>2015-07-23 01:27:38 +0200
committerNEMESIS13cz <seke94@seznam.cz>2015-07-23 01:27:38 +0200
commit90872da066e858e16cc358ecdb6b3b753bf019d3 (patch)
tree8a0fb251ac4b60324f109dc864a34d4142c01a65
parent09e0d761f53e25ad025dbf06b032766f9b94d6e7 (diff)
Fixed timed-match scheduling
-rw-r--r--snowbrawl.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/snowbrawl.py b/snowbrawl.py
index 7b14d56..6ec4243 100644
--- a/snowbrawl.py
+++ b/snowbrawl.py
@@ -5,6 +5,7 @@ import org.bukkit.inventory.ItemStack as ItemStack
import org.bukkit.Material as Material
import org.bukkit.potion.PotionEffect as PotionEffect
import org.bukkit.potion.PotionEffectType as PotionEffectType
+from java.lang import Runnable
from java.util.UUID import fromString as juuid
from operator import __contains__
from traceback import format_exc as trace
@@ -525,6 +526,14 @@ arenas = load_snowbrawl()
# Threads
##############################################################################################
+class timings_runnable(Runnable):
+
+ def __init__(self, arena):
+ self.arena = arena
+
+ def run(self):
+ self.arena.end_match()
+
#timings thread to end arenas if their type is time
def timings():
while True:
@@ -534,7 +543,8 @@ def timings():
current_time = time.time()
start_time = arena.start_time
if arena.start_time + arena.match_goal < current_time:
- arena.end_match()
+ timing = timings_runnable(arena)
+ server.getScheduler().runTask(server.getPluginManager().getPlugin("RedstonerUtils"), timing)
time.sleep(0.1)