Usability improvements: Drafts now auto open in new tab when they start; Tournament messages do not persist in history; One missed console.log removed from hall.js

This commit is contained in:
jakub.salavec
2025-03-13 14:55:52 +01:00
parent 10b638615e
commit 1f6184020e
3 changed files with 33 additions and 6 deletions

View File

@@ -54,8 +54,6 @@ var GempLotrHallUI = Class.extend({
this.chat = chat;
this.chat.tournamentCallback = function(from, message) {
var thisName = that.userInfo.name
console.log(from);
console.log(message);
if (from == "TournamentSystem" && that.inTournament) {
that.showDialog("Tournament Update", message, 320);
} else if (from.startsWith("TournamentSystemTo:")) {
@@ -841,8 +839,19 @@ var GempLotrHallUI = Class.extend({
$("table.tournaments", this.tablesDiv)
.append(row);
if (joined == "true") {
// Display joined tournaments also as playing tables
$("table.playingTables", this.tablesDiv)
.append(tablesRow)
if (type === "table_solodraft" || type === "table_draft") {
var tourneyId = tournament.getAttribute("id");
window.open("/gemp-lotr/tableDraft.html?eventId=" + tourneyId, '_blank');
this.PlaySound("gamestart");
} else if (type === "solodraft") {
var tourneyId = tournament.getAttribute("id");
window.open("/gemp-lotr/soloDraft.html?eventId=" + tourneyId, '_blank');
this.PlaySound("gamestart");
}
}
}

View File

@@ -108,6 +108,24 @@ public class ChatRoomMediator {
}
}
public void sendMessageNoHistory(String playerId, String message, boolean admin) throws PrivateInformationException, ChatCommandErrorException {
if (message.trim().startsWith("/")) {
processIfKnownCommand(playerId, message.trim().substring(1), admin);
return;
}
_lock.writeLock().lock();
try {
if (!admin && _allowedPlayers != null && !_allowedPlayers.contains(playerId))
throw new PrivateInformationException();
_logger.trace(playerId+": "+message);
_chatRoom.postMessage(playerId, message, false, admin);
} finally {
_lock.writeLock().unlock();
}
}
public void setIncognito(String username, boolean incognito) {
_lock.writeLock().lock();
try {

View File

@@ -943,11 +943,11 @@ public class HallServer extends AbstractServer {
try {
//check-in callback
if (toWhom == null || toWhom.isEmpty()) {
_hallChat.sendMessage("TournamentSystem", message, true);
_hallChat.sendMessageNoHistory("TournamentSystem", message, true);
} else {
StringBuilder builder = new StringBuilder("TournamentSystemTo:");
toWhom.forEach(player -> builder.append(player).append(";"));
_hallChat.sendMessage(builder.substring(0, builder.length() - 1), message, true);
_hallChat.sendMessageNoHistory(builder.substring(0, builder.length() - 1), message, true);
}
} catch (PrivateInformationException exp) {
// Ignore, sent as admin
@@ -998,11 +998,11 @@ public class HallServer extends AbstractServer {
try {
//check-in callback
if (toWhom == null || toWhom.isEmpty()) {
_hallChat.sendMessage("TournamentSystem", message, true);
_hallChat.sendMessageNoHistory("TournamentSystem", message, true);
} else {
StringBuilder builder = new StringBuilder("TournamentSystemTo:");
toWhom.forEach(player -> builder.append(player).append(";"));
_hallChat.sendMessage(builder.substring(0, builder.length() - 1), message, true);
_hallChat.sendMessageNoHistory(builder.substring(0, builder.length() - 1), message, true);
}
} catch (PrivateInformationException exp) {
// Ignore, sent as admin