forked from akanyan/mu3-mods
feat!: rename and reorganize
This commit is contained in:
29
Extras/Blacklist/MU3.User/patch_UserManager.cs
Normal file
29
Extras/Blacklist/MU3.User/patch_UserManager.cs
Normal file
@ -0,0 +1,29 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user