How to use the quarry.net.server.ServerProtocol.player_joined function in quarry

To help you get started, we’ve selected a few quarry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github barneygale / quarry / quarry / net / proxy.py View on Github external
def player_joined(self):
        ServerProtocol.player_joined(self)
        self.bridge.downstream_ready()
github barneygale / quarry / examples / server_auth.py View on Github external
def player_joined(self):
        # This method gets called when a player successfully joins the server.
        #   If we're in online mode (the default), this means auth with the
        #   session server was successful and the user definitely owns the
        #   display name they claim to.

        # Call super. This switches us to "play" mode, marks the player as
        #   in-game, and does some logging.
        ServerProtocol.player_joined(self)

        # Define your own logic here. It could be an HTTP request to an API,
        #   or perhaps an update to a database table.
        display_name = self.display_name
        ip_addr = self.remote_addr.host
        self.logger.info("[%s authed with IP %s]" % (display_name, ip_addr))

        # Kick the player.
        self.close("Thanks, you are now registered!")
github barneygale / quarry / examples / server_chat_room.py View on Github external
def player_joined(self):
        # Call super. This switches us to "play" mode, marks the player as
        #   in-game, and does some logging.
        ServerProtocol.player_joined(self)

        # Send "Join Game" packet
        self.send_packet("join_game",
            self.buff_type.pack("iBqiB",
                0,                              # entity id
                3,                              # game mode
                0,                              # dimension
                0,                              # hashed seed
                0),                             # max players
            self.buff_type.pack_string("flat"), # level type
            self.buff_type.pack_varint(1),      # view distance
            self.buff_type.pack("??",
                False,                          # reduced debug info
                True))                          # show respawn screen

        # Send "Player Position and Look" packet
github Yardanico / puremine / server.py View on Github external
def player_joined(self):
        ServerProtocol.player_joined(self)
        self.ip = self.remote_addr.host
        self.position = Position(0, 66, 0)
        self.entity_id = self.get_free_id()
        self.default_gamemode = 1  # 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. Bit 3 (0x8) is the hardcore flag.
        self.dimension = 0  # -1: Nether, 0:Overworld, 1:End
        self.difficulty = 0  # 0:peaceful,1:easy,2:normal,3:hard
        self.level_type = "default"  # default, flat, largeBiomes, amplified, default_1_1
        self.reduced_debug_info = False  # If true, a Notchian client shows reduced information on the debug screen.
        players[
            self.entity_id] = self  # add player object to dict eid:player , so we can iterate over ALL players on the server
        self.logger.info("UUID of player {0} is {1}".format(self.username, self.uuid))
        self.nickname = self.username
        self.send_game(self.entity_id, self.default_gamemode, self.dimension, self.difficulty, "default", False)
        self.send_spawn_pos(self.position)
        self.send_abilities(True, True, True, True, 0.2, 0.2)
        self.send_position_and_look(self.position, 0, 0, False)