diff --git a/Plugins/Mineplex.ClansGenerator/src/mineplex/clansgenerator/ClansGenerator.java b/Plugins/Mineplex.ClansGenerator/src/mineplex/clansgenerator/ClansGenerator.java
index fbab3adc7..2238167d5 100644
--- a/Plugins/Mineplex.ClansGenerator/src/mineplex/clansgenerator/ClansGenerator.java
+++ b/Plugins/Mineplex.ClansGenerator/src/mineplex/clansgenerator/ClansGenerator.java
@@ -99,6 +99,7 @@ public class ClansGenerator extends JavaPlugin implements Runnable, Listener
getServer().getPluginManager().registerEvents(this, this);
}
+ @SuppressWarnings("deprecation")
@EventHandler
public void onPopulate(ChunkPopulateEvent event)
{
@@ -117,6 +118,27 @@ public class ClansGenerator extends JavaPlugin implements Runnable, Listener
{
getLogger().info("Removing dungeon pieces");
}
+ continue;
+ }
+ if (block.getType() == Material.LAVA)
+ {
+ byte data = block.getData();
+ block.setTypeIdAndData(Material.WATER.getId(), data, false);
+ if (_debug)
+ {
+ getLogger().info("Removing lava");
+ }
+ continue;
+ }
+ if (block.getType() == Material.STATIONARY_LAVA)
+ {
+ byte data = block.getData();
+ block.setTypeIdAndData(Material.STATIONARY_WATER.getId(), data, false);
+ if (_debug)
+ {
+ getLogger().info("Removing lava");
+ }
+ continue;
}
}
}
diff --git a/Plugins/Mineplex.ClansQueue.Common/pom.xml b/Plugins/Mineplex.ClansQueue.Common/pom.xml
new file mode 100644
index 000000000..d468c56ca
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/pom.xml
@@ -0,0 +1,23 @@
+
+
+ 4.0.0
+
+
+ com.mineplex
+ mineplex-parent
+ dev-SNAPSHOT
+ ../plugin.xml
+
+
+ ClansQueue-Common
+ mineplex-clansqueue-common
+
+
+
+ ${project.groupId}
+ mineplex-serverdata
+ ${project.version}
+
+
+
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/ClansQueueMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/ClansQueueMessage.java
new file mode 100644
index 000000000..2bb7211c3
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/ClansQueueMessage.java
@@ -0,0 +1,8 @@
+package com.mineplex.clansqueue.common;
+
+public class ClansQueueMessage
+{
+ protected String Origin;
+ protected String BodyClass;
+ protected String BodySerialized;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/ClansQueueMessageBody.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/ClansQueueMessageBody.java
new file mode 100644
index 000000000..9a81b2c75
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/ClansQueueMessageBody.java
@@ -0,0 +1,13 @@
+package com.mineplex.clansqueue.common;
+
+import mineplex.serverdata.Utility;
+
+public abstract class ClansQueueMessageBody
+{
+ @Override
+ public final String toString()
+ {
+ super.toString();
+ return Utility.serialize(this);
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/ClansQueueMessenger.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/ClansQueueMessenger.java
new file mode 100644
index 000000000..1de841e9f
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/ClansQueueMessenger.java
@@ -0,0 +1,115 @@
+package com.mineplex.clansqueue.common;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.BiConsumer;
+
+import mineplex.serverdata.Utility;
+import mineplex.serverdata.servers.ServerManager;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+import redis.clients.jedis.JedisPubSub;
+
+public class ClansQueueMessenger
+{
+ private static final String CHANNEL_NAME_BASE = "ClansQueueMessageChannel:";
+
+ private static final Map _messengers = new ConcurrentHashMap<>();
+
+ private final String _identifier;
+ private final JedisPool _readPool;
+ private final JedisPool _writePool;
+ @SuppressWarnings("rawtypes")
+ private final Map _bodyTypes = Collections.synchronizedMap(new HashMap<>());
+ @SuppressWarnings("rawtypes")
+ private final Map> _listeners = Collections.synchronizedMap(new HashMap<>());
+
+ private ClansQueueMessenger(String identifier)
+ {
+ _identifier = identifier;
+
+ _writePool = Utility.generatePool(ServerManager.getMasterConnection());
+ _readPool = Utility.generatePool(ServerManager.getSlaveConnection());
+
+ initialize();
+ }
+
+ private void initialize()
+ {
+ new Thread("Clans Queue Messenger: " + _identifier)
+ {
+ public void run()
+ {
+ try (Jedis jedis = _readPool.getResource())
+ {
+ jedis.subscribe(new ClansQueueMessageListener(ClansQueueMessenger.this), CHANNEL_NAME_BASE + "ALL", CHANNEL_NAME_BASE + _identifier);
+ }
+ }
+ }.start();
+ }
+
+ public void registerListener(Class messageType, BiConsumer callback)
+ {
+ _bodyTypes.putIfAbsent(messageType.getName(), messageType);
+ _listeners.computeIfAbsent(messageType.getName(), (type) -> new ArrayList<>()).add(callback);
+ }
+
+ public void transmitMessage(ClansQueueMessageBody message)
+ {
+ transmitMessage(message, "ALL");
+ }
+
+ public void transmitMessage(ClansQueueMessageBody message, String target)
+ {
+ ClansQueueMessage msg = new ClansQueueMessage();
+ msg.Origin = _identifier;
+ msg.BodyClass = message.getClass().getName();
+ msg.BodySerialized = message.toString();
+
+ final String toSend = Utility.serialize(msg);
+
+ new Thread(() ->
+ {
+ try (Jedis jedis = _writePool.getResource())
+ {
+ jedis.publish(CHANNEL_NAME_BASE + target, toSend);
+ }
+ }).start();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void receiveMessage(ClansQueueMessage message)
+ {
+ if (_listeners.containsKey(message.BodyClass) && _bodyTypes.containsKey(message.BodyClass))
+ {
+ T body = Utility.deserialize(message.BodySerialized, (Class)_bodyTypes.get(message.BodyClass));
+ _listeners.get(message.BodyClass).forEach(listener -> listener.accept(body, message.Origin));
+ }
+ }
+
+ private static class ClansQueueMessageListener extends JedisPubSub
+ {
+ private final ClansQueueMessenger _manager;
+
+ private ClansQueueMessageListener(ClansQueueMessenger manager)
+ {
+ _manager = manager;
+ }
+
+ @Override
+ public void onMessage(String channelName, String message)
+ {
+ ClansQueueMessage msg = Utility.deserialize(message, ClansQueueMessage.class);
+ _manager.receiveMessage(msg);
+ }
+ }
+
+ public static ClansQueueMessenger getMessenger(String identifier)
+ {
+ return _messengers.computeIfAbsent(identifier, (id) -> new ClansQueueMessenger(id));
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/QueueConstant.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/QueueConstant.java
new file mode 100644
index 000000000..241f40ea0
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/QueueConstant.java
@@ -0,0 +1,8 @@
+package com.mineplex.clansqueue.common;
+
+public class QueueConstant
+{
+ public static final String SERVICE_MESSENGER_IDENTIFIER = "Queue System";
+ public static final int BYPASS_QUEUE_WEIGHT = -1;
+ public static final int MAX_TRANSFERS_PER_UPDATE = 5;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/SortableLinkedList.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/SortableLinkedList.java
new file mode 100644
index 000000000..1cffc506a
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/SortableLinkedList.java
@@ -0,0 +1,13 @@
+package com.mineplex.clansqueue.common;
+
+import java.util.LinkedList;
+
+public class SortableLinkedList> extends LinkedList
+{
+ private static final long serialVersionUID = -1751886037436467545L;
+
+ public void sort()
+ {
+ sort((t1, t2) -> t1.compareTo(t2));
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/ClansServerStatusMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/ClansServerStatusMessage.java
new file mode 100644
index 000000000..f8e0d7119
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/ClansServerStatusMessage.java
@@ -0,0 +1,10 @@
+package com.mineplex.clansqueue.common.messages;
+
+import com.mineplex.clansqueue.common.ClansQueueMessageBody;
+
+public class ClansServerStatusMessage extends ClansQueueMessageBody
+{
+ public String ServerName;
+ public int OpenSlots;
+ public boolean Online;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerJoinQueueCallbackMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerJoinQueueCallbackMessage.java
new file mode 100644
index 000000000..73fa93238
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerJoinQueueCallbackMessage.java
@@ -0,0 +1,12 @@
+package com.mineplex.clansqueue.common.messages;
+
+import java.util.UUID;
+
+import com.mineplex.clansqueue.common.ClansQueueMessageBody;
+
+public class PlayerJoinQueueCallbackMessage extends ClansQueueMessageBody
+{
+ public UUID PlayerUUID;
+ public String TargetServer;
+ public int Position;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerJoinQueueMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerJoinQueueMessage.java
new file mode 100644
index 000000000..c31946294
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerJoinQueueMessage.java
@@ -0,0 +1,12 @@
+package com.mineplex.clansqueue.common.messages;
+
+import java.util.UUID;
+
+import com.mineplex.clansqueue.common.ClansQueueMessageBody;
+
+public class PlayerJoinQueueMessage extends ClansQueueMessageBody
+{
+ public UUID PlayerUUID;
+ public String TargetServer;
+ public int PlayerPriority;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerLeaveQueueMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerLeaveQueueMessage.java
new file mode 100644
index 000000000..dc177c457
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerLeaveQueueMessage.java
@@ -0,0 +1,11 @@
+package com.mineplex.clansqueue.common.messages;
+
+import java.util.UUID;
+
+import com.mineplex.clansqueue.common.ClansQueueMessageBody;
+
+public class PlayerLeaveQueueMessage extends ClansQueueMessageBody
+{
+ public UUID PlayerUUID;
+ public String TargetServer;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerSendToServerMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerSendToServerMessage.java
new file mode 100644
index 000000000..b1fe5fff0
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/PlayerSendToServerMessage.java
@@ -0,0 +1,11 @@
+package com.mineplex.clansqueue.common.messages;
+
+import java.util.UUID;
+
+import com.mineplex.clansqueue.common.ClansQueueMessageBody;
+
+public class PlayerSendToServerMessage extends ClansQueueMessageBody
+{
+ public UUID PlayerUUID;
+ public String TargetServer;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueueDeleteMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueueDeleteMessage.java
new file mode 100644
index 000000000..d8594724b
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueueDeleteMessage.java
@@ -0,0 +1,8 @@
+package com.mineplex.clansqueue.common.messages;
+
+import com.mineplex.clansqueue.common.ClansQueueMessageBody;
+
+public class QueueDeleteMessage extends ClansQueueMessageBody
+{
+ public String ServerName;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueuePauseBroadcastMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueuePauseBroadcastMessage.java
new file mode 100644
index 000000000..b871ee252
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueuePauseBroadcastMessage.java
@@ -0,0 +1,9 @@
+package com.mineplex.clansqueue.common.messages;
+
+import com.mineplex.clansqueue.common.ClansQueueMessageBody;
+
+public class QueuePauseBroadcastMessage extends ClansQueueMessageBody
+{
+ public String ServerName;
+ public boolean Paused;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueuePauseUpdateMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueuePauseUpdateMessage.java
new file mode 100644
index 000000000..c17064447
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueuePauseUpdateMessage.java
@@ -0,0 +1,9 @@
+package com.mineplex.clansqueue.common.messages;
+
+import com.mineplex.clansqueue.common.ClansQueueMessageBody;
+
+public class QueuePauseUpdateMessage extends ClansQueueMessageBody
+{
+ public String ServerName;
+ public boolean Paused;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueueStatusMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueueStatusMessage.java
new file mode 100644
index 000000000..135acb4cc
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/QueueStatusMessage.java
@@ -0,0 +1,20 @@
+package com.mineplex.clansqueue.common.messages;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import com.mineplex.clansqueue.common.ClansQueueMessageBody;
+
+public class QueueStatusMessage extends ClansQueueMessageBody
+{
+ public final List Snapshots = new ArrayList<>();
+
+ public static class QueueSnapshot
+ {
+ public String ServerName;
+ public Map Queue;
+ public boolean Paused;
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/ServerOfflineMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/ServerOfflineMessage.java
new file mode 100644
index 000000000..51761ccb9
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/ServerOfflineMessage.java
@@ -0,0 +1,8 @@
+package com.mineplex.clansqueue.common.messages;
+
+import com.mineplex.clansqueue.common.ClansQueueMessageBody;
+
+public class ServerOfflineMessage extends ClansQueueMessageBody
+{
+ public String ServerName;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/ServerOnlineMessage.java b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/ServerOnlineMessage.java
new file mode 100644
index 000000000..0d95cc1aa
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue.Common/src/com/mineplex/clansqueue/common/messages/ServerOnlineMessage.java
@@ -0,0 +1,8 @@
+package com.mineplex.clansqueue.common.messages;
+
+import com.mineplex.clansqueue.common.ClansQueueMessageBody;
+
+public class ServerOnlineMessage extends ClansQueueMessageBody
+{
+ public String ServerName;
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/pom.xml b/Plugins/Mineplex.ClansQueue/pom.xml
new file mode 100644
index 000000000..a202846c3
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/pom.xml
@@ -0,0 +1,48 @@
+
+
+ 4.0.0
+
+
+ com.mineplex
+ mineplex-plugin
+ dev-SNAPSHOT
+ ../plugin.xml
+
+
+ ClansQueue
+ mineplex-clansqueue
+
+
+
+ ${project.groupId}
+ mineplex-clansqueue-common
+ ${project.version}
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+
+ false
+
+
+ com.mineplex.clansqueue.service.QueueService
+
+
+
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/QueueService.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/QueueService.java
new file mode 100644
index 000000000..aea90d00d
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/QueueService.java
@@ -0,0 +1,95 @@
+package com.mineplex.clansqueue.service;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import com.mineplex.clansqueue.common.ClansQueueMessenger;
+import com.mineplex.clansqueue.common.QueueConstant;
+import com.mineplex.clansqueue.common.messages.ClansServerStatusMessage;
+import com.mineplex.clansqueue.common.messages.PlayerJoinQueueMessage;
+import com.mineplex.clansqueue.common.messages.PlayerLeaveQueueMessage;
+import com.mineplex.clansqueue.common.messages.QueuePauseUpdateMessage;
+import com.mineplex.clansqueue.common.messages.ServerOfflineMessage;
+import com.mineplex.clansqueue.common.messages.ServerOnlineMessage;
+import com.mineplex.clansqueue.service.commands.CommandSystem;
+import com.mineplex.clansqueue.service.commands.ConsoleCommand;
+import com.mineplex.clansqueue.service.queue.ClansQueueManager;
+
+import mineplex.serverdata.Region;
+
+public class QueueService
+{
+ public static void main(String[] args)
+ {
+ QueueService service = new QueueService(new File("eu.dat").exists());
+ service.start();
+ while (service.isRunning()) {}
+ System.exit(0);
+ }
+
+ private final Region _region;
+ private final AtomicBoolean _running;
+ private final Map _commandMap = Collections.synchronizedMap(new HashMap<>());
+ private final CommandSystem _commandSystem;
+ private final ClansQueueManager _queueManager;
+
+ private QueueService(boolean eu)
+ {
+ if (eu)
+ {
+ _region = Region.EU;
+ }
+ else
+ {
+ _region = Region.US;
+ }
+ _running = new AtomicBoolean();
+ _commandSystem = new CommandSystem(this, _commandMap);
+ _queueManager = new ClansQueueManager(this);
+ }
+
+ private void start()
+ {
+ System.out.println("[Queue Service] Enabling on region " + getRegion().name());
+ _running.set(true);
+ _commandSystem.start();
+ _queueManager.start();
+
+ ClansQueueMessenger messenger = ClansQueueMessenger.getMessenger(QueueConstant.SERVICE_MESSENGER_IDENTIFIER);
+ messenger.registerListener(ServerOnlineMessage.class, (online, origin) -> _queueManager.handleServerEnable(online.ServerName));
+ messenger.registerListener(ServerOfflineMessage.class, (offline, origin) -> _queueManager.handleServerDisable(offline.ServerName));
+ messenger.registerListener(QueuePauseUpdateMessage.class, (pause, origin) -> _queueManager.handleQueuePause(pause.ServerName, pause.Paused));
+ messenger.registerListener(PlayerJoinQueueMessage.class, (join, origin) -> _queueManager.joinQueue(join.TargetServer, origin, join.PlayerUUID, join.PlayerPriority));
+ messenger.registerListener(PlayerLeaveQueueMessage.class, (leave, origin) -> _queueManager.leaveQueue(leave.TargetServer, leave.PlayerUUID));
+ messenger.registerListener(ClansServerStatusMessage.class, (status, origin) -> _queueManager.handleServerUpdate(status.ServerName, status.OpenSlots, status.Online));
+ }
+
+ public ClansQueueManager getQueueManager()
+ {
+ return _queueManager;
+ }
+
+ public boolean isRunning()
+ {
+ return _running.get();
+ }
+
+ public Region getRegion()
+ {
+ return _region;
+ }
+
+ public void registerCommand(ConsoleCommand command)
+ {
+ _commandMap.put(command.getCommand().toLowerCase(), command);
+ }
+
+ public void shutdown()
+ {
+ System.out.println("[Queue Service] Shutting down...");
+ _running.set(false);
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/CommandSystem.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/CommandSystem.java
new file mode 100644
index 000000000..e02409633
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/CommandSystem.java
@@ -0,0 +1,65 @@
+package com.mineplex.clansqueue.service.commands;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.Scanner;
+
+import com.mineplex.clansqueue.service.QueueService;
+
+public class CommandSystem extends Thread
+{
+ private final QueueService _service;
+ private final Map _commands;
+
+ public CommandSystem(QueueService service, Map commands)
+ {
+ super("Command System");
+ _service = service;
+ _commands = commands;
+
+ _service.registerCommand(new HelpCommand(_commands));
+ _service.registerCommand(new StopCommand(_service));
+ _service.registerCommand(new DeleteQueueCommand(_service));
+ _service.registerCommand(new ListQueuesCommand(_service));
+ _service.registerCommand(new PauseQueueCommand(_service));
+ _service.registerCommand(new UnpauseQueueCommand(_service));
+ }
+
+ private boolean matches(String key, String input)
+ {
+ if (key.equalsIgnoreCase(input))
+ {
+ return true;
+ }
+ if (input.toLowerCase().startsWith(key + " "))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void run()
+ {
+ try (Scanner scanner = new Scanner(System.in))
+ {
+ while (_service.isRunning())
+ {
+ String input = scanner.nextLine();
+ if (input.isEmpty())
+ {
+ continue;
+ }
+ Optional opt = _commands.entrySet().stream().filter(entry -> matches(entry.getKey(), input)).map(Map.Entry::getValue).findAny();
+ if (opt.isPresent())
+ {
+ opt.get().call(input);
+ }
+ else
+ {
+ System.out.println("Command '" + input.split(" ")[0] + "' was not found. Run 'help' for a list of commands.");
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/ConsoleCommand.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/ConsoleCommand.java
new file mode 100644
index 000000000..f962d4dd6
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/ConsoleCommand.java
@@ -0,0 +1,59 @@
+package com.mineplex.clansqueue.service.commands;
+
+public abstract class ConsoleCommand
+{
+ private final String _command;
+ private final String _usageText;
+ private StringBuilder _outputBuilder;
+
+ public ConsoleCommand(String command, String usageText)
+ {
+ _command = command;
+ _usageText = usageText;
+ }
+
+ public String getCommand()
+ {
+ return _command;
+ }
+
+ public String getUsageText()
+ {
+ return _usageText;
+ }
+
+ protected final void addOutput(String text)
+ {
+ if (_outputBuilder == null)
+ {
+ _outputBuilder = new StringBuilder();
+ }
+ else
+ {
+ _outputBuilder.append("\n");
+ }
+ _outputBuilder.append(text);
+ }
+
+ protected final void sendOutput()
+ {
+ System.out.println(_outputBuilder.toString());
+ _outputBuilder = null;
+ }
+
+ public final void call(String input)
+ {
+ String parsing = input.trim();
+ if (parsing.length() > getCommand().length() + 2)
+ {
+ String[] args = parsing.substring(getCommand().length() + 1).split(" ");
+ use(args);
+ }
+ else
+ {
+ use(new String[] {});
+ }
+ }
+
+ protected abstract void use(String[] arguments);
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/DeleteQueueCommand.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/DeleteQueueCommand.java
new file mode 100644
index 000000000..fd169d08e
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/DeleteQueueCommand.java
@@ -0,0 +1,38 @@
+package com.mineplex.clansqueue.service.commands;
+
+import com.mineplex.clansqueue.service.QueueService;
+import com.mineplex.clansqueue.service.queue.ClansServer;
+
+public class DeleteQueueCommand extends ConsoleCommand
+{
+ private final QueueService _service;
+
+ public DeleteQueueCommand(QueueService service)
+ {
+ super("delete", "Deletes an existing server and queue");
+
+ _service = service;
+ }
+
+ @Override
+ protected void use(String[] arguments)
+ {
+ if (arguments.length < 1)
+ {
+ addOutput("Usage: delete ");
+ sendOutput();
+ return;
+ }
+ ClansServer server = _service.getQueueManager().getLoadedServer(arguments[0]);
+ if (server == null)
+ {
+ addOutput("Server '" + arguments[0] + "' was not found. Run 'list' for a list of servers.");
+ sendOutput();
+ return;
+ }
+
+ _service.getQueueManager().deleteServer(server);
+ addOutput("Server and queue deleted.");
+ sendOutput();
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/HelpCommand.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/HelpCommand.java
new file mode 100644
index 000000000..808c1ab2d
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/HelpCommand.java
@@ -0,0 +1,41 @@
+package com.mineplex.clansqueue.service.commands;
+
+import java.util.Map;
+
+public class HelpCommand extends ConsoleCommand
+{
+ private final Map _commands;
+
+ public HelpCommand(Map commands)
+ {
+ super("help", "Lists commands and their usage");
+
+ _commands = commands;
+ }
+
+ @Override
+ protected void use(String[] arguments)
+ {
+ if (arguments.length < 1)
+ {
+ addOutput("Commands:");
+ _commands.values().forEach(command ->
+ {
+ addOutput(command.getCommand() + " : " + command.getUsageText());
+ });
+ }
+ else
+ {
+ if (_commands.containsKey(arguments[0].toLowerCase()))
+ {
+ ConsoleCommand cmd = _commands.get(arguments[0].toLowerCase());
+ addOutput(cmd.getCommand() + " : " + cmd.getUsageText());
+ }
+ else
+ {
+ addOutput("Command '" + arguments[0] + "' was not found. Run 'help' for a list of commands.");
+ }
+ }
+ sendOutput();
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/ListQueuesCommand.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/ListQueuesCommand.java
new file mode 100644
index 000000000..55de6784c
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/ListQueuesCommand.java
@@ -0,0 +1,29 @@
+package com.mineplex.clansqueue.service.commands;
+
+import java.util.stream.Collectors;
+
+import com.mineplex.clansqueue.service.QueueService;
+import com.mineplex.clansqueue.service.queue.ClansServer;
+
+public class ListQueuesCommand extends ConsoleCommand
+{
+ private final QueueService _service;
+
+ public ListQueuesCommand(QueueService service)
+ {
+ super("list", "Lists existing servers");
+
+ _service = service;
+ }
+
+ @Override
+ protected void use(String[] arguments)
+ {
+ StringBuilder servers = new StringBuilder("Servers: [");
+ servers.append(_service.getQueueManager().getLoadedServers().stream().map(ClansServer::getName).collect(Collectors.joining(", ")));
+ servers.append(']');
+
+ addOutput(servers.toString());
+ sendOutput();
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/PauseQueueCommand.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/PauseQueueCommand.java
new file mode 100644
index 000000000..c417883e6
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/PauseQueueCommand.java
@@ -0,0 +1,38 @@
+package com.mineplex.clansqueue.service.commands;
+
+import com.mineplex.clansqueue.service.QueueService;
+import com.mineplex.clansqueue.service.queue.ClansServer;
+
+public class PauseQueueCommand extends ConsoleCommand
+{
+ private final QueueService _service;
+
+ public PauseQueueCommand(QueueService service)
+ {
+ super("pause", "Pauses an existing queue");
+
+ _service = service;
+ }
+
+ @Override
+ protected void use(String[] arguments)
+ {
+ if (arguments.length < 1)
+ {
+ addOutput("Usage: pause ");
+ sendOutput();
+ return;
+ }
+ ClansServer server = _service.getQueueManager().getLoadedServer(arguments[0]);
+ if (server == null)
+ {
+ addOutput("Server '" + arguments[0] + "' was not found. Run 'list' for a list of servers.");
+ sendOutput();
+ return;
+ }
+
+ _service.getQueueManager().handleQueuePause(server.getName(), true);
+ addOutput("Queue paused.");
+ sendOutput();
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/StopCommand.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/StopCommand.java
new file mode 100644
index 000000000..a1c100d64
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/StopCommand.java
@@ -0,0 +1,21 @@
+package com.mineplex.clansqueue.service.commands;
+
+import com.mineplex.clansqueue.service.QueueService;
+
+public class StopCommand extends ConsoleCommand
+{
+ private final QueueService _service;
+
+ public StopCommand(QueueService service)
+ {
+ super("stop", "Stops the Queue Service");
+
+ _service = service;
+ }
+
+ @Override
+ protected void use(String[] arguments)
+ {
+ _service.shutdown();
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/UnpauseQueueCommand.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/UnpauseQueueCommand.java
new file mode 100644
index 000000000..c047e6972
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/commands/UnpauseQueueCommand.java
@@ -0,0 +1,38 @@
+package com.mineplex.clansqueue.service.commands;
+
+import com.mineplex.clansqueue.service.QueueService;
+import com.mineplex.clansqueue.service.queue.ClansServer;
+
+public class UnpauseQueueCommand extends ConsoleCommand
+{
+ private final QueueService _service;
+
+ public UnpauseQueueCommand(QueueService service)
+ {
+ super("unpause", "Resumes an existing queue");
+
+ _service = service;
+ }
+
+ @Override
+ protected void use(String[] arguments)
+ {
+ if (arguments.length < 1)
+ {
+ addOutput("Usage: unpause ");
+ sendOutput();
+ return;
+ }
+ ClansServer server = _service.getQueueManager().getLoadedServer(arguments[0]);
+ if (server == null)
+ {
+ addOutput("Server '" + arguments[0] + "' was not found. Run 'list' for a list of servers.");
+ sendOutput();
+ return;
+ }
+
+ _service.getQueueManager().handleQueuePause(server.getName(), false);
+ addOutput("Queue unpaused.");
+ sendOutput();
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/ClansQueueManager.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/ClansQueueManager.java
new file mode 100644
index 000000000..bf08084a3
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/ClansQueueManager.java
@@ -0,0 +1,202 @@
+package com.mineplex.clansqueue.service.queue;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import com.mineplex.clansqueue.common.ClansQueueMessenger;
+import com.mineplex.clansqueue.common.QueueConstant;
+import com.mineplex.clansqueue.common.messages.PlayerJoinQueueCallbackMessage;
+import com.mineplex.clansqueue.common.messages.PlayerSendToServerMessage;
+import com.mineplex.clansqueue.common.messages.QueueDeleteMessage;
+import com.mineplex.clansqueue.common.messages.QueuePauseBroadcastMessage;
+import com.mineplex.clansqueue.common.messages.QueueStatusMessage;
+import com.mineplex.clansqueue.common.messages.QueueStatusMessage.QueueSnapshot;
+import com.mineplex.clansqueue.service.QueueService;
+
+public class ClansQueueManager
+{
+ private final Map _servers = new HashMap<>();
+ private final Map _queues = new HashMap<>();
+ private final Thread _updater;
+
+ public ClansQueueManager(QueueService service)
+ {
+ _updater = new Thread(() ->
+ {
+ while (service.isRunning())
+ {
+ try
+ {
+ updateQueues();
+ Thread.sleep(5000);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }, "Queue Update Thread");
+ }
+
+ private QueueStatusMessage buildStatusMessage(Collection queues)
+ {
+ QueueStatusMessage message = new QueueStatusMessage();
+
+ queues.forEach(queue ->
+ {
+ QueueSnapshot snapshot = new QueueSnapshot();
+ snapshot.Paused = queue.isPaused();
+ snapshot.ServerName = queue.getServer().getName();
+ snapshot.Queue = new HashMap<>();
+ queue.getPlayers().values().forEach(player -> snapshot.Queue.put(player.PlayerUUID, player.Position));
+
+ message.Snapshots.add(snapshot);
+ });
+
+ return message;
+ }
+
+ private synchronized void updateQueues()
+ {
+ System.out.println("Updating queues");
+ Collection queues = _queues.values();
+
+ queues.forEach(q ->
+ {
+ q.updatePositions(Math.min(q.getServer().getOpenSlots(), QueueConstant.MAX_TRANSFERS_PER_UPDATE));
+ if (q.getServer().isOnline())
+ {
+ q.getNextSend().entrySet().forEach(entry ->
+ {
+ PlayerSendToServerMessage message = new PlayerSendToServerMessage();
+ message.PlayerUUID = entry.getKey();
+ message.TargetServer = q.getServer().getName();
+ ClansQueueMessenger.getMessenger(QueueConstant.SERVICE_MESSENGER_IDENTIFIER).transmitMessage(message, entry.getValue());
+ });
+ }
+ });
+
+ QueueStatusMessage message = buildStatusMessage(queues);
+ ClansQueueMessenger.getMessenger(QueueConstant.SERVICE_MESSENGER_IDENTIFIER).transmitMessage(message);
+ }
+
+ public synchronized ClansServer getLoadedServer(String serverName)
+ {
+ return _servers.get(serverName);
+ }
+
+ public synchronized Collection getLoadedServers()
+ {
+ return _servers.values();
+ }
+
+ public synchronized void deleteServer(ClansServer server)
+ {
+ _servers.remove(server.getName());
+ _queues.remove(server);
+ QueueDeleteMessage message = new QueueDeleteMessage();
+ ClansQueueMessenger.getMessenger(QueueConstant.SERVICE_MESSENGER_IDENTIFIER).transmitMessage(message);
+ }
+
+ public synchronized void handleServerEnable(String serverName)
+ {
+ _servers.computeIfAbsent(serverName, (name) ->
+ {
+ ClansServer server = new ClansServer(name);
+
+ _queues.put(server, new ServerQueue(server));
+
+ return server;
+ }).setOnline(true);
+
+ System.out.println("Clans server " + serverName + " enabled.");
+ }
+
+ public synchronized void handleServerDisable(String serverName)
+ {
+ _servers.computeIfAbsent(serverName, (name) ->
+ {
+ ClansServer server = new ClansServer(name);
+
+ _queues.put(server, new ServerQueue(server));
+
+ return server;
+ }).setOnline(false);
+ }
+
+ public synchronized void handleServerUpdate(String serverName, int openSlots, boolean online)
+ {
+ ClansServer server = _servers.computeIfAbsent(serverName, (name) ->
+ {
+ ClansServer s = new ClansServer(name);
+
+ _queues.put(s, new ServerQueue(s));
+
+ return s;
+ });
+ server.setOpenSlots(openSlots);
+ server.setOnline(online);
+ }
+
+ public synchronized void handleQueuePause(String serverName, boolean pause)
+ {
+ ClansServer server = _servers.get(serverName);
+ if (server != null)
+ {
+ _queues.get(server).setPaused(pause);
+ System.out.println("Clans server " + serverName + " queue pause: " + pause);
+ QueuePauseBroadcastMessage message = new QueuePauseBroadcastMessage();
+ message.ServerName = serverName;
+ message.Paused = pause;
+ ClansQueueMessenger.getMessenger(QueueConstant.SERVICE_MESSENGER_IDENTIFIER).transmitMessage(message);
+ }
+ }
+
+ public synchronized void joinQueue(String serverName, String currentServer, UUID uuid, int weight)
+ {
+ ClansServer server = _servers.get(serverName);
+ if (server != null)
+ {
+ ServerQueue queue = _queues.get(server);
+ if (weight == QueueConstant.BYPASS_QUEUE_WEIGHT)
+ {
+ queue.addBypasser(uuid, currentServer);
+ }
+ else
+ {
+ queue.addPlayer(uuid, currentServer, weight, player ->
+ {
+ PlayerJoinQueueCallbackMessage message = new PlayerJoinQueueCallbackMessage();
+ message.PlayerUUID = uuid;
+ message.TargetServer = serverName;
+ message.Position = player.Position;
+ ClansQueueMessenger.getMessenger(QueueConstant.SERVICE_MESSENGER_IDENTIFIER).transmitMessage(message, currentServer);
+ QueueStatusMessage update = buildStatusMessage(Arrays.asList(queue));
+ ClansQueueMessenger.getMessenger(QueueConstant.SERVICE_MESSENGER_IDENTIFIER).transmitMessage(update);
+ });
+ }
+ }
+ }
+
+ public synchronized void leaveQueue(String serverName, UUID uuid)
+ {
+ ClansServer server = _servers.get(serverName);
+ if (server != null)
+ {
+ ServerQueue queue = _queues.get(server);
+ queue.removePlayer(uuid, () ->
+ {
+ QueueStatusMessage message = buildStatusMessage(Arrays.asList(queue));
+ ClansQueueMessenger.getMessenger(QueueConstant.SERVICE_MESSENGER_IDENTIFIER).transmitMessage(message);
+ });
+ }
+ }
+
+ public void start()
+ {
+ _updater.start();
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/ClansServer.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/ClansServer.java
new file mode 100644
index 000000000..375a7ebc6
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/ClansServer.java
@@ -0,0 +1,58 @@
+package com.mineplex.clansqueue.service.queue;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class ClansServer
+{
+ private final String _serverName;
+ private final AtomicBoolean _online = new AtomicBoolean();
+ private final AtomicInteger _openSlots = new AtomicInteger();
+
+ public ClansServer(String serverName)
+ {
+ _serverName = serverName;
+ }
+
+ public String getName()
+ {
+ return _serverName;
+ }
+
+ public boolean isOnline()
+ {
+ return _online.get();
+ }
+
+ public void setOnline(boolean online)
+ {
+ _online.set(online);
+ }
+
+ public int getOpenSlots()
+ {
+ return _openSlots.get();
+ }
+
+ public void setOpenSlots(int openSlots)
+ {
+ _openSlots.set(openSlots);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return _serverName.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (o == null || !getClass().isInstance(o))
+ {
+ return false;
+ }
+
+ return ((ClansServer)o)._serverName.equals(_serverName);
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/QueuePlayer.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/QueuePlayer.java
new file mode 100644
index 000000000..2c5048d8b
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/QueuePlayer.java
@@ -0,0 +1,33 @@
+package com.mineplex.clansqueue.service.queue;
+
+import java.util.UUID;
+
+public class QueuePlayer
+{
+ public final UUID PlayerUUID;
+ public final String CurrentServer;
+ public int Position;
+
+ public QueuePlayer(UUID uuid, String currentServer)
+ {
+ PlayerUUID = uuid;
+ CurrentServer = currentServer;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return PlayerUUID.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (o == null || !getClass().isInstance(o))
+ {
+ return false;
+ }
+
+ return ((QueuePlayer)o).PlayerUUID.equals(PlayerUUID);
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/ServerQueue.java b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/ServerQueue.java
new file mode 100644
index 000000000..e9e269efc
--- /dev/null
+++ b/Plugins/Mineplex.ClansQueue/src/com/mineplex/clansqueue/service/queue/ServerQueue.java
@@ -0,0 +1,222 @@
+package com.mineplex.clansqueue.service.queue;
+
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Queue;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
+
+import com.mineplex.clansqueue.common.SortableLinkedList;
+
+public class ServerQueue
+{
+ private final ClansServer _server;
+ private final Map _sending = new LinkedHashMap<>();
+ private final Map _bypassing = new LinkedHashMap<>();
+ private final SortableLinkedList _queues = new SortableLinkedList<>();
+ private final Object _bypassLock = new Object();
+ private final Object _queueLock = new Object();
+ private final Object _sendLock = new Object();
+ private final AtomicBoolean _paused = new AtomicBoolean();
+
+ public ServerQueue(ClansServer server)
+ {
+ _server = server;
+ }
+
+ public ClansServer getServer()
+ {
+ return _server;
+ }
+
+ public boolean isPaused()
+ {
+ return _paused.get() || !_server.isOnline();
+ }
+
+ public Map getNextSend()
+ {
+ synchronized (_sendLock)
+ {
+ Map sending = new LinkedHashMap<>();
+ sending.putAll(_sending);
+ _sending.clear();
+ return sending;
+ }
+ }
+
+ public Map getPlayers()
+ {
+ synchronized (_queueLock)
+ {
+ Map players = new LinkedHashMap<>();
+ _queues.forEach(queue -> queue._players.forEach(qp -> players.put(qp.PlayerUUID, qp)));
+
+ return players;
+ }
+ }
+
+ public void addBypasser(UUID uuid, String currentServer)
+ {
+ synchronized (_bypassLock)
+ {
+ _bypassing.put(uuid, currentServer);
+ }
+ }
+
+ public void addPlayer(UUID uuid, String currentServer, int weight, Consumer callback)
+ {
+ synchronized (_queueLock)
+ {
+ Optional queueOpt = _queues.stream().filter(q -> q._weight == weight).findFirst();
+ PlayerQueue queue = queueOpt.orElseGet(() ->
+ {
+ PlayerQueue creating = new PlayerQueue(weight);
+ if (_queues.add(creating))
+ {
+ _queues.sort();
+ }
+
+ return creating;
+ });
+
+ QueuePlayer player = new QueuePlayer(uuid, currentServer);
+ queue._players.add(player);
+
+ AtomicInteger position = new AtomicInteger(1);
+ if (_queues.removeIf(q -> q._players.isEmpty()))
+ {
+ _queues.sort();
+ }
+ _queues.forEach(q -> q._players.forEach(qp ->
+ {
+ qp.Position = position.getAndIncrement();
+ }));
+
+ if (callback != null)
+ {
+ callback.accept(player);
+ }
+ }
+ }
+
+ public void removePlayer(UUID uuid, Runnable after)
+ {
+ synchronized (_queueLock)
+ {
+ _queues.forEach(queue -> queue._players.removeIf(player -> player.PlayerUUID.equals(uuid)));
+
+ AtomicInteger position = new AtomicInteger(1);
+ if (_queues.removeIf(q -> q._players.isEmpty()))
+ {
+ _queues.sort();
+ }
+ _queues.forEach(q -> q._players.forEach(qp ->
+ {
+ qp.Position = position.getAndIncrement();
+ }));
+
+ if (after != null)
+ {
+ after.run();
+ }
+ }
+ }
+
+ public void setPaused(boolean paused)
+ {
+ _paused.set(paused);
+ }
+
+ public void updatePositions(int openPlayerSlots)
+ {
+ Map send = new LinkedHashMap<>();
+ if (_server.isOnline())
+ {
+ synchronized (_bypassLock)
+ {
+ send.putAll(_bypassing);
+ _bypassing.clear();
+ }
+ }
+ synchronized (_queueLock)
+ {
+ if (!isPaused() && openPlayerSlots > 0)
+ {
+ while (send.size() < openPlayerSlots)
+ {
+ if (_queues.removeIf(queue -> queue._players.isEmpty()))
+ {
+ _queues.sort();
+ }
+ PlayerQueue queue = _queues.peek();
+ if (queue == null)
+ {
+ break;
+ }
+ QueuePlayer player = queue._players.poll();
+ send.put(player.PlayerUUID, player.CurrentServer);
+ }
+ }
+ AtomicInteger position = new AtomicInteger(1);
+ if (_queues.removeIf(queue -> queue._players.isEmpty()))
+ {
+ _queues.sort();
+ }
+ _queues.forEach(queue -> queue._players.forEach(qp ->
+ {
+ qp.Position = position.getAndIncrement();
+ }));
+ }
+ if (send.isEmpty())
+ {
+ return;
+ }
+ synchronized (_sendLock)
+ {
+ _sending.putAll(send);
+ }
+ }
+
+ private static class PlayerQueue implements Comparable
+ {
+ private final int _weight;
+ private final Queue _players = new LinkedList<>();
+
+ private PlayerQueue(int weight)
+ {
+ _weight = weight;
+ }
+
+ @Override
+ public int compareTo(PlayerQueue queue)
+ {
+ if (queue == null)
+ {
+ throw new NullPointerException();
+ }
+ return Integer.compare(queue._weight, _weight);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return Integer.hashCode(_weight);
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (o == null || !getClass().isInstance(o))
+ {
+ return false;
+ }
+
+ return ((PlayerQueue)o)._weight == _weight;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilCollections.java b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilCollections.java
index 1c41ffe51..c0f41b86d 100644
--- a/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilCollections.java
+++ b/Plugins/Mineplex.Core.Common.Base/src/mineplex/core/common/util/UtilCollections.java
@@ -78,7 +78,7 @@ public class UtilCollections
{
for (int i = 0; i < elements.length; i++)
{
- consumer.accept(Integer.valueOf(i), elements[i]);
+ consumer.accept(i, elements[i]);
}
}
@@ -91,7 +91,7 @@ public class UtilCollections
{
for (int i = min; i < max; i++)
{
- consumer.accept(Integer.valueOf(i));
+ consumer.accept(i);
}
}
@@ -281,4 +281,4 @@ public class UtilCollections
{
return optionalList.stream().filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimationPoint.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimationPoint.java
index a02e78796..316e23b87 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimationPoint.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimationPoint.java
@@ -54,5 +54,4 @@ public class AnimationPoint
{
return Objects.hash(_tick, _move);
}
-
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/lang/IntlString.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/lang/IntlString.java
index fada15f15..ff4de1345 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/lang/IntlString.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/lang/IntlString.java
@@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
+import java.util.Objects;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
@@ -154,7 +155,7 @@ public class IntlString
@Override
public int hashCode()
{
- return toString().hashCode();
+ return Objects.hash(getKey(), getArguments());
}
@Override
@@ -220,7 +221,7 @@ public class IntlString
@Override
public int hashCode()
{
- return toString().hashCode();
+ return Objects.hash(getArgument(), getStyle());
}
@Override
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java
index 54204cd9e..0b301c04b 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java
@@ -45,7 +45,8 @@ public class SkinData
public final static SkinData STEVE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjY3MzgxOTAzNDYsInByb2ZpbGVJZCI6ImJiYjg3ZGJlNjkwZjQyMDViZGM1NzJmZmI4ZWJjMjlkIiwicHJvZmlsZU5hbWUiOiJkaXJld29s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mVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMTY5YWQwZTUyYjM1N2NiZGYxZDU0NGVkNGNmOWJmOTI4YmI0ZWNlMDhlY2YyY2M0YmYyYTlmMjJhODI4MmQifX19", "LL4RiSKQoTZamRQ4QG6izpvhgFu5gAqW4eZxcWAihk7GkhyxifpJpBTOzKrj5hH9fCUfYkkijVWUYTEcVSVRWhocp2HXW59TbKfxOeMvHU5vTMwgpwm6PnUfwuTsRPSLC7WMnEreI3cjOxPVmXbTniOSd+o8j4oOIgwFS+VLPiYLh5Jl16i5I/9ekafl3/x41NISKWl62geqO2jPWehlk+r3soiRJsxaKw20T61GSNLu19iA96Rz2T2tUHB4opm8hbLgoiNL2g1affTjq3cZPLHH4JWF3vPhqLB5uw6xb55vFLM/PP0YiEMIi7YZOfRGeaPp7uXbXgHeew+7PG9UDVMfqbwANQY4ndECijZoei54+xX3MDXkMhQsc5S+FLnGH6e4d008v81eEOyzJUPkKbGxLCBgTUb1s4IHwomCr30twPlo1IuFBOY1qeVvZUfAfPJsREuj5q/oCAoYFgupmb3ClWECnwwaH/T4wdHjfSBHoZQdLzcgDOAl0b5EXxWmYBECqk/WA4TrYIDVGdwkqjI0RkPLUoxTj6135KO+F7P7PwhU9WBGeW8hHq918DBL0fjQVHjrzvolTqwmw6nySSePnPOxFX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0=");
@@ -91,6 +92,11 @@ public class SkinData
public static final SkinData PINEAPPLE = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDEzNjU5Mjc3OTMsInByb2ZpbGVJZCI6ImJiMDgwOTFhOTJlZDQzYWQ5NGYxZWRmZDc0NmIwYTJjIiwicHJvZmlsZU5hbWUiOiJJcDRuZHgiLCJzaWduYXR1c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VyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzJkODc1ZGY4NzM3MDk1YjczZDQ5YmJkZTE5YjM5NDg0MzIxMjY5Y2MyNTU5YTlkMzQ2NWU1OGRiYTJkOWFiNSJ9fX0=", "Z07wjY/5re7JBLSK2Wo475mezAX9AkGf3agoYoDn5Sz92tyybyRk5OpqyIw+w/9RgsurpSbJWwKp3HWG2N67q+RUDdDV2goxBeywEfsemjZIIS/pHHvX8QVCG+owyVrE2t4LRn+Bps6ZaTMCH5xS9wiPUpuuSN2t6KG+OR29sobhlv/Vr4U0NLJ6S/RKdhDIqsVqGLA4T0XwCaMn7vtFLpedR1flF4V9qAHFoxjaSGVy12h9AzJHybNfTJWPy7dsI7aTPemO6joT+chUoJwOIGonzStUkk/kq+Y6GmQYeQcudRfQ/sH1rSt2hZ0LOuJ6DGz4eILhNiCMgAjSUEEkoC0hyTbRadWF6pBhkTiDJWOBraGnE1Jh7KiqbzALwh5UQ4U1ZSgergi1oICL8RC8ZzqNpOFBod/CKkQvCVa9rMgwuZ7HkS3pdp/NBeM/k6HvQC+peUawqGvKzOMdGGRmt1waQnrCQ+p7pB3VwWL6kMLFwDJOuReqJgxo5kIwpET5cKisO9iiCrFL9B++c0M2gcf4g785MpJnUmSc1ABXw2FdZXy7UQugK+HtYDN1vmmu+aGClKQ/GXTecnPeLLnl6X7XyJKAvPQ0NnKhunCxMuRtb1kdwQh+Mxn8cOihGimxCvIBzqonojeUr7SlIcBQ6DguzYDJ+mJoRX7skYnYECE=");
// Comments this out for now, so it doesn't load the player profile
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java
index 5cb6e7758..bd110173c 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java
@@ -1,15 +1,7 @@
package mineplex.core.common.util;
-import com.google.common.collect.Sets;
-import org.apache.commons.lang3.Validate;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.player.PlayerQuitEvent;
-
-import javax.annotation.Nonnull;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -17,12 +9,21 @@ import java.util.UUID;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
+import javax.annotation.Nonnull;
+
+import org.apache.commons.lang3.Validate;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerQuitEvent;
+
public class PlayerMap implements Map
{
private static final Object LOCK = new Object();
private static final RemovalListener REMOVAL_LISTENER = new RemovalListener();
- private static final Set> ALL_PLAYER_MAPS = Sets.newSetFromMap(new WeakHashMap<>());
+ private static final Set> ALL_PLAYER_MAPS = Collections.newSetFromMap(new WeakHashMap<>());
static
{
@@ -231,4 +232,4 @@ public class PlayerMap implements Map
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java
index 1a8c443da..341de3aa3 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java
@@ -9,16 +9,6 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
-import net.minecraft.server.v1_8_R3.BlockPosition;
-import net.minecraft.server.v1_8_R3.Blocks;
-import net.minecraft.server.v1_8_R3.IBlockData;
-import net.minecraft.server.v1_8_R3.Item;
-import net.minecraft.server.v1_8_R3.MathHelper;
-import net.minecraft.server.v1_8_R3.MinecraftKey;
-import net.minecraft.server.v1_8_R3.NBTTagCompound;
-import net.minecraft.server.v1_8_R3.TileEntityFlowerPot;
-import net.minecraft.server.v1_8_R3.WorldServer;
-
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.SkullType;
@@ -47,6 +37,16 @@ import com.mojang.authlib.GameProfile;
import mineplex.core.common.Pair;
import mineplex.core.common.block.MultiBlockUpdaterAgent;
import mineplex.core.common.skin.SkinData;
+import net.minecraft.server.v1_8_R3.AxisAlignedBB;
+import net.minecraft.server.v1_8_R3.BlockPosition;
+import net.minecraft.server.v1_8_R3.Blocks;
+import net.minecraft.server.v1_8_R3.IBlockData;
+import net.minecraft.server.v1_8_R3.Item;
+import net.minecraft.server.v1_8_R3.MathHelper;
+import net.minecraft.server.v1_8_R3.MinecraftKey;
+import net.minecraft.server.v1_8_R3.NBTTagCompound;
+import net.minecraft.server.v1_8_R3.TileEntityFlowerPot;
+import net.minecraft.server.v1_8_R3.WorldServer;
public class UtilBlock
{
@@ -109,6 +109,7 @@ public class UtilBlock
blockAirFoliageSet.add((byte) Material.AIR.getId());
blockAirFoliageSet.add((byte) Material.SAPLING.getId());
blockAirFoliageSet.add((byte) Material.LONG_GRASS.getId());
+ blockAirFoliageSet.add((byte) Material.DOUBLE_PLANT.getId());
blockAirFoliageSet.add((byte) Material.DEAD_BUSH.getId());
blockAirFoliageSet.add((byte) Material.YELLOW_FLOWER.getId());
blockAirFoliageSet.add((byte) Material.RED_ROSE.getId());
@@ -628,6 +629,14 @@ public class UtilBlock
return false;
}
+ public static List getInBoundingBox(World world, AxisAlignedBB box)
+ {
+ Location l1 = new Location(world, box.a, box.b, box.c);
+ Location l2 = new Location(world, box.d, box.e, box.f);
+
+ return getInBoundingBox(l1, l2);
+ }
+
public static ArrayList getInBoundingBox(Location a, Location b)
{
return getInBoundingBox(a, b, true);
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
index 07a2058c5..3dabf341d 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
@@ -947,21 +947,22 @@ public class UtilEnt
**/
public static int getNewEntityId(boolean modifynumber)
{
- try
- {
- Field field = net.minecraft.server.v1_8_R3.Entity.class.getDeclaredField("entityCount");
- field.setAccessible(true);
- int entityId = field.getInt(null);
- if (modifynumber) {
- field.set(null, Integer.valueOf(entityId + 1));
- }
- return entityId;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- return -1;
+ try
+ {
+ Field field = net.minecraft.server.v1_8_R3.Entity.class.getDeclaredField("entityCount");
+ field.setAccessible(true);
+ int entityId = field.getInt(null);
+ if (modifynumber)
+ {
+ field.set(null, entityId + 1);
+ }
+ return entityId;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ return -1;
}
public static Entity getEntityById(int entityId)
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java
index 47fd7594c..e9f182af0 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java
@@ -670,7 +670,7 @@ public class UtilItem
public static boolean isBoundless(Material material)
{
- return (_materials.get(material).contains(ItemCategory.BOUNDLESS));
+ return material == null ? false : contains(material, ItemCategory.BOUNDLESS);
}
public static boolean isBoundless(ItemStack stack)
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java
index 5295e759a..550c36094 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java
@@ -133,38 +133,6 @@ public class UtilPlayer
return entry.trackedPlayers.contains(ep);
}
-
- public static void hideFrom(Player player, Collection players) {
- players.stream().forEach(p->p.hidePlayer(player));
- }
-
- public static void showFor(Player player, Collection players) {
- players.stream().forEach(p->p.hidePlayer(player));
- }
-
- public static void hideFromAll(Player player, Collection except) {
- UtilServer.getPlayersCollection().stream().filter(p->!except.contains(p)).forEach(p->p.hidePlayer(player));
- }
-
- public static void showForAll(Player player, Collection except) {
- UtilServer.getPlayersCollection().stream().filter(p->!except.contains(p)).forEach(p->p.showPlayer(player));
- }
-
- public static void hideFrom(Player player, Player...players) {
- hideFrom(player, Arrays.asList(players));
- }
-
- public static void showFor(Player player, Player...players) {
- showFor(player, Arrays.asList(players));
- }
-
- public static void hideFromAll(Player player, Player...players) {
- hideFromAll(player, Arrays.asList(players));
- }
-
- public static void showForAll(Player player, Player...players) {
- showForAll(player, Arrays.asList(players));
- }
public static boolean is1_9(Player player)
{
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java
index bef877efd..a71666592 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java
@@ -1,8 +1,18 @@
package mineplex.core.common.util;
import java.util.HashMap;
+import java.util.Map;
import java.util.UUID;
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.scheduler.BukkitRunnable;
+
import mineplex.core.common.DummyEntity;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity;
@@ -13,17 +23,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutBossBar;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.World;
-import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-import org.bukkit.scheduler.BukkitRunnable;
-
public class UtilTextTop
{
// Base Commands
@@ -42,7 +41,7 @@ public class UtilTextTop
public static final int EntityDragonId = 777777;
public static final int EntityWitherId = 777778;
public static final UUID BossUUID = UUID.fromString("178f5cde-2fb0-3e73-8296-967ec7e46748");
- private static HashMap _lastUpdated = new HashMap();
+ private static Map _lastUpdated = new HashMap<>();
// Display
public static void displayTextBar(final Player player, double healthPercent, String text)
@@ -68,7 +67,7 @@ public class UtilTextTop
}
};
- runnable.runTaskLater(Bukkit.getPluginManager().getPlugins()[0], 20);
+ runnable.runTaskLater(UtilServer.getPlugin(), 20);
if (UtilPlayer.is1_9(player))
{
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java
index 03cb5e95e..510da7011 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java
@@ -1,13 +1,12 @@
package mineplex.core.common.util.particles;
-import mineplex.core.common.util.UtilParticle;
-import mineplex.core.common.util.UtilServer;
import org.bukkit.Location;
import org.bukkit.entity.Player;
+import mineplex.core.common.util.UtilParticle;
+
public class ColoredParticle extends ParticleData
{
-
private ParticleColor _color;
public ColoredParticle(UtilParticle.ParticleType particleType, ParticleColor color, Location location)
@@ -45,21 +44,8 @@ public class ColoredParticle extends ParticleData
}
}
- @Override
- public void display(UtilParticle.ViewDist viewDist)
- {
- display(viewDist, UtilServer.getPlayers());
- }
-
- @Override
- public void display()
- {
- display(UtilParticle.ViewDist.NORMAL);
- }
-
public void setColor(ParticleColor color)
{
_color = color;
}
-
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java
index b0eaa5b80..2df994067 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java
@@ -7,7 +7,6 @@ import org.bukkit.entity.Player;
public class ParticleData
{
-
protected UtilParticle.ParticleType _particleType;
protected Location _location;
@@ -18,8 +17,8 @@ public class ParticleData
}
/**
- * Displays the particles for all the players with a different ammount
- * @param count the ammount of particles
+ * Displays the particles for all the players with a different amount
+ * @param count the amount of particles
*/
public void display(int count)
{
@@ -73,5 +72,4 @@ public class ParticleData
{
return _location;
}
-
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java
index 17ee9245f..9744e51b3 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java
@@ -9,10 +9,9 @@ import java.util.stream.Collectors;
public class WeightSet
{
-
private static Random random = new Random();
- private Set> _weights = new HashSet>();
+ private Set> _weights = new HashSet<>();
private volatile transient Set _keyset;
@@ -50,10 +49,18 @@ public class WeightSet
computeKeyset();
}
- public void add(int weight, T element)
+ public Weight add(int weight, T element)
{
- _weights.add(new Weight(weight, element));
+ Weight w = new Weight<>(weight, element);
+ _weights.add(w);
computeKeyset();
+
+ return w;
+ }
+
+ public void remove(Weight weight)
+ {
+ _weights.remove(weight);
}
private int getTotalWeight()
@@ -89,11 +96,11 @@ public class WeightSet
public Set elements()
{
- return this._keyset;
+ return _keyset;
}
private void computeKeyset()
{
_keyset = Collections.unmodifiableSet(_weights.stream().map(Weight::getValue).collect(Collectors.toSet()));
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java
index 0c6a0e75e..8089ec178 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java
@@ -617,7 +617,6 @@ public class CoreClientManager extends MiniPlugin
if (client.hasPermission(Perm.JOIN_FULL))
{
event.allow();
- event.setResult(PlayerLoginEvent.Result.ALLOWED);
return;
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/PermissionGroup.java b/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/PermissionGroup.java
index d5aea51eb..5bcc454f1 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/PermissionGroup.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/PermissionGroup.java
@@ -50,7 +50,7 @@ public enum PermissionGroup
//SUB-GROUPS
QA("qa", "", "Members of the Quality Assurance team.", ChatColor.WHITE, 50, false),
QAM("qam", "", "Managers of the Quality Assurance team.", ChatColor.WHITE, 50, false, PermissionGroup.QA),
- CMOD("cmod", "", "Members of the Clans Management team.", ChatColor.WHITE, 32, false),
+ CMOD("cmod", "", "Members of the Clans Management team.", ChatColor.WHITE, 46, false),
TM("tm", "", "Members of the Trainee Management team.", ChatColor.WHITE, 52, false),
MC("mc", "", "Members of the Moderator Coordination team.", ChatColor.WHITE, 49, false),
EVENTMOD("eventmod", "", "Members of the Event Management team.", ChatColor.WHITE, -1, false),
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java
index c2859d691..1befc2493 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java
@@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
+import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.Effect;
@@ -15,6 +16,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
@@ -29,7 +31,7 @@ import mineplex.core.updater.event.UpdateEvent;
@ReflectivelyCreateMiniPlugin
public class BlockRestore extends MiniPlugin
{
- private HashMap _blocks = new HashMap();
+ private Map _blocks = new HashMap<>();
private LinkedList _restoreMaps;
private BlockRestore()
@@ -266,7 +268,7 @@ public class BlockRestore extends MiniPlugin
return null;
}
- public HashMap getBlocks()
+ public Map getBlocks()
{
return _blocks;
}
@@ -282,6 +284,15 @@ public class BlockRestore extends MiniPlugin
{
_restoreMaps.remove(blockRestore);
}
+
+ @EventHandler
+ public void onBlockPhysics(BlockPhysicsEvent event)
+ {
+ if (_blocks.containsKey(event.getBlock()))
+ {
+ event.setCancelled(true);
+ }
+ }
@Override
public void disable()
@@ -294,4 +305,4 @@ public class BlockRestore extends MiniPlugin
restoreAll();
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java
index dc466f5b8..0c7d5fcdc 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java
@@ -365,7 +365,7 @@ public class Chat extends MiniPlugin
for (Function filter : _highPriorityFilters)
{
- if (filter.apply(event).booleanValue())
+ if (filter.apply(event))
{
event.setCancelled(true);
return;
@@ -433,7 +433,7 @@ public class Chat extends MiniPlugin
for (Function filter : _lowPriorityFilters)
{
- if (filter.apply(event).booleanValue())
+ if (filter.apply(event))
{
event.setCancelled(true);
return;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityJoinRequestsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityJoinRequestsPage.java
index 1c5c69c92..e1f82de22 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityJoinRequestsPage.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityJoinRequestsPage.java
@@ -137,7 +137,7 @@ public class CommunityJoinRequestsPage extends CommunitiesGUIPage
@EventHandler
public void onMembershipUpdate(CommunityMembershipUpdateEvent event)
{
- if (event.getCommunity().getId().intValue() != _community.getId().intValue())
+ if (event.getCommunity().getId() != _community.getId())
{
return;
}
@@ -155,7 +155,7 @@ public class CommunityJoinRequestsPage extends CommunitiesGUIPage
@EventHandler
public void onRequestsUpdate(CommunityJoinRequestsUpdateEvent event)
{
- if (event.getCommunity().getId().intValue() != _community.getId().intValue())
+ if (event.getCommunity().getId() != _community.getId())
{
return;
}
@@ -165,7 +165,7 @@ public class CommunityJoinRequestsPage extends CommunitiesGUIPage
@EventHandler
public void onCommunityDisband(CommunityDisbandEvent event)
{
- if (_community.getId().intValue() == event.getCommunity().getId().intValue())
+ if (_community.getId() == event.getCommunity().getId())
{
Viewer.closeInventory();
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityMembersPage.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityMembersPage.java
index 720d5a41c..2513f0e69 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityMembersPage.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityMembersPage.java
@@ -158,7 +158,7 @@ public class CommunityMembersPage extends CommunitiesGUIPage
@EventHandler
public void onRequestsUpdate(CommunityJoinRequestsUpdateEvent event)
{
- if (event.getCommunity().getId().intValue() != _community.getId().intValue())
+ if (event.getCommunity().getId() != _community.getId())
{
return;
}
@@ -171,7 +171,7 @@ public class CommunityMembersPage extends CommunitiesGUIPage
@EventHandler
public void onMembershipUpdate(CommunityMembershipUpdateEvent event)
{
- if (event.getCommunity().getId().intValue() != _community.getId().intValue())
+ if (event.getCommunity().getId() != _community.getId())
{
return;
}
@@ -182,7 +182,7 @@ public class CommunityMembersPage extends CommunitiesGUIPage
@EventHandler
public void onCommunityDisband(CommunityDisbandEvent event)
{
- if (_community.getId().intValue() == event.getCommunity().getId().intValue())
+ if (_community.getId() == event.getCommunity().getId())
{
Viewer.closeInventory();
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunitySettingsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunitySettingsPage.java
index 56e1d0ba4..44031723a 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunitySettingsPage.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunitySettingsPage.java
@@ -109,7 +109,7 @@ public class CommunitySettingsPage extends CommunitiesGUIPage
@EventHandler
public void onRequestsUpdate(CommunityJoinRequestsUpdateEvent event)
{
- if (event.getCommunity().getId().intValue() != _community.getId().intValue())
+ if (event.getCommunity().getId() != _community.getId())
{
return;
}
@@ -122,7 +122,7 @@ public class CommunitySettingsPage extends CommunitiesGUIPage
@EventHandler
public void onMembershipUpdate(CommunityMembershipUpdateEvent event)
{
- if (event.getCommunity().getId().intValue() != _community.getId().intValue())
+ if (event.getCommunity().getId() != _community.getId())
{
return;
}
@@ -136,7 +136,7 @@ public class CommunitySettingsPage extends CommunitiesGUIPage
@EventHandler
public void onSettingsUpdate(CommunitySettingUpdateEvent event)
{
- if (event.getCommunity().getId().intValue() != _community.getId().intValue())
+ if (event.getCommunity().getId() != _community.getId())
{
return;
}
@@ -146,7 +146,7 @@ public class CommunitySettingsPage extends CommunitiesGUIPage
@EventHandler
public void onCommunityDisband(CommunityDisbandEvent event)
{
- if (_community.getId().intValue() == event.getCommunity().getId().intValue())
+ if (_community.getId() == event.getCommunity().getId())
{
Viewer.closeInventory();
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java
index a4eb5dc4a..8951f526a 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java
@@ -72,7 +72,7 @@ public class DisguisePlayer extends DisguiseHuman
private DisguisePlayer(Entity entity)
{
super(EntityType.PLAYER, entity);
- this._originalProfile = entity instanceof Player ? UtilGameProfile.getGameProfile((Player) entity) : null;
+ _originalProfile = entity instanceof Player ? UtilGameProfile.getGameProfile((Player) entity) : null;
}
/**
@@ -82,7 +82,7 @@ public class DisguisePlayer extends DisguiseHuman
{
this(entity);
- this._profile = UtilGameProfile.clone(gameProfile);
+ _profile = UtilGameProfile.clone(gameProfile);
}
/**
@@ -101,16 +101,16 @@ public class DisguisePlayer extends DisguiseHuman
{
this(entity);
- this._requestedUsername = username;
- this._requestedSkin = skin;
+ _requestedUsername = username;
+ _requestedSkin = skin;
}
public DisguisePlayer(Entity entity, String username, SkinData skinData)
{
this(entity);
- this._requestedUsername = username;
- this._requestedSkinData = skinData;
+ _requestedUsername = username;
+ _requestedSkinData = skinData;
}
/**
@@ -121,7 +121,7 @@ public class DisguisePlayer extends DisguiseHuman
*/
public Future