forked from akanyan/mu3-mods
feat: implement Blacklist
This commit is contained in:
7
Blacklist/Blacklist.csproj
Normal file
7
Blacklist/Blacklist.csproj
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyName>Assembly-CSharp.Blacklist.mm</AssemblyName>
|
||||||
|
<Description>Block custom charts from being uploaded</Description>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="..\Mu3Mods.csproj" />
|
||||||
|
</Project>
|
28
Blacklist/MU3.User/patch_UserManager.cs
Normal file
28
Blacklist/MU3.User/patch_UserManager.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using MU3.DataStudio;
|
||||||
|
|
||||||
|
namespace MU3.User;
|
||||||
|
class patch_UserManager: UserManager {
|
||||||
|
private bool _loadedBlacklistData = false;
|
||||||
|
private int _blacklistMin = -1;
|
||||||
|
private int _blacklistMax = -1;
|
||||||
|
public extern UserFumen orig_getUserFumen(int musicId, FumenDifficulty difficulty, bool create);
|
||||||
|
public new UserFumen getUserFumen(int musicId, FumenDifficulty difficulty, bool create) {
|
||||||
|
if(!_loadedBlacklistData) {
|
||||||
|
loadBlacklistData();
|
||||||
|
}
|
||||||
|
if(musicId >= _blacklistMin && musicId <= _blacklistMax) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return orig_getUserFumen(musicId, difficulty, create);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadBlacklistData() {
|
||||||
|
using IniFile iniFile = new("mu3.ini");
|
||||||
|
|
||||||
|
_blacklistMin = iniFile.getIntValue("Extra", "BlacklistMin", 10000);
|
||||||
|
_blacklistMax = iniFile.getIntValue("Extra", "BlacklistMax", 19999);
|
||||||
|
|
||||||
|
_loadedBlacklistData = true;
|
||||||
|
}
|
||||||
|
}
|
@ -53,8 +53,7 @@ class patch_UICredit: UICredit {
|
|||||||
groupIcon_.image.rectTransform.pivot = new Vector2(0f, 0.5f);
|
groupIcon_.image.rectTransform.pivot = new Vector2(0f, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iniFile.getValue("Extra", "HideVersion", true))
|
if(iniFile.getValue("Extra", "HideVersion", true)) {
|
||||||
{
|
|
||||||
version_.transform.localScale = new Vector3(0, 0, 0);
|
version_.transform.localScale = new Vector3(0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user