Using view/click requirements
-
Resource Links:
Available Placeholders: https://www.spigotmc.org/wiki/placeholderapi-placeholders/
One of the core features that DeluxeMenus provides is the ability to show items based on checks the plugin can do for individual players. This can make your server dynamic and exciting. There are an infinite amount of ways we can use the expressions the plugin takes advantage of. Remember, These can be used in the view_requirements or the click requirements.
As the click requirements tag is pretty self explanatory...we won't directly reference it. On this page I will only talk about view_requirements, but be aware that any expression I use can be used in click requirements as well.
There are two types of expressions. There are comparisons (using placeholders) and there are java expressions (which can use placeholders, but do not have to). Here's a basic comparison:
Code (YAML):view_requirement:
requirements:
anythinghere:
type: '>'
input: '%vault_eco_balance%'
output: 100
We can do this comparison with ANY placeholder that returns a number. However, We are not limited to simple comparisons.
Here is a java expression that checks if a player has a permission:
Code (YAML):view_requirement:
requirements:
anythinghere:
type: has permission
permission: 'some.permission'
Code (YAML):view_requirement:
requirements:
anythinghere:
type: string equals ignorecase
input: '%player_world%'
output: 'world_nether'
Now, What if you wanted this item to show unless they were IN the world_nether? Let's say you want this item to show only if they are in the main world or the end world...rather than in the nether. Well, We can tell the statement to do the opposite. Look at this example:
Code (YAML):view_requirement:
requirements:
anythinghere:
type: javascript
expression: '!"%player_world%".equalsIgnoreCase("world_nether");'
So, If you understand how that works...you can grasp that the view_requirement hides the item if the expression returns "false" and shows the item if it returns "true".
Now, Let's say you have a placeholder that returns true/false. Like the %essentials_kit_is_available_<kitname>% placeholder. We could do a statement like this:
Code (YAML):view_requirement:
requirements:
anythinghere:
type: string equals ignorecase
input: '%essentials_kit_is_available_<kitname>%'
output: 'yes'
Once again, If you can't get an expression working...try putting the placeholder in chat to see what it is returning.
Note: I have been using "string equals ignorecase", but you can also use "string equals" and it will check the value including casing. This means that if you had a world called "WoRLd_TeSt" you could do ".equals" and it would require it to have the exact casing to return true.
These expressions can be done with ANY placeholder, and you can use any kind of Java statement in them. If you need help getting one working...please let us know in the thread, and we will try to help.
Be sure and check future example menu pages to see how you can use these expressions. - Loading...
- Loading...
XenCarta PRO
© Jason Axelrod from 8WAYRUN.COM