Various fixes for new UI

- fixed slash commands not working in chat
- added a warning if an invite-only table is made for a user that doesn't exist
- fixed the CoC not rendering properly
- Combined the chopped-up help messages so that spam is avoided (as <br> can just be used now)
- fixed league games being eligible for custom descriptions (this breaks anonymity)
This commit is contained in:
Christian 'ketura' McCarty
2022-08-26 01:59:03 -05:00
parent 10b2dcec01
commit ff767a4181
4 changed files with 52 additions and 18 deletions

View File

@@ -98,7 +98,12 @@ public class ChatRequestHandler extends LotroServerRequestHandler implements Uri
//Escaping underscores so that URLs with lots of underscores (i.e. wiki links) aren't mangled //Escaping underscores so that URLs with lots of underscores (i.e. wiki links) aren't mangled
// Besides, who uses _this_ instead of *this*? // Besides, who uses _this_ instead of *this*?
newMsg = newMsg.replace("_", "\\_"); newMsg = newMsg.replace("_", "\\_");
newMsg = _markdownRenderer.render(_markdownParser.parse(newMsg));
//Need to preserve any commands being made
if(!newMsg.startsWith("/")) {
newMsg = _markdownRenderer.render(_markdownParser.parse(newMsg));
newMsg = newMsg.replaceAll("</blockquote>[\n \t]*<blockquote>", "</blockquote><br /><blockquote>");
}
chatRoom.sendMessage(resourceOwner.getName(), newMsg, admin); chatRoom.sendMessage(resourceOwner.getName(), newMsg, admin);
responseWriter.writeXmlResponse(null); responseWriter.writeXmlResponse(null);

View File

@@ -129,7 +129,7 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
String format = getFormParameterSafely(postDecoder, "format"); String format = getFormParameterSafely(postDecoder, "format");
String deckName = getFormParameterSafely(postDecoder, "deckName"); String deckName = getFormParameterSafely(postDecoder, "deckName");
String timer = getFormParameterSafely(postDecoder, "timer"); String timer = getFormParameterSafely(postDecoder, "timer");
String desc = getFormParameterSafely(postDecoder, "desc"); String desc = getFormParameterSafely(postDecoder, "desc").trim();
String isPrivateVal = getFormParameterSafely(postDecoder, "isPrivate"); String isPrivateVal = getFormParameterSafely(postDecoder, "isPrivate");
boolean isPrivate = (isPrivateVal != null ? Boolean.valueOf(isPrivateVal) : false); boolean isPrivate = (isPrivateVal != null ? Boolean.valueOf(isPrivateVal) : false);
@@ -145,6 +145,19 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
responseWriter.writeXmlResponse(marshalException(new HallException("Absolutely no playing with yourself!! Private matches must be with someone else."))); responseWriter.writeXmlResponse(marshalException(new HallException("Absolutely no playing with yourself!! Private matches must be with someone else.")));
return; return;
} }
try {
var player = _playerDao.getPlayer(desc);
if(player == null)
{
responseWriter.writeXmlResponse(marshalException(new HallException("Cannot find player '" + desc + "'. Check your spelling and capitalization and ensure it is exact.")));
return;
}
}
catch(RuntimeException ex) {
responseWriter.writeXmlResponse(marshalException(new HallException("Cannot find player '" + desc + "'. Check your spelling and capitalization and ensure it is exact.")));
return;
}
} }
@@ -160,12 +173,17 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
Player librarian = _playerDao.getPlayer("Librarian"); Player librarian = _playerDao.getPlayer("Librarian");
_hallServer.spoofNewTable(format, resourceOwner, librarian, deckName, timer, "(New Player) " + desc, isPrivate); _hallServer.spoofNewTable(format, resourceOwner, librarian, deckName, timer, "(New Player) " + desc, isPrivate);
responseWriter.writeXmlResponse(null); responseWriter.writeXmlResponse(null);
return;
} }
catch (HallException ex) { } catch (HallException ex) { }
responseWriter.writeXmlResponse(marshalException(e)); responseWriter.writeXmlResponse(marshalException(e));
} }
} }
catch (Exception ex)
{
responseWriter.writeXmlResponse(marshalException(new HallException("Failed to create table. Please try again later.")));
}
finally { finally {
postDecoder.destroy(); postDecoder.destroy();
} }

View File

@@ -412,11 +412,11 @@ table.tables tr.privateForPlayer {
margin-bottom: 5px; margin-bottom: 5px;
font-style: italic; font-style: italic;
} }
.chatMessage blockquote br { /*.chatMessage blockquote br {
line-height: 0px; line-height: 0px;
margin: 0px; margin: 0px;
content: ""; content: "";
} }*/
.user-mention { .user-mention {
background-color: #FFFF0044; background-color: #FFFF0044;
@@ -576,8 +576,8 @@ table.tables tr.privateForPlayer {
#ui-tabs-1, #ui-tabs-1,
#ui-tabs-2, #ui-tabs-2,
#ui-tabs-3, #ui-tabs-3,
#ui-tabs-4, #ui-tabs-4
#ui-tabs-5 { /*#ui-tabs-5*/ {
overflow-x: hidden; overflow-x: hidden;
overflow-y: hidden; overflow-y: hidden;
height: 100%; height: 100%;

View File

@@ -206,18 +206,25 @@ public class HallServer extends AbstractServer {
new ChatCommandCallback() { new ChatCommandCallback() {
@Override @Override
public void commandReceived(String from, String parameters, boolean admin) { public void commandReceived(String from, String parameters, boolean admin) {
_hallChat.sendToUser("System", from, "List of available commands:"); //_hallChat.sendToUser("System", from,
_hallChat.sendToUser("System", from, "/ignore username - Adds user 'username' to list of your ignores"); String message = """
_hallChat.sendToUser("System", from, "/unignore username - Removes user 'username' from list of your ignores"); List of available commands:
_hallChat.sendToUser("System", from, "/listIgnores - Lists all your ignored users"); /ignore username - Adds user 'username' to list of your ignores
_hallChat.sendToUser("System", from, "/incognito - Makes you incognito (not visible in user list)"); /unignore username - Removes user 'username' from list of your ignores
_hallChat.sendToUser("System", from, "/endIncognito - Turns your visibility 'on' again"); /listIgnores - Lists all your ignored users
/incognito - Makes you incognito (not visible in user list)
/endIncognito - Turns your visibility 'on' again""";
if (admin) { if (admin) {
_hallChat.sendToUser("System", from, "Admin only commands:"); message += """
_hallChat.sendToUser("System", from, "/ban username - Bans user 'username' permanently");
_hallChat.sendToUser("System", from, "/banIp ip - Bans specified ip permanently");
_hallChat.sendToUser("System", from, "/banIpRange ip - Bans ips with the specified prefix, ie. 10.10.10."); Admin only commands:
/ban username - Bans user 'username' permanently
/banIp ip - Bans specified ip permanently
/banIpRange ip - Bans ips with the specified prefix, ie. 10.10.10.""";
} }
_hallChat.sendToUser("System", from, message.replace("\n", "<br />"));
} }
}); });
_hallChat.addChatCommandCallback("nocommand", _hallChat.addChatCommandCallback("nocommand",
@@ -375,9 +382,13 @@ public class HallServer extends AbstractServer {
throw new HallException("There is no ongoing serie for that league"); throw new HallException("There is no ongoing serie for that league");
if(isPrivate) { if(isPrivate) {
throw new HallException("League games cannot be private"); throw new HallException("League games cannot be invite-only");
} }
//Don't want people getting around the anonymity for leagues.
if(description != null)
description = "";
format = _formatLibrary.getFormat(leagueSerie.getFormat()); format = _formatLibrary.getFormat(leagueSerie.getFormat());
collectionType = leagueSerie.getCollectionType(); collectionType = leagueSerie.getCollectionType();