diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..b3537e0
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml
new file mode 100644
index 0000000..4533c1b
--- /dev/null
+++ b/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_8_5.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_5.xml
new file mode 100644
index 0000000..2888f96
--- /dev/null
+++ b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_5.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_guava_guava_17_0.xml b/.idea/libraries/Maven__com_google_guava_guava_17_0.xml
new file mode 100644
index 0000000..2a9069c
--- /dev/null
+++ b/.idea/libraries/Maven__com_google_guava_guava_17_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml b/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml
new file mode 100644
index 0000000..f3f3738
--- /dev/null
+++ b/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_minexd_pidgin_1_0_SNAPSHOT.xml b/.idea/libraries/Maven__com_minexd_pidgin_1_0_SNAPSHOT.xml
new file mode 100644
index 0000000..91308d8
--- /dev/null
+++ b/.idea/libraries/Maven__com_minexd_pidgin_1_0_SNAPSHOT.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_qrakn_honcho_1_0_SNAPSHOT.xml b/.idea/libraries/Maven__com_qrakn_honcho_1_0_SNAPSHOT.xml
new file mode 100644
index 0000000..d69348d
--- /dev/null
+++ b/.idea/libraries/Maven__com_qrakn_honcho_1_0_SNAPSHOT.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_qrakn_phoenix_lang_1_0_SNAPSHOT.xml b/.idea/libraries/Maven__com_qrakn_phoenix_lang_1_0_SNAPSHOT.xml
new file mode 100644
index 0000000..921181e
--- /dev/null
+++ b/.idea/libraries/Maven__com_qrakn_phoenix_lang_1_0_SNAPSHOT.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml b/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml
new file mode 100644
index 0000000..2ec8376
--- /dev/null
+++ b/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml b/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml
new file mode 100644
index 0000000..e60370e
--- /dev/null
+++ b/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__junit_junit_4_10.xml b/.idea/libraries/Maven__junit_junit_4_10.xml
new file mode 100644
index 0000000..ed8bf5f
--- /dev/null
+++ b/.idea/libraries/Maven__junit_junit_4_10.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_8_SNAPSHOT.xml b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_8_SNAPSHOT.xml
new file mode 100644
index 0000000..2e39f35
--- /dev/null
+++ b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_8_SNAPSHOT.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml b/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml
new file mode 100644
index 0000000..91f161a
--- /dev/null
+++ b/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml
new file mode 100644
index 0000000..acdf443
--- /dev/null
+++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml b/.idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml
new file mode 100644
index 0000000..66c713e
--- /dev/null
+++ b/.idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_spigotmc_spigot_api_1_8_8_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_8_8_R0_1_SNAPSHOT.xml
new file mode 100644
index 0000000..15616ef
--- /dev/null
+++ b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_8_8_R0_1_SNAPSHOT.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml b/.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml
new file mode 100644
index 0000000..02d9152
--- /dev/null
+++ b/.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..3855629
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..f4ff6f8
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..3348b3e
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,409 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PlayerInteract
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1543033884549
+
+
+ 1543033884549
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/application.iml b/application/application.iml
new file mode 100644
index 0000000..1027610
--- /dev/null
+++ b/application/application.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/dependency-reduced-pom.xml b/application/dependency-reduced-pom.xml
new file mode 100644
index 0000000..ba98884
--- /dev/null
+++ b/application/dependency-reduced-pom.xml
@@ -0,0 +1,46 @@
+
+
+
+ quartz-parent
+ com.minexd.quartz
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ application
+
+
+
+ maven-compiler-plugin
+ 3.8.0
+
+
+ 1.8
+
+
+
+ maven-shade-plugin
+ 3.2.0
+
+
+ package
+
+ shade
+
+
+
+
+
+ maven-jar-plugin
+ 3.1.0
+
+
+
+ joeleoli
+ com.minexd.quartz.Quartz
+
+
+
+
+
+
+
diff --git a/application/pom.xml b/application/pom.xml
new file mode 100644
index 0000000..ca2057e
--- /dev/null
+++ b/application/pom.xml
@@ -0,0 +1,63 @@
+
+
+ 4.0.0
+
+
+ com.minexd.quartz
+ quartz-parent
+ 1.0-SNAPSHOT
+
+
+ application
+
+
+
+ com.minexd.quartz
+ common
+ 1.0-SNAPSHOT
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.0
+
+
+ 1.8
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.0
+
+
+ package
+
+ shade
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.1.0
+
+
+
+ joeleoli
+ com.minexd.quartz.Quartz
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/src/main/java/com/minexd/quartz/Quartz.java b/application/src/main/java/com/minexd/quartz/Quartz.java
new file mode 100644
index 0000000..c0793dc
--- /dev/null
+++ b/application/src/main/java/com/minexd/quartz/Quartz.java
@@ -0,0 +1,82 @@
+package com.minexd.quartz;
+
+import com.minexd.pidgin.Pidgin;
+import com.minexd.quartz.network.NetworkListener;
+import com.minexd.quartz.log.Logger;
+import com.minexd.quartz.packet.PlayerAddPacket;
+import com.minexd.quartz.packet.PlayerAddedPacket;
+import com.minexd.quartz.packet.PlayerRemovePacket;
+import com.minexd.quartz.packet.PlayerRemovedPacket;
+import com.minexd.quartz.packet.PlayerSendPacket;
+import com.minexd.quartz.packet.QueueListPacket;
+import com.minexd.quartz.packet.ServerMetadataPacket;
+import com.minexd.quartz.packet.ServerUpdatePacket;
+import com.minexd.quartz.queue.Queue;
+import com.minexd.quartz.thread.BroadcastThread;
+import com.minexd.quartz.thread.QueueThread;
+import com.minexd.quartz.data.QuartzData;
+import com.minexd.quartz.file.Config;
+
+import java.util.Arrays;
+import lombok.Getter;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+
+public class Quartz {
+
+ private static Quartz quartz;
+
+ @Getter private Config config;
+ @Getter private JedisPool jedisPool;
+ @Getter private Pidgin pidgin;
+ @Getter private QuartzData quartzData;
+
+ private Quartz() {
+ quartz = this;
+
+ config = new Config();
+ jedisPool = new JedisPool(config.getRedisHost(), config.getRedisPort());
+
+ if (config.getRedisPassword() != null) {
+ try (Jedis jedis = jedisPool.getResource()) {
+ jedis.auth(config.getRedisPassword());
+ }
+ }
+
+ pidgin = new Pidgin("quartz", config.getRedisHost(), config.getRedisPort(), config.getRedisPassword());
+ pidgin.registerListener(new NetworkListener());
+
+ Arrays.asList(
+ PlayerAddedPacket.class,
+ PlayerAddPacket.class,
+ PlayerRemovedPacket.class,
+ PlayerRemovePacket.class,
+ PlayerSendPacket.class,
+ QueueListPacket.class,
+ ServerMetadataPacket.class,
+ ServerUpdatePacket.class
+ ).forEach(pidgin::registerPacket);
+
+ quartzData = new QuartzData(jedisPool);
+
+ for (String name : config.getQueues()) {
+ quartzData.getQueues().add(new Queue(name));
+
+ Logger.print("Loaded queue `" + name + "` from config");
+ }
+
+ Logger.print("Quartz is now running...");
+
+ new QueueThread().start();
+ new BroadcastThread().start();
+ }
+
+ public static void main(String[] args) {
+ new Quartz();
+ }
+
+ public static Quartz get() {
+ return quartz;
+ }
+
+}
diff --git a/application/src/main/java/com/minexd/quartz/file/Config.java b/application/src/main/java/com/minexd/quartz/file/Config.java
new file mode 100644
index 0000000..6daa217
--- /dev/null
+++ b/application/src/main/java/com/minexd/quartz/file/Config.java
@@ -0,0 +1,69 @@
+package com.minexd.quartz.file;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import lombok.Getter;
+
+@Getter
+public class Config {
+
+ private String[] queues;
+ private String redisHost;
+ private int redisPort;
+ private String redisPassword;
+
+ public Config() {
+ File file = new File("config.properties");
+
+ if (!file.exists()) {
+ try {
+ file.createNewFile();
+
+ FileOutputStream output = new FileOutputStream(file);
+ output.write("queues=test1,test2,test3\n".getBytes());
+ output.write("redis-host=127.0.0.1\n".getBytes());
+ output.write("redis-port=6379\n".getBytes());
+ output.write("redis-password=dev\n".getBytes());
+ output.flush();
+ output.close();
+ } catch (IOException io) {
+ io.printStackTrace();
+ }
+ }
+
+ Properties prop = new Properties();
+ InputStream input = null;
+
+ try {
+ input = new FileInputStream("config.properties");
+
+ prop.load(input);
+
+ String queues = ((String) prop.getOrDefault("queues", ""));
+
+ this.queues = queues.equals("") ? new String[0] : queues.split(",");
+ this.redisHost = ((String) prop.getOrDefault("redis-host", "127.0.0.1"));
+ this.redisPort = Integer.valueOf((String) prop.getOrDefault("redis-port", "6379"));
+ this.redisPassword = ((String) prop.getOrDefault("redis-password", null));
+
+ if (this.redisPassword.isEmpty()) {
+ this.redisPassword = null;
+ }
+ } catch (IOException io) {
+ io.printStackTrace();
+ } finally {
+ if (input != null) {
+ try {
+ input.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+}
diff --git a/application/src/main/java/com/minexd/quartz/log/Logger.java b/application/src/main/java/com/minexd/quartz/log/Logger.java
new file mode 100644
index 0000000..b36b344
--- /dev/null
+++ b/application/src/main/java/com/minexd/quartz/log/Logger.java
@@ -0,0 +1,15 @@
+package com.minexd.quartz.log;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+public class Logger {
+
+ private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+
+ public static void print(String message) {
+ System.out.println("[" + DATE_FORMAT.format(Calendar.getInstance().getTime()) + "] [Quartz] " + message);
+ }
+
+}
diff --git a/application/src/main/java/com/minexd/quartz/network/NetworkListener.java b/application/src/main/java/com/minexd/quartz/network/NetworkListener.java
new file mode 100644
index 0000000..9fe0e82
--- /dev/null
+++ b/application/src/main/java/com/minexd/quartz/network/NetworkListener.java
@@ -0,0 +1,110 @@
+package com.minexd.quartz.network;
+
+import com.google.gson.JsonObject;
+import com.minexd.pidgin.packet.handler.IncomingPacketHandler;
+import com.minexd.pidgin.packet.listener.PacketListener;
+import com.minexd.quartz.packet.PlayerAddPacket;
+import com.minexd.quartz.packet.PlayerAddedPacket;
+import com.minexd.quartz.packet.PlayerRemovePacket;
+import com.minexd.quartz.packet.PlayerRemovedPacket;
+import com.minexd.quartz.packet.ServerUpdatePacket;
+import java.util.Iterator;
+import java.util.UUID;
+import com.minexd.quartz.Quartz;
+import com.minexd.quartz.log.Logger;
+import com.minexd.quartz.queue.Queue;
+import com.minexd.quartz.queue.QueuePlayer;
+import com.minexd.quartz.server.Server;
+
+public class NetworkListener implements PacketListener {
+
+ @IncomingPacketHandler
+ public void onPlayerAddPacket(PlayerAddPacket packet) {
+ Queue queue = Quartz.get().getQuartzData().getQueueByName(packet.getData().get("queue").getAsString());
+
+ if (queue != null) {
+ JsonObject playerObject = packet.getData().get("player").getAsJsonObject();
+ QueuePlayer player = new QueuePlayer(playerObject);
+
+ if (Quartz.get().getQuartzData().getQueueByPlayer(player.getUuid()) != null) {
+ return;
+ }
+
+ player.setInserted(System.currentTimeMillis());
+
+ queue.getPlayers().add(player);
+
+ playerObject.addProperty("inserted-at", player.getInserted());
+ packet.getData().add("player", playerObject);
+
+ Quartz.get().getPidgin().sendPacket(new PlayerAddedPacket(packet.getData()));
+ }
+ }
+
+ @IncomingPacketHandler
+ public void onPlayerRemovePacket(PlayerRemovePacket packet) {
+ UUID uuid = UUID.fromString(packet.getData().get("uuid").getAsString());
+ Queue queue = Quartz.get().getQuartzData().getQueueByPlayer(uuid);
+
+ if (queue != null) {
+ QueuePlayer queuePlayer = null;
+
+ Iterator iterator = queue.getPlayers().iterator();
+
+ while (iterator.hasNext()) {
+ QueuePlayer other = iterator.next();
+
+ if (other.getUuid().equals(uuid)) {
+ queuePlayer = other;
+
+ iterator.remove();
+ }
+ }
+
+ if (queuePlayer != null) {
+ JsonObject rankObject = new JsonObject();
+ rankObject.addProperty("name", queuePlayer.getRank().getName());
+ rankObject.addProperty("priority", queuePlayer.getRank().getPriority());
+
+ JsonObject playerObject = new JsonObject();
+ playerObject.addProperty("uuid", queuePlayer.getUuid().toString());
+ playerObject.addProperty("inserted-at", queuePlayer.getInserted());
+ playerObject.add("rank", rankObject);
+
+ JsonObject data = new JsonObject();
+ data.addProperty("queue", queue.getName());
+ data.add("player", playerObject);
+
+ Quartz.get().getPidgin().sendPacket(new PlayerRemovedPacket(data));
+ }
+ }
+ }
+
+ @IncomingPacketHandler
+ public void onServerUpdatePacket(ServerUpdatePacket packet) {
+ String serverId = packet.getData().get("id").getAsString();
+ Server server = Quartz.get().getQuartzData().getServerById(serverId);
+ Queue queue = Quartz.get().getQuartzData().getQueueByName(serverId);
+
+ if (server == null) {
+ server = new Server(serverId);
+
+ if (queue != null) {
+ queue.setEnabled(true);
+ }
+
+ Logger.print("Initiated server `" + serverId + "`");
+ }
+
+ server.setName(packet.getData().get("name").getAsString());
+ server.setOnlinePlayers(packet.getData().get("online-players").getAsInt());
+ server.setMaximumPlayers(packet.getData().get("maximum-players").getAsInt());
+ server.setWhitelisted(packet.getData().get("whitelisted").getAsBoolean());
+ server.setPort(packet.getData().get("port").getAsInt());
+ server.setMetadata(packet.getData().get("metadata").getAsJsonObject());
+ server.setLastUpdate(System.currentTimeMillis());
+
+ Logger.print("Updated server `" + serverId + "`");
+ }
+
+}
diff --git a/application/src/main/java/com/minexd/quartz/thread/BroadcastThread.java b/application/src/main/java/com/minexd/quartz/thread/BroadcastThread.java
new file mode 100644
index 0000000..adc9baf
--- /dev/null
+++ b/application/src/main/java/com/minexd/quartz/thread/BroadcastThread.java
@@ -0,0 +1,58 @@
+package com.minexd.quartz.thread;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.minexd.quartz.log.Logger;
+import com.minexd.quartz.packet.QueueListPacket;
+import com.minexd.quartz.queue.Queue;
+import com.minexd.quartz.util.JsonChain;
+import com.minexd.quartz.Quartz;
+import com.minexd.quartz.queue.QueuePlayer;
+
+public class BroadcastThread extends Thread {
+
+ @Override
+ public void run() {
+ while (true) {
+ try {
+ JsonArray queues = new JsonArray();
+
+ for (Queue queue : Quartz.get().getQuartzData().getQueues()) {
+ JsonArray players = new JsonArray();
+
+ for (QueuePlayer player : queue.getPlayers()) {
+ JsonObject rankObject = new JsonChain()
+ .addProperty("name", player.getRank().getName())
+ .addProperty("priority", player.getRank().getPriority())
+ .get();
+
+ JsonObject playerObject = new JsonChain()
+ .addProperty("uuid", player.getUuid().toString())
+ .addProperty("inserted-at", player.getInserted())
+ .add("rank", rankObject)
+ .get();
+
+ players.add(playerObject);
+ }
+
+ JsonObject queueObject = new JsonObject();
+ queueObject.addProperty("id", queue.getName());
+ queueObject.addProperty("status", queue.isEnabled());
+ queueObject.add("players", players);
+
+ queues.add(queueObject);
+ }
+
+ Quartz.get().getPidgin().sendPacket(new QueueListPacket(queues));
+
+ Logger.print("Broadcast server and queue list");
+
+ Thread.sleep(5000L);
+ } catch (Exception e) {
+ e.printStackTrace();
+ continue;
+ }
+ }
+ }
+
+}
diff --git a/application/src/main/java/com/minexd/quartz/thread/QueueThread.java b/application/src/main/java/com/minexd/quartz/thread/QueueThread.java
new file mode 100644
index 0000000..a876809
--- /dev/null
+++ b/application/src/main/java/com/minexd/quartz/thread/QueueThread.java
@@ -0,0 +1,54 @@
+package com.minexd.quartz.thread;
+
+import com.minexd.quartz.packet.PlayerSendPacket;
+import com.minexd.quartz.queue.Queue;
+import com.minexd.quartz.server.Server;
+import com.minexd.quartz.util.JsonChain;
+import com.minexd.quartz.Quartz;
+import com.minexd.quartz.queue.QueuePlayer;
+
+public class QueueThread extends Thread {
+
+ private static final Long SEND_DELAY = 500L;
+
+ @Override
+ public void run() {
+ while (true) {
+ try {
+ for (Queue queue : Quartz.get().getQuartzData().getQueues()) {
+ if (!this.canSend(queue)) {
+ continue;
+ }
+
+ QueuePlayer next = queue.getPlayers().poll();
+
+ if (next != null) {
+ Quartz.get().getPidgin().sendPacket(new PlayerSendPacket(new JsonChain()
+ .addProperty("server", queue.getName())
+ .addProperty("uuid", next.getUuid().toString())
+ .get()));
+ }
+ }
+
+ Thread.sleep(SEND_DELAY);
+ } catch (Exception e) {
+ e.printStackTrace();
+ continue;
+ }
+ }
+ }
+
+ private boolean canSend(Queue queue) {
+ if (queue.isEnabled()) {
+ Server server = Quartz.get().getQuartzData().getServerById(queue.getName());
+
+ if (server != null) {
+ return server.isOnline() && !server.isWhitelisted() &&
+ server.getOnlinePlayers() < server.getMaximumPlayers();
+ }
+ }
+
+ return false;
+ }
+
+}
diff --git a/application/target/classes/com/minexd/quartz/Quartz.class b/application/target/classes/com/minexd/quartz/Quartz.class
new file mode 100644
index 0000000..cb8c622
Binary files /dev/null and b/application/target/classes/com/minexd/quartz/Quartz.class differ
diff --git a/application/target/classes/com/minexd/quartz/file/Config.class b/application/target/classes/com/minexd/quartz/file/Config.class
new file mode 100644
index 0000000..9e7a697
Binary files /dev/null and b/application/target/classes/com/minexd/quartz/file/Config.class differ
diff --git a/application/target/classes/com/minexd/quartz/log/Logger.class b/application/target/classes/com/minexd/quartz/log/Logger.class
new file mode 100644
index 0000000..fb44a40
Binary files /dev/null and b/application/target/classes/com/minexd/quartz/log/Logger.class differ
diff --git a/application/target/classes/com/minexd/quartz/network/NetworkListener.class b/application/target/classes/com/minexd/quartz/network/NetworkListener.class
new file mode 100644
index 0000000..cfda634
Binary files /dev/null and b/application/target/classes/com/minexd/quartz/network/NetworkListener.class differ
diff --git a/application/target/classes/com/minexd/quartz/thread/BroadcastThread.class b/application/target/classes/com/minexd/quartz/thread/BroadcastThread.class
new file mode 100644
index 0000000..a3f0167
Binary files /dev/null and b/application/target/classes/com/minexd/quartz/thread/BroadcastThread.class differ
diff --git a/application/target/classes/com/minexd/quartz/thread/QueueThread.class b/application/target/classes/com/minexd/quartz/thread/QueueThread.class
new file mode 100644
index 0000000..52d7deb
Binary files /dev/null and b/application/target/classes/com/minexd/quartz/thread/QueueThread.class differ
diff --git a/application/target/maven-archiver/pom.properties b/application/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..200776a
--- /dev/null
+++ b/application/target/maven-archiver/pom.properties
@@ -0,0 +1,4 @@
+#Created by Apache Maven 3.3.9
+version=1.0-SNAPSHOT
+groupId=com.minexd.quartz
+artifactId=application
diff --git a/application/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/application/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..e3c71c4
--- /dev/null
+++ b/application/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,6 @@
+com\minexd\quartz\file\Config.class
+com\minexd\quartz\thread\QueueThread.class
+com\minexd\quartz\network\NetworkListener.class
+com\minexd\quartz\Quartz.class
+com\minexd\quartz\thread\BroadcastThread.class
+com\minexd\quartz\log\Logger.class
diff --git a/application/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/application/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..9915658
--- /dev/null
+++ b/application/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,6 @@
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\application\src\main\java\com\minexd\quartz\thread\QueueThread.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\application\src\main\java\com\minexd\quartz\file\Config.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\application\src\main\java\com\minexd\quartz\log\Logger.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\application\src\main\java\com\minexd\quartz\network\NetworkListener.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\application\src\main\java\com\minexd\quartz\Quartz.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\application\src\main\java\com\minexd\quartz\thread\BroadcastThread.java
diff --git a/application/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/application/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/application/target/original-quartz-application-1.0-SNAPSHOT.jar b/application/target/original-quartz-application-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..936728f
Binary files /dev/null and b/application/target/original-quartz-application-1.0-SNAPSHOT.jar differ
diff --git a/application/target/quartz-application-1.0-SNAPSHOT.jar b/application/target/quartz-application-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..2da2f40
Binary files /dev/null and b/application/target/quartz-application-1.0-SNAPSHOT.jar differ
diff --git a/common/common.iml b/common/common.iml
new file mode 100644
index 0000000..eb71873
--- /dev/null
+++ b/common/common.iml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common/dependency-reduced-pom.xml b/common/dependency-reduced-pom.xml
new file mode 100644
index 0000000..c1993ef
--- /dev/null
+++ b/common/dependency-reduced-pom.xml
@@ -0,0 +1,50 @@
+
+
+
+ quartz-parent
+ com.minexd.quartz
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ common
+
+
+
+ true
+ src/main/resources
+
+ plugin.yml
+
+
+
+ src/main/resources
+
+ plugin.yml
+
+
+
+
+
+ maven-compiler-plugin
+
+
+ 1.8
+ -parameters
+
+
+
+ maven-shade-plugin
+ 2.4.3
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+
diff --git a/common/pom.xml b/common/pom.xml
new file mode 100644
index 0000000..7478e31
--- /dev/null
+++ b/common/pom.xml
@@ -0,0 +1,79 @@
+
+
+ 4.0.0
+
+
+ com.minexd.quartz
+ quartz-parent
+ 1.0-SNAPSHOT
+
+
+ common
+
+
+
+ org.projectlombok
+ lombok
+ 1.16.16
+ compile
+
+
+ com.google.code.gson
+ gson
+ LATEST
+ compile
+
+
+ com.minexd
+ pidgin
+ 1.0-SNAPSHOT
+ compile
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.8
+ -parameters
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.4.3
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+ src/main/resources
+ true
+
+ plugin.yml
+
+
+
+ src/main/resources
+ false
+
+ plugin.yml
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/java/com/minexd/quartz/data/QuartzData.java b/common/src/main/java/com/minexd/quartz/data/QuartzData.java
new file mode 100644
index 0000000..22cd867
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/data/QuartzData.java
@@ -0,0 +1,103 @@
+package com.minexd.quartz.data;
+
+import com.google.gson.JsonParser;
+import com.minexd.quartz.queue.Queue;
+import com.minexd.quartz.server.Server;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import lombok.Getter;
+import com.minexd.quartz.queue.QueuePlayer;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+import redis.clients.jedis.ScanParams;
+import redis.clients.jedis.ScanResult;
+
+public class QuartzData {
+
+ private final JedisPool jedisPool;
+ @Getter private final List servers = new ArrayList<>();
+ @Getter private final List queues = new ArrayList<>();
+
+ public QuartzData(JedisPool jedisPool) {
+ this.jedisPool = jedisPool;
+ }
+
+ public void loadServers() {
+ try (Jedis jedis = jedisPool.getResource()) {
+ ScanResult found = jedis.scan("0", new ScanParams().match("quartz:server-info").count(100));
+
+ for (String path : found.getResult()) {
+ String[] split = path.split(":");
+ int port = Integer.valueOf(split[2]);
+
+ Map map = jedis.hgetAll(path);
+
+ if (map == null || map.isEmpty()) {
+ continue;
+ }
+
+ // Try and get the server if it is already cached
+ Server server = this.getServerById(map.get("id"));
+
+ // If not, create it
+ if (server == null) {
+ this.servers.add((server = new Server(map.get("id"))));
+ }
+
+ // Update fields
+ server.setName(map.get("name"));
+ server.setPort(port);
+ server.setOnlinePlayers(Integer.valueOf(map.get("online-players")));
+ server.setMaximumPlayers(Integer.valueOf(map.get("maximum-players")));
+ server.setWhitelisted(Boolean.valueOf(map.get("whitelisted")));
+ server.setMetadata(new JsonParser().parse(map.get("metadata")).getAsJsonObject());
+ server.setLastUpdate(Long.valueOf(map.get("last-update")));
+ }
+ }
+ }
+
+ public Server getServerById(String id) {
+ for (Server server : this.servers) {
+ if (server.getId().equalsIgnoreCase(id)) {
+ return server;
+ }
+ }
+
+ return null;
+ }
+
+ public Server getByPort(int port) {
+ for (Server server : this.servers) {
+ if (server.getPort() == port) {
+ return server;
+ }
+ }
+
+ return null;
+ }
+
+ public Queue getQueueByName(String name) {
+ for (Queue queue : this.queues) {
+ if (queue.getName().equalsIgnoreCase(name)) {
+ return queue;
+ }
+ }
+
+ return null;
+ }
+
+ public Queue getQueueByPlayer(UUID uuid) {
+ for (Queue queue : this.queues) {
+ for (QueuePlayer queuePlayer : queue.getPlayers()) {
+ if (queuePlayer.getUuid().equals(uuid)) {
+ return queue;
+ }
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/common/src/main/java/com/minexd/quartz/packet/PlayerAddPacket.java b/common/src/main/java/com/minexd/quartz/packet/PlayerAddPacket.java
new file mode 100644
index 0000000..0d43f01
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/packet/PlayerAddPacket.java
@@ -0,0 +1,31 @@
+package com.minexd.quartz.packet;
+
+import com.google.gson.JsonObject;
+import com.minexd.pidgin.packet.Packet;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Getter
+public class PlayerAddPacket implements Packet {
+
+ private JsonObject data;
+
+ @Override
+ public int id() {
+ return 2;
+ }
+
+ @Override
+ public JsonObject serialize() {
+ return data;
+ }
+
+ @Override
+ public void deserialize(JsonObject object) {
+ data = object;
+ }
+
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/minexd/quartz/packet/PlayerAddedPacket.java b/common/src/main/java/com/minexd/quartz/packet/PlayerAddedPacket.java
new file mode 100644
index 0000000..8ac0864
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/packet/PlayerAddedPacket.java
@@ -0,0 +1,31 @@
+package com.minexd.quartz.packet;
+
+import com.google.gson.JsonObject;
+import com.minexd.pidgin.packet.Packet;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Getter
+public class PlayerAddedPacket implements Packet {
+
+ private JsonObject data;
+
+ @Override
+ public int id() {
+ return 1;
+ }
+
+ @Override
+ public JsonObject serialize() {
+ return data;
+ }
+
+ @Override
+ public void deserialize(JsonObject object) {
+ data = object;
+ }
+
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/minexd/quartz/packet/PlayerRemovePacket.java b/common/src/main/java/com/minexd/quartz/packet/PlayerRemovePacket.java
new file mode 100644
index 0000000..e5c8a6a
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/packet/PlayerRemovePacket.java
@@ -0,0 +1,31 @@
+package com.minexd.quartz.packet;
+
+import com.google.gson.JsonObject;
+import com.minexd.pidgin.packet.Packet;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Getter
+public class PlayerRemovePacket implements Packet {
+
+ private JsonObject data;
+
+ @Override
+ public int id() {
+ return 4;
+ }
+
+ @Override
+ public JsonObject serialize() {
+ return data;
+ }
+
+ @Override
+ public void deserialize(JsonObject object) {
+ data = object;
+ }
+
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/minexd/quartz/packet/PlayerRemovedPacket.java b/common/src/main/java/com/minexd/quartz/packet/PlayerRemovedPacket.java
new file mode 100644
index 0000000..4390d49
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/packet/PlayerRemovedPacket.java
@@ -0,0 +1,31 @@
+package com.minexd.quartz.packet;
+
+import com.google.gson.JsonObject;
+import com.minexd.pidgin.packet.Packet;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Getter
+public class PlayerRemovedPacket implements Packet {
+
+ private JsonObject data;
+
+ @Override
+ public int id() {
+ return 3;
+ }
+
+ @Override
+ public JsonObject serialize() {
+ return data;
+ }
+
+ @Override
+ public void deserialize(JsonObject object) {
+ data = object;
+ }
+
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/minexd/quartz/packet/PlayerSendPacket.java b/common/src/main/java/com/minexd/quartz/packet/PlayerSendPacket.java
new file mode 100644
index 0000000..2f1145d
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/packet/PlayerSendPacket.java
@@ -0,0 +1,31 @@
+package com.minexd.quartz.packet;
+
+import com.google.gson.JsonObject;
+import com.minexd.pidgin.packet.Packet;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Getter
+public class PlayerSendPacket implements Packet {
+
+ private JsonObject data;
+
+ @Override
+ public int id() {
+ return 5;
+ }
+
+ @Override
+ public JsonObject serialize() {
+ return data;
+ }
+
+ @Override
+ public void deserialize(JsonObject object) {
+ data = object;
+ }
+
+}
diff --git a/common/src/main/java/com/minexd/quartz/packet/QueueListPacket.java b/common/src/main/java/com/minexd/quartz/packet/QueueListPacket.java
new file mode 100644
index 0000000..9dc6b19
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/packet/QueueListPacket.java
@@ -0,0 +1,33 @@
+package com.minexd.quartz.packet;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.minexd.pidgin.packet.Packet;
+import com.minexd.quartz.util.JsonChain;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Getter
+public class QueueListPacket implements Packet {
+
+ private JsonArray data;
+
+ @Override
+ public int id() {
+ return 6;
+ }
+
+ @Override
+ public JsonObject serialize() {
+ return new JsonChain().add("data", data).get();
+ }
+
+ @Override
+ public void deserialize(JsonObject object) {
+ data = object.getAsJsonArray("data");
+ }
+
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/minexd/quartz/packet/ServerMetadataPacket.java b/common/src/main/java/com/minexd/quartz/packet/ServerMetadataPacket.java
new file mode 100644
index 0000000..b2d3192
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/packet/ServerMetadataPacket.java
@@ -0,0 +1,31 @@
+package com.minexd.quartz.packet;
+
+import com.google.gson.JsonObject;
+import com.minexd.pidgin.packet.Packet;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Getter
+public class ServerMetadataPacket implements Packet {
+
+ private JsonObject data;
+
+ @Override
+ public int id() {
+ return 7;
+ }
+
+ @Override
+ public JsonObject serialize() {
+ return data;
+ }
+
+ @Override
+ public void deserialize(JsonObject object) {
+ data = object;
+ }
+
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/minexd/quartz/packet/ServerUpdatePacket.java b/common/src/main/java/com/minexd/quartz/packet/ServerUpdatePacket.java
new file mode 100644
index 0000000..0f78294
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/packet/ServerUpdatePacket.java
@@ -0,0 +1,31 @@
+package com.minexd.quartz.packet;
+
+import com.google.gson.JsonObject;
+import com.minexd.pidgin.packet.Packet;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Getter
+public class ServerUpdatePacket implements Packet {
+
+ private JsonObject data;
+
+ @Override
+ public int id() {
+ return 8;
+ }
+
+ @Override
+ public JsonObject serialize() {
+ return data;
+ }
+
+ @Override
+ public void deserialize(JsonObject object) {
+ data = object;
+ }
+
+}
diff --git a/common/src/main/java/com/minexd/quartz/queue/Queue.java b/common/src/main/java/com/minexd/quartz/queue/Queue.java
new file mode 100644
index 0000000..9bc52af
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/queue/Queue.java
@@ -0,0 +1,53 @@
+package com.minexd.quartz.queue;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.*;
+
+@Getter
+public class Queue {
+
+ private String name;
+ @Setter
+ private PriorityQueue players = new PriorityQueue<>(new QueuePlayerComparator());
+ @Setter
+ private boolean enabled;
+
+ public Queue(String name) {
+ this.name = name;
+ }
+
+ public boolean containsPlayer(UUID uuid) {
+ for (QueuePlayer player : this.players) {
+ if (player.getUuid().equals(uuid)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public int getPosition(UUID uuid) {
+ if (!this.containsPlayer(uuid)) {
+ return 0;
+ }
+
+ PriorityQueue queue = new PriorityQueue<>(this.players);
+
+ int position = 0;
+
+ while (!queue.isEmpty()) {
+ QueuePlayer player = queue.poll();
+
+ if (player.getUuid().equals(uuid)) {
+ break;
+ }
+
+ position++;
+ }
+
+ return position + 1;
+ }
+
+}
diff --git a/common/src/main/java/com/minexd/quartz/queue/QueuePlayer.java b/common/src/main/java/com/minexd/quartz/queue/QueuePlayer.java
new file mode 100644
index 0000000..c55dc93
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/queue/QueuePlayer.java
@@ -0,0 +1,50 @@
+package com.minexd.quartz.queue;
+
+import com.google.gson.JsonObject;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import java.util.UUID;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class QueuePlayer implements Comparable {
+
+ private UUID uuid;
+ private QueueRank rank;
+ private long inserted;
+
+ public QueuePlayer(JsonObject object) {
+ this.uuid = UUID.fromString(object.get("uuid").getAsString());
+ this.rank = new QueueRank(object.get("rank").getAsJsonObject());
+
+ if (object.has("inserted-at")) {
+ this.inserted = object.get("inserted-at").getAsLong();
+ }
+ }
+
+ @Override
+ public int compareTo(Object object) {
+ int result = 0;
+
+ if (object instanceof QueuePlayer) {
+ QueuePlayer otherPlayer = (QueuePlayer) object;
+ result = this.rank.getPriority() - otherPlayer.getRank().getPriority();
+
+ if (result == 0) {
+ if (this.inserted < otherPlayer.getInserted()) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+ }
+
+ return result;
+ }
+
+}
diff --git a/common/src/main/java/com/minexd/quartz/queue/QueuePlayerComparator.java b/common/src/main/java/com/minexd/quartz/queue/QueuePlayerComparator.java
new file mode 100644
index 0000000..30ff9f1
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/queue/QueuePlayerComparator.java
@@ -0,0 +1,12 @@
+package com.minexd.quartz.queue;
+
+import java.util.Comparator;
+
+public class QueuePlayerComparator implements Comparator {
+
+ @Override
+ public int compare(QueuePlayer firstPlayer, QueuePlayer secondPlayer) {
+ return firstPlayer.compareTo(secondPlayer);
+ }
+
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/minexd/quartz/queue/QueueRank.java b/common/src/main/java/com/minexd/quartz/queue/QueueRank.java
new file mode 100644
index 0000000..955032c
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/queue/QueueRank.java
@@ -0,0 +1,34 @@
+package com.minexd.quartz.queue;
+
+import com.google.gson.JsonObject;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class QueueRank implements Comparable {
+
+ private String name;
+ private int priority;
+
+ public QueueRank(JsonObject object) {
+ this.name = object.get("name").getAsString();
+ this.priority = object.get("priority").getAsInt();
+ }
+
+ @Override
+ public int compareTo(Object o) {
+ int result = 0;
+
+ if (o instanceof QueueRank) {
+ result = this.priority - ((QueueRank) o).priority;
+ }
+
+ return result;
+ }
+
+}
diff --git a/common/src/main/java/com/minexd/quartz/server/Server.java b/common/src/main/java/com/minexd/quartz/server/Server.java
new file mode 100644
index 0000000..90cd087
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/server/Server.java
@@ -0,0 +1,29 @@
+package com.minexd.quartz.server;
+
+import com.google.gson.JsonObject;
+import java.util.HashSet;
+import java.util.Set;
+import lombok.Data;
+import lombok.Getter;
+
+@Data
+public class Server {
+
+ private String id;
+ private String name;
+ private int onlinePlayers;
+ private int maximumPlayers;
+ private boolean whitelisted;
+ private int port;
+ private JsonObject metadata;
+ private long lastUpdate;
+
+ public Server(String id) {
+ this.id = id;
+ }
+
+ public boolean isOnline() {
+ return System.currentTimeMillis() - this.lastUpdate <= 15_000L;
+ }
+
+}
diff --git a/common/src/main/java/com/minexd/quartz/server/ServerType.java b/common/src/main/java/com/minexd/quartz/server/ServerType.java
new file mode 100644
index 0000000..106cbe8
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/server/ServerType.java
@@ -0,0 +1,12 @@
+package com.minexd.quartz.server;
+
+public enum ServerType {
+
+ PRACTICE,
+ HCFACTIONS,
+ UHC_MEETUP,
+ POTION_SG;
+
+ private String readable;
+
+}
diff --git a/common/src/main/java/com/minexd/quartz/util/JsonChain.java b/common/src/main/java/com/minexd/quartz/util/JsonChain.java
new file mode 100644
index 0000000..cb819be
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/util/JsonChain.java
@@ -0,0 +1,39 @@
+package com.minexd.quartz.util;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+public class JsonChain {
+
+ private JsonObject json = new JsonObject();
+
+ public JsonChain addProperty(String property, String value) {
+ this.json.addProperty(property, value);
+ return this;
+ }
+
+ public JsonChain addProperty(String property, Number value) {
+ this.json.addProperty(property, value);
+ return this;
+ }
+
+ public JsonChain addProperty(String property, Boolean value) {
+ this.json.addProperty(property, value);
+ return this;
+ }
+
+ public JsonChain addProperty(String property, Character value) {
+ this.json.addProperty(property, value);
+ return this;
+ }
+
+ public JsonChain add(String property, JsonElement element) {
+ this.json.add(property, element);
+ return this;
+ }
+
+ public JsonObject get() {
+ return this.json;
+ }
+
+}
diff --git a/common/src/main/java/com/minexd/quartz/util/MapUtil.java b/common/src/main/java/com/minexd/quartz/util/MapUtil.java
new file mode 100644
index 0000000..f7a3560
--- /dev/null
+++ b/common/src/main/java/com/minexd/quartz/util/MapUtil.java
@@ -0,0 +1,23 @@
+package com.minexd.quartz.util;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MapUtil {
+
+ public static > Map sortByValue(Map map) {
+ List> list = new ArrayList<>(map.entrySet());
+ list.sort(Map.Entry.comparingByValue());
+
+ Map result = new LinkedHashMap<>();
+
+ for (Map.Entry entry : list) {
+ result.put(entry.getKey(), entry.getValue());
+ }
+
+ return result;
+ }
+
+}
\ No newline at end of file
diff --git a/common/target/classes/com/minexd/quartz/data/QuartzData.class b/common/target/classes/com/minexd/quartz/data/QuartzData.class
new file mode 100644
index 0000000..09fc9e8
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/data/QuartzData.class differ
diff --git a/common/target/classes/com/minexd/quartz/packet/PlayerAddPacket.class b/common/target/classes/com/minexd/quartz/packet/PlayerAddPacket.class
new file mode 100644
index 0000000..ce3e9bd
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/packet/PlayerAddPacket.class differ
diff --git a/common/target/classes/com/minexd/quartz/packet/PlayerAddedPacket.class b/common/target/classes/com/minexd/quartz/packet/PlayerAddedPacket.class
new file mode 100644
index 0000000..ed7fd2d
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/packet/PlayerAddedPacket.class differ
diff --git a/common/target/classes/com/minexd/quartz/packet/PlayerRemovePacket.class b/common/target/classes/com/minexd/quartz/packet/PlayerRemovePacket.class
new file mode 100644
index 0000000..bb762f9
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/packet/PlayerRemovePacket.class differ
diff --git a/common/target/classes/com/minexd/quartz/packet/PlayerRemovedPacket.class b/common/target/classes/com/minexd/quartz/packet/PlayerRemovedPacket.class
new file mode 100644
index 0000000..477418c
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/packet/PlayerRemovedPacket.class differ
diff --git a/common/target/classes/com/minexd/quartz/packet/PlayerSendPacket.class b/common/target/classes/com/minexd/quartz/packet/PlayerSendPacket.class
new file mode 100644
index 0000000..0e9610c
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/packet/PlayerSendPacket.class differ
diff --git a/common/target/classes/com/minexd/quartz/packet/QueueListPacket.class b/common/target/classes/com/minexd/quartz/packet/QueueListPacket.class
new file mode 100644
index 0000000..d329514
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/packet/QueueListPacket.class differ
diff --git a/common/target/classes/com/minexd/quartz/packet/ServerMetadataPacket.class b/common/target/classes/com/minexd/quartz/packet/ServerMetadataPacket.class
new file mode 100644
index 0000000..744fc40
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/packet/ServerMetadataPacket.class differ
diff --git a/common/target/classes/com/minexd/quartz/packet/ServerUpdatePacket.class b/common/target/classes/com/minexd/quartz/packet/ServerUpdatePacket.class
new file mode 100644
index 0000000..76a6e75
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/packet/ServerUpdatePacket.class differ
diff --git a/common/target/classes/com/minexd/quartz/queue/Queue.class b/common/target/classes/com/minexd/quartz/queue/Queue.class
new file mode 100644
index 0000000..630ba9e
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/queue/Queue.class differ
diff --git a/common/target/classes/com/minexd/quartz/queue/QueuePlayer.class b/common/target/classes/com/minexd/quartz/queue/QueuePlayer.class
new file mode 100644
index 0000000..d5fad5d
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/queue/QueuePlayer.class differ
diff --git a/common/target/classes/com/minexd/quartz/queue/QueuePlayerComparator.class b/common/target/classes/com/minexd/quartz/queue/QueuePlayerComparator.class
new file mode 100644
index 0000000..9a89910
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/queue/QueuePlayerComparator.class differ
diff --git a/common/target/classes/com/minexd/quartz/queue/QueueRank.class b/common/target/classes/com/minexd/quartz/queue/QueueRank.class
new file mode 100644
index 0000000..ebd0fc9
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/queue/QueueRank.class differ
diff --git a/common/target/classes/com/minexd/quartz/server/Server.class b/common/target/classes/com/minexd/quartz/server/Server.class
new file mode 100644
index 0000000..473802c
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/server/Server.class differ
diff --git a/common/target/classes/com/minexd/quartz/server/ServerType.class b/common/target/classes/com/minexd/quartz/server/ServerType.class
new file mode 100644
index 0000000..fc1ea85
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/server/ServerType.class differ
diff --git a/common/target/classes/com/minexd/quartz/util/JsonChain.class b/common/target/classes/com/minexd/quartz/util/JsonChain.class
new file mode 100644
index 0000000..a78e834
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/util/JsonChain.class differ
diff --git a/common/target/classes/com/minexd/quartz/util/MapUtil.class b/common/target/classes/com/minexd/quartz/util/MapUtil.class
new file mode 100644
index 0000000..e7bd450
Binary files /dev/null and b/common/target/classes/com/minexd/quartz/util/MapUtil.class differ
diff --git a/common/target/maven-archiver/pom.properties b/common/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..f18715c
--- /dev/null
+++ b/common/target/maven-archiver/pom.properties
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Fri Nov 23 23:38:54 EST 2018
+version=1.0-SNAPSHOT
+groupId=com.minexd.quartz
+artifactId=common
diff --git a/common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..fd1811f
--- /dev/null
+++ b/common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,17 @@
+com\minexd\quartz\util\MapUtil.class
+com\minexd\quartz\packet\PlayerSendPacket.class
+com\minexd\quartz\packet\PlayerRemovePacket.class
+com\minexd\quartz\data\QuartzData.class
+com\minexd\quartz\packet\PlayerRemovedPacket.class
+com\minexd\quartz\packet\QueueListPacket.class
+com\minexd\quartz\server\ServerType.class
+com\minexd\quartz\queue\QueuePlayer.class
+com\minexd\quartz\queue\QueueRank.class
+com\minexd\quartz\packet\PlayerAddedPacket.class
+com\minexd\quartz\packet\PlayerAddPacket.class
+com\minexd\quartz\util\JsonChain.class
+com\minexd\quartz\packet\ServerMetadataPacket.class
+com\minexd\quartz\queue\QueuePlayerComparator.class
+com\minexd\quartz\packet\ServerUpdatePacket.class
+com\minexd\quartz\queue\Queue.class
+com\minexd\quartz\server\Server.class
diff --git a/common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..6921c45
--- /dev/null
+++ b/common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,17 @@
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\server\ServerType.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\packet\PlayerAddPacket.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\packet\QueueListPacket.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\server\Server.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\queue\QueuePlayer.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\util\MapUtil.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\queue\QueueRank.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\packet\PlayerAddedPacket.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\queue\Queue.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\queue\QueuePlayerComparator.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\data\QuartzData.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\packet\PlayerRemovePacket.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\util\JsonChain.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\packet\ServerMetadataPacket.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\packet\ServerUpdatePacket.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\packet\PlayerRemovedPacket.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\common\src\main\java\com\minexd\quartz\packet\PlayerSendPacket.java
diff --git a/common/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/common/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/common/target/original-quartz-common-1.0-SNAPSHOT.jar b/common/target/original-quartz-common-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..4a4b32e
Binary files /dev/null and b/common/target/original-quartz-common-1.0-SNAPSHOT.jar differ
diff --git a/common/target/quartz-common-1.0-SNAPSHOT.jar b/common/target/quartz-common-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..e092089
Binary files /dev/null and b/common/target/quartz-common-1.0-SNAPSHOT.jar differ
diff --git a/plugin/dependency-reduced-pom.xml b/plugin/dependency-reduced-pom.xml
new file mode 100644
index 0000000..3208baf
--- /dev/null
+++ b/plugin/dependency-reduced-pom.xml
@@ -0,0 +1,90 @@
+
+
+
+ quartz-parent
+ com.minexd.quartz
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ plugin
+
+
+
+ true
+ src/main/resources
+
+ plugin.yml
+
+
+
+ src/main/resources
+
+ plugin.yml
+
+
+
+
+
+ maven-compiler-plugin
+
+
+ 1.8
+ -parameters
+
+
+
+ maven-shade-plugin
+ 2.4.3
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+
+ md5-repo
+ http://repo.md-5.net/content/groups/public/
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.8.8-R0.1-SNAPSHOT
+ provided
+
+
+ commons-lang
+ commons-lang
+
+
+ json-simple
+ com.googlecode.json-simple
+
+
+ guava
+ com.google.guava
+
+
+ ebean
+ org.avaje
+
+
+ snakeyaml
+ org.yaml
+
+
+ bungeecord-chat
+ net.md-5
+
+
+
+
+
+
diff --git a/plugin/plugin.iml b/plugin/plugin.iml
new file mode 100644
index 0000000..ad3339a
--- /dev/null
+++ b/plugin/plugin.iml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin/pom.xml b/plugin/pom.xml
new file mode 100644
index 0000000..4b4df48
--- /dev/null
+++ b/plugin/pom.xml
@@ -0,0 +1,97 @@
+
+
+ 4.0.0
+
+
+ com.minexd.quartz
+ quartz-parent
+ 1.0-SNAPSHOT
+
+
+ plugin
+
+
+
+ md5-repo
+ http://repo.md-5.net/content/groups/public/
+
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.8.8-R0.1-SNAPSHOT
+ provided
+
+
+ org.projectlombok
+ lombok
+ 1.16.16
+ compile
+
+
+ com.minexd.quartz
+ common
+ 1.0-SNAPSHOT
+
+
+ com.qrakn
+ phoenix-lang
+ 1.0-SNAPSHOT
+ compile
+
+
+ com.qrakn
+ honcho
+ 1.0-SNAPSHOT
+ compile
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.8
+ -parameters
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.4.3
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+ src/main/resources
+ true
+
+ plugin.yml
+
+
+
+ src/main/resources
+ false
+
+ plugin.yml
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugin/src/main/java/com/minexd/quartz/Locale.java b/plugin/src/main/java/com/minexd/quartz/Locale.java
new file mode 100644
index 0000000..ce5c729
--- /dev/null
+++ b/plugin/src/main/java/com/minexd/quartz/Locale.java
@@ -0,0 +1,30 @@
+package com.minexd.quartz;
+
+import java.text.MessageFormat;
+import lombok.AllArgsConstructor;
+import org.bukkit.ChatColor;
+import org.bukkit.command.CommandSender;
+
+@AllArgsConstructor
+public enum Locale {
+
+ JOINED_QUEUE("QUEUE.JOINED"),
+ LEFT_QUEUE("QUEUE.LEFT"),
+ REMINDER("QUEUE.REMINDER"),
+ SENDING("QUEUE.SENDING");
+
+ private String path;
+
+ public void send(CommandSender sender, Object... objects) {
+ if (Quartz.get().getMainConfig().get(path) instanceof String) {
+ sender.sendMessage(new MessageFormat(ChatColor.translateAlternateColorCodes('&',
+ Quartz.get().getMainConfig().getString(path))).format(objects));
+ } else {
+ for (String string : Quartz.get().getMainConfig().getStringList(path)) {
+ sender.sendMessage(new MessageFormat(ChatColor.translateAlternateColorCodes('&', string))
+ .format(objects));
+ }
+ }
+ }
+
+}
diff --git a/plugin/src/main/java/com/minexd/quartz/Quartz.java b/plugin/src/main/java/com/minexd/quartz/Quartz.java
new file mode 100644
index 0000000..e75e203
--- /dev/null
+++ b/plugin/src/main/java/com/minexd/quartz/Quartz.java
@@ -0,0 +1,144 @@
+package com.minexd.quartz;
+
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.minexd.pidgin.Pidgin;
+import com.minexd.quartz.command.JoinQueueCommand;
+import com.minexd.quartz.command.LeaveQueueCommand;
+import com.minexd.quartz.command.adapter.QueueTypeAdapter;
+import com.minexd.quartz.network.NetworkListener;
+import com.minexd.quartz.packet.PlayerAddPacket;
+import com.minexd.quartz.packet.PlayerAddedPacket;
+import com.minexd.quartz.packet.PlayerRemovePacket;
+import com.minexd.quartz.packet.PlayerRemovedPacket;
+import com.minexd.quartz.packet.PlayerSendPacket;
+import com.minexd.quartz.packet.QueueListPacket;
+import com.minexd.quartz.packet.ServerMetadataPacket;
+import com.minexd.quartz.packet.ServerUpdatePacket;
+import com.minexd.quartz.queue.Queue;
+import com.minexd.quartz.util.JsonChain;
+import com.qrakn.honcho.Honcho;
+import com.qrakn.phoenix.lang.file.type.BasicConfigurationFile;
+import java.util.Arrays;
+import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
+import com.minexd.quartz.data.QuartzData;
+import com.minexd.quartz.priority.Priority;
+import com.minexd.quartz.priority.impl.DefaultPriority;
+import com.minexd.quartz.task.ReminderTask;
+import com.minexd.quartz.task.UpdateTask;
+import org.bukkit.Bukkit;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.plugin.java.JavaPlugin;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+
+public class Quartz extends JavaPlugin {
+
+ private static Quartz quartz;
+
+ @Getter private BasicConfigurationFile mainConfig;
+ @Getter private JedisPool jedisPool;
+ @Getter private Honcho honcho;
+ @Getter private Pidgin pidgin;
+ @Getter private QuartzData quartzData;
+ @Getter @Setter private Priority priority;
+
+ @Getter private String serverId;
+ @Getter private String serverName;
+ @Getter private JsonObject metadata = new JsonObject();
+
+ @Override
+ public void onEnable() {
+ quartz = this;
+
+ mainConfig = new BasicConfigurationFile(this, "config");
+
+ final String redisHost = mainConfig.getString("REDIS.HOST");
+ final int redisPort = mainConfig.getInteger("REDIS.PORT");
+ final String redisPassword;
+
+ if (mainConfig.getBoolean("REDIS.AUTHENTICATION.ENABLED")) {
+ redisPassword = mainConfig.getString("REDIS.AUTHENTICATION.PASSWORD");
+ } else {
+ redisPassword = null;
+ }
+
+ jedisPool = new JedisPool(redisHost, redisPort);
+
+ if (redisPassword != null) {
+ try (Jedis jedis = jedisPool.getResource()) {
+ jedis.auth(redisPassword);
+ }
+ }
+
+ loadQuartzData();
+
+ honcho = new Honcho(this);
+ honcho.registerCommand(new JoinQueueCommand());
+ honcho.registerCommand(new LeaveQueueCommand());
+ honcho.registerTypeAdapter(Queue.class, new QueueTypeAdapter());
+
+ pidgin = new Pidgin("quartz", redisHost, redisPort, redisPassword);
+ pidgin.registerListener(new NetworkListener());
+
+ Arrays.asList(
+ PlayerAddedPacket.class,
+ PlayerAddPacket.class,
+ PlayerRemovedPacket.class,
+ PlayerRemovePacket.class,
+ PlayerSendPacket.class,
+ QueueListPacket.class,
+ ServerMetadataPacket.class,
+ ServerUpdatePacket.class
+ ).forEach(pidgin::registerPacket);
+
+ quartzData = new QuartzData(jedisPool);
+ quartzData.loadServers();
+
+ priority = new DefaultPriority();
+
+ new ReminderTask().runTaskTimerAsynchronously(this, 0L, 20L * 10L);
+ new UpdateTask().runTaskTimerAsynchronously(this, 0L, 20L * 3L);
+
+ getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
+
+ getServer().getPluginManager().registerEvents(new Listener() {
+ @EventHandler
+ public void onPlayerQuit(PlayerQuitEvent event) {
+ Quartz.get().getPidgin().sendPacket(new PlayerRemovePacket(new JsonChain()
+ .addProperty("uuid", event.getPlayer().getUniqueId().toString())
+ .get()));
+ }
+ }, this);
+ }
+
+ private void loadQuartzData() {
+ serverId = mainConfig.getString("SETTINGS.SERVER_ID");
+ serverName = mainConfig.getString("SETTINGS.SERVER_NAME");
+
+ try (Jedis jedis = jedisPool.getResource()) {
+ String key = "quartz:server-info:" + Bukkit.getPort();
+
+ if (jedis.exists(key)) {
+ Map map = jedis.hgetAll(key);
+
+ serverId = map.get("id");
+ serverName = map.get("name");
+ metadata = new JsonParser().parse(map.get("metadata")).getAsJsonObject();
+ }
+ }
+
+ if (metadata == null || metadata.isJsonNull()) {
+ metadata = new JsonObject();
+ }
+ }
+
+ public static Quartz get() {
+ return quartz;
+ }
+
+}
diff --git a/plugin/src/main/java/com/minexd/quartz/command/JoinQueueCommand.java b/plugin/src/main/java/com/minexd/quartz/command/JoinQueueCommand.java
new file mode 100644
index 0000000..021c8e3
--- /dev/null
+++ b/plugin/src/main/java/com/minexd/quartz/command/JoinQueueCommand.java
@@ -0,0 +1,65 @@
+package com.minexd.quartz.command;
+
+import com.google.gson.JsonObject;
+import com.minexd.quartz.Quartz;
+import com.minexd.quartz.packet.PlayerAddPacket;
+import com.minexd.quartz.packet.PlayerSendPacket;
+import com.minexd.quartz.queue.Queue;
+import com.minexd.quartz.queue.QueueRank;
+import com.minexd.quartz.server.Server;
+import com.minexd.quartz.util.JsonChain;
+import com.qrakn.honcho.command.CPL;
+import com.qrakn.honcho.command.CommandMeta;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+
+@CommandMeta(label = "joinqueue", async = true)
+public class JoinQueueCommand {
+
+ public void execute(Player player, @CPL("queue") Queue queue) {
+ if (queue == null) {
+ player.sendMessage(ChatColor.RED + "A queue with that name does not exist.");
+ return;
+ }
+
+ Server server = Quartz.get().getQuartzData().getServerById(queue.getName());
+
+ if (server == null || !server.isOnline()) {
+ player.sendMessage(ChatColor.RED + "That queue is offline.");
+ return;
+ }
+
+ if (Quartz.get().getQuartzData().getQueueByPlayer(player.getUniqueId()) != null) {
+ player.sendMessage(ChatColor.RED + "You are already in a queue!");
+ return;
+ }
+
+ if (player.hasPermission("quartz.bypass")) {
+ Quartz.get().getPidgin().sendPacket(new PlayerSendPacket(new JsonChain()
+ .addProperty("server", queue.getName())
+ .addProperty("uuid", player.getUniqueId().toString())
+ .get()));
+ return;
+ }
+
+ QueueRank queueRank = Quartz.get().getPriority().getRank(player);
+
+ JsonObject rankObject = new JsonChain()
+ .addProperty("name", queueRank.getName())
+ .addProperty("priority", queueRank.getPriority())
+ .get();
+
+ JsonObject playerObject = new JsonChain()
+ .addProperty("uuid", player.getUniqueId().toString())
+ .add("rank", rankObject)
+ .get();
+
+ JsonObject data = new JsonChain()
+ .addProperty("queue", queue.getName())
+ .add("player", playerObject)
+ .get();
+
+ Quartz.get().getPidgin().sendPacket(new PlayerAddPacket(data));
+ }
+
+}
diff --git a/plugin/src/main/java/com/minexd/quartz/command/LeaveQueueCommand.java b/plugin/src/main/java/com/minexd/quartz/command/LeaveQueueCommand.java
new file mode 100644
index 0000000..4f1e012
--- /dev/null
+++ b/plugin/src/main/java/com/minexd/quartz/command/LeaveQueueCommand.java
@@ -0,0 +1,27 @@
+package com.minexd.quartz.command;
+
+import com.minexd.quartz.Quartz;
+import com.minexd.quartz.packet.PlayerRemovePacket;
+import com.minexd.quartz.queue.Queue;
+import com.minexd.quartz.util.JsonChain;
+import com.qrakn.honcho.command.CommandMeta;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+
+@CommandMeta(label = "leavequeue", async = true)
+public class LeaveQueueCommand {
+
+ public void execute(Player player) {
+ Queue queue = Quartz.get().getQuartzData().getQueueByPlayer(player.getUniqueId());
+
+ if (queue == null) {
+ player.sendMessage(ChatColor.RED + "You are not in a queue!");
+ return;
+ }
+
+ Quartz.get().getPidgin().sendPacket(new PlayerRemovePacket(new JsonChain()
+ .addProperty("uuid", player.getUniqueId().toString())
+ .get()));
+ }
+
+}
diff --git a/plugin/src/main/java/com/minexd/quartz/command/adapter/QueueTypeAdapter.java b/plugin/src/main/java/com/minexd/quartz/command/adapter/QueueTypeAdapter.java
new file mode 100644
index 0000000..ad6aae4
--- /dev/null
+++ b/plugin/src/main/java/com/minexd/quartz/command/adapter/QueueTypeAdapter.java
@@ -0,0 +1,13 @@
+package com.minexd.quartz.command.adapter;
+
+import com.minexd.quartz.Quartz;
+import com.qrakn.honcho.command.adapter.CommandTypeAdapter;
+
+public class QueueTypeAdapter implements CommandTypeAdapter {
+
+ @Override
+ public T convert(String string, Class type) {
+ return type.cast(Quartz.get().getQuartzData().getQueueByName(string));
+ }
+
+}
diff --git a/plugin/src/main/java/com/minexd/quartz/network/NetworkListener.java b/plugin/src/main/java/com/minexd/quartz/network/NetworkListener.java
new file mode 100644
index 0000000..86fc0e1
--- /dev/null
+++ b/plugin/src/main/java/com/minexd/quartz/network/NetworkListener.java
@@ -0,0 +1,134 @@
+package com.minexd.quartz.network;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.minexd.pidgin.packet.handler.IncomingPacketHandler;
+import com.minexd.pidgin.packet.listener.PacketListener;
+import com.minexd.quartz.Locale;
+import com.minexd.quartz.Quartz;
+import com.minexd.quartz.packet.PlayerAddedPacket;
+import com.minexd.quartz.packet.PlayerRemovedPacket;
+import com.minexd.quartz.packet.PlayerSendPacket;
+import com.minexd.quartz.packet.QueueListPacket;
+import com.minexd.quartz.packet.ServerMetadataPacket;
+import com.minexd.quartz.packet.ServerUpdatePacket;
+import com.minexd.quartz.queue.Queue;
+import com.minexd.quartz.queue.QueuePlayer;
+import com.minexd.quartz.queue.QueuePlayerComparator;
+import com.minexd.quartz.server.Server;
+import com.minexd.quartz.util.BungeeUtil;
+import java.util.PriorityQueue;
+import java.util.UUID;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
+public class NetworkListener implements PacketListener {
+
+ @IncomingPacketHandler
+ public void onPlayerAddedPacket(PlayerAddedPacket packet) {
+ Queue queue = Quartz.get().getQuartzData().getQueueByName(packet.getData().get("queue").getAsString());
+
+ if (queue != null) {
+ QueuePlayer queuePlayer = new QueuePlayer(packet.getData().get("player").getAsJsonObject());
+ Player player = Bukkit.getPlayer(queuePlayer.getUuid());
+
+ queue.getPlayers().add(queuePlayer);
+
+ if (player != null) {
+ Locale.JOINED_QUEUE.send(player, queue.getName());
+ }
+ }
+ }
+
+ @IncomingPacketHandler
+ public void onPlayerRemovedPacket(PlayerRemovedPacket packet) {
+ Queue queue = Quartz.get().getQuartzData().getQueueByName(packet.getData().get("queue").getAsString());
+
+ if (queue != null) {
+ QueuePlayer queuePlayer = new QueuePlayer(packet.getData().get("player").getAsJsonObject());
+ Player player = Bukkit.getPlayer(queuePlayer.getUuid());
+
+ queue.getPlayers().removeIf(check -> check.getUuid().equals(player.getUniqueId()));
+
+ if (player != null) {
+ Locale.LEFT_QUEUE.send(player, queue.getName());
+ }
+ }
+ }
+
+ @IncomingPacketHandler
+ public void onPlayerSendPacket(PlayerSendPacket packet) {
+ Player player = Bukkit.getPlayer(UUID.fromString(packet.getData().get("uuid").getAsString()));
+
+ if (player != null) {
+ final String server = packet.getData().get("server").getAsString();
+
+ Locale.SENDING.send(player, packet.getData().get("server").getAsString());
+ BungeeUtil.sendToServer(player, server);
+ }
+ }
+
+ @IncomingPacketHandler
+ public void onQueueListPacket(QueueListPacket packet) {
+ if (!Quartz.get().getMainConfig().getBoolean("SETTINGS.CACHE_SERVERS")) {
+ return;
+ }
+
+ JsonArray array = packet.getData();
+
+ for (JsonElement queueElement : array) {
+ JsonObject queueObject = queueElement.getAsJsonObject();
+ final String queueName = queueObject.get("id").getAsString();
+
+ Queue queue = Quartz.get().getQuartzData().getQueueByName(queueName);
+
+ if (queue == null) {
+ queue = new Queue(queueName);
+ Quartz.get().getQuartzData().getQueues().add(queue);
+ }
+
+ PriorityQueue players = new PriorityQueue<>(new QueuePlayerComparator());
+
+ for (JsonElement playerElement : queueObject.get("players").getAsJsonArray()) {
+ QueuePlayer player = new QueuePlayer(playerElement.getAsJsonObject());
+ players.add(player);
+ }
+
+ queue.setPlayers(players);
+ queue.setEnabled(queueObject.get("status").getAsBoolean());
+ }
+ }
+
+ @IncomingPacketHandler
+ public void onServerMetadata(ServerMetadataPacket packet) {
+ Server server = Quartz.get().getQuartzData().getServerById(packet.getData().get("id").getAsString());
+
+ if (server != null) {
+ server.getMetadata().add(packet.getData().get("field").getAsString(), packet.getData().get("value"));
+ }
+ }
+
+ @IncomingPacketHandler
+ public void onServerUpdate(ServerUpdatePacket packet) {
+ String serverId = packet.getData().get("id").getAsString();
+
+ if (Quartz.get().getMainConfig().getBoolean("SETTINGS.CACHE_SERVERS")) {
+ Server server = Quartz.get().getQuartzData().getServerById(serverId);
+
+ if (server == null) {
+ server = new Server(serverId);
+ Quartz.get().getQuartzData().getServers().add(server);
+ }
+
+ server.setName(packet.getData().get("name").getAsString());
+ server.setOnlinePlayers(packet.getData().get("online-players").getAsInt());
+ server.setMaximumPlayers(packet.getData().get("maximum-players").getAsInt());
+ server.setWhitelisted(packet.getData().get("whitelisted").getAsBoolean());
+ server.setPort(packet.getData().get("port").getAsInt());
+ server.setMetadata(packet.getData().get("metadata").getAsJsonObject());
+ server.setLastUpdate(System.currentTimeMillis());
+ }
+ }
+
+}
diff --git a/plugin/src/main/java/com/minexd/quartz/priority/Priority.java b/plugin/src/main/java/com/minexd/quartz/priority/Priority.java
new file mode 100644
index 0000000..a6bc3bd
--- /dev/null
+++ b/plugin/src/main/java/com/minexd/quartz/priority/Priority.java
@@ -0,0 +1,10 @@
+package com.minexd.quartz.priority;
+
+import com.minexd.quartz.queue.QueueRank;
+import org.bukkit.entity.Player;
+
+public interface Priority {
+
+ QueueRank getRank(Player player);
+
+}
diff --git a/plugin/src/main/java/com/minexd/quartz/priority/impl/DefaultPriority.java b/plugin/src/main/java/com/minexd/quartz/priority/impl/DefaultPriority.java
new file mode 100644
index 0000000..f395627
--- /dev/null
+++ b/plugin/src/main/java/com/minexd/quartz/priority/impl/DefaultPriority.java
@@ -0,0 +1,56 @@
+package com.minexd.quartz.priority.impl;
+
+import com.minexd.quartz.Quartz;
+import com.minexd.quartz.queue.QueueRank;
+import com.minexd.quartz.util.MapUtil;
+import com.minexd.quartz.priority.Priority;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class DefaultPriority implements Priority {
+
+ private QueueRank defaultPriority;
+ private Map priorities = new HashMap<>();
+
+ public DefaultPriority() {
+ FileConfiguration config = Quartz.get().getMainConfig().getConfiguration();
+
+ try {
+ this.defaultPriority = new QueueRank("Default", 1);
+
+ if (config.contains("priority.default")) {
+ this.defaultPriority.setPriority(config.getInt("priority.default"));
+ }
+
+ if (config.contains("priority.ranks") && config.isConfigurationSection("priority.ranks")) {
+ for (String rank : config.getConfigurationSection("priority.ranks").getKeys(false)) {
+ String path = "priority.ranks." + rank;
+
+ if (config.contains(path + ".priority") && config.contains(path + ".permission")) {
+ this.priorities.put(config.getString(path + ".permission"), new QueueRank(rank, config.getInt
+ (path + ".priority")));
+ }
+ }
+ }
+
+ this.priorities = MapUtil.sortByValue(this.priorities);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public QueueRank getRank(Player player) {
+ for (Map.Entry entry : this.priorities.entrySet()) {
+ if (player.hasPermission(entry.getKey())) {
+ return entry.getValue();
+ }
+ }
+
+ return this.defaultPriority;
+ }
+
+}
diff --git a/plugin/src/main/java/com/minexd/quartz/task/ReminderTask.java b/plugin/src/main/java/com/minexd/quartz/task/ReminderTask.java
new file mode 100644
index 0000000..3a263ed
--- /dev/null
+++ b/plugin/src/main/java/com/minexd/quartz/task/ReminderTask.java
@@ -0,0 +1,23 @@
+package com.minexd.quartz.task;
+
+import com.minexd.quartz.Locale;
+import com.minexd.quartz.Quartz;
+import com.minexd.quartz.queue.Queue;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.scheduler.BukkitRunnable;
+
+public class ReminderTask extends BukkitRunnable {
+
+ @Override
+ public void run() {
+ for (Player player : Bukkit.getOnlinePlayers()) {
+ Queue queue = Quartz.get().getQuartzData().getQueueByPlayer(player.getUniqueId());
+
+ if (queue != null) {
+ Locale.SENDING.send(player, queue.getName());
+ }
+ }
+ }
+
+}
diff --git a/plugin/src/main/java/com/minexd/quartz/task/UpdateTask.java b/plugin/src/main/java/com/minexd/quartz/task/UpdateTask.java
new file mode 100644
index 0000000..71a0798
--- /dev/null
+++ b/plugin/src/main/java/com/minexd/quartz/task/UpdateTask.java
@@ -0,0 +1,53 @@
+package com.minexd.quartz.task;
+
+import com.google.gson.JsonObject;
+import com.minexd.quartz.Quartz;
+import com.minexd.quartz.packet.ServerUpdatePacket;
+import com.minexd.quartz.util.JsonChain;
+import org.bukkit.Bukkit;
+import org.bukkit.scheduler.BukkitRunnable;
+import redis.clients.jedis.Jedis;
+
+public class UpdateTask extends BukkitRunnable {
+
+ private Quartz quartz = Quartz.get();
+
+ @Override
+ public void run() {
+ // Update server info in redis
+ {
+ try (Jedis jedis = Quartz.get().getJedisPool().getResource()) {
+ final String infoKey = "quartz:server-info:" + Bukkit.getPort();
+
+ jedis.hset(infoKey, "id", quartz.getServerId());
+ jedis.hset(infoKey, "name", quartz.getServerName());
+ jedis.hset(infoKey, "port", "" + Bukkit.getPort());
+ jedis.hset(infoKey, "online-players", Bukkit.getOnlinePlayers().size() + "");
+ jedis.hset(infoKey, "maximum-players", Bukkit.getMaxPlayers() + "");
+ jedis.hset(infoKey, "whitelisted", Bukkit.hasWhitelist() + "");
+ jedis.hset(infoKey, "metadata", quartz.getMetadata().toString());
+ jedis.hset(infoKey, "last-update", System.currentTimeMillis() + "");
+
+ // Update server lookup data
+ jedis.hset("quartz:lookup:port", "" + Bukkit.getPort(), quartz.getServerId());
+ jedis.hset("quartz:lookup:id", quartz.getServerId(), Bukkit.getPort() + "");
+ }
+ }
+
+ // Broadcast server info to other Quartz instances
+ {
+ JsonObject data = new JsonChain()
+ .addProperty("id", quartz.getServerId())
+ .addProperty("name", quartz.getServerName())
+ .addProperty("online-players", Bukkit.getOnlinePlayers().size())
+ .addProperty("maximum-players", Bukkit.getMaxPlayers())
+ .addProperty("whitelisted", Bukkit.hasWhitelist())
+ .addProperty("port", Bukkit.getPort())
+ .add("metadata", quartz.getMetadata())
+ .get();
+
+ Quartz.get().getPidgin().sendPacket(new ServerUpdatePacket(data));
+ }
+ }
+
+}
diff --git a/plugin/src/main/java/com/minexd/quartz/util/BungeeUtil.java b/plugin/src/main/java/com/minexd/quartz/util/BungeeUtil.java
new file mode 100644
index 0000000..a1fa8f3
--- /dev/null
+++ b/plugin/src/main/java/com/minexd/quartz/util/BungeeUtil.java
@@ -0,0 +1,26 @@
+package com.minexd.quartz.util;
+
+import com.google.common.io.ByteArrayDataOutput;
+import com.google.common.io.ByteStreams;
+import com.minexd.quartz.Quartz;
+import org.bukkit.entity.Player;
+
+public final class BungeeUtil {
+
+ private BungeeUtil() {
+ throw new RuntimeException("Cannot instantiate a utility class.");
+ }
+
+ public static void sendToServer(Player player, String server) {
+ try {
+ ByteArrayDataOutput out = ByteStreams.newDataOutput();
+ out.writeUTF("Connect");
+ out.writeUTF(server);
+
+ player.sendPluginMessage(Quartz.get(), "BungeeCord", out.toByteArray());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/plugin/src/main/resources/config.yml b/plugin/src/main/resources/config.yml
new file mode 100644
index 0000000..d88428e
--- /dev/null
+++ b/plugin/src/main/resources/config.yml
@@ -0,0 +1,29 @@
+REDIS:
+ HOST: "127.0.0.1"
+ PORT: 6379
+ AUTHENTICATION:
+ ENABLED: false
+ PASSWORD: ""
+SETTINGS:
+ SERVER_ID: "hub-1" # The server's unique ID
+ SERVER_NAME: "Hub" # The server's display name (not network name)
+ CACHE_SERVERS: true
+PRIORITY:
+ DEFAULT: 1
+ RANKS:
+ Default:
+ PRIORITY: 1
+ PERMISSION: "ranks.default"
+ VIP:
+ PRIORITY: 2
+ PERMISSION: "ranks.vip"
+ MVP:
+ PRIORITY: 3
+ PERMISSION: "ranks.mvp"
+QUEUE:
+ JOINED: "&aYou have joined the {0} queue."
+ LEFT: "&cYou have been removed from the {0} queue."
+ REMINDER:
+ - "&eYou are position &d#{0} &eof &d{1} &ein the &a{2} &equeue."
+ - "&7Purchase a rank at www.minexd.com to get a higher queue priority."
+ SENDING: "&aSending you to {0}..."
\ No newline at end of file
diff --git a/plugin/src/main/resources/plugin.yml b/plugin/src/main/resources/plugin.yml
new file mode 100644
index 0000000..c9a4355
--- /dev/null
+++ b/plugin/src/main/resources/plugin.yml
@@ -0,0 +1,6 @@
+main: com.minexd.quartz.Quartz
+name: Quartz
+author: joeleoli
+version: ${project.version}
+description: ${project.description}
+depend: [ProtocolLib]
\ No newline at end of file
diff --git a/plugin/target/classes/com/minexd/quartz/Locale.class b/plugin/target/classes/com/minexd/quartz/Locale.class
new file mode 100644
index 0000000..c40720d
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/Locale.class differ
diff --git a/plugin/target/classes/com/minexd/quartz/Quartz$1.class b/plugin/target/classes/com/minexd/quartz/Quartz$1.class
new file mode 100644
index 0000000..8e26332
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/Quartz$1.class differ
diff --git a/plugin/target/classes/com/minexd/quartz/Quartz.class b/plugin/target/classes/com/minexd/quartz/Quartz.class
new file mode 100644
index 0000000..9eba302
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/Quartz.class differ
diff --git a/plugin/target/classes/com/minexd/quartz/command/JoinQueueCommand.class b/plugin/target/classes/com/minexd/quartz/command/JoinQueueCommand.class
new file mode 100644
index 0000000..e9cb654
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/command/JoinQueueCommand.class differ
diff --git a/plugin/target/classes/com/minexd/quartz/command/LeaveQueueCommand.class b/plugin/target/classes/com/minexd/quartz/command/LeaveQueueCommand.class
new file mode 100644
index 0000000..479f1c9
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/command/LeaveQueueCommand.class differ
diff --git a/plugin/target/classes/com/minexd/quartz/command/adapter/QueueTypeAdapter.class b/plugin/target/classes/com/minexd/quartz/command/adapter/QueueTypeAdapter.class
new file mode 100644
index 0000000..96d33b7
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/command/adapter/QueueTypeAdapter.class differ
diff --git a/plugin/target/classes/com/minexd/quartz/network/NetworkListener.class b/plugin/target/classes/com/minexd/quartz/network/NetworkListener.class
new file mode 100644
index 0000000..5d3f7e9
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/network/NetworkListener.class differ
diff --git a/plugin/target/classes/com/minexd/quartz/priority/Priority.class b/plugin/target/classes/com/minexd/quartz/priority/Priority.class
new file mode 100644
index 0000000..c5b35ec
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/priority/Priority.class differ
diff --git a/plugin/target/classes/com/minexd/quartz/priority/impl/DefaultPriority.class b/plugin/target/classes/com/minexd/quartz/priority/impl/DefaultPriority.class
new file mode 100644
index 0000000..cc6ba85
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/priority/impl/DefaultPriority.class differ
diff --git a/plugin/target/classes/com/minexd/quartz/task/ReminderTask.class b/plugin/target/classes/com/minexd/quartz/task/ReminderTask.class
new file mode 100644
index 0000000..706521f
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/task/ReminderTask.class differ
diff --git a/plugin/target/classes/com/minexd/quartz/task/UpdateTask.class b/plugin/target/classes/com/minexd/quartz/task/UpdateTask.class
new file mode 100644
index 0000000..2b1323e
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/task/UpdateTask.class differ
diff --git a/plugin/target/classes/com/minexd/quartz/util/BungeeUtil.class b/plugin/target/classes/com/minexd/quartz/util/BungeeUtil.class
new file mode 100644
index 0000000..6b66554
Binary files /dev/null and b/plugin/target/classes/com/minexd/quartz/util/BungeeUtil.class differ
diff --git a/plugin/target/classes/config.yml b/plugin/target/classes/config.yml
new file mode 100644
index 0000000..d88428e
--- /dev/null
+++ b/plugin/target/classes/config.yml
@@ -0,0 +1,29 @@
+REDIS:
+ HOST: "127.0.0.1"
+ PORT: 6379
+ AUTHENTICATION:
+ ENABLED: false
+ PASSWORD: ""
+SETTINGS:
+ SERVER_ID: "hub-1" # The server's unique ID
+ SERVER_NAME: "Hub" # The server's display name (not network name)
+ CACHE_SERVERS: true
+PRIORITY:
+ DEFAULT: 1
+ RANKS:
+ Default:
+ PRIORITY: 1
+ PERMISSION: "ranks.default"
+ VIP:
+ PRIORITY: 2
+ PERMISSION: "ranks.vip"
+ MVP:
+ PRIORITY: 3
+ PERMISSION: "ranks.mvp"
+QUEUE:
+ JOINED: "&aYou have joined the {0} queue."
+ LEFT: "&cYou have been removed from the {0} queue."
+ REMINDER:
+ - "&eYou are position &d#{0} &eof &d{1} &ein the &a{2} &equeue."
+ - "&7Purchase a rank at www.minexd.com to get a higher queue priority."
+ SENDING: "&aSending you to {0}..."
\ No newline at end of file
diff --git a/plugin/target/classes/plugin.yml b/plugin/target/classes/plugin.yml
new file mode 100644
index 0000000..2373045
--- /dev/null
+++ b/plugin/target/classes/plugin.yml
@@ -0,0 +1,6 @@
+main: com.minexd.quartz.Quartz
+name: Quartz
+author: joeleoli
+version: 1.0-SNAPSHOT
+description: ${project.description}
+depend: [ProtocolLib]
\ No newline at end of file
diff --git a/plugin/target/maven-archiver/pom.properties b/plugin/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..e34237b
--- /dev/null
+++ b/plugin/target/maven-archiver/pom.properties
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Fri Nov 23 23:38:57 EST 2018
+version=1.0-SNAPSHOT
+groupId=com.minexd.quartz
+artifactId=plugin
diff --git a/plugin/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/plugin/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..9e60b26
--- /dev/null
+++ b/plugin/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,12 @@
+com\minexd\quartz\network\NetworkListener.class
+com\minexd\quartz\task\UpdateTask.class
+com\minexd\quartz\priority\Priority.class
+com\minexd\quartz\util\BungeeUtil.class
+com\minexd\quartz\Quartz.class
+com\minexd\quartz\task\ReminderTask.class
+com\minexd\quartz\Quartz$1.class
+com\minexd\quartz\command\LeaveQueueCommand.class
+com\minexd\quartz\command\JoinQueueCommand.class
+com\minexd\quartz\priority\impl\DefaultPriority.class
+com\minexd\quartz\Locale.class
+com\minexd\quartz\command\adapter\QueueTypeAdapter.class
diff --git a/plugin/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/plugin/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..16c6383
--- /dev/null
+++ b/plugin/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,11 @@
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\plugin\src\main\java\com\minexd\quartz\task\UpdateTask.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\plugin\src\main\java\com\minexd\quartz\command\adapter\QueueTypeAdapter.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\plugin\src\main\java\com\minexd\quartz\network\NetworkListener.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\plugin\src\main\java\com\minexd\quartz\command\JoinQueueCommand.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\plugin\src\main\java\com\minexd\quartz\task\ReminderTask.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\plugin\src\main\java\com\minexd\quartz\command\LeaveQueueCommand.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\plugin\src\main\java\com\minexd\quartz\Locale.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\plugin\src\main\java\com\minexd\quartz\priority\impl\DefaultPriority.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\plugin\src\main\java\com\minexd\quartz\util\BungeeUtil.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\plugin\src\main\java\com\minexd\quartz\priority\Priority.java
+C:\Users\skruf\Documents\Projects\MineXD\quartz-parent\plugin\src\main\java\com\minexd\quartz\Quartz.java
diff --git a/plugin/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/plugin/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/plugin/target/original-quartz-plugin-1.0-SNAPSHOT.jar b/plugin/target/original-quartz-plugin-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..e3b235a
Binary files /dev/null and b/plugin/target/original-quartz-plugin-1.0-SNAPSHOT.jar differ
diff --git a/plugin/target/quartz-plugin-1.0-SNAPSHOT.jar b/plugin/target/quartz-plugin-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..7446625
Binary files /dev/null and b/plugin/target/quartz-plugin-1.0-SNAPSHOT.jar differ
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..1db4fdd
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,22 @@
+
+
+ 4.0.0
+
+ com.minexd.quartz
+ quartz-parent
+ pom
+ 1.0-SNAPSHOT
+
+ plugin
+ application
+ common
+
+
+
+ quartz-${project.name}-${project.version}
+
+
+
+
\ No newline at end of file
diff --git a/quartz-parent.iml b/quartz-parent.iml
new file mode 100644
index 0000000..8d8ffd9
--- /dev/null
+++ b/quartz-parent.iml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file