Tutorials/6. Reward Shops

With OnTime you can also give players some control over the types of rewards they receive through OnTime's Loyalty Points and Econ Shops.

This function was added to OnTime to give more meaning to the "Loyalty Points" function. Once the code was there for the "points" shops, it was a very simple extension to also add the "econ" based shop. So, this is not really meant as a full function replacement for other "shop" plugins, but an really an extension to the OnTime "points" rewards.

OnTime & OnSign Integration

The OnTime Reward Shops are implemented through integration between the OnTime plugin and its companion plugin OnSign. The rewards to be issued are defined in OnTime, similar to other OnTime Rewards, and OnSign provides the shop creation and handling of player purchases.

Setting up Shop

Setting up an OnTime Shop is very simple. The first step is to define the reward and its cost through OnTime commands. Then the creation of a sign, that requires a single line.

Example 1: Diamonds for Points

For example, I want to create a shop where a player can purchase diamonds at the cost of 500 Points. To do this I need to first execute these commands:

/ontime rewards add item 1 diamond tag=diamondShop

/ontime rewards shop diamondShop points 500

The first command establishes the reward as one diamond, and I gave this a rewardTag of "diamondShop". In the second command I indicate that the 'diamondShop' reward should be a "shop" reward that costs 500 points.

The next step to complete the shop is to place a sign, and on the first line insert the rewardTag proceeded by "%". So in this example I would put "%diamondShop" on the first line, and I can then use the remaining lines for any text I choose. OnSign will replace that first line with a configurable string, such as "Points Shop". Please see OnSign for more information on creating and customizing signs.

In my example my sign would look like this:

   1 Diamond
   500 Points

Example 2: Promotion for Points

In this example I want to create another shop, but this time I want players to be able to promote themselves to the "Builder" rank using Points (cost=1000 points) they have earned. Setting this up is very similar to the diamond shop I created above, but there is an extra step that I need to take to make sure OnTime handles promotions properly.

As with all other promotion/demotion rewards supported by OnTime, one of the key pieces of information it needs is an ordered list of the ranks on the server. This list insures that OnTime does not accidentally promote (to lower) or demote (to higher) a player incorrectly. Please click here for information on how to set up the "groups:" list within the rewards.yml file.

Once the "groups:" is properly set up, I simply need to execute the following commands:

/ontime rewards add promotion Builder tag=builderShop

/ontime rewards shop builderShop points 1000

The last step is to create a sign, where I must put "%%builderShop" on the first line.

   to 'Builder'
  1000 Points

Example 3: Buying a temporary permission for "coins"

In this last example I want to create a shop on my server that player's can click on to buy the "ontime.other" permission (allows them to use the "/ontime <playerName>" command to see other player's OnTime stats) for a 24 hour period, at a cost of 200 coins. Here are the commands for this:

/ontime rewards add addperm ontime.other tag=otherShop

/ontime rewards shop otherShop econ 200

/ontime rewards add rmperm ontime.other real 24h tag=removeOther

/ontime rewards link otherShop removeOther

In the commands above:

  1. This creates the reward to give the permission 'ontime.other', and gives the rewardTag of 'otherShop'
  2. This makes 'otherShop' reward a "shop" reward with a cost of 200 econ units (e.g. coins)
  3. This creates a reward that takes away the permission 'ontime.other' after 24 hours of real (clock) time, with a tag of 'removeOther'
  4. This links 'otherShop" and 'removeOther', such that as soon as 'otherShop' reward is issued, the clock starts ticking on the execution of the second.

Again the last step is to create a sign. Mine looks like this when I created it:

   for 24 hours
   200 coins

Purchasing Shop Rewards via Command

Once there are shop rewards defined there is an alternative method to make a purchase from a shop. An 'admin' command has been defined that can be used to make a purchase from a shop for a specified player, and the main purpose is to create a way to link OnTime Points/Econ shops with other plugins. This command requires the 'ontime.rewards.admin' permission string in order to use it.


ontime rewards purchase <RewardTag/RewadID> <playerName>

For the command to execute successfully, the specified player must have the sufficient number of Points or Econ units, as required by the reward shop. The messages displayed the user are the same as if the player had interacted with a Sign Shop to make the same purchase.

End Tutorial


Posts Quoted:
Clear All Quotes