def on_entity_create(self, data):
     """Projectile protection check"""
     """
     if self.protocol.player.planet in self.protected_planets and self.protocol.player.access_level < UserLevels.ADMIN:
         name = self.protocol.player.org_name
         if name in self.player_planets[self.protocol.player.planet]:
             return True
         else:
             entities = entity_create.parse(data.data)
             for entity in entities.entity:
                 if entity.entity_type == EntityType.PROJECTILE:
                     #if self.block_all: return False
                     p_type = star_string("").parse(entity.entity)
                     if p_type in self.blacklist:
                         self.logger.info(
                             "Player %s attempted to use a prohibited projectile, %s, on a protected planet.",
                             self.protocol.player.org_name, p_type)
                         return False
     """
     if self.protect_everything and self.protocol.player.access_level < UserLevels.REGISTERED and not self.protocol.player.on_ship:
         entities = entity_create.parse(data.data)
         for entity in entities.entity:
             if entity.entity_type == EntityType.PROJECTILE:
                 if self.block_all: return False
                 p_type = star_string("").parse(entity.entity)
                 if p_type in self.blacklist:
                     self.logger.info(
                         "Player %s attempted to use a prohibited projectile, %s, on a protected planet.",
                         self.protocol.player.org_name, p_type)
                     return False
 def on_entity_create(self, data):
     """
     Projectile protection check
     """
     if (
             self.protocol.player.planet in self.protected_planets and
             self.protocol.player.access_level < UserLevels.ADMIN
     ):
         name = self.protocol.player.org_name
         if name in self.player_planets[self.protocol.player.planet]:
             return True
         else:
             entities = entity_create().parse(data.data)
             for entity in entities.entity:
                 self.logger.vdebug('Entity Type: %s', entity.entity_type)
                 if entity.entity_type == EntityType.PROJECTILE:
                     self.logger.vdebug('projectile detected')
                     if self.block_all:
                         return False
                     p_type = star_string('').parse(entity.payload)
                     self.logger.vdebug('projectile: %s', p_type)
                     if p_type in self.blacklist:
                         if p_type in ['water', 'glowingrain']:
                             self.logger.vdebug(
                                 'Player %s attempted to use a prohibited '
                                 'projectile, %s, on a protected planet.',
                                 self.protocol.player.org_name, p_type
                             )
                         else:
                             self.logger.info(
                                 'Player %s attempted to use a prohibited '
                                 'projectile, %s, on a protected planet.',
                                 self.protocol.player.org_name, p_type
                             )
                         return False
Exemple #3
0
 def on_entity_create(self, data):
     """
     Projectile protection check
     """
     if (self.protocol.player.planet in self.protected_planets
             and self.protocol.player.access_level < UserLevels.ADMIN):
         name = self.protocol.player.org_name
         if name in self.player_planets[self.protocol.player.planet]:
             return True
         else:
             entities = entity_create().parse(data.data)
             for entity in entities.entity:
                 self.logger.vdebug('Entity Type: %s', entity.entity_type)
                 if entity.entity_type == EntityType.PROJECTILE:
                     self.logger.vdebug('projectile detected')
                     if self.block_all:
                         return False
                     p_type = star_string('').parse(entity.payload)
                     self.logger.vdebug('projectile: %s', p_type)
                     if p_type in self.blacklist:
                         if p_type in ['water', 'glowingrain']:
                             self.logger.vdebug(
                                 'Player %s attempted to use a prohibited '
                                 'projectile, %s, on a protected planet.',
                                 self.protocol.player.org_name, p_type)
                         else:
                             self.logger.info(
                                 'Player %s attempted to use a prohibited '
                                 'projectile, %s, on a protected planet.',
                                 self.protocol.player.org_name, p_type)
                         return False
Exemple #4
0
 def on_entity_create(self, data):
     """Projectile protection check"""
     """
     if self.protocol.player.planet in self.protected_planets and self.protocol.player.access_level < UserLevels.ADMIN:
         name = self.protocol.player.org_name
         if name in self.player_planets[self.protocol.player.planet]:
             return True
         else:
             entities = entity_create.parse(data.data)
             for entity in entities.entity:
                 if entity.entity_type == EntityType.PROJECTILE:
                     #if self.block_all: return False
                     p_type = star_string("").parse(entity.entity)
                     if p_type in self.blacklist:
                         self.logger.info(
                             "Player %s attempted to use a prohibited projectile, %s, on a protected planet.",
                             self.protocol.player.org_name, p_type)
                         return False
     """
     if self.protect_everything and self.protocol.player.access_level < UserLevels.REGISTERED and not self.protocol.player.on_ship:
         entities = entity_create.parse(data.data)
         for entity in entities.entity:
             if entity.entity_type == EntityType.PROJECTILE:
                 if self.block_all: return False
                 p_type = star_string("").parse(entity.entity)
                 if p_type in self.blacklist:
                     self.logger.info(
                         "Player %s attempted to use a prohibited projectile, %s, on a protected planet.",
                         self.protocol.player.org_name, p_type)
                     return False
 def on_entity_create(self, data):
     if self.protocol.player.planet in self.protected_planets and self.protocol.player.access_level <= UserLevels.MODERATOR:
         entities = entity_create.parse(data.data)
         for entity in entities.entity:
             if entity.entity_type == EntityType.PROJECTILE:
                 p_type = star_string("").parse(entity.entity)
                 if p_type in self.blacklist:
                     self.logger.info("Player %s attempted to use a prohibited projectile, %s, on a protected planet.", self.protocol.player.name, p_type)
                     return False
 def on_entity_create(self, data):
     if self.protocol.player.planet in self.protected_planets and self.protocol.player.access_level <= UserLevels.MODERATOR:
         entities = entity_create.parse(data.data)
         for entity in entities.entity:
             if entity.entity_type == EntityType.PROJECTILE:
                 if self.block_all: return False
                 p_type = star_string("").parse(entity.entity)
                 if p_type in self.blacklist:
                     self.logger.info("Player %s attempted to use a prohibited projectile, %s, on a protected planet.", self.protocol.player.name, p_type)
                     return False