https://github.com/allejo/bzdblock
A BZFlag plug-in that allows server owners to lock BZDB variables from being changed by admins
https://github.com/allejo/bzdblock
bzflag bzflag-plugin
Last synced: 3 months ago
JSON representation
A BZFlag plug-in that allows server owners to lock BZDB variables from being changed by admins
- Host: GitHub
- URL: https://github.com/allejo/bzdblock
- Owner: allejo
- License: mit
- Created: 2020-09-20T05:10:37.000Z (over 4 years ago)
- Default Branch: release
- Last Pushed: 2020-09-21T15:51:52.000Z (over 4 years ago)
- Last Synced: 2025-01-15T03:05:24.748Z (5 months ago)
- Topics: bzflag, bzflag-plugin
- Language: C++
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# BZDB Lock
[](https://github.com/allejo/bzdbLock/releases/latest)

[](LICENSE.md)A BZFlag plug-in that allows you to restrict which BZDB settings an admin is allowed or not allowed to change.
The plugin has two modes, a "whitelist" or "blacklist" mode. In whitelist mode, only the specified BZDB will allowed be to changed. In blacklist mode, every BZDB variable **except** for those listed will be allowed to be changed.
## Requirements
- C++11
- BZFS 2.4.4+This plug-in follows [my standard instructions for compiling plug-ins](https://github.com/allejo/docs.allejo.io/wiki/BZFlag-Plug-in-Distribution).
## Usage
### Loading the plug-in
This plugin expects an INI configuration file with either the blacklist or whitelist definition specified.
```
-loadplugin bzdbLock,/path/to/variables.cfg
```### Configuration File
The configuration is a standard INI file using either the `bzdb_blacklist` or `bzdb_whitelist` keys. [A sample configuration](./bzdbLock.cfg) is provided in this repo.
The only important part about these key/value pairs are the keys; the values are ignored and can be anything at the moment.
```ini
[bzdb_blacklist]
_worldSize=0
```### Custom Slash Commands
| Command | Permission | Description |
| ------- | ---------- | ----------- |
|/bzdblock [list]
| setAll | Lists all of the variables that can or cannot be modified depending on the mode the plugin is in. |
|/set <param>
| setAll | Overrides the command to disable setting locked variables only. |
|/reload [all\|bzdbLockList]
| setAll | Re-read the configuration file to load the BZDB lock list. |### Inter-Plug-in Communication
This plug-in supports using generic callbacks for inter-plug-in communication. Since this plug-in uses semantic versioning in its name, accessing this plugin via a generic callback is not feasible. For this reason, the plug-in registers a clip field under the name of `allejo/bzdbLock`.
```cpp
std::string bzdbLock = bz_getclipFieldString("allejo/bzdbLock");std::string variableName = "_worldSize";
void* data = variableName;
int response = bz_callPluginGenericCallback(bzdbLock.c_str(), "isBZDBVarLocked", data);
```| Callback Name | Expected Type | Return Type |
| ------------- | ------------- | ----------- |
| `isBZDBVarLocked` | `std::string` | An integer representation of a boolean on whether a variable is locked. |#### Notes
- The value of `-9999` will be returned in the case of an error
#### Warning
- Passing an object of the incorrect type will lead to unexpected behavior (and possibly server crashes?)
## License
[MIT](LICENSE.md)