Note that in "functions" and "internal functions" the arguments are divided by the character "/"
$event_id$
= the event real id$storage$
= The instance of the storage class.$storage_config_id$
= the storage config id$player$
= bukkit player instance$player_name$
= Name of the player who executes the action.$event$
= The object of the event. Represents the event class and its children$storage_id$
= The id of the activated storage%slash_char%
= It is used to use the "/" character since, being an argument divider, it detects it as suchIt is used to define variables and inside there are objects. These objects you can then interact with.
$$
$item$ | internal = getItemStackByAdapter( item = mc:emerald_block )
This type of variable is used to replace the %% variable with the text that you have defined for it.
%%
%player_name% | var = $player_name$
This type of variable is used to define it globally. Once defined, there is no need to define it again and if you try to define it, nothing will change.
{}
{global_var} | inventory = getItem(10)
{global_var}.object
{global_var}.id
vars:
- " {var1} | number = 0 "
- " $var_remmap_object$ | var = {var1}.object"
- " $var_remmap_id$ | var = {var1}.id"
- " $var_remmap$ | var = {var1}"
The executors are the ones that "Executes as" by default the "Executes as" is Storage
BLOCK_STORAGE
$block_storage$
$block_storage_id$
$block_storage_config_id$
STORAGE
$storage_id$
= The id of the activated storage$storage$
= The instance of the storage class.$storage_config_id$
= the storage config idFURNITURE_STORAGE
$furniture_storage$
$furniture_storage_id$
$furniture_storage_config_id$
ENTITY_STORAGE
ITEM_STORAGE
$item_storage_owner$
$item_storage_owner_name$
$item_storage_config_id$
API
$api$
$api_id$
$api_type$
.
run: SYNC # SYNC OR ASYNC
This method is executed in the main thread of the server, this means that if, for example, it is to use the click item storage event and you want to cancel the event, you would need the SYNC method.
The disadvantage is that it runs in the main server thread.
And that means that performance may be affected somewhat
On the other hand, this method is the most recommended since it runs asynchronously with the server, which means that it uses other threads on your processor, this will ensure that your server is not affected.
Used to globally import classes
.
java_imports:
- org.bukkit.Material
- org.bukkit.inventory.ItemStack
To make comparisons you must use the argument inside "{}"
{ java = $player$.isOp() } == { boolean = true}
It should be noted that when it is a java argument it is not necessary to enter 2 {}
This also works
{ java = $player$.isOp() }
But only when it comes to java.
- "{ java = $player$.isOp() }"
- "{ internal = getAdapterId( item = <inventory = getItem(8)> ) } == { adapter = mc:diamond }"
If you want to know more see information about BeanShell
Arguments can be used in various places and in various ways
The main use of arguments is to use them in variables.
In the example below it is exactly the same, the only thing is that the var list is a list of objects so you can add more items to that list.
"Internal"
is the argument and "getItemStackByAdapter( item = mc:emerald block )"
is the argument value
Example with vars and vars list:
.
vars_list:
var3_list:
var: "$items$"
type: internal
list:
- "getItemStackByAdapter( item = mc:emerald_block )"
vars:
- " $item$ | internal = getItemStackByAdapter( item = mc:emerald_block ) "
An example of use would be to use it with "<arg=value>"
it would be the same as declaring a variable and using that argument
I will show 2 examples, one using <> and the other without using it.
We can see in the example below how in the end the result will be that the item emerald_block will be placed in slot 0
Example of with function and using variables
.
vars:
- " $item$ | internal = getItemStackByAdapter( item = mc:emerald_block ) "
functions:
- "SetItemInventory{ slot = 0 / item = $item$ }"
We can see in the example below how in the end the result will be that the item emerald_block will be placed in slot 0
Example of with function and using <>
.
functions:
- "SetItemInventory{ slot = 0 / item = <internal = getItemStackByAdapter( item = mc:emerald_block )> }"
Both are valid but each has its advantages.
This is link config options. LINK
actions:
action1:
run: SYNC
This is link config options. LINK
.
java_imports:
- org.bukkit.Material
- org.bukkit.inventory.ItemStack
This is link config options. LINK
.
execute_as: block_storage
This is link config options. LINK
.
vars_list:
var1_list:
var: "$items$"
type: internal
list:
- "getItemStackByAdapter( item = mc:emerald_block )"
This is link config options. LINK
.
vars:
- " $item$ | internal = getItemStackByAdapter( item = mc:emerald_block ) "
This is link config options. LINK
.
functions:
- javaCode { code = $storage$.addItemStackToAllPagesWithRestrictions( $item$ ) }
This is link config options. LINK
.
conditions:
- "{ java = $player$.isOp() }"
- "{ internal = getAdapterId( item = <inventory = getItem(8)> ) } == { adapter = mc:diamond }"
action1:
run: SYNC
java_imports:
- org.bukkit.Material
- org.bukkit.inventory.ItemStack
execute_as: block_storage
vars_list:
var1_list:
var: "$items$"
type: internal # Argument type
list:
- "getItemStackByAdapter( item = mc:emerald_block )"
vars:
- " $item$ | internal = getItemStackByAdapter( item = mc:emerald_block ) "
functions:
- javaCode { code = $storage$.addItemStackToAllPagesWithRestrictions( $item$ ) }
conditions:
- "{ java = $player$.isOp() }"
- "{ internal = getAdapterId( item = <inventory = getItem(8)> ) } == { adapter = mc:diamond }"