From b4c485776149ee5b1a854b63b78f0fde889ba52f Mon Sep 17 00:00:00 2001 From: PanFritz Date: Sun, 20 Sep 2015 01:47:36 +0200 Subject: [PATCH] Attempt to make a sync decorator --- sync.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 sync.py diff --git a/sync.py b/sync.py new file mode 100644 index 0000000..0a2cd0b --- /dev/null +++ b/sync.py @@ -0,0 +1,21 @@ +from helpers import * +from java.lang import Runnable + +class Sync_class(Runnable): + + def __init__(self,function,*args,**kwargs): + self.function = function + self.args = args + self.kwargs = kwargs + + def run(self): + self.function(self.args,self.kwargs) + + + +def sync(function): + def wrapper(*args,**kwargs): + sync_function = Sync_class(function) + server.getScheduler().runTask(server.getPluginManager().getPlugin("RedstonerUtils"),sync_function) + return None + return wrapper \ No newline at end of file