# Path: twistedbot/plugins/base.py
# class PluginEventHandlerBase(PluginBase):
#     pass


import twistedbot.logbot
from twistedbot.plugins.base import PluginEventHandlerBase
        from twisted.internet import reactor
log = twistedbot.logbot.getlogger("CORE EVENT")


class ProtocolEvents(PluginEventHandlerBase):

    def on_connection_made(self):
        self.world.connected = True
        self.world.send_packet("handshake", {"protocol": self.world.config.PROTOCOL_VERSION,
                                             "username": self.world.config.USERNAME,
                                             "server_host": self.world.config.SERVER_HOST,
                                             "server_port": self.world.config.SERVER_PORT})

    def on_connection_lost(self):
        self.world.connected = False
        self.world.logged_in = False
        self.world.protocol = None
        self.world.bot.on_connection_lost()

    def on_ping(self, ping_id):
        self.world.send_packet("keep alive", {"pid": ping_id})

    def on_login(self, bot_eid, level_type, game_mode, dimension, difficulty, max_players):
        log.msg("Login data: eid:%s level type:%s, game_mode:%s, dimension:%s, difficulty:%s, max players:%s" %
                (bot_eid, level_type, game_mode, dimension, difficulty, max_players))
        self.world.bot.eid = bot_eid
        self.world.logged_in = True
        self.world.dimension_change(dimension)
        self.world.game_mode = game_mode
        self.world.difficulty = difficulty
        self.world.bot.behavior_tree.blackboard.setup()

# Path: twistedbot/plugins/base.py
# class PluginEventHandlerBase(PluginBase):
#     pass


# Path: twistedbot/plugins/core/protocol_events.py
import twistedbot.logbot
from twistedbot.plugins.base import PluginEventHandlerBase
        from twisted.internet import reactor

log = twistedbot.logbot.getlogger("CORE EVENT")


class ProtocolEvents(PluginEventHandlerBase):

    def on_connection_made(self):
        self.world.connected = True
        self.world.send_packet("handshake", {"protocol": self.world.config.PROTOCOL_VERSION,
                                             "username": self.world.config.USERNAME,
                                             "server_host": self.world.config.SERVER_HOST,
                                             "server_port": self.world.config.SERVER_PORT})

    def on_connection_lost(self):
        self.world.connected = False
        self.world.logged_in = False
        self.world.protocol = None
        self.world.bot.on_connection_lost()

    def on_ping(self, ping_id):
        self.world.send_packet("keep alive", {"pid": ping_id})

    def on_login(self, bot_eid, level_type, game_mode, dimension, difficulty, max_players):
        log.msg("Login data: eid:%s level type:%s, game_mode:%s, dimension:%s, difficulty:%s, max players:%s" %
                (bot_eid, level_type, game_mode, dimension, difficulty, max_players))
        self.world.bot.eid = bot_eid
        self.world.logged_in = True
        self.world.dimension_change(dimension)
        self.world.game_mode = game_mode
        self.world.difficulty = difficulty
        self.world.bot.behavior_tree.blackboard.setup()

        self.world.send_packet("locale view distance", {'locale': self.world.config.LOCALE,