Conditions

Sep 16, 2017
Conditions
  • Conditions
    You can set up conditions that need to be met in order for the shopitem to be displayed to a player. Setting up conditions is quite simple.
    [​IMG]

    Example:
    Code (Text):
    ShopName: food-condition
    DisplayName: 'Food Condition'
    signs:
      text: '[conditions]'
      NeedPermissionToCreateSign: true
    InventorySize: 45
    shop:
      5-1:
        Condition:
        - type:Hunger
        - under:20
        RewardType: item
        PriceType: free
        Reward:
        - type:COOKED_CHICKEN
        - amount:1
        MenuItem:
        - type:COOKED_CHICKEN
        - name:&9Hungry?
        - 'lore:#&aYou seem very hungry!#&aClick for a free Cooked Chicken!'
        - amount:1
        InventoryLocation: 23
      5:
        RewardType: nothing
        PriceType: free
        MenuItem:
        - type:BARRIER
        - name:&9Hungry?
        - 'lore:#&cYou don''t seem hungry..#&cCome back when you''re hungry'
        - amount:1
        InventoryLocation: 23
     
    The chicken shopitem is shown only when the player has less than 20 hunger, which means it is shown when the player has any hunger (hunger 20 = full hunger bar). Else the barrier item is going to be shown.

    The output looks like this:
    [​IMG]


    Structure
    Conditions are set up in a list. First you need to define the current type of conditions and next you set up the condition rules. You can add as many conditions as you like. Examples:

    Code (Text):
        Condition:
        - type:serverpinging
        - online:true
        - over:200

    Code (Text):
        Condition:
        - type:permission
        - match:permission.node
    Code (Text):
        Condition:
        - type:money
        - over:1000
        - type:health
        - between:5:15

    Rules
    AND
    All conditions in the list need to be met in order for an item to be displayed. If one of all conditions is false the item will be hidden. Example:
    Code (Text):
        Condition:
        - type:money
        - over:1000
        - type:health
        - between:5:15
    Here the player needs both 5-15 health and over 1000 money in order to get the item displayed.

    OR
    In case of "match" condition types it is possible to work with optional conditions: You can list different match values, separated with a comma. If one of those values does match the condition returns true, even if all other match values are false.
    Code (Text):
        Condition:
        - type:group
        - match:group1,group2,group3,group4
    Here the player only needs to be in one of the listed groups in order to see the item.


    Available condition types
    Just inform me if you wish some additional types of conditions to be added.

    BossShopPro loads all shopitems in the order they are set up in the config. If the conditions of a shopitem are not met the shopitem won't be displayed. In that case if an other shopitem has the same inventorylocation defined, it will be shown instead.

    Code (Text):
    # Possible condition types and examples.
    Condition types:
        - Money/Points
            - over:1000             (Matches any balance over 1000 - vault or points plugin)
            - under:500             (Matches any balance under 500 - vault or points plugin)
            - equals:150            (Matches only a balance of 150 - vault or points plugin)
            - between:300:600       (Matches any balance between 300 and 600 - vault or points plugin)
        - ServerPinging
            - online:true           (Matches if the server is succesfully pinged and online)
            - over:70               (Matches any player count over 70)
            - under:40              (Matches any player count under 40)
            - equals:500            (Matches only a player count of 500)
            - between:1:100         (Matches any player count between 1 and 100)
        - Permission
            - match:node.node       (If this permission node is matched, it will be shown)
            - dontmatch:node.node   (If this permission node is NOT matched, it will be shown)
        - Group
            - match:plus            (Shows item if user is in group Plus)
            - dontmatch:vip         (Shows item if user is NOT on group vip)
        - Item
            - match:stone           (Shows item if user has stone in his inventory)
            - dontmatch:diamond     (Shows item if user does not have diamonds in his inventory)
        - HandItem
            - match:stone           (Shows item if user has stone in his main hand)
            - dontmatch:diamond     (Shows item if user does not have diamonds in his main hand)
        - Health/Hunger/Exp
            - over:10               (Matches any health/hunger/exp level over 10)
            - under:5               (Matches any health/hunger/exp level below 5)
            - equals:15             (Matches exactly health/hunger/exp level of 15)
            - between:5:15          (Matches health/hunger/exp level between 5 and 15)
        - Time
            - over:4000             (Matches if the Minecraft day has passed 4000 ticks, from 0)
            - under:2000            (Matches if the Minecraft day has not passed 2000 ticks, from 0)
            - equals:8000           (Matches exactly 8000 Minecraft day ticks.. Not really useful)
            - between:12000:24000   (Matches if the Minecraft day is between 12000 and 24000 ticks)
    #RealDay = Day of year; RealWeekDay = Day of week, starting with monday = 1
        - RealYear/RealMonth/RealWeek/RealDay/RealWeekDay/RealHour/RealSecond/RealMillisecond
            - over:12               (Matches if value is higher than 12)
            - under:20              (Matches if value is lower than 20)
            - equals:11             (Matches if value is 11; Can be used for a christmas calendar for example or weekly rewards)
            - between:18:24         (Matches if value is between 18 and 24)
        - LightLevel
            - over:10               (Matches if light level is high)
            - under:6               (Matches if light level is low)
            - equals:15             (Matches if lightlevel is at maximum brightness)
            - between:8:14          (Matches if the light level is not sunlight but still high)
        - LocationX/LocationY/LocationZ (The Y coordinate determines the height of the player)
            - over:100              (Matches if coordinate of player is higher than 100)
            - under:50              (Matches if coordinate is lower than 50)
            - equals:1              (Matches if coordinate equals 1)
            - between:1:40          (Matches if coordinate is between 1 and 40)
        - World
            - match:worldname       (Shows item if user is in world with name "worldname")
            - dontmatch:worldname   (Shows item if user is in world with a name different from "worldname")
     
    Placeholder conditions
    The condition types "placeholdernumber" and "placeholdermatch" allow checking any BossShopPro or PlaceholderAPI supported placeholder and checking values of any supported plugin.

    PlaceholderNumber:
    Code (Text):
        Condition:
        - type:placeholdernumber
        - '%balancepoints%:over:100'
    PlaceholderMatch:
    Code (Text):
        Condition:
        - type:placeholdermatch
        - '%item_in_hand%:match:WOOD_SWORD,STONE_SWORD,IRON_SWORD,GOLD_SWORD,DIAMOND_SWORD'
    Colons (":") within placeholders do not work directly because colons are used by BossShopPro in order to split the line into placeholder, condition and conditionstype. If your placeholders contain colons, use "[colon]" instead to make them work.



    Modulo support
    Numerical condition types support modulo. Here's an advanced example:
    Code (Text):
      Moving_1:
        MenuItem:
        - name:&c[*]
        - type:STAINED_GLASS_PANE:0
        RewardType: NOTHING
        PriceType: NOTHING
        Message: ''
        ExtraPermission: ''
        InventoryLocation: 1
        Condition:
        - type:realsecond
        - 'between:0:5#%45'
      Moving_2:
        MenuItem:
        - name:&c[*]
        - type:STAINED_GLASS_PANE:1
        RewardType: NOTHING
        PriceType: NOTHING
        Message: ''
        ExtraPermission: ''
        InventoryLocation: 2
        Condition:
        - type:realsecond
        - 'between:6:10#%45'
      Moving_3:
        MenuItem:
        - name:&c[*]
        - type:STAINED_GLASS_PANE:2
        RewardType: NOTHING
        PriceType: NOTHING
        Message: ''
        ExtraPermission: ''
        InventoryLocation: 3
        Condition:
        - type:realsecond
        - 'between:11:15#%45'
      Moving_4:
        MenuItem:
        - name:&c[*]
        - type:STAINED_GLASS_PANE:3
        RewardType: NOTHING
        PriceType: NOTHING
        Message: ''
        ExtraPermission: ''
        InventoryLocation: 4
        Condition:
        - type:realsecond
        - 'between:16:20#%45'
      Moving_5:
        MenuItem:
        - name:&c[*]
        - type:STAINED_GLASS_PANE:4
        RewardType: NOTHING
        PriceType: NOTHING
        Message: ''
        ExtraPermission: ''
        InventoryLocation: 5
        Condition:
        - type:realsecond
        - 'between:21:25#%45'
      Moving_6:
        MenuItem:
        - name:&c[*]
        - type:STAINED_GLASS_PANE:5
        RewardType: NOTHING
        PriceType: NOTHING
        Message: ''
        ExtraPermission: ''
        InventoryLocation: 6
        Condition:
        - type:realsecond
        - 'between:26:30#%45'
      Moving_7:
        MenuItem:
        - name:&c[*]
        - type:STAINED_GLASS_PANE:6
        RewardType: NOTHING
        PriceType: NOTHING
        Message: ''
        ExtraPermission: ''
        InventoryLocation: 7
        Condition:
        - type:realsecond
        - 'between:31:35#%45'
      Moving_8:
        MenuItem:
        - name:&c[*]
        - type:STAINED_GLASS_PANE:7
        RewardType: NOTHING
        PriceType: NOTHING
        Message: ''
        ExtraPermission: ''
        InventoryLocation: 8
        Condition:
        - type:realsecond
        - 'between:36:40#%45'
      Moving_9:
        MenuItem:
        - name:&c[*]
        - type:STAINED_GLASS_PANE:8
        RewardType: NOTHING
        PriceType: NOTHING
        Message: ''
        ExtraPermission: ''
        InventoryLocation: 9
        Condition:
        - type:realsecond
        - 'between:41:45#%45'
    This will generate an animated item that will move from slot 1 to slot 9 and then start at slot 1 again.
    Putting "#%<divisor>" to the end of conditions makes BossShopPro transform the value related to the condition via modulo. If you for example use conditiontype 'realsecond' and work with modulo '10' all values received by the condition checkers are between 0 and 9, because "<current time % 10>" will result in numbers of that range. Modulo is helpful if you want to create animated shops.
  • Loading...
  • Loading...