BanHandler is a basic API to add and remove players from a banlist. If a player is on that banlist, they will be disconnected each time they join that realm.
import { PluginApi } from './@interface/pluginApi.i'
import { BanHandler } from './@interface/BanHandler.i'
class examplePlugin {
private api: PluginApi
constructor(api: PluginApi) {
this.api = api
}
public onLoaded(): void {
this.api.getLogger().info('Plugin loaded!')
}
public onEnabled(): void {
this.api.getLogger().info('Plugin enabled!')
const banhandler = this.api.getPlugins().get("banhandler")
const plugin = banhandler.plugin as unknown as BanHandler // The plugins banlist api
for (const [, player] of this.api.getPlayerManager().getPlayerList()) {
plugin.userAdd({
player,
}, "Hacking/Name Spoof", "Server")
}
}
public onDisabled(): void {
this.api.getLogger().info('Plugin disabled!')
}
}
export = examplePlugin
onEnabled(): void
Fires when BeRP enables the plugin.
onDisabled(): void
Fires when BeRP disables the plugin.
userAdd(options: Options, reason: String, auth: String): Promise<boolean>
Adds a user to the banlist.
Types: Options
userRemove(options: Options): Promise<boolean>
Removes a user to the banlist.
Types: Options
userExist(options: Options): Promise<boolean>
Checks if a user exists in the banlist.
Types: Options
getUser(options: Options): Promise<BanlistEntry>
Gets a players banlist entry.
Types: Options, BanlistEntry
getAllUsers(): Promise<BanlistEntry[]>
Gets all the player entries in the banlist.
Types: BanlistEntry
getConfig(): Config
Returns the config for the banlist.
Types: Config
getDatabase(): Database
Returns the database.
Types: Database