Skip to content
This repository has been archived by the owner on Apr 27, 2019. It is now read-only.

Commit

Permalink
Merge pull request #163 from kharidiron/master
Browse files Browse the repository at this point in the history
Pray to the bug gods, amend ye, source code, and work for thy peoples!
  • Loading branch information
kamilion committed Dec 16, 2015
2 parents d17dd61 + fd3118d commit b9dbd55
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 113 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

StarryPy is Twisted-based plugin-driven Starbound server wrapper. It is currently in beta.

# The build is currently broken while we are applying a PEP8 pull request.

## Features

With the built-in plugins (which are removable):
Expand All @@ -16,7 +14,7 @@ With the built-in plugins (which are removable):
* Join/quit announcements.
* And more.

## Version 1.7.1 is here!
## Version 1.7.2 is here!

With this most recent release, we are compatible with the current release of Starbound (Glad Giraffe - Protocol 710). Any bugs found in the process, please open an issue ticket, so we can squash them as quickly as possible.

Expand Down
10 changes: 3 additions & 7 deletions plugins/claims/claims_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,9 @@ def claim_list(self, data):
)
self.protocol.send_chat_message(
'Players registered to this planet: ^yellow;{}'.format(
'^green;, ^yellow;'.join(
(
self.player_planets[planet]
.replace('[', '')
.replace(']', '')
)
)
'^green;, ^yellow;'.join(self.player_planets[planet])
.replace('[', '')
.replace(']', '')
)
)
elif planet in self.unclaimable_planets:
Expand Down
44 changes: 22 additions & 22 deletions plugins/core/admin_commands_plugin/admin_command_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class UserCommandPlugin(SimpleCommandPlugin):
name = 'admin_commands_plugin'
depends = ['command_plugin', 'player_manager_plugin']
commands = [
'who', 'whoami', 'whois', 'promote', 'kick', 'ban', 'ban_list',
'who', 'whois', 'promote', 'kick', 'ban', 'ban_list',
'unban', 'item', 'planet', 'mute', 'unmute', 'passthrough', 'shutdown',
'timestamps'
]
Expand Down Expand Up @@ -61,27 +61,27 @@ def planet(self, data):
)
)

@permissions(UserLevels.GUEST)
def whoami(self, data):
"""
Displays client data about yourself.
Syntax: /whoami
"""
info = self.protocol.player
self.protocol.send_chat_message(
'Name: {} ^green;: ^gray;{}\nUserlevel: ^yellow;{}^green; '
'(^gray;{}^green;)\nUUID: ^yellow;{}^green;\nIP address: '
'^cyan;{}^green;\nCurrent planet: ^yellow;{}^green;'.format(
info.colored_name(self.config.colors),
info.org_name,
UserLevels(info.access_level),
info.last_seen.strftime('%c'),
info.uuid,
info.ip,
info.planet
)
)
return False
# @permissions(UserLevels.GUEST)
# def whoami(self, data):
# """
# Displays client data about yourself.
# Syntax: /whoami
# """
# info = self.protocol.player
# self.protocol.send_chat_message(
# 'Name: {} ^green;: ^gray;{}\nUserlevel: ^yellow;{}^green; '
# '(^gray;{}^green;)\nUUID: ^yellow;{}^green;\nIP address: '
# '^cyan;{}^green;\nCurrent planet: ^yellow;{}^green;'.format(
# info.colored_name(self.config.colors),
# info.org_name,
# UserLevels(info.access_level),
# info.last_seen.strftime('%c'),
# info.uuid,
# info.ip,
# info.planet
# )
# )
# return False

@permissions(UserLevels.REGISTERED)
def whois(self, data):
Expand Down
2 changes: 1 addition & 1 deletion plugins/core/player_manager_plugin/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def wrapped_function(self, *args, **kwargs):

if self.protocol.player.access_level >= level:
if level >= UserLevels.MODERATOR:
if not self.protocol.player.admin_logged_in:
if self.protocol.player.admin_logged_in == 0:
self.protocol.send_chat_message(
'^red;You\'re not logged in, so I can\'t '
'let you do that.^yellow;'
Expand Down
7 changes: 6 additions & 1 deletion plugins/core/player_manager_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,10 @@ def nick_set(self, data):
Changes player nickname.
Syntax: /nick_set (name) (new name)
"""
if data:
if not data:
self.protocol.send_chat_message(self.nick_set.__doc__)
return

try:
first_name, rest = extract_name(data)

Expand All @@ -271,8 +272,10 @@ def nick_set(self, data):
'please surround it by quotes!'
)
return

if not rest:
self.protocol.send_chat_message(self.nick_set.__doc__)
return
else:
try:
second_name = extract_name(rest)[0]
Expand All @@ -286,10 +289,12 @@ def nick_set(self, data):
'please surround it by quotes!'
)
return

player = self.player_manager.get_by_name(str(first_name))
player2 = self.player_manager.get_by_name(str(second_name))
org_player = self.player_manager.get_by_org_name(str(first_name))
org_player2 = self.player_manager.get_by_org_name(str(second_name))

if player:
first_uuid = player.uuid
elif org_player:
Expand Down
2 changes: 1 addition & 1 deletion plugins/partychat_plugin/partychat_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PartyChatPlugin(SimpleCommandPlugin):
Party chat.
"""
name = 'partychat_plugin'
commands = ['party', 'p', 'party_check']
commands = ['party', 'p']
depends = ['command_plugin', 'player_manager_plugin']

def activate(self):
Expand Down
12 changes: 4 additions & 8 deletions plugins/planet_protect/planet_protect_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,10 @@ def protect_list(self, data):
return
if planet in self.player_planets:
self.protocol.send_chat_message(
'Players registered to this planet: ^yellow;{}'.format(
'^green;, ^yellow;'.join(
(
self.player_planets[planet]
.replace('[', '')
.replace(']', '')
)
)
'Players registered to this planet: ^green;{}'.format(
'^yellow;, ^green;'.join(self.player_planets[planet])
.replace('[', '')
.replace(']', '')
)
)
else:
Expand Down
8 changes: 4 additions & 4 deletions plugins/plugin_manager_plugin/plugin_manager_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def plugin_list(self, data):
]

self.protocol.send_chat_message(
'Currently loaded plugins: ^yellow;%s'.format(
'^green;, ^yellow;'.join(
'Currently loaded plugins: ^green; {}'.format(
'^yellow;, ^green;'.join(
[
plugin
for plugin in self.plugin_manager.plugins.iterkeys()
Expand All @@ -39,8 +39,8 @@ def plugin_list(self, data):

if len(inactive_plugins) > 0:
self.protocol.send_chat_message(
'Inactive plugins: ^red;%s'.format(
'^green;, ^red;'.join(inactive_plugins)
'Inactive plugins: ^red; {}'.format(
'^yellow;, ^red;'.join(inactive_plugins)
)
)

Expand Down
132 changes: 67 additions & 65 deletions plugins/teleport_plugin/teleport_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def teleport(self, data):
Player teleportation system. By default, this system will teleport a
player to another player. Use subcommands to modify this behavior.
Available subcommands are:
^cyan;player, ship, home, ^gray;outpost, bookmark, poi
^cyan;player, home, ^gray;ship, outpost, bookmark, poi
"""
self.logger.vdebug('Teleport command called')
if not data:
Expand All @@ -61,7 +61,7 @@ def tp(self, data):
Player teleportation system. By default, this system will teleport a
player to another player. Use subcommands to modify this behavior.
Available subcommands are:
^cyan;player, ship, home
^cyan;player, home
"""
self.teleport(data)

Expand All @@ -71,7 +71,7 @@ def teleport_help(self, data):
Player teleportation system. By default, this system will teleport a
player to another player. Use subcommands to modify this behavior.
Available subcommands are:
^cyan;player, ship, home
^cyan;player, home
"""
self.protocol.send_chat_message(self.teleport.__doc__)

Expand Down Expand Up @@ -159,69 +159,71 @@ def teleport_to_ship(self, data):
Syntax: /teleport ship (destination player) [source player]
"""
usage = 'Syntax: /teleport ship (destination player) [source player]'
if not data:
self.protocol.send_chat_message(self.teleport_to_ship.__doc__)
return

destination, rest = extract_name(data)
if not self._validate_player(destination):
self.protocol.send_chat_message(usage)
return
destination = destination.lower()

if not rest:
source = self.protocol.player.name
source = source.lower()
else:
source, rest = extract_name(rest)
if not self._validate_player(source):
self.protocol.send_chat_message(usage)
return
source = source.lower()

if source == destination:
self.teleport_to_own_ship(None)
return

destination_player = self.player_manager.get_logged_in_by_name(
destination
)
if destination_player is None:
self.logger.debug(
'Error: Player %s is not logged in.', destination
)
self.protocol.send_chat_message(
'Error: Player {} is not logged in.'.format(destination)
)
return

source_player = self.player_manager.get_logged_in_by_name(source)
if source_player is None:
self.logger.debug('Error: Player %s is not logged in.', source)
self.protocol.send_chat_message(
'Error: Player {} is not logged in.'.format(source)
)
return

source_protocol = self.factory.protocols[source_player.protocol]
teleport_packet = build_packet(
Packets.PLAYER_WARP,
player_warp_toplayerworld_write(
destination=destination_player.uuid
)
)

source_protocol.client_protocol.transport.write(teleport_packet)
self.protocol.send_chat_message('This is not yet implemented.')

self.logger.debug(
"Teleport command called by %s. Teleporting %s to %s's ship",
self.protocol.player.name, source, destination
)
self.protocol.send_chat_message(
"Teleported ^green;{}^yellow; to ^green;{}^yellow;'s ship.".format(
source, destination
)
)
# if not data:
# self.protocol.send_chat_message(self.teleport_to_ship.__doc__)
# return

# destination, rest = extract_name(data)
# if not self._validate_player(destination):
# self.protocol.send_chat_message(usage)
# return
# destination = destination.lower()

# if not rest:
# source = self.protocol.player.name
# source = source.lower()
# else:
# source, rest = extract_name(rest)
# if not self._validate_player(source):
# self.protocol.send_chat_message(usage)
# return
# source = source.lower()

# if source == destination:
# self.teleport_to_own_ship(None)
# return

# destination_player = self.player_manager.get_logged_in_by_name(
# destination
# )
# if destination_player is None:
# self.logger.debug(
# 'Error: Player %s is not logged in.', destination
# )
# self.protocol.send_chat_message(
# 'Error: Player {} is not logged in.'.format(destination)
# )
# return

# source_player = self.player_manager.get_logged_in_by_name(source)
# if source_player is None:
# self.logger.debug('Error: Player %s is not logged in.', source)
# self.protocol.send_chat_message(
# 'Error: Player {} is not logged in.'.format(source)
# )
# return

# source_protocol = self.factory.protocols[source_player.protocol]
# teleport_packet = build_packet(
# Packets.PLAYER_WARP,
# player_warp_toplayerworld_write(
# destination=destination_player.uuid
# )
# )

# source_protocol.client_protocol.transport.write(teleport_packet)

# self.logger.debug(
# "Teleport command called by %s. Teleporting %s to %s's ship",
# self.protocol.player.name, source, destination
# )
# self.protocol.send_chat_message(
# "Teleported ^green;{}^yellow; to ^green;{}^yellow;'s ship.".format(
# source, destination
# )
# )

@permissions(UserLevels.REGISTERED)
def teleport_to_own_ship(self, data):
Expand Down
2 changes: 1 addition & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from plugin_manager import PluginManager, route, FatalPluginError
from utility_functions import build_packet

VERSION = '1.7'
VERSION = '1.7.2'


VDEBUG_LVL = 9
Expand Down

0 comments on commit b9dbd55

Please sign in to comment.