Coder Social home page Coder Social logo

starrypy3k's Introduction

StarryPy3k

About

StarryPy3k is the successor to StarryPy. StarryPy is a plugin-driven Starbound server wrapper that adds a great deal of functionality to Starbound. StarryPy3k is written using asyncio in Python 3.11.

Please note this is still in very active development and is not ready to be used on general purpose servers. It should mostly work, but you have been forewarned.

Requirements

Due to an upgrade of the Discord API, Python 3.8 or greater is required. Tests are only conducted on Python version 3.11.

While StarryPy3k may work with earlier or later versions of Python, it is not recommended and will not be readily supported.

Installation

If you are installing during the development phase, please clone the repository with git. While it is not strictly necessary, it is highly encouraged to run your StarryPy3k instance from a virtual environment, as future plugins may require more Python modules than are currently listed (eg - IRC3), and using a virtual environment helps to keep a clean namespace and reduce the chance of bugs.

Starbound Server Configuration

StarryPy works as a benevolent "man in the middle" between the Starbound game client and the Starbound dedicated server, in effect acting as a proxy server. As such, for easiest transition from a "Vanilla" server to one enhanced by StarryPy, you need to set your Starbound server to accept incoming connections on a new TCP port. By default, this will be the port one lower than standard, to wit: 21024. To accomplish this, edit your starbound_server.config. Look for the lines below, and change them to specify port 21024:

  "gameServerPort" : 21025,
  [...]
  "queryServerPort" : 21025,

While editing your starbound_server.config, you should also add some accounts for your server's staff, if you have not done so already. StarryPy3k's basic_auth plugin uses Starbound's account system to authenticate privileged users (moderator and up), so you will need at least one account before your staff can join the server. Look for the lines below:

  "serverUsers" : {
  },

And add some accounts (preferably one per staff member) using the format below. Note: you do not need to set "admin" to "false". Set it to "true" if you would like this account to have administrator privileges on the underlying Starbound dedicated server.

  "serverUsers" : {
    "repalceWithAccountName" : {
      "admin" : false,
      "password" : "replaceWithAccountPassword"
    },
    "repalceWithAnotherAccountName" : {
      "admin" : false,
      "password" : "replaceWithAnotherAccountPassword"
    }
  },

StarryPy Proxy Configuration

An example configuration file, config.json.default, is provided in the config directory. Copy that file to a new one named config.json in the same location. Open it in your text editor of choice. The following are the most likely changes you will have to make:

        "basic_auth": {
            "enabled": true,
            "owner_sb_account": "-- REPLACE WITH OWNER ACCOUNT --",
            "staff_sb_accounts": [
                "-- REPLACE WITH STARBOUND ACCOUNT NAME --",
                "-- REPLACE WITH ANOTHER --",
                "-- SO ON AND SO FORTH --"
            ]
        },

The section above is used by StarryPy3k's basic_auth plugin to define Starbound accounts that staff members can use to authenticate. Edit the example above to use only the account names (no passwords) that you just set up in your starbound_server.config file.

        "irc_bot": {
            "channel": "#YourChannel",
            "log_irc": false,
            "server": "irc.example.com",
            "strip_colors": true,
            "username": "Replace With Valid IRC Nick"
        },

This section controls the built-in IRC-to-Starbound bridge. It will be active if you have the irc3 Python module installed on your system. Edit the sample values here to match your preferred IRC server, bot nick, et cetera. Chat in the Starbound server will be relayed to the specified IRC channel, and vice versa. You can also see who is on the server from IRC by saying .who in the IRC channel (we cannot use / as the command leader in IRC for obvious reasons.

        "motd": {
            "message": "Insert your MOTD message here. ^red;Note^reset; color codes work."
        },
        "new_player_greeters": {
            "gifts": {},
            "greeting": "This message will be displayed to players the first time StarryPy sees them connect."
        },

The MOTD, or Message Of The Day, will be displayed to all players when they connect to the Starbound server. You can update this in-game by using the /set_motd command. The next section allows you to specify a message to be displayed to any players the first time they connect to the server. You can also have StarryPy give items to new players by enumarating them in the gifts property. Use Starbound's names for items as specified in its .json files.

        "player_manager": {
            "owner_uuid": "!--REPLACE WITH YOUR UUID--!",
            "player_db": "config/player"
        },

Replace the obvious value here with your UUID. This is how StarryPy will recognize you as the owner of the server and accord you the relevant rights and privileges. You can find your UUID by watching the Starbound server log as you connect, by using the list RCON command, or by observing the names of your save files on the computer you use to play Starbound.

Once you have finished editing config.json, copy the permissions.json.default file to permissions.json and edit it to your liking. Example of permissions format is provided below:

"Role Name": {
 "priority": 100000, // This determines the role heirarchy for administrative commands such as /kick, /ban, and /user
 "prefix": "^#F7434C;", // This role's chat prefix, typically a color
 "inherits": [ // Roles to inherit permissions from
   "Another Role"
 ],
 "permissions": [ // An array of permissions; see permissions.json.default for all the permissions included
   "special.allperms"
 ]
}

Starting the proxy

Starting StarryPy is as simple as issueing the command python3 ./server.py once you have finised editing config/config.json and config/permissions .json. To terminate the proxy, either press ^C in an interactive terminal session, or send it an INT signal.

Running under Docker

StarryPy now includes a basic Docker configuration. To run this image, all you need to do is run:

  docker run -p 21025:21025 starrypy/starrypy:1.0.0

StarryPy exports a volume at /app/config which stores your configuration file and the various databases. You can create your own data container for this volume to persist your configuration and data even if you rebuild or upgrade StarryPy, or use volume mount points to share a directory from your host server into the container.

To use a storage volume, create a volume with:

docker volume create --name sb-data

Then provide it as part of your startup command:

docker run -d --name starry -p 20125:21025 -v sb-data:/app/config starrypy/starrypy:1.0.0

You can edit the config by mounting the volume into another container with your favorite text editor:

docker run --rm -v sb-data:/app/config -ti thinca/vim /app/config/config.json

If you'd rather map a directory on your host, just provide that as an argument to -v instead:

docker run -d --name starry -p 20125:21025 -v /opt/wherever/you/want/it:/app/config starrypy/starrypy:1.0.0

You can also run as a low-privileges user, with starry only having access to write to its config volume:

docker run -d --name starry -p 20125:21025 -v /opt/wherever/you/want/it:/app/config --user 1002 starrypy/starrypy:1.0.0

Please note that this is a Linux-based docker container, so it won't work properly on Docker for Windows in Windows Container mode.

Contributing

Contributions are highly encouraged and always welcome. Please feel free to open an issue on GitHub if you are having an error, or wish to make a suggestion. If you're feeling really motivated, fork the repo and contribute some code.

In addition, plugin development is encouraged. There are still a few features missing from the core (particularly in the role system). A more comprehensive guide on plugin development is in the works. Please note that plugins will not work without modification from the original version of StarryPy.

If you would like to talk with other contributors/ask questions about development, please join #StarryPy on irc.freenode.net, or chat with us on gitter.

History

StarryPy3k was originally developed by CarrotsAreMediocre, who set all the groundwork for AsyncIO and packet interpreting. Due to personal circumstances, Carrots stepped away from the project.

After roughly 2 years of laying dormant, Kharidiron, having spent some time learning the ropes of StarryPy, decided to take the reigns on StarryPy3k. After many months of staring at the code (and many emails to CarrotsAreMediocre requesting assistance in understanding just what it is doing), is feeling a modicum more confident in handling this project and keeping it running.

starrypy3k's People

Contributors

amorporkian avatar dopeghoti avatar evonzee avatar germaniumsystem avatar kamilion avatar kharidiron avatar tsunder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

starrypy3k's Issues

Adding own roles and shuffling commands

Hello, I am aware that a way to move commands around to different roles is coming.

But is there anything happening about making our own roles? (for example a donator role)

In regards to both what do you think the ETA can be?

Commands cannot be used on players with quotes in their name.

It appears that using commands on players with quotes in their name is impossible. The quotation mark seems to throw off the quoted argument extractor and no amount of single quotes or escaping seems to help. Log snippets are attached below.

Am I just missing something or is this legitimately an issue?

2017-02-18 10:57:19 - INFO - starrypy # Received connection from ::1
2017-02-18 10:57:19 - DEBUG - starrypy # New connection established.
2017-02-18 10:57:19 - INFO - starrypy.plugin.basic_auth # Player with privileged UUID 'deadbeefdeadbeefdeadbeefdeadbeef' successfully authenticated as 'beef'
2017-02-18 10:57:19 - INFO - starrypy.plugin.player_manager # Known player is attempting to log in: dead"beef
2017-02-18 10:57:19 - INFO - starrypy.plugin.player_manager # Player dead"beef is now at location: dead"beef's ship
2017-02-18 10:57:24 - INFO - starrypy.plugin.chat_logger # dead"beef: /who
2017-02-18 10:57:32 - INFO - starrypy.plugin.chat_logger # dead"beef: /whois "dead\"beef"
2017-02-18 10:57:37 - INFO - starrypy.plugin.chat_logger # dead"beef: /whois "dead"beef"
2017-02-18 10:57:45 - INFO - starrypy.plugin.chat_logger # dead"beef: /whois "dead"""beef"
2017-02-18 10:57:56 - INFO - starrypy.plugin.chat_logger # dead"beef: /whois 'dead"beef'
2017-02-18 10:58:05 - INFO - starrypy.plugin.chat_logger # dead"beef: /whois 'dead''beef'
2017-02-18 10:58:12 - INFO - starrypy.plugin.chat_logger # dead"beef: /whois 'dead'"'beef'
2017-02-18 11:00:32 - INFO - starrypy.plugin.chat_logger # dead"beef: /whois 'dead\"beef'
2017-02-18 11:25:07 - INFO - starrypy.plugin.chat_logger # dead"beef: /whois "dead\\"beef"
2017-02-18 11:25:12 - INFO - starrypy.plugin.chat_logger # dead"beef: /whois "dead\\\"beef"
2017-02-18 11:25:15 - INFO - starrypy.plugin.chat_logger # dead"beef: /whois "dead\\\\"beef"
[Info] Chat: 1 players online:
[Info] Chat: [^red;5^reset;] dead"beef
[Info] Chat: Player not found!
[Info] Chat: Player not found!
[Info] Chat: Player not found!
[Info] Chat: Player not found!
[Info] Chat: Player not found!
[Info] Chat: Player not found!
[Info] Chat: Player not found!
[Info] Chat: Player not found!
[Info] Chat: Player not found!
[Info] Chat: Player not found!

Discord Bot Crashed

Hello ; After I setup everything plus discord bot, It's decide to crash and it was working before restart ? I checked syntax/codes but still kinda pointless. I didn't change anything on it

Ignoring exception in on_message
Traceback (most recent call last):
  File "/.../.../..../starryp3k_main/virtualsb/lib/python3.5/site-packages/discord/client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "/.../.../..../starryp3k_main/StarryPy3k/plugins/discord_bot.py", line 76, in on_message
    yield from DiscordPlugin.send_to_game(message)
  File "/.../.../..../starryp3k_main/StarryPy3k/plugins/discord_bot.py", line 214, in send_to_game
    asyncio.ensure_future(cls.handle_command(message.content[1:]))
TypeError: handle_command() missing 1 required positional argument: 'data'

PS: I shorted the paths, don't think as path issue or something

Edit1 : when put "..." to the chat makes crash when I type an actual word/letter It's not sending message but not gives error either

Player DB does not get saved from IDE - socket error without

so i fifgured it now for my environment
if i run from PyCharm IDE, then it never gets that socket error and it instanly closes
but never saves config
if i run from command line with python3 it saves, but it always gets that error on exit
takes from 10-40 sec to close

This is on windows - just adding notes for future look-into

AFK plugin

Proper AFK settings. Autodetection should also be a possibility, though not a priority.

Teleport command

It would be useful to have teleport re implemented, such that admins can /tp to users without having to be in their party.

Add "maintenance" mode - reject new player connections

From @dopeghoti on August 6, 2016 22:5

I prefer not to kick players off of my server if I don't have to, just to upgrade Starbound or the proxy.

It would be helpful to add an owner or admin command to tell StarryPy to no longer accept new player connections until either told otherwise or it is restarted. That way, server admins can flip this switch, and when the last connected players leave of their own volition, the service(s) can be updated and restarted.

Bonus points for either or both of giving a configurable message shown to rejected clients, or for managing the MOTD and in-game broadcasts.

Copied from original issue: kharidiron#38

Installation of pathlib and asyncio on systems without Visual Studio

A potential problem in setting up python 3 with StarryPy lies in the initial download of the asyncio and pathlib libraries when doing pip install -r "requirements.txt", where it will say "error: could not find vcvarsall.bat", due to pip being unable to find the C/C++ compiler for use.

Systems with at least Visual Studio 2010 installed will be okay, but systems without will be unable to download and install the binaries above; they can only get the pre-compiled libs from someone else and place it in their python3/libs/site-package/ folder. Attached is a rar file containing affected libs: https://www.dropbox.com/s/dheblt3xb7grikw/site-packages.rar

Protecting Instance worlds.

From @ren-kun on August 14, 2016 1:57

I would like to protect my custom instance worlds and things like the outpost.

People are going nuts on it and crashing the server with an immense amounts of items on the floor.

Copied from original issue: kharidiron#46

connection problem with starbound 1.2

I am surely stating the obvious here... but it seems that starbound 1.2 changed the packets between client and server. Therefore, Starrypy3k does not works right now with 1.2.

Terraforming bypasses planet protection

I'm trying to run a server, but our players are fighting over it using terraformers. We have a planet that players can easily get build permissions on, and as such, they're able to place down terraformers and proceed to fight over which biome the planet should be. This is very annoying and destroys what the planet SHOULD be. Why are Terraformers bypassing the planet protection?

Unique names

Make all names unique and disable the Starbound /nick command and handle that internally.

Error in chat

From @ren-kun on September 21, 2016 0:48

2016-09-20 19:03:34 - WARNING - starrypy.plugin.chat_enhancements # Sender [user] is sending a message that the wrapper isn't handling correctly

Copied from original issue: kharidiron#56

The /report does not show in other chat tabs

Is it possible to make /report high priority and appear in local & other chat tabs?

If moderators and higher can't see it in all chat tabs then there's a possibility of a delay for staff to respond when in their current tab

Is /poi PLANET_NAME failing to work?

Hey everyone,

/poi - works as a command

but when trying to do /poi NAME (to force the ship to go somewhere)

It doesn't work. Did i perhaps set something wrong:?

Vehicle bypass planets protection

Hello,
so basically, some vehicles (like XS mech mod for example) can destroy blocks with their weapons, even if the planets was protected.
Is there a way to fix this?
thanks.

muted players transmit to IRC

behaviour: irc bridge transmits what muted players say
expected: irc bridge does not transmit what muted players say.

Configuration Manager

Hi !

~/Starbound/StarryPy3k/ python3 server.py       
Traceback (most recent call last):
  File "server.py", line 5, in <module>
    from configuration_manager import ConfigurationManager
ImportError: No module named 'configuration_manager'

Had you idea ? :/

Whois a players IP

From @ren-kun on September 23, 2016 11:27

You can whois a user based on their ID.

Would be good if we could whois an IP to bring up the relevant information as well

Copied from original issue: kharidiron#58

Warp plugin blocks access to Starbound's more powerfull built-in warp command

The addition of the warp plugin appears to have blocked access to Starbound's built-in warp command. Sadly, Starbound's warp command is quite a bit more powerful than the warp plugin and losing access is rather problematic.

Since the "warp" and "tp" commands are synonymous, removing the "warp" command and relying on "tp" alone may solve this problem.

-/motd

Does the MOTD have a time parameter? Not sure if it pops up enough.

Or perhaps when an admin uses /motd it forces it to all users with a 5 minute cool down?

Pushover support

While I closed the old PR for adding pushover support, as it wont work with the current code-version of SP3K, I am opening a ticket to re-examine the idea of implementing it for the future.

ref: #21

Ban/unban issue

From @ren-kun on September 23, 2016 11:24

Concerning the un-ban command. If you unban via IP, the next reboot, the person is banned again. You must unban via the original name that was banned.

Copied from original issue: kharidiron#57

Players with zero-length names cause various errors

If a player joins the server with an empty string for their name, it causes problems for StarryPy. Things I've noticed so far:

  1. /list_players stops when their entry is reached
  2. messages sent raise the following exception

2016-08-05 20:46:43 - ERROR - starrypy.plugin_manager # Exception encountered in plugin on action: c hat_sent Traceback (most recent call last): File ".\StarryPy3k\plugin_manager.py", line 45, in do if not (yield from p(packet, connection)): File ".\StarryPy3k\plugins\chat_enhancements.py", line 75, in on_chat_sent sender = self._decorate_line(connection) File ".\StarryPy3k\plugins\chat_enhancements.py", line 98, in _decorate_line connection.player.alias) AttributeError: 'Player' object has no attribute 'alias'

Since zero-length alias strings are (apparently) valid they should be handled gracefully.

Idea: more RP compatibility

Hell!o

I've been asked about the possibility of a command short-formed to /ooc or "out of character"

Apparently this RP based command will be used to change the color of the sentence, An example could be..

/ooc [color] [text] - color can be a predefined word such as red or a hex code

I think /nick can do it, but then it comes into permissions and other issues.

What do you think?

Chat censoring

From @ren-kun on August 7, 2016 9:42

If possible, have a dictionary that will check chat for cussing or rude words.

No more need to patrol chat for cussing etc.

Also allow the plugin to reload when adding new dictionary words on the fly.

Copied from original issue: kharidiron#40

Player database won't save

Hey,
It seems like every time I reboot StarryPy3k, the player database get wiped (i keep getting the greeting message to new players). Same thing for planets, so my /protect and /claims commands are not saved either.
I use python3.5, and I set the writing permissions on the /StarryPy3k folder. Is that a bug, or am I missing something?

thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.