LaserHydra
Create promotion codes which run commands when redeemed by players

Supported Games
GameServerKingsGameServerKings

Promocodes allows you to create promotion codes which run commands when redeemed by players.

You can either use automatically generated codes using the "Automatically Fill To (Amount)" option, or insert your own.

This website can be used to generate codes aswell.

Commands

This plugin provides universal chat and console commands. When using a command in the chat, prefix it with a forward slash: /.

  • redeem <code> -- Redeem a promocode

Configuration

[
  {
    "Automatically Fill To (Amount)": 5,
    "Codes": [],
    "Commands": [
      {
        "Parameters": [
          "{username} just redeemed a code!"
        ],
        "Command": "say"
      }
    ]
  }
]

Every setting looks like this: "Key": Value

The key is the name/description of the setting while the value is the actual value you want to set it to.

The whole part inside the outer [ ] can be duplicated to create another "promocode group".

Automatically Fill To (Amount) -- Promocodes will ensure there are always this many codes, if there are less, it automatically generates new onesCodes -- Contains all redeemable codes of this code group (If the same code exists in multiple code groups, all of those are activated)Commands -- The commands to be run when a code from this code group is redeemed; The commands can also be duplicated to run multiple commandsParameters -- Contains the parameters to be passed when running the commandCommand -- The command to be run

Example Configuration

[
  {
    "Automatically Fill To (Amount)": 0,
    "Codes": [
        "ABC-DEF-GHI",
        "JKL-MNO-PQR-STU"
    ],
    "Commands": [
      {
        "Parameters": [
          "{username} just redeemed a VIP package!"
        ],
        "Command": "say"
      },
      {
        "Parameters": [
          "add",
          "{id}",
          "vip"
        ],
        "Command": "o.usergroup"
      }
    ]
  },
  {
    "Automatically Fill To (Amount)": 2,
    "Codes": [
        "123-456-111",
        "123-456-112"
    ],
    "Commands": [
      {
        "Parameters": [
          "{username} just redeemed a VIP  package!"
        ],
        "Command": "say"
      },
      {
        "Parameters": [
          "add",
          "{id}",
          "vip-plus"
        ],
        "Command": "o.usergroup"
      }
    ]
  }
]

Localization

{
  "Invalid Code": "The code you entered seems to be either invalid or already redeemed.",
  "Code Redeemed": "You redeemed a code with and received {amount} reward packages."
}

MIT License


Copyright (c) 2019 LaserHydra


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:


The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.