diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CheckCommandOld.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CheckCommandOld.java new file mode 100644 index 000000000..cf5791ec3 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CheckCommandOld.java @@ -0,0 +1,46 @@ +package mineplex.staffServer.customerSupport; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class CheckCommandOld extends CommandBase +{ + public CheckCommandOld(CustomerSupport plugin) + { + super(plugin, CustomerSupport.Perm.CHECK_COMMAND, "check", "c"); + } + + @Override + public void Execute(final Player caller, String[] args) + { + if (args == null || args.length != 1) + { + Plugin.Help(caller); + } + else + { + String playerName = args[0]; + + _commandCenter.GetClientManager().checkPlayerName(caller, playerName, name -> + { + if (name != null) + { + _commandCenter.GetClientManager().loadClientByName(name, client -> + { + if (client != null) + { + Plugin.showPlayerInfo(caller, client, false); + } + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Could not load data for " + name)); + } + }); + } + }); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/checkCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/checkCommand.java index 822a78a96..44dc7676e 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/checkCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/checkCommand.java @@ -3,44 +3,61 @@ package mineplex.staffServer.customerSupport; import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.staffServer.ui.SupportHomePage; +import mineplex.staffServer.ui.SupportShop; -public class checkCommand extends CommandBase +public class CheckCommand extends CommandBase { - public checkCommand(CustomerSupport plugin) + private SupportShop _supportShop; + + public CheckCommand(CustomerSupport plugin) { super(plugin, CustomerSupport.Perm.CHECK_COMMAND, "check", "c"); + + _supportShop = new SupportShop(plugin); } @Override - public void Execute(final Player caller, String[] args) + public void Execute(Player caller, String[] args) { - if (args == null || args.length != 1) + if (args == null || args.length < 1) { - Plugin.Help(caller); + caller.sendMessage(F.main(Plugin.getName(), "Usage: " + C.cYellow + "/check ")); + return; } - else - { - String playerName = args[0]; - _commandCenter.GetClientManager().checkPlayerName(caller, playerName, name -> - { - if (name != null) - { - _commandCenter.GetClientManager().loadClientByName(name, client -> - { - if (client != null) - { - Plugin.showPlayerInfo(caller, client, false); - } - else - { - UtilPlayer.message(caller, F.main(Plugin.getName(), "Could not load data for " + name)); - } - }); - } - }); + String playerName = args[0]; + + Player onlinePlayer = UtilPlayer.searchExact(playerName); + if (onlinePlayer != null && Plugin.getClientManager().Get(onlinePlayer) != null) + { + _supportShop.openPageAsync(caller, new SupportHomePage(Plugin, _supportShop, caller, Plugin.getClientManager().Get(onlinePlayer))); + return; } + + _commandCenter.GetClientManager().checkPlayerName(caller, playerName, name -> + { + if (name != null) + { + _commandCenter.GetClientManager().loadClientByName(name, client -> + { + if (client != null) + { + _supportShop.openPageAsync(caller, new SupportHomePage(Plugin, _supportShop, caller, client)); + } + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Could not load data for " + C.cYellow + playerName)); + } + }); + } + else + { + caller.sendMessage(F.main(Plugin.getName(), "Could not load data for " + C.cYellow + playerName)); + } + }); } -} \ No newline at end of file +}