diff options
Diffstat (limited to 'src/main/java/de')
4 files changed, 20 insertions, 7 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java index 9f5d004..0c784eb 100644 --- a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java +++ b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java @@ -79,8 +79,12 @@ public class MooCommand extends CommandBase { } else if (args[0].equalsIgnoreCase("list")) { handleListBestFriends(); } else if (args[0].equalsIgnoreCase("online")) { - main.getChatHelper().sendMessage(EnumChatFormatting.GRAY, "Checking online status of " + EnumChatFormatting.WHITE + main.getFriendsHandler().getBestFriends().size() + EnumChatFormatting.GRAY + " best friends. This may take a few seconds."); - main.getFriendsHandler().runBestFriendsOnlineCheck(true); + if (main.getFriendsHandler().getBestFriends().size() > 0) { + main.getChatHelper().sendMessage(EnumChatFormatting.GRAY, "Checking online status of " + EnumChatFormatting.WHITE + main.getFriendsHandler().getBestFriends().size() + EnumChatFormatting.GRAY + " best friends. This may take a few seconds."); + main.getFriendsHandler().runBestFriendsOnlineCheck(true); + } else { + main.getChatHelper().sendMessage(EnumChatFormatting.RED, "You haven't added anyone to your best friends list yet. Do so with " + EnumChatFormatting.WHITE + "/moo add <playerName>"); + } } else if (args[0].equalsIgnoreCase("nameChangeCheck")) { handleNameChangeCheck(args); } @@ -105,7 +109,7 @@ public class MooCommand extends CommandBase { else if (args[0].equalsIgnoreCase("config") || args[0].equalsIgnoreCase("toggle")) { displayGuiScreen(new MooGuiConfig(null)); } else if (args[0].equalsIgnoreCase("search")) { - displayGuiScreen(new GuiSearch(main.getConfigDirectory())); + displayGuiScreen(new GuiSearch(main.getConfigDirectory(), CommandBase.buildString(args, 1))); } else if (args[0].equalsIgnoreCase("guiscale")) { handleGuiScale(args); } else if (args[0].equalsIgnoreCase("rr")) { diff --git a/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java b/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java index 466c002..a936888 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java @@ -89,7 +89,7 @@ public class ChatListener { if (Utils.isValidUuid(moo)) { MooConfig.moo = moo; main.getConfig().syncFromFields(); - main.getChatHelper().sendMessage(EnumChatFormatting.GREEN, "Added updated API key in " + Cowlection.MODNAME + " config!"); + main.getChatHelper().sendMessage(EnumChatFormatting.GREEN, "Saved your API key in " + Cowlection.MODNAME + " config!"); } } } diff --git a/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java b/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java index 5748f15..1074a43 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java @@ -74,7 +74,7 @@ public class PlayerListener { public void onServerJoin(FMLNetworkEvent.ClientConnectedToServerEvent e) { main.getVersionChecker().runUpdateCheck(false); new TickDelay(() -> main.getChatHelper().sendOfflineMessages(), 6 * 20); - if (MooConfig.doBestFriendsOnlineCheck) { + if (MooConfig.doBestFriendsOnlineCheck && main.getFriendsHandler().getBestFriends().size() > 0) { main.getFriendsHandler().runBestFriendsOnlineCheck(false); } isOnSkyBlock = false; diff --git a/src/main/java/de/cowtipper/cowlection/search/GuiSearch.java b/src/main/java/de/cowtipper/cowlection/search/GuiSearch.java index 48c9212..ed1a1d9 100644 --- a/src/main/java/de/cowtipper/cowlection/search/GuiSearch.java +++ b/src/main/java/de/cowtipper/cowlection/search/GuiSearch.java @@ -51,6 +51,7 @@ public class GuiSearch extends GuiScreen { 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat(Cowlection.MODID + "-logfilesearcher-%d").build()); // data + private boolean hasInitialSearchQuery; private String searchQuery; private boolean chatOnly; private boolean matchCase; @@ -79,14 +80,19 @@ public class GuiSearch extends GuiScreen { private String analyzedFilesWithHits; private boolean areEntriesSearchResults; - public GuiSearch(File configDirectory) { + public GuiSearch(File configDirectory, String initialSearchQuery) { this.mcLogOutputFile = new File(configDirectory, "mc-log.txt"); try { mcLogOutputFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } - this.searchQuery = SEARCH_QUERY_PLACE_HOLDER; + if (initialSearchQuery.length() > 0) { + hasInitialSearchQuery = true; + this.searchQuery = initialSearchQuery; + } else { + this.searchQuery = SEARCH_QUERY_PLACE_HOLDER; + } this.searchResults = new ArrayList<>(); this.dateStart = MooConfig.calculateStartDate(); this.dateEnd = LocalDate.now(); @@ -107,6 +113,9 @@ public class GuiSearch extends GuiScreen { if (SEARCH_QUERY_PLACE_HOLDER.equals(searchQuery)) { this.fieldSearchQuery.setFocused(true); this.fieldSearchQuery.setSelectionPos(0); + } else if (hasInitialSearchQuery) { + this.fieldSearchQuery.setFocused(true); + this.hasInitialSearchQuery = false; } // date field: start |