diff --git a/Pocket/plugins/Mineplex/.idea/misc.xml b/Pocket/plugins/Mineplex/.idea/misc.xml
new file mode 100644
index 000000000..8662aa97f
--- /dev/null
+++ b/Pocket/plugins/Mineplex/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Pocket/plugins/Mineplex/.idea/workspace.xml b/Pocket/plugins/Mineplex/.idea/workspace.xml
index 3f2f96e7c..83d445750 100644
--- a/Pocket/plugins/Mineplex/.idea/workspace.xml
+++ b/Pocket/plugins/Mineplex/.idea/workspace.xml
@@ -25,34 +25,68 @@
-
+
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
-
+
+
+
+
+
@@ -60,7 +94,7 @@
-
+
@@ -70,58 +104,28 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -148,7 +152,10 @@
+
+
+
@@ -162,7 +169,6 @@
-
@@ -359,6 +365,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -388,6 +424,9 @@
+
+
+
@@ -397,9 +436,6 @@
-
-
-
@@ -413,7 +449,7 @@
-
+
@@ -422,7 +458,9 @@
-
+
+
+
@@ -430,11 +468,9 @@
-
-
@@ -460,10 +496,10 @@
-
-
+
+
-
+
@@ -504,30 +540,16 @@
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -540,59 +562,40 @@
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
@@ -605,6 +608,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -619,37 +672,57 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/Main.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/Main.php
index d47c87f97..6137cdf7a 100644
--- a/Pocket/plugins/Mineplex/src/mineplex/plugin/Main.php
+++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/Main.php
@@ -2,8 +2,12 @@
namespace mineplex\plugin;
+use mineplex\plugin\core\updater\UpdateType;
use mineplex\plugin\tasks\TickTask;
use mineplex\plugin\events\TickEvent;
+use mineplex\plugin\core\updater\Updater;
+use mineplex\plugin\core\updater\UpdateEvent;
+use mineplex\plugin\core\updater\UpdateType as UpdaterType;
use mineplex\plugin\util\UtilString;
use mineplex\plugin\packets\StrangePacket;
@@ -19,6 +23,7 @@ class Main extends PluginBase implements Listener
$this->getServer()->getScheduler()->scheduleRepeatingTask(new TickTask($this), 1);
$this->getServer()->getPluginManager()->registerEvents($this, $this);
+ new Updater($this);
}
public function onDisable()
@@ -68,8 +73,9 @@ class Main extends PluginBase implements Listener
}
}
- public function onTick(TickEvent $event)
+ public function onTick(UpdateEvent $event)
{
-
+ if ($event->getTime() == UpdateType::TICK)
+ $this->getLogger()->info("tick");
}
}
\ No newline at end of file
diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/core/updater/UpdateEvent.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/core/updater/UpdateEvent.php
new file mode 100644
index 000000000..5d9b4b5c1
--- /dev/null
+++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/core/updater/UpdateEvent.php
@@ -0,0 +1,28 @@
+time = $time;
+ }
+
+ public function getTime()
+ {
+ return $this->time;
+ }
+}
\ No newline at end of file
diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/core/updater/UpdateType.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/core/updater/UpdateType.php
new file mode 100644
index 000000000..7f7349dfd
--- /dev/null
+++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/core/updater/UpdateType.php
@@ -0,0 +1,37 @@
+time = $time;
+ }
+}
\ No newline at end of file
diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/core/updater/Updater.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/core/updater/Updater.php
new file mode 100644
index 000000000..4d833ed2e
--- /dev/null
+++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/core/updater/Updater.php
@@ -0,0 +1,58 @@
+plugin = $host;
+ $this->owner = $host;
+ $this->plugin->getServer()->getScheduler()->scheduleRepeatingTask($this, 1);
+
+ $this->updateTypes = array(
+ new UpdateType(UpdateType::TICK)
+ , new UpdateType(UpdateType::FASTEST)
+ , new UpdateType(UpdateType::FASTER)
+ , new UpdateType(UpdateType::FAST)
+ , new UpdateType(UpdateType::SEC)
+ , new UpdateType(UpdateType::TWOSEC)
+ , new UpdateType(UpdateType::SLOW)
+ , new UpdateType(UpdateType::SLOWER)
+ , new UpdateType(UpdateType::SLOWEST)
+ , new UpdateType(UpdateType::MIN_01)
+ , new UpdateType(UpdateType::MIN_02)
+ , new UpdateType(UpdateType::MIN_04)
+ , new UpdateType(UpdateType::MIN_08)
+ , new UpdateType(UpdateType::MIN_16)
+ , new UpdateType(UpdateType::MIN_32)
+ , new UpdateType(UpdateType::MIN_64));
+ }
+
+ public function onRun($currentTick)
+ {
+ $timeSpent = round(microtime(true) * 1000) - $this->last;
+ $this->last = round(microtime(true) * 1000);
+
+ foreach ($this->updateTypes as &$updateType)
+ {
+ if ($timeSpent >= $updateType->time)
+ {
+ $this->plugin->getServer()->getPluginManager()->callEvent(new UpdateEvent($updateType->time));
+ }
+ }
+ }
+}
\ No newline at end of file