Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
TomGrobbe committed Mar 19, 2019
2 parents 61b8644 + 4707fba commit f3b9e72
Show file tree
Hide file tree
Showing 10 changed files with 502 additions and 7,862 deletions.
4 changes: 3 additions & 1 deletion SharedClasses/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public enum Setting
vmenu_pvp_mode,
vmenu_disable_server_info_convars,
vmenu_player_names_distance,
vmenu_disable_entity_outlines_tool
vmenu_disable_entity_outlines_tool,
vmenu_bans_database_filepath,
vmenu_bans_use_database
}

public static bool GetSettingsBool(Setting setting)
Expand Down
Binary file removed dependencies/server/CitizenFX.Core.dll
Binary file not shown.
7,685 changes: 0 additions & 7,685 deletions dependencies/server/CitizenFX.Core.xml

This file was deleted.

10 changes: 8 additions & 2 deletions vMenu/CommonFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -630,13 +630,19 @@ public static async void BanPlayer(Player player, bool forever)
{
if (double.TryParse(banDurationHours, out double banHours))
{
TriggerServerEvent("vMenu:TempBanPlayer", player.ServerId, banHours, banReason);
if (banHours > 0.0)
TriggerServerEvent("vMenu:TempBanPlayer", player.ServerId, banHours, banReason);
else
Notify.Error("You need to enter a ban duration, enter a value ~h~between~h~ 1 and 720!");
}
else
{
if (int.TryParse(banDurationHours, out int banHoursInt))
{
TriggerServerEvent("vMenu:TempBanPlayer", player.ServerId, (double)banHoursInt, banReason);
if ((double)banHoursInt > 0.0)
TriggerServerEvent("vMenu:TempBanPlayer", player.ServerId, (double)banHoursInt, banReason);
else
Notify.Error("You need to enter a ban duration, enter a value ~h~between~h~ 1 and 720!");
}
else
{
Expand Down
15 changes: 14 additions & 1 deletion vMenu/menus/PlayerAppearance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ private void CreateMenu()

// Create the menu items.
MenuItem pedCustomization = new MenuItem("Ped Customization", "Modify your ped's appearance.") { Label = "→→→" };
MenuItem saveCurrentPed = new MenuItem("Save Ped", "Save your current ped. Note for the MP Male/Female peds this won't save most of their customization, just because that's impossible. Create those characters in the MP Character creator instead.");
MenuItem savedPedsBtn = new MenuItem("Saved Peds", "Edit, rename, clone, spawn or delete saved peds.") { Label = "→→→" };
MenuItem spawnPedsBtn = new MenuItem("Spawn Peds", "Change ped model by selecting one from the list or by selecting an addon ped from the list.") { Label = "→→→" };

Expand All @@ -82,6 +83,7 @@ private void CreateMenu()

// Add items to the menu.
menu.AddMenuItem(pedCustomization);
menu.AddMenuItem(saveCurrentPed);
menu.AddMenuItem(savedPedsBtn);
menu.AddMenuItem(spawnPedsBtn);

Expand Down Expand Up @@ -503,12 +505,23 @@ async void SpawnPed(Menu m, MenuItem item, int index)
};

// Handle button presses.
menu.OnItemSelect += (sender, item, index) =>
menu.OnItemSelect += async (sender, item, index) =>
{
if (item == pedCustomization)
{
RefreshCustomizationMenu();
}
else if (item == saveCurrentPed)
{
if (await SavePed())
{
Notify.Success("Successfully saved your new ped.");
}
else
{
Notify.Error("Could not save your current ped, does that save name already exist?");
}
}
};


Expand Down
598 changes: 435 additions & 163 deletions vMenuServer/BanManager.cs

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion vMenuServer/MainServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public enum LogLevel
/// <param name="data"></param>
public static void Log(dynamic data, LogLevel level = LogLevel.none)
{
if (MainServer.DebugMode)
if (MainServer.DebugMode || level == LogLevel.error || level == LogLevel.warning)
{
string prefix = "[vMenu] ";
if (level == LogLevel.error)
Expand Down Expand Up @@ -358,6 +358,10 @@ public MainServer()
Debug.WriteLine("vmenuserver weather <new weather type | dynamic <true | false>>");
Debug.WriteLine("vmenuserver time <freeze|<hour> <minute>>");
}
else if (args[0].ToString().ToLower() == "migrate" && source < 1)
{
BanManager.MigrateBansToDatabase();
}
else
{
Debug.WriteLine($"vMenu is currently running version: {Version}. Try ^5vmenuserver help^7 for info.");
Expand Down Expand Up @@ -463,6 +467,11 @@ public MainServer()
// Start the loops
Tick += WeatherLoop;
Tick += TimeLoop;

if (GetSettingsBool(Setting.vmenu_bans_use_database) && !string.IsNullOrEmpty(LoadResourceFile(GetCurrentResourceName(), "bans.json")))
{
Log("^3You have setup vMenu to use the SQLite database for storing banned players, however you also have a bans.json file!\nPlease check your configuration and only use ONE of these methods at a time.\nIf you no longer want to use the bans.json file, feel free to delete it after migrating to the database!^7", LogLevel.warning);
}
}
}
#endregion
Expand Down
16 changes: 16 additions & 0 deletions vMenuServer/config/permissions.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,22 @@ setr vmenu_player_names_distance 500.0
setr vmenu_disable_entity_outlines_tool false


#######################################################################################################################################################
# Database (SQLite) player bans storage options. USE AT YOUR OWN RISK, DON'T TOUCH IF YOU DON'T KNOW WHAT YOU'RE DOING. NO SUPPORT WILL BE PROVIDED.

# If you put a folder location here, then the filepath must end with a '/'! Leave this field empty if you don't know what you're doing.
# For example either use "" or "resources/vMenu/". Filepath will start relative from the same folder that contains your server.cfg.
setr vmenu_bans_database_filepath ""

# Set this to true if you want to use SQLite for storing banned players instead of the bans.json, this will improve performance.
# Set this to false if you already have a bans.json with banned players in it, then type 'vmenuserver migrate' in the server console.
# Then make a backup of your bans.json file, and delete the original. After that stop the server and set this to true, then restar the server.
# You should now have a working SQLite database setup for your banned players.
setr vmenu_bans_use_database true
#######################################################################################################################################################



#############################################################################################
# vMenu PERMISSIONS #
# For help, see https://docs.vespura.com/vmenu/permissions-ref #
Expand Down
4 changes: 0 additions & 4 deletions vMenuServer/packages.config

This file was deleted.

21 changes: 16 additions & 5 deletions vMenuServer/vMenuServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -39,10 +41,6 @@
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="CitizenFX.Core">
<HintPath>..\dependencies\server\CitizenFX.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dependencies\shared\Newtonsoft.Json.dll</HintPath>
Expand All @@ -52,7 +50,9 @@
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.CSharp">
<Private>False</Private>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
Expand Down Expand Up @@ -83,6 +83,17 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Data.SQLite.Core">
<Version>1.0.110</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CitizenFX.Core.Server">
<Version>1.0.1141</Version>
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent Condition=" '$(OS)' == 'Unix'">
Expand Down

0 comments on commit f3b9e72

Please sign in to comment.