Add bitwise SetBitFlags for AdminId and GroupId (#1677)
* Add bitwise SetFlags for AdminId * Inline SetFlags natives
This commit is contained in:
parent
0e4894e8db
commit
c5049990a3
@ -191,6 +191,20 @@ methodmap AdminId {
|
||||
// @param enabled True to enable, false to disable.
|
||||
public native void SetFlag(AdminFlag flag, bool enabled);
|
||||
|
||||
// Sets multiple bitwise flags to be enabled/disabled on an admin.
|
||||
//
|
||||
// @param flags Bitwise admin flags (ADMFLAG_*).
|
||||
// @param enabled True to set the flag, false to unset/disable.
|
||||
public void SetBitFlags(int flags, bool enabled)
|
||||
{
|
||||
AdminFlag flagArray[AdminFlags_TOTAL];
|
||||
int num = FlagBitsToArray(flags, flagArray, sizeof(flagArray));
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
this.SetFlag(flagArray[i], enabled);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns whether or not a flag is enabled on an admin.
|
||||
//
|
||||
// @param flag Admin flag to use.
|
||||
@ -278,6 +292,20 @@ methodmap GroupId {
|
||||
// @param enabled True to set the flag, false to unset/disable.
|
||||
public native void SetFlag(AdminFlag flag, bool enabled);
|
||||
|
||||
// Adds or removes multiple bitwise flags from a group's flag set.
|
||||
//
|
||||
// @param flags Bitwise admin flags (ADMFLAG_*).
|
||||
// @param enabled True to set the flag, false to unset/disable.
|
||||
public void SetBitFlags(int flags, bool enabled)
|
||||
{
|
||||
AdminFlag flagArray[AdminFlags_TOTAL];
|
||||
int num = FlagBitsToArray(flags, flagArray, sizeof(flagArray));
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
this.SetFlag(flagArray[i], enabled);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the flag set that is added to users from this group.
|
||||
//
|
||||
// @return Bitstring containing the flags enabled.
|
||||
|
Loading…
Reference in New Issue
Block a user