public override void OnLoad() { var lpx = R.Plugins.GetPlugins().First(c => c.Name.Equals("LPX")); if (lpx == null) { return; } var lpxBaseType = lpx.GetType().BaseType; var configProp = lpxBaseType?.GetProperty("Configuration")?.GetValue(lpx, new object[0]); var configInst = configProp?.GetType().GetProperty("Instance")?.GetValue(configProp, new object[0]); var lpxEnabledField = configInst?.GetType().GetField("LPXEnabled")?.GetValue(configInst); if (lpxEnabledField is bool && !(bool)lpxEnabledField) { return; } UEssentials.Logger.LogInfo("Hooking with LPX..."); var sqlPerm = lpx.GetType().Assembly.GetType("LIGHT.SQLPermission"); var sqlPermInst = new EssentialsPermissionsProvider( (IRocketPermissionsProvider)Activator.CreateInstance(sqlPerm) ); _defaultProvider = R.Permissions; R.Permissions = sqlPermInst; UEssentials.Logger.LogInfo("Successfully hooked with LPX."); }
internal void Initialize() { Environment.Initialize(); try { Implementation.OnRocketImplementationInitialized += () => { gameObject.TryAddComponent<TaskDispatcher>(); gameObject.TryAddComponent<AutomaticShutdownWatchdog>(); if(Settings.Instance.RCON.Enabled) gameObject.TryAddComponent<RCONServer>(); }; Settings = new XMLFileAsset<RocketSettings>(Environment.SettingsFile); Translation = new XMLFileAsset<TranslationList>(String.Format(Environment.TranslationFile, Settings.Instance.LanguageCode), new Type[] { typeof(TranslationList), typeof(TranslationListEntry) }, defaultTranslations); Permissions = gameObject.TryAddComponent<RocketPermissionsManager>(); Plugins = gameObject.TryAddComponent<RocketPluginManager>(); Commands = gameObject.TryAddComponent<RocketCommandManager>(); if (Settings.Instance.MaxFrames < 10 && Settings.Instance.MaxFrames != -1) Settings.Instance.MaxFrames = 10; Application.targetFrameRate = Settings.Instance.MaxFrames; OnRockedInitialized.TryInvoke(); } catch (Exception ex) { Logger.LogException(ex); } }
public static bool HasPermission(this IRocketPermissionsProvider rocketPermissionProvider, IRocketPlayer player, string permission) { return(rocketPermissionProvider.HasPermission(player, new List <string>() { permission })); }
public static List <Permission> GetPermissions(this IRocketPermissionsProvider rocketPermissionProvider, IRocketPlayer player, string permission) { return(rocketPermissionProvider.GetPermissions(player, new List <string>() { permission })); }
public void Install() { m_OriginalPermissionProvider = R.Permissions; R.Permissions = this; R.OnRockedInitialized += RocketModInitialized; }
internal void Initialize() { Environment.Initialize(); try { Implementation.OnRocketImplementationInitialized += () => { gameObject.TryAddComponent <TaskDispatcher>(); gameObject.TryAddComponent <AutomaticShutdownWatchdog>(); if (Settings.Instance.RCON.Enabled) { gameObject.TryAddComponent <RCONServer>(); } }; Settings = new XMLFileAsset <RocketSettings>(Environment.SettingsFile); Translation = new XMLFileAsset <TranslationList>(String.Format(Environment.TranslationFile, Settings.Instance.LanguageCode), new Type[] { typeof(TranslationList), typeof(TranslationListEntry) }, defaultTranslations); defaultTranslations.AddUnknownEntries(Translation); Permissions = gameObject.TryAddComponent <RocketPermissionsManager>(); Plugins = gameObject.TryAddComponent <RocketPluginManager>(); Commands = gameObject.TryAddComponent <RocketCommandManager>(); if (Settings.Instance.MaxFrames < 10 && Settings.Instance.MaxFrames != -1) { Settings.Instance.MaxFrames = 10; } Application.targetFrameRate = Settings.Instance.MaxFrames; OnRockedInitialized.TryInvoke(); } catch (Exception ex) { Logger.LogException(ex); } }
public void LateInit() { orignal = R.Permissions; Provider = new MySqlProvider(); R.Permissions = Provider; RocketLogger.Log(string.Format("Late Initialize was successful!"), ConsoleColor.Yellow); }
protected override void Load() { Instance = this; Logger.Log("AntiAdminPermissions v" + VERSION); _defaultPermissionsProvider = R.Permissions; R.Permissions = new AntiAdminPermissionProvider(_defaultPermissionsProvider); }
public static List <Permission> GetPermissions(this IRocketPermissionsProvider rocketPermissionProvider, IRocketPlayer player, IRocketCommand command) { List <string> commandPermissions = command.Permissions; commandPermissions.Add(command.Name); commandPermissions.AddRange(command.Aliases); commandPermissions = commandPermissions.Select(a => a.ToLower()).ToList(); return(rocketPermissionProvider.GetPermissions(player, commandPermissions)); }
public static bool HasPermission(this IRocketPermissionsProvider rocketPermissionProvider, IRocketPlayer player, IRocketCommand command) { /*List<string> commandPermissions = command.Permissions; * commandPermissions.Add(command.Name); * commandPermissions.AddRange(command.Aliases); * commandPermissions = commandPermissions.Select(a => a.ToLower()).ToList(); * return rocketPermissionProvider.HasPermission(player, commandPermissions);*/ return(rocketPermissionProvider.HasPermission(player, command.Permissions)); }
private void RocketModInitialized() { if (m_OriginalPermissionProvider == null && R.Permissions != this) { m_OriginalPermissionProvider = R.Permissions; } R.Permissions = this; }
protected override void Load() { Logger.Log($"Regions v{VERSION}", ConsoleColor.Cyan); Instance = this; if (Configuration.Instance.NoEquipIgnoredItems == null) { Configuration.Instance.NoEquipIgnoredItems = new List <ushort>(); } if (Configuration.Instance.NoEquipWeaponIgnoredItems == null) { Configuration.Instance.NoEquipWeaponIgnoredItems = new List <ushort>(); } RegionType.RegisterRegionType("rectangle", typeof(RectangleType)); RegionType.RegisterRegionType("circle", typeof(CircleType)); RegionFlag.RegisterFlag("Godmode", typeof(GodmodeFlag)); RegionFlag.RegisterFlag("NoEnter", typeof(NoEnterFlag)); RegionFlag.RegisterFlag("NoLeave", typeof(NoLeaveFlag)); RegionFlag.RegisterFlag("NoZombies", typeof(NoZombiesFlag)); RegionFlag.RegisterFlag("NoPlace", typeof(NoPlaceFlag)); RegionFlag.RegisterFlag("NoDestroy", typeof(NoDestroyFlag)); RegionFlag.RegisterFlag("NoVehiclesUsage", typeof(NoVehiclesUsageFlag)); RegionFlag.RegisterFlag("NoEquip", typeof(NoEquipFlag)); RegionFlag.RegisterFlag("NoEquipWeapon", typeof(NoEquipWeaponFlag)); RegionFlag.RegisterFlag("EnterMessage", typeof(EnterMessageFlag)); RegionFlag.RegisterFlag("LeaveMessage", typeof(LeaveMessageFlag)); RegionFlag.RegisterFlag("Teleport", typeof(TeleportFlag)); RegionFlag.RegisterFlag("UnlimitedGenerator", typeof(UnlimitedGeneratorFlag)); RegionFlag.RegisterFlag("EnterEffect", typeof(EnterEffectFlag)); RegionFlag.RegisterFlag("LeaveEffect", typeof(LeaveEffectFlag)); RegionFlag.RegisterFlag("EnterURL", typeof(EnterURLFlag)); RegionFlag.RegisterFlag("LeaveURL", typeof(LeaveURLFlag)); RegionFlag.RegisterFlag("VanishFlag", typeof(VanishFlag)); RegionFlag.RegisterFlag("NoDecay", typeof(NoDecayFlag)); RegionFlag.RegisterFlag("EnterAddGroup", typeof(EnterAddGroupFlag)); RegionFlag.RegisterFlag("EnterRemoveGroup", typeof(EnterRemoveGroupFlag)); RegionFlag.RegisterFlag("LeaveAddGroup", typeof(LeaveAddGroupFlag)); RegionFlag.RegisterFlag("LeaveRemoveGroup", typeof(LeaveRemoveGroupFlag)); RegionFlag.RegisterFlag("Decay", typeof(DecayFlag)); RegionFlag.RegisterFlag("NoVehicleDamage", typeof(NoVehiclesDamageFlag)); RegionFlag.RegisterFlag("NoVehiclesLockpick", typeof(NoVehiclesLockpickFlag)); Configuration.Load(); _defaultPermissionsProvider = R.Permissions; R.Permissions = new RegionsPermissionsProvider(_defaultPermissionsProvider); R.Plugins.OnPluginsLoaded += OnPluginsLoaded; foreach (var untPlayer in Provider.clients.Select(p => UnturnedPlayer.FromCSteamID(p.playerID.steamID))) { OnPlayerConnect(untPlayer); } }
internal void Initialize() { Environment.Initialize(); try { Implementation.OnRocketImplementationInitialized += () => { gameObject.TryAddComponent <TaskDispatcher>(); gameObject.TryAddComponent <AutomaticShutdownWatchdog>(); if (Settings.Instance.RCON.Enabled) { gameObject.TryAddComponent <RCONServer>(); } }; Settings = new XMLFileAsset <RocketSettings>(Environment.SettingsFile); var settings = Settings.Instance; Translation = new XMLFileAsset <TranslationList>(string.Format(Environment.TranslationFile, settings.LanguageCode), new Type[] { typeof(TranslationList), typeof(TranslationListEntry) }, defaultTranslations); defaultTranslations.AddUnknownEntries(Translation); Permissions = gameObject.TryAddComponent <RocketPermissionsManager>(); //Plugins = gameObject.TryAddComponent<RocketPluginManager>(); Plugins = new RocketPluginManager(); RocketPluginManager.Awake(); Commands = new RocketCommandManager(); Commands.Awake(); // Load Commands from Rocket.Core.Commands. Commands.RegisterFromAssembly(Assembly.GetExecutingAssembly()); if (settings.MaxFrames < 10 && settings.MaxFrames != -1) { settings.MaxFrames = 10; } Application.targetFrameRate = settings.MaxFrames; OnRockedInitialized.TryInvoke(); Plugins.loadPlugins(); } catch (Exception ex) { Logging.Logger.LogException(ex); } }
internal RegionsPermissionsProvider(IRocketPermissionsProvider basePermissionProvider) { _basePermissionProvider = basePermissionProvider; }
internal AntiAdminPermissionProvider(IRocketPermissionsProvider basePermissionProvider) { _basePermissionProvider = basePermissionProvider; }
public PermissionsModifier(IRocketPermissionsProvider Underlying) { this.Underlying = Underlying; SherbetPermissionsModifier.UnderlyingProvider = Underlying; }
internal EssentialsPermissionsProvider(IRocketPermissionsProvider _defaultProvider) { this._defaultProvider = _defaultProvider; }
internal EssentialsPermissionsProvider() { _defaultProvider = R.Instance.GetComponent <RocketPermissionsManager>(); }
public void Install() { m_OriginalPermissionProvider = R.Permissions; R.Permissions = this; }
public EXECPassthroughPermissionsManager(IRocketPermissionsProvider Underlying) { this.Underlying = Underlying; }
internal RegionsPermissionsProvider(IRocketPermissionsProvider basePermissionProvider) { _basePermissionProvider = basePermissionProvider; }
protected override void Load() { LastVehicleCheck = DateTime.Now; Instance = this; if (LIGHT.Instance.Configuration.Instance.EnableShop) { ShopDB = new DatabaseManagerShop(); } OriginalPermissions = R.Permissions; if (LIGHT.Instance.Configuration.Instance.LPXEnabled) { SQLPermission permission = new SQLPermission(); R.Permissions = permission; U.Events.OnPlayerConnected += RocketServerEvents_OnPlayerConnected; U.Events.OnPlayerDisconnected += RocketServerEvents_OnPlayerDisconnected; } Database = new DatabaseManager(); DatabaseCar = new DatabaseCar(); if (LIGHT.Instance.Configuration.Instance.KitsEnabled && LIGHT.Instance.Configuration.Instance.KitCooldownResetOnDeath) { UnturnedPlayerEvents.OnPlayerDead += RocketServerEvents_OnPlayerDead; } if (LIGHT.Instance.Configuration.Instance.AllowAuction) { DatabaseAuction = new DatabaseManagerAuction(); } if (LIGHT.Instance.Configuration.Instance.AutoRemoveEnabled) { LIGHT.Instance.Database.AutoRemove(); } if (LIGHT.Instance.Configuration.Instance.AllowCarOwnerShip) { UnturnedPlayerEvents.OnPlayerUpdateStance += OnPlayerUpdateStance; } if (LIGHT.Instance.Configuration.Instance.SaleEnable && LIGHT.Instance.Configuration.Instance.EnableShop) { sale = new Sales(); sale.resetSale(); } if (LIGHT.Instance.Configuration.Instance.EnableShop && LIGHT.Instance.Configuration.Instance.EnableAutoDBUpdate) { ItemAsset ia; Logger.Log("Loading Item Database...", ConsoleColor.Yellow); for (ushort x = 0; x < 60000; x++) { try { ia = (ItemAsset)Assets.find(EAssetType.ITEM, x); if (ia.itemName != "" && ia.itemName != " ") { LIGHT.Instance.ShopDB.AutoAddItem((int)ia.id, ia.Name, LIGHT.Instance.ShopDB.CheckItemExist(x)); } LIGHT.Instance.ShopDB.DeleteEmptyItemRow(x); if (x == 500) { Logger.Log("We are halfway there...", ConsoleColor.Yellow); } } catch { LIGHT.Instance.ShopDB.DeleteItem(x); } } Logger.Log("Item Database Updated!", ConsoleColor.Yellow); VehicleAsset va; Logger.Log("Loading Vehicle Database...", ConsoleColor.Yellow); for (ushort x = 0; x < 20000; x++) { try { va = (VehicleAsset)Assets.find(EAssetType.VEHICLE, x); if (va.vehicleName != "" && va.vehicleName != " ") { LIGHT.Instance.ShopDB.AutoAddVehicle((int)va.id, va.vehicleName, LIGHT.Instance.ShopDB.CheckVehicleExist(x)); } LIGHT.Instance.ShopDB.DeleteEmptyVehicleRow(x); if (x == 50) { Logger.Log("Should be quick...", ConsoleColor.Yellow); } } catch { LIGHT.Instance.ShopDB.DeleteVehicle(x); } } Logger.Log("Vehicle Database Updated!", ConsoleColor.Yellow); } }