private static String request(String queryString) { String line = "failed"; final String twitterbotURL = ConfigEntry.TWITTERBOT_URL.getString(); final String twitterbotSecret = ConfigEntry.TWITTERBOT_SECRET.getString(); if (twitterbotURL != null && twitterbotSecret != null && !twitterbotURL.isEmpty() && !twitterbotSecret.isEmpty()) { try { URL getUrl = new URL(twitterbotURL + "?auth=" + twitterbotSecret + "&" + queryString); URLConnection urlConnection = getUrl.openConnection(); // Read the response BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); line = in.readLine(); in.close(); } catch (Exception ex) { FLog.severe(ex); } } return line; }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlayerChatFormat(AsyncPlayerChatEvent event) { try { handleChatEvent(event); } catch (Exception ex) { FLog.severe(ex); } }
public void adminChat(CommandSender sender, String message) { String name = sender.getName() + " " + plugin.rm.getDisplay(sender).getColoredTag() + ChatColor.WHITE; FLog.info("[ADMIN] " + name + ": " + message); for (Player player : server.getOnlinePlayers()) { if (plugin.al.isAdmin(player)) { player.sendMessage( "[" + ChatColor.LIGHT_PURPLE + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.YELLOW + name + ": " + ChatColor.AQUA + message); } } }