/Grasscutter-MeaMailPlus

A plugin of Grasscutter for send in-game mail conveniently

Primary LanguageJavaGNU Affero General Public License v3.0AGPL-3.0

Group 148.jpg

MeaMailPlus - Grasscutter Mail enhancements

MeaMailPlus is a plugin of Grasscutter, you can use this plugin to send your mail conveniently.

English | 简体中文

Grasscutter's command tools: GrasscutterCommandGenerator

💡Feature

  • Birthday Mail - Send birthday emails to players on their birthdays.
  • Daily Bonus - Players will receive rewards when they join the server.
  • Newbie Gift Mail - Players will receive rewards when they first joined.
  • Scheduled Mail push - You can limit the level threshold of players to receive the mail.
  • Command support - Support sending Mails by command.
  • RESTful API - Send Mail via third-party API.
  • MORE - Comming soon...

🍗Setup

Install

  1. Download Plugin Jar
  2. Put plugins into plugins folder of your grasscutter server.
  3. Start your server, then the plugin will create MeaMailPlus folder in your server plugin folder.
Root
│   lib
│   keys
│   resources
│   ...
└───plugins
    │   ...
    └───MeaMailPlus
        │   template       // template files
        └───config.json    // plugin config file

How to use?

The plugin will create a MeaMailPlus folder in your server plugin folder, include template folder and config.json file.

Config file

The config file is a JSON file, you can edit it to set the plugin's behavior. Run command /meamail reload in console to reload the config.

{
  "updateTime": [4, 0, 0],         // set the server's start time for send mail of the day, default is 04:00:00(24 hours system)
  "initialMail": [ 1001 ],         // set the initial mail template id, you can set multiple mail ids like [1001, 1002, 1003]
  "birthDayMail": [ 1004 ],        // set the birthday mail template id, you can set multiple mail too!
  
  "dailySignInMail": [             // players can only receive once a day, and will not send if they are not online.
    {
      "templateId": 1002,          // set the template id for daily sign in mail.
      "minLevel": 0                // you can limit the level(0-60) threshold of players to receive the mail.
    },
    {
      "templateId": 1003,          // multiple mail...
      "minLevel": 25                
    },
    {
      "templateId": 1004,          // multiple mail...
      "minLevel": 55                
    }
  ],
  
  "dailyRepetitionMail": [         // send a timed email collectively
    {
      "onlineOnly": false,         // whether the player needs to be online to receive mail
      "triggerTime": [12, 0, 0],   // 12:00:00
      "templateId": 1003,          // templateId
      "minLevel": 0                // you can limit the level(0-60) threshold of players to receive the mail.
    },
    {                              // multiple mail...
      "onlineOnly": true,
      "triggerTime": [16, 0, 0],    // 16:00:00
      "templateId": 1003,
      "minLevel": 0
    },
    {                              // multiple mail...
      "onlineOnly": true,
      "triggerTime": [0, 0, 0],    // 24:00:00
      "templateId": 1003,
      "minLevel": 0
    }
  ]
}

Template file

You can make multiple template files in template folder, only supports JSON. like this: TemplateExample.json

{
  "templateId": 1001,              // Your template id, can't be repeated         
  "title": "Mail title",           // Your Mail title
  "sender": "KiritaniIwako",       // Your sender name, you can set "Server"
  "expireTime": 0,                 // Your mail expire time, will be explained in detail later.
  "remainTime": 2592000,           // Your mail remain time, if you have set the remainTime, the expireTime will not take effect.
  "importance": 0,                 // Your mail importance, 0 is normal, 1 is star
  "body": {                        // Your mail content, will be explained in detail later.
    "content": "Mail content",
    "items": [
      {
        "id": 223,                 // item id
        "count": 1,                // amount
        "level": 1                 // item level(0-90?)
      }
    ]
  }
}
  1. How to set the mail expireTime or remainTime?
{
  "expireTime": 1651571451,
  // use 10 digits timestamp, like this: 
  // you can use convert tool to convert the timestamp to 10 digits timestamp, 
  // https://www.epochconverter.com/
  
  "remainTime": 2592000
  // time in second
  // 2592000 is the seconds of 30 days: 
  // 2592000 = 30(d) * 24(h) * 60(m) * 60(s)
  // if you are not sure, you can use two 10 digits timestamp subtraction:
  // 2592000 = 1651568400 (2022-5-3 9:00:00GMT) - 1648976400 (2022-4-3 9:00:00GMT)
}
  1. How to set the mail body/content?
{
  "body": {
    "content": "Mail content",
    // you can set the content of the mail, 
    // you can use the variable: 
    // `{playerName}`: (Testing) player name
    // `\r\n`: line feed
    // you can use link to open Browser & Webview in-game:
    // <type=\"browser\" text=\"title\" href=\"You website link\"/>
    // for example:
    // `<type=\"browser\" text=\"Discord\" href=\"https://discord.gg/T5vZU6UyeG\"/>`: open a Browser, tag name is "Discord".
    // `<type=\"webview\" text=\"Discord\" href=\"https://discord.gg/T5vZU6UyeG\"/>`: open a in-game Browser, tag name is "Discord".
    
    "items": [                     // items in the mail, if you set `[]`, no item will be sent
      {
        "id": 223,                 // item id
        "count": 1,                // amount
        "level": 1                 // item level(1-90?)
      },
      {
        "id": 224,                 // Multiple items...
        "count": 1,
        "level": 1
      },
      {
        "id": 202,                 // Multiple items...
        "count": 10000000,
        "level": 1
      }
    ]
  }
}

Hyperlinks in the mail content:

<type=\"browser\" text=\"title\" href=\"You website link\"/>

for example:

<type=\"browser\" text=\"Discord\" href=\"https://discord.gg/T5vZU6UyeG\"/>
<type=\"webview\" text=\"Discord\" href=\"https://discord.gg/T5vZU6UyeG\"/>

Command & Permission

Command:

Send Mail:
    /meamail send <templateId> <uid>
    /meamail sendall <templateId> <minLevel>
    /meamail sendallonline <templateId> <minLevel>
Other:
    /meamail reload
    /meamail help

Permission:

meo.mail | Control plugin functions