Punish - Making a new menu

Mar 28, 2016
Punish - Making a new menu
  • A feature introduced into Punish 3.0 is the ability for the user to create unlimited menus to fit their server needs.

    Upon loading Punish for the first time, 3 menu files will be created: punish.yml, fun.yml, options.yml; Each of these files can either be edited or removed completely.

    To create a new menu navigate to your menus folder (plugins/Punish/menus) and create a new file. I'll call mine tutorial.yml for the sake or referencing it later.

    Once you have the file created, open it up, we have to add the two basic option requirements in: Title, and Size.

    Code (Text):

    # The name of the menu, variables and colors supported.
    Title: 'Tutorial Menu'
    # The size of the menu, up to 54, must be divisible by 9 (9,18,27,36,45,54)
    Size: 9
     
    Next, we need to decide whether or not we want a command to open our menu. For the sake of the tutorial. We will make /tutorial.

    Code (Text):

    # The name of the menu, variables and colors supported.
    Title: 'Tutorial Menu'
    # The size of the menu, up to 54, must be divisible by 9 (9,18,27,36,45,54)
    Size: 9
    # Command used to open the menu (not required)
    Command: tutorial
     
    Now we can leave it as is or make a permission required to use the command. This one will be 'tutorial.use'

    Code (Text):

    # The name of the menu, variables and colors supported.
    Title: 'Tutorial Menu'
    # The size of the menu, up to 54, must be divisible by 9 (9,18,27,36,45,54)
    Size: 9
    # Command used to open the menu (not required)
    Command: tutorial
    # Permission required to use the command
    Permission: tutorial.target
     


    Next, we need to decide on whether or not the menu requires a Target (for banning, warning, etc). This one will.

    Code (Text):

    # The name of the menu, variables and colors supported.
    Title: 'Tutorial Menu'
    # The size of the menu, up to 54, must be divisible by 9 (9,18,27,36,45,54)
    Size: 9
    # Command used to open the menu (not required)
    Command: tutorial
    # Permission required to use the command
    Permission: tutorial.target
    # Set whether or not to use a target; If true command becomes /<command> <targetName> (e.g. /tutorial GrimReaper52498)
    UseTarget: true
     


    Now we can do the same thing but for a reason, of course setting this to true will require the user to enter a reason for Punishing.
    I'm not going to be using it in this Tutorial, however it can be easily added by added UseReason: true


    Now, Save & Close the file and restart your server. Enter the game and you should now be able to do /tutorial GrimReaper52498 and the menu will open

    Congratulations! You've successfully created a menu! Now you probably want that menu to do something, huh? Well head here to learn how to create items inside the menu!
  • Loading...
  • Loading...