mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
add configuration option to force local translations
fix silly bug with no being able to claim ownership continue work on configuration via webfront
This commit is contained in:
@ -35,7 +35,7 @@ namespace SharedLibraryCore.Commands
|
||||
public override async Task ExecuteAsync(GameEvent E)
|
||||
{
|
||||
if (await (E.Owner.Manager.GetClientService() as ClientService).GetOwnerCount() == 0 &&
|
||||
!E.Target.SetLevel(EFClient.Permission.Owner, Utilities.IW4MAdminClient(E.Owner)).Failed)
|
||||
!E.Origin.SetLevel(EFClient.Permission.Owner, Utilities.IW4MAdminClient(E.Owner)).Failed)
|
||||
{
|
||||
E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_OWNER_SUCCESS"]);
|
||||
}
|
||||
@ -484,7 +484,7 @@ namespace SharedLibraryCore.Commands
|
||||
// we don't really want to tell them if they're demoted haha
|
||||
if (newPerm > oldPerm)
|
||||
{
|
||||
ActiveClient.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_SUCCESS_TARGET"].FormatExt(newPerm)));
|
||||
ActiveClient.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_SUCCESS_TARGET"].FormatExt(newPerm));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,64 +1,92 @@
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using SharedLibraryCore.Helpers;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SharedLibraryCore.Configuration
|
||||
{
|
||||
public class ApplicationConfiguration : IBaseConfiguration
|
||||
{
|
||||
[LocalizedDisplayName("SETUP_ENABLE_WEBFRONT")]
|
||||
[LinkedConfiguration("WebfrontBindUrl", "ManualWebfrontUrl")]
|
||||
public bool EnableWebFront { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_BIND_URL")]
|
||||
public string WebfrontBindUrl { get; set; }
|
||||
[ConfigurationOptional]
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_MANUAL_URL")]
|
||||
public string ManualWebfrontUrl { get; set; }
|
||||
|
||||
[LocalizedDisplayName("SETUP_ENABLE_MULTIOWN")]
|
||||
public bool EnableMultipleOwners { get; set; }
|
||||
[LocalizedDisplayName("SETUP_ENABLE_STEPPEDPRIV")]
|
||||
public bool EnableSteppedHierarchy { get; set; }
|
||||
[LocalizedDisplayName("SETUP_DISPLAY_SOCIAL")]
|
||||
public bool EnableSocialLink { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_USE_LOCAL_TRANSLATIONS")]
|
||||
public bool UseLocalTranslations { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_IGNORE_BOTS")]
|
||||
public bool IgnoreBots { get; set; }
|
||||
|
||||
[LinkedConfiguration("CustomSayName")]
|
||||
[LocalizedDisplayName("SETUP_ENABLE_CUSTOMSAY")]
|
||||
public bool EnableCustomSayName { get; set; }
|
||||
[LocalizedDisplayName("SETUP_SAY_NAME")]
|
||||
public string CustomSayName { get; set; }
|
||||
|
||||
[LocalizedDisplayName("SETUP_DISPLAY_SOCIAL")]
|
||||
[LinkedConfiguration("SocialLinkAddress", "SocialLinkTitle")]
|
||||
public bool EnableSocialLink { get; set; }
|
||||
[LocalizedDisplayName("SETUP_SOCIAL_LINK")]
|
||||
public string SocialLinkAddress { get; set; }
|
||||
[LocalizedDisplayName("SETUP_SOCIAL_TITLE")]
|
||||
public string SocialLinkTitle { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_BIND_URL")]
|
||||
public string WebfrontBindUrl { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_MANUAL_URL")]
|
||||
public string ManualWebfrontUrl { get; set; }
|
||||
public string WebfrontUrl => string.IsNullOrEmpty(ManualWebfrontUrl) ? WebfrontBindUrl?.Replace("0.0.0.0", "127.0.0.1") : ManualWebfrontUrl;
|
||||
|
||||
[LocalizedDisplayName("SETUP_USE_CUSTOMENCODING")]
|
||||
[LinkedConfiguration("CustomParserEncoding")]
|
||||
public bool EnableCustomParserEncoding { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENCODING")]
|
||||
public string CustomParserEncoding { get; set; }
|
||||
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENABLE_WHITELIST")]
|
||||
[LinkedConfiguration("WebfrontConnectionWhitelist")]
|
||||
public bool EnableWebfrontConnectionWhitelist { get; set; }
|
||||
public List<string> WebfrontConnectionWhitelist { get; set; }
|
||||
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")]
|
||||
[LinkedConfiguration("CustomLocale")]
|
||||
public bool EnableCustomLocale { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")]
|
||||
public string CustomLocale { get; set; }
|
||||
|
||||
[ConfigurationOptional]
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_DB_PROVIDER")]
|
||||
public string DatabaseProvider { get; set; } = "sqlite";
|
||||
[ConfigurationOptional]
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CONNECTION_STRING")]
|
||||
public string ConnectionString { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_RCON_POLLRATE")]
|
||||
public int RConPollRate { get; set; } = 5000;
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_IGNORE_BOTS")]
|
||||
public bool IgnoreBots { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_MAX_TB")]
|
||||
public TimeSpan MaximumTempBanTime { get; set; } = new TimeSpan(24 * 30, 0, 0);
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENABLE_WHITELIST")]
|
||||
public bool EnableWebfrontConnectionWhitelist { get; set; }
|
||||
public List<string> WebfrontConnectionWhitelist { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_USE_LOCAL_TRANSLATIONS")]
|
||||
public bool UseLocalTranslations { get; set; }
|
||||
public string Id { get; set; }
|
||||
public List<ServerConfiguration> Servers { get; set; }
|
||||
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_AUTOMESSAGE_PERIOD")]
|
||||
public int AutoMessagePeriod { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_AUTOMESSAGES")]
|
||||
public List<string> AutoMessages { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_GLOBAL_RULES")]
|
||||
public List<string> GlobalRules { get; set; }
|
||||
public List<MapConfiguration> Maps { get; set; }
|
||||
public List<QuickMessageConfiguration> QuickMessages { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_DISALLOWED_NAMES")]
|
||||
public List<string> DisallowedClientNames { get; set; }
|
||||
public List<ServerConfiguration> Servers { get; set; }
|
||||
|
||||
|
||||
[ConfigurationIgnore]
|
||||
public string Id { get; set; }
|
||||
[ConfigurationIgnore]
|
||||
public List<MapConfiguration> Maps { get; set; }
|
||||
[ConfigurationIgnore]
|
||||
public List<QuickMessageConfiguration> QuickMessages { get; set; }
|
||||
[ConfigurationIgnore]
|
||||
public string WebfrontUrl => string.IsNullOrEmpty(ManualWebfrontUrl) ? WebfrontBindUrl?.Replace("0.0.0.0", "127.0.0.1") : ManualWebfrontUrl;
|
||||
|
||||
public IBaseConfiguration Generate()
|
||||
{
|
||||
|
11
SharedLibraryCore/Helpers/ConfigurationIgnore.cs
Normal file
11
SharedLibraryCore/Helpers/ConfigurationIgnore.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Helpers
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
|
||||
public class ConfigurationIgnore : Attribute
|
||||
{
|
||||
}
|
||||
}
|
11
SharedLibraryCore/Helpers/ConfigurationOptional.cs
Normal file
11
SharedLibraryCore/Helpers/ConfigurationOptional.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Helpers
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
|
||||
public class ConfigurationOptional : Attribute
|
||||
{
|
||||
}
|
||||
}
|
15
SharedLibraryCore/Helpers/LinkedConfiguration.cs
Normal file
15
SharedLibraryCore/Helpers/LinkedConfiguration.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace SharedLibraryCore.Helpers
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
|
||||
public class LinkedConfiguration : Attribute
|
||||
{
|
||||
public string[] LinkedPropertyNames { get; set; }
|
||||
|
||||
public LinkedConfiguration(params string[] linkedPropertyNames)
|
||||
{
|
||||
LinkedPropertyNames = linkedPropertyNames;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user