Options
All
  • Public
  • Public/Protected
  • All
Menu

Class VoteBanSystem<RoomType>

Represents a room object for handling vote kicks.

See VoteBanSystemEvents for events to listen to.

Type parameters

  • RoomType: Hostable

Hierarchy

  • Networkable<VoteBanSystemData, VoteBanSystemEvents, RoomType>
    • VoteBanSystem

Index

Methods

Awake

  • Awake(): void

Deserialize

  • Deserialize(reader: HazelReader, spawn?: boolean): void

Destroy

  • Destroy(): void

FixedUpdate

  • FixedUpdate(delta: number): void

HandleRpc

PreSerialize

  • PreSerialize(): void

Serialize

  • Serialize(writer: HazelWriter, spawn?: boolean): boolean

addVote

  • addVote(voter: PlayerDataResolvable, target: PlayerDataResolvable): void
  • Add the vote of a player to vote for another player to be kicked.

    example
    room.votebansystem.addVote(client.me, player);
    

    Parameters

    • voter: PlayerDataResolvable

      The player to count the vote as.

    • target: PlayerDataResolvable

      The player to vote to be kicked.

    Returns void

canBeManaged

  • canBeManaged(): boolean

despawn

  • despawn(): void
  • Despawns the component from the room it belongs in.

    Returns void

emit

  • emit<Event>(event: Event): Promise<Event>

emitSerial

  • emitSerial<Event>(event: Event): Promise<Event>

emitSync

  • emitSync<Event>(event: Event): Event

getComponent

  • getComponent<T>(component: NetworkableConstructor<T>): undefined | T
  • Get a certain component from the object.

    Type parameters

    • T: Networkable<any, NetworkableEvents<Hostable<any>>, Hostable<any>, T>

    Parameters

    • component: NetworkableConstructor<T>

      The component class to get.

    Returns undefined | T

getListeners

  • getListeners<Event>(event: string): Listener<Event>[]

off

  • off<EventName>(event: EventName, listener: Listener<VoteBanSystemEvents<Hostable<any>>[EventName]>): void
  • off<K>(event: string, listener: Listener<K>): void
  • Type parameters

    • EventName: "component.spawn" | "component.despawn"

    Parameters

    • event: EventName
    • listener: Listener<VoteBanSystemEvents<Hostable<any>>[EventName]>

    Returns void

  • Type parameters

    Parameters

    • event: string
    • listener: Listener<K>

    Returns void

on

  • on<EventName>(event: EventName, listener: Listener<VoteBanSystemEvents<Hostable<any>>[EventName]>): () => void
  • on<K>(event: string, listener: Listener<K>): () => void
  • Type parameters

    • EventName: "component.spawn" | "component.despawn"

    Parameters

    • event: EventName
    • listener: Listener<VoteBanSystemEvents<Hostable<any>>[EventName]>

    Returns () => void

      • (): void
      • Returns void

  • Type parameters

    Parameters

    • event: string
    • listener: Listener<K>

    Returns () => void

      • (): void
      • Returns void

once

  • once<EventName>(event: EventName, listener: Listener<VoteBanSystemEvents<Hostable<any>>[EventName]>): () => void
  • once<K>(event: string, listener: Listener<K>): () => void
  • Type parameters

    • EventName: "component.spawn" | "component.despawn"

    Parameters

    • event: EventName
    • listener: Listener<VoteBanSystemEvents<Hostable<any>>[EventName]>

    Returns () => void

      • (): void
      • Returns void

  • Type parameters

    Parameters

    • event: string
    • listener: Listener<K>

    Returns () => void

      • (): void
      • Returns void

removeAllListeners

  • removeAllListeners(): void

removeListeners

  • removeListeners(event: string): void

spawn

  • spawn(): void
  • Spawn this component if does not exist in the room it belongs in.

    Returns void

wait

  • wait<EventName>(event: EventName): Promise<VoteBanSystemEvents<Hostable<any>>[EventName]>
  • wait(event: string): Promise<BasicEvent>
  • Type parameters

    • EventName: "component.spawn" | "component.despawn"

    Parameters

    • event: EventName

    Returns Promise<VoteBanSystemEvents<Hostable<any>>[EventName]>

  • Parameters

    • event: string

    Returns Promise<BasicEvent>

waitf

  • waitf<EventName>(event: EventName, filter: (ev: VoteBanSystemEvents<Hostable<any>>[EventName]) => boolean | Promise<boolean>): Promise<VoteBanSystemEvents<Hostable<any>>[EventName]>
  • waitf<K>(event: string, filter: (ev: K) => boolean | Promise<boolean>): Promise<BasicEvent>
  • Type parameters

    • EventName: "component.spawn" | "component.despawn"

    Parameters

    • event: EventName
    • filter: (ev: VoteBanSystemEvents<Hostable<any>>[EventName]) => boolean | Promise<boolean>
        • (ev: VoteBanSystemEvents<Hostable<any>>[EventName]): boolean | Promise<boolean>
        • Parameters

          • ev: VoteBanSystemEvents<Hostable<any>>[EventName]

          Returns boolean | Promise<boolean>

    Returns Promise<VoteBanSystemEvents<Hostable<any>>[EventName]>

  • Type parameters

    Parameters

    • event: string
    • filter: (ev: K) => boolean | Promise<boolean>
        • (ev: K): boolean | Promise<boolean>
        • Parameters

          • ev: K

          Returns boolean | Promise<boolean>

    Returns Promise<BasicEvent>

Properties

components

components: Networkable<any, NetworkableEvents<Hostable<any>>, RoomType>[]

dirtyBit

dirtyBit: number = 0

The dirty state of this component.

flags

flags: number

Flags for this object, see SpawnFlag.

netId

netId: number

The net ID of this component.

ownerId

ownerId: number

The ID of the owner of this component.

Optional player

player: PlayerData<RoomType>

The player that this component belongs to.

room

room: RoomType

The room that this component belongs to.

spawnType

spawnType: SpawnType

The type of object that this component belongs to.

voted

voted: Map<number, [undefined | PlayerData<RoomType>, undefined | PlayerData<RoomType>, undefined | PlayerData<RoomType>]>

The accumulated votes.

Constructors

constructor

  • new VoteBanSystem<RoomType>(room: RoomType, spawnType: SpawnType, netId: number, ownerid: number, flags: number, data?: HazelReader | VoteBanSystemData, gameData?: GameData<RoomType>): VoteBanSystem<RoomType>
  • Type parameters

    • RoomType: Hostable<any, RoomType>

    Parameters

    • room: RoomType
    • spawnType: SpawnType
    • netId: number
    • ownerid: number
    • flags: number
    • Optional data: HazelReader | VoteBanSystemData
    • Optional gameData: GameData<RoomType>

    Returns VoteBanSystem<RoomType>

Accessors

owner

  • get owner(): RoomType

Generated using TypeDoc