Skip to content

BeRP-Plugins/BanHandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BanHandler

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.

Using in other Plugins

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

Methods

onEnabled

onEnabled(): void

Fires when BeRP enables the plugin.

onDisabled

onDisabled(): void

Fires when BeRP disables the plugin.

userAdd

userAdd(options: Options, reason: String, auth: String): Promise<boolean>

Adds a user to the banlist.

Types: Options

userRemove

userRemove(options: Options): Promise<boolean>

Removes a user to the banlist.

Types: Options

userExist

userExist(options: Options): Promise<boolean>

Checks if a user exists in the banlist.

Types: Options

getUser

getUser(options: Options): Promise<BanlistEntry>

Gets a players banlist entry.

Types: Options, BanlistEntry

getAllUsers

getAllUsers(): Promise<BanlistEntry[]>

Gets all the player entries in the banlist.

Types: BanlistEntry

getConfig

getConfig(): Config

Returns the config for the banlist.

Types: Config

getDatabase

getDatabase(): Database

Returns the database.

Types: Database

About

A BeRP plugin the allows you to ban players from your realm with special disconnect messages.

Resources

License

Stars

Watchers

Forks