GithubHelp home page GithubHelp logo

column01 / minepyscript Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 750 KB

A Spigot/Bungeecord plugin to provide python scripting for Minecraft Servers

License: GNU General Public License v3.0

Java 100.00%

minepyscript's Introduction

MinePyScript (WIP)

A Spigot/Bungeecord plugin to provide python scripting for Minecraft Servers

Introduction

When working on minecraft servers, often there are things you'd like to do that require some level of scripting.

I often find myself wishing there was an easy way to work with my servers to implement QOL features or simple things that otherwise would be frustrating to implement in Java. Things that otherwise don't require the entire spigot API, but you would like simple, (read only?) access to.

This project aims to be a solution to these problems.

The Plan

I'd like to implement a simple Python HTTP server using Flask that can take HTTP requests from the plugin and handle them in different ways.

For example:

  1. Spigot/Bungeecord server starts.
  2. In the onEnable event for either, it makes an HTTP request to the Python server to trigger tasks that you would normally run in the onEnable section.
  3. In the python server, it loads a set of user defined scripts. These scripts would be provided with a python library or pseudo API to format some pre-defined commands to execute on the main java server. (For example, registering a command or event handler). The python server then replies to the Java server with a list of these pre-defined commands to execute.
  4. The main java server reads the reply and executes these commands, registering any nessecary event or command handlers.
  5. Whenever the java server recieves one of these events or commands, it sends another HTTP request to the python server that will then handle that command by forwarding it to the user defined scripts.
  6. Your handler is then allowed to execute a simple set of commands (like send the player a command reply or to cancel an event) that will be parsed by the python server.
  7. The python server then forwards your handled event or command back to the Java server which will then execute whatever set of functions or commands you requested in your script.

Challenges

  • How do you execute a python webserver in a way that respects Bungeecord/Spigot's "non reloadable" nature (while it is possible to reload, it is strongly discouraged)
  • How do you secure a system like this against potential attackers? (Likely some sort of key exchange should be made to ensure an attacker cannot intervene or run malicious code)
  • What is the best way to implement object serialization for sending through HTTP? Which side should do the brunt of the processing?
  • How do you distribute the Python library in an intelligent mannner that allows for easy development of scripts?
  • If Spigot/Bungeecord changes, what is the easiest way to implement these changes to my scripts?
  • By nature, python is dynamically typed whereas java is strictly typed. This could cause issues in conversion of objects from one language to another.

Todo list

Python

  • Implement basic HTTP server in Flask
  • Build class/file loading system for loading scripts
  • Create interfaces for various spigot/bungee things (like chat colors)
  • Work out a command structure for communicating with the Java Server

Java

  • Implement basic interfaces for command handler (Bungee)
  • Implement basic interface for event listeners (Bungee)
  • Implement basic interfaces for command handler (Spigot)
  • Implement basic interface for event listeners (Spigot)
  • Build HTTP messaging system
  • Build command parser from HTTP request responses

minepyscript's People

Contributors

column01 avatar

Stargazers

 avatar

Watchers

 avatar

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.