From ddf1a8ff74a5b8fbd728c469c0bef0cb7f826c08 Mon Sep 17 00:00:00 2001 From: Peter Miller Date: Mon, 7 Jul 2014 17:30:03 -0400 Subject: [PATCH] Pointed "send" command to "AddTransferRecord" method in Portal module. Corrected "serverTarget" to "playerTarget" in "Player...does not exist!" message. Cleaned up unnecessary references. --- .../core/portal/Commands/SendCommand.java | 11 ++--------- .../src/mineplex/core/portal/Portal.java | 18 +++++------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java index a2b7f5f81..4b29c5343 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java @@ -1,6 +1,5 @@ package mineplex.core.portal.Commands; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import mineplex.core.command.*; @@ -37,7 +36,7 @@ public class SendCommand extends CommandBase { if (!playerExists) { - UtilPlayer.message(player, F.main(Plugin.GetName(), C.cGray + "Player " + C.cGold + serverTarget + C.cGray + " does not exist!")); + UtilPlayer.message(player, F.main(Plugin.GetName(), C.cGray + "Player " + C.cGold + playerTarget + C.cGray + " does not exist!")); return; } @@ -51,13 +50,7 @@ public class SendCommand extends CommandBase return; } - Bukkit.getServer().getScheduler().runTaskAsynchronously(Plugin.GetPlugin(), new Runnable() - { - public void run() - { - Plugin.getRepository().addServerTransfer(playerTarget, serverTarget); - } - }); + Plugin.AddTransferRecord(playerTarget, serverTarget); UtilPlayer.message(player, F.main(Plugin.GetName(), C.cGray + "You have sent player: " + C.cGold + playerTarget + C.cGray + " to server: " + C.cGold + serverTarget + C.cGray + "!")); return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java index 6c22f3cfe..ed76f5151 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java @@ -108,16 +108,13 @@ public class Portal extends MiniPlugin public void AddTransferRecord(final String playerName, final String serverName) { - synchronized (_transferLock) + Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable() { - Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable() + public void run() { - public void run() - { - _repository.addServerTransfer(playerName, serverName); - } - }); - } + _repository.addServerTransfer(playerName, serverName); + } + }); } public void DoesServerExist(final String serverName, final Callback callback) @@ -207,9 +204,4 @@ public class Portal extends MiniPlugin }); } } - - public PortalRepository getRepository() - { - return _repository; - } }