RESOLVED! DOES NOT NEED FURTHER ATTENTION! Slightly complicated to describe as well, however the intention is clear. I found a plugin not too long ago supporting ingame translations through live chat, using the Bing translation API to translate the chat and then send it back so the plugin can use it. The issue I am attempting to solve is that I can see it from ingame fine, as can others, but I can never see this on console. Adding code to the section which gives the translated text causes it to appear multiple times on the console, and that is an issue. I have a for loop which takes the language of each player, runs the original string sent from player X (who is being translated from) through the translator using the each players language as the "to LANGUAGE" part and returns the translated string to the players. I need to be able to run the same string from player X through the translator outside the for loop, however I cannot figure out how this is done. The for loop is the only contents of the method Run(), which is shown below: Code: public void run() { for (Player plr : Bukkit.getOnlinePlayers()) { Language lang = (Language)VectronTranslate.known.get(plr.getName()); if (lang != Language.AUTO_DETECT) { if (!plr.getName().equals(tm.player)) { if (plr.hasPermission("vectron.translate")) { String what = (String)translated.get(lang); if(what == "") {what = tm.message;} if(!what.equalsIgnoreCase(tm.message)) { if (what.toLowerCase().contains("ArgumentOutOfRangeException".toLowerCase())) { System.out.println("An error has occured while attempting to translate '" + tm.message + "' from " + tm.player + "\nDetails of the error are below: \n--------------------\n" + what + "\n--------------------"); if(plr.getName().equals(tm.player)){ plr.sendMessage(ChatColor.RED + "Internal server error!"); } } else { try { plr.sendMessage(ChatColor.YELLOW + tm.player + " (To " + lang.toString().toUpperCase() + "): " + what); } catch (Exception ex) { System.out.println("Exception: " + ex.getMessage()); } } } } } } } } How do I print the translation (in English only) to console while leaving the translations sent to every other player unaffected? Additionally, are there any parts of the code which are not done as standard or expected? BAI1
I don't have access to change the thread title or prefix, so if one of you would like to then please do. BAI1