Case-insensitive check for game channel owner name comparison, added some comments

This commit is contained in:
Vankka 2022-04-12 11:30:46 +03:00
parent da8ba3d3a6
commit 02121a61f9
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0

View File

@ -183,19 +183,23 @@ public class ChannelConfigHelper {
public BaseChannelConfig get(String ownerName, String channelName) {
if (ownerName != null) {
ownerName = ownerName.toLowerCase(Locale.ROOT);
// Check if there is a channel defined like this: "owner:channel"
BaseChannelConfig config = findChannel(ownerName + ":" + channelName);
if (config != null) {
return config;
}
// Check if this owner has the highest priority for this channel name
GameChannel gameChannel = nameToChannelCache.get(channelName);
if (gameChannel != null && gameChannel.getOwnerName().equals(ownerName)) {
if (gameChannel != null && gameChannel.getOwnerName().equalsIgnoreCase(ownerName)) {
config = findChannel(channelName);
return config;
}
return null;
}
// Get the highest priority owner for this channel name and relookup
GameChannel gameChannel = nameToChannelCache.get(channelName);
return gameChannel != null ? get(gameChannel) : null;
}