Rust+.py Docs
  • Getting Started
    • Welcome to the Rust+.py Docs!
    • Quick Start
    • Getting Player Details
      • FCM Listener
      • Getting Entity ID's
    • RustSocket
      • Rate Limiting
  • API methods
    • Removing Listeners
    • Getting Team Info
    • Getting Team Chat
    • Getting Server Info
    • Getting the Map
    • Sending Messages
    • Getting the Time
    • Getting Entity Information
    • Getting Map Markers
    • Getting Contents of Monitors
    • Promoting Players to Team Leader
  • Command System
    • Commands Overview
    • Command Options
    • Command Decorator
    • Hanging The Socket
  • Event System
    • Events Overview
  • Cameras
    • Camera Managers
Powered by GitBook
On this page
  • Registered Listeners
  • Removing The listener

Was this helpful?

  1. API methods

Removing Listeners

Registered Listeners

A registered listener is a wrapper object around the coroutine itself that will allow the listener to be removed later on. Should you need the coroutine back, call RegisteredListener.get_coro().

Removing The listener

Removing a listener is as simple as using an Event's HandlerList. This is one example:

@EntityEvent(server_details, 25743493)
async def on_entity_event(payload: EntityEventPayload):
    await rust_socket.set_entity_value(payload.entity_id, not payload.value)
    
    
EntityEventPayload.HANDLER_LIST.unregister(on_entity_event, server_details)

# You can also unregister all listeners for a specific event
EntityEventPayload.HANDLER_LIST.unregister_all()
PreviousRate LimitingNextGetting Team Info

Last updated 8 months ago

Was this helpful?