update Explore, get and list

This commit is contained in:
Vlammar 2021-05-29 02:00:34 +02:00
parent a9fd510e28
commit 0b70b503ca
3 changed files with 12 additions and 5 deletions

View File

@ -52,7 +52,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandInfo(name = "explore",usageParameters = "[player name]") @CommandInfo(name = "explore", usageParameters = "[player name]")
public class ExploreCommand extends IoMCommand { public class ExploreCommand extends IoMCommand {
@Override @Override
protected void run() throws CommandException { protected void run() throws CommandException {
@ -81,8 +81,14 @@ public class ExploreCommand extends IoMCommand {
return; return;
} }
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid); OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);
if (offlinePlayer == null) {
warning(sender, I.t("The player {0} does not exist.", playerName));
return;
}
if (sender.isOnline()) { if (sender.isOnline()) {
Gui.open(sender, new MapListGui(offlinePlayer,playerName)); //RunTask.nextTick(() -> {
Gui.open(sender, new MapListGui(offlinePlayer, playerName));
//});
} }
}); });

View File

@ -80,8 +80,6 @@ public class GetCommand extends IoMCommand {
} }
//TODO passer en static //TODO passer en static
ImageOnMap.getPlugin().getCommandWorker().offlineNameFetch(playerName, uuid -> { ImageOnMap.getPlugin().getCommandWorker().offlineNameFetch(playerName, uuid -> {

View File

@ -80,7 +80,9 @@ public class ListCommand extends IoMCommand {
//TODO passer en static //TODO passer en static
ImageOnMap.getPlugin().getCommandWorker().offlineNameFetch(playerName, uuid -> { ImageOnMap.getPlugin().getCommandWorker().offlineNameFetch(playerName, uuid -> {
List<ImageMap> mapList = MapManager.getMapList(uuid); if (!sender.isOnline()) {
return;
}
if (uuid == null) { if (uuid == null) {
try { try {
throwInvalidArgument(I.t("Player {} not found.", playerName)); throwInvalidArgument(I.t("Player {} not found.", playerName));
@ -89,6 +91,7 @@ public class ListCommand extends IoMCommand {
} }
return; return;
} }
List<ImageMap> mapList = MapManager.getMapList(uuid);
if (mapList.isEmpty()) { if (mapList.isEmpty()) {
info(sender, I.t("No map found.")); info(sender, I.t("No map found."));
return; return;