legendeagler legendeagler @askmask1231 Utilities

THIS IS A BUNGEE PLUGIN! Install in 'bungee_command/plugins' not 'bukkit_command/plugins'

EaglerMOTD

This plugin can add animated MOTDs to your Eaglercraft server

EaglerMOTD Sample

It can also add custom "Accept:" query handlers for 3rd party sites to gather more information about your server

How to Install

Download EaglerMOTD.jar and place it in your EaglercraftBungee '/plugins' directory. Then, restart EaglercraftBungee

You will find a new 'EaglerMOTD' folder in the plugins folder you put the jar in, once you finish restarting your server. This contains the plugin's configuration files, you can edit any of them and then type motd-reload in the EaglercraftBungee console to reload all the variables.

Configuration Guide

Messages.json:

{
  "close_socket_after": 1200,
  "max_sockets_per_ip": 10,
  "max_total_sockets": 256,
  "allow_banned_ips": false,
  "messages": {
    "all": [
      {
        "name": "default",
        "frames": [ 
          "frames.frame1",
          "frames.frame2",
          "frames.frame3",
          "frames.frame4"
        ],
        "interval": 8,
        "random": false,
        "shuffle": false,
        "timeout": 500,
        "weight": 1.0,
        "next": "any"
      }
    ]
  }
}

Frames.json:

You can name this file anything you want, and you can create more than one. In 'messages.json' just define the frame as, for example, 'file.name' and it will look in a file called 'file.json' for a frame named 'name'. The example 'frames.frame1' in 'messages.json' will load 'frame1' from this default file called 'frames.json'

{
    "frame1": { 
        "icon": "server-animation.png",
        "icon_spriteX": 0,
        "icon_spriteY": 0,
        "online": "default",
        "max": "default",
        "players": "default",
        "text0": "&7An Eaglercraft server",
        "text1": "&0!!!!&8Running EaglerMOTD plugin"
    },
    "frame2": { 
        "icon": "server-animation.png",
        "icon_spriteX": 1,
        "icon_spriteY": 0,
        "icon_color": [ 1.0, 0.0, 0.0, 0.15 ],
        "online": 10,
        "players": [ "fake player 1", "fake player 2" ],
        "text0": "&6&nAn&r &7Eaglercraft server",
        "text1": "&0!!&8!&0!&8Running EaglerMOTD plugin"
    },
    "frame3": { 
        "icon": "server-animation.png",
        "icon_spriteX": 2,
        "icon_spriteY": 0,
        "icon_color": [ 1.0, 0.0, 0.0, 0.15 ],
        "icon_tint": [ 0.8, 0.8, 1.0 ],
        "online": 20,
        "players": [],
        "text0": "&7An &6&nEaglercraft&r &7server",
        "text1": "&0!&8!!&0!&8Running EaglerMOTD plugin"
    },
    "frame4": { 
        "icon": "server-animation.png",
        "icon_spriteX": 3,
        "icon_spriteY": 0,
        "icon_color": [ 1.0, 1.0, 0.0, 0.15 ],
        "icon_tint": [ 0.8, 0.8, 1.0, 0.8 ],
        "online": 30,
        "players": "default",
        "text0": "&7An Eaglercraft &6&nserver&r",
        "text1": "&8!!!&0!&8Running EaglerMOTD plugin"
    }
}

Every frame will retrieve the values from the previous frame in the message for the default value for every variable

Queries.json:

This has nothing to do with MOTD, skip this part if you're just trying to add an animated MOTD

This file allows you to configure custom Accept: handlers to EaglercraftBungee to provide more custom statistics to 3rd party server lists and crawlers

{
    "queries": { 
        "ExampleQuery1": { 
            "type": "ExampleQuery1_result",
            "string": "This is a string"
        },
        "ExampleQuery2": { 
            "type": "ExampleQuery2_result",
            "txt": "query2.txt"
        },
        "ExampleQuery3": { 
            "type": "ExampleQuery3_result",
            "string": "This query returns binary",
            "file": "binary.dat"
        },
        "ExampleQuery4": { 
            "type": "ExampleQuery4_result",
            "json": "query4.json"
        },
        "ExampleQuery5": { 
            "type": "ExampleQuery5_result",
            "json": {
                "key1": "value1",
                "key2": "value2"
            }
        },
        "ExampleQuery6": { 
            "type": "ExampleQuery6_result",
            "json": {
                "desc": "This query returns JSON and a file",
                "filename": "test_file.dat",
                "size": 69
            },
            "file": "test_file.dat"
        }
    }
}

"queries" contains a JSON object, each variable in this JSON object is the name of a query and the value is a JSON object containing the type of response and the content of the "data" value in the response

Here is an example of a server's response to a generic query:

{
    "type": "<type here>",
    "data": "<data here>",
    "vers": "0.1.0",
    "name": "EaglercraftBungee Server",
    "time": 1648946954405,
    "brand": "Eagtek",
    "cracked": true
}

"type" is just a generic string you can set to hint to the client what kind of response you are sending, and "data" stores the actually data of the response, and can be either a string or JSON object

Binary WebSocket packets can also be sent to a client, their format can be completely arbitrary and arrive containing the same raw unformatted data that was sent. They accompany a regular JSON response, the "type" and/or "data" value of the JSON response can be used to hint to the client when a raw binary packet is present

The "vers", "name", "time", "brand", and "cracked" values are added internally by the server and cannot be changed

Queries.json Format:

The file contains a JSON object with a "queries" value which contains a map of keys matching Accept: types to JSON objects

The JSON objects contain the "type" of response to send and what the "data" for that response should be. Also, a path to a binary file can be specified.

All files specified in queries.json are RELOADED AUTOMATICALLY when changes are detected. This allows you to dynamically update the response for certain queries without motd-reload because you can just edit the file the query is configured to read and it will update the version cached in memory automatically.

To add or edit an entry in queries.json, you need to define:

Then, you must define one of:

Optionally, you can define:

Use motd-reload to reload queries.json

Compiling and Contributing

First, download the latest EaglercraftBungee jar in stable-download on LAX1DUDE/eaglercraft

Make a new java project in Eclipse/IDEA/etc and add 'src' folder in this repository as the source code folder

Then, add your EaglercraftBungee jar (bungee-dist.jar) to the java project's Build Path and refresh

Export the contents of 'src' folder of the project to a JAR file to compile the plugin

For a PR: Tabs, not spaces, and format the code like the Eclipse auto format tool on factory settings.