Code improvements.

This commit is contained in:
MobiusDev
2016-04-24 16:30:15 +00:00
parent 8bd51aba1c
commit 2dd14bef9b
860 changed files with 8865 additions and 17041 deletions

View File

@@ -69,17 +69,14 @@ public class FavoriteBoard implements IParseBoardHandler
{
while (rs.next())
{
String link = list.replaceAll("%fav_bypass%", String.valueOf(rs.getString("favBypass")));
link = link.replaceAll("%fav_title%", rs.getString("favTitle"));
String link = list.replaceAll("%fav_bypass%", String.valueOf(rs.getString("favBypass"))).replaceAll("%fav_title%", rs.getString("favTitle"));
final SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
link = link.replaceAll("%fav_add_date%", date.format(rs.getTimestamp("favAddDate")));
link = link.replaceAll("%fav_id%", String.valueOf(rs.getInt("favId")));
sb.append(link);
}
}
String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/favorite.html");
html = html.replaceAll("%fav_list%", sb.toString());
CommunityBoardHandler.separateAndSend(html, activeChar);
CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/favorite.html").replaceAll("%fav_list%", sb.toString()), activeChar);
}
catch (Exception e)
{

View File

@@ -45,21 +45,12 @@ public class FriendsBoard implements IParseBoardHandler
if (command.equals("_friendlist"))
{
CommunityBoardHandler.getInstance().addBypass(activeChar, "Friends List", command);
final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/friends_list.html");
CommunityBoardHandler.separateAndSend(html, activeChar);
CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/friends_list.html"), activeChar);
}
else if (command.equals("_friendblocklist"))
{
CommunityBoardHandler.getInstance().addBypass(activeChar, "Ignore list", command);
final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/friends_block_list.html");
CommunityBoardHandler.separateAndSend(html, activeChar);
}
else
{
CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/friends_block_list.html"), activeChar);
}
return true;
}

View File

@@ -95,8 +95,7 @@ public final class HomeBoard implements IParseBoardHandler
final String path = command.replace("_bbstop;", "");
if ((path.length() > 0) && path.endsWith(".html"))
{
final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/" + customPath + path);
CommunityBoardHandler.separateAndSend(html, activeChar);
CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/" + customPath + path), activeChar);
}
}
else if (Config.CUSTOM_CB_ENABLED && Config.COMMUNITYBOARD_ENABLE_MULTISELLS && command.startsWith("_bbsmultisell"))
@@ -162,8 +161,7 @@ public final class HomeBoard implements IParseBoardHandler
SkillData.getInstance().getSkill(buffId, buffLevel).applyEffects(activeChar.getPet(), activeChar.getPet());
}
}
final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/Custom/" + page + ".html");
CommunityBoardHandler.separateAndSend(html, activeChar);
CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/Custom/" + page + ".html"), activeChar);
}
return false;
}

View File

@@ -71,16 +71,13 @@ public class RegionBoard implements IWriteBoardHandler
sb.append(link);
}
String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/region.html");
html = html.replace("%region_list%", sb.toString());
CommunityBoardHandler.separateAndSend(html, activeChar);
CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/region.html").replace("%region_list%", sb.toString()), activeChar);
}
else if (command.startsWith("_bbsloc;"))
{
CommunityBoardHandler.getInstance().addBypass(activeChar, "Region>", command);
final String id = command.replace("_bbsloc;", "");
if (!Util.isDigit(id))
if (!Util.isDigit(command.replace("_bbsloc;", "")))
{
LOG.warning(RegionBoard.class.getSimpleName() + ": Player " + activeChar + " sent and invalid region bypass " + command + "!");
return false;