diff --git a/docs/wiki/site/permission/index.html b/docs/wiki/site/permission/index.html index 967e1ca88..c211b58be 100644 --- a/docs/wiki/site/permission/index.html +++ b/docs/wiki/site/permission/index.html @@ -362,6 +362,24 @@ + + +
The following permissions are available in PetBlocks.
-Permission | +Level | +Description | +
---|---|---|
petblocks.command | +User | +Allows to use the /petblocks command. | +
petblocks.pet.spawn | +User | +Required permission to see the pet. If you remove this permission from a player, the pet automatically despawns. | +
petblocks.pet.amount.1 | +User | +The slot where the pet is stored. 1 is the default slot. | +
Allows to use the /petblocks command. | ||||
petblocks.pet.spawn | +User | +Required permission to see the pet. If you remove this permission from a player, the pet automatically despawns. | +||
petblocks.pet.amount.1 | +User | +The slot where the pet is stored. 1 is the default slot. | +||
petblocks.pet.amount.[number] | +User | +The slot where the pet is stored. e.g. petblocks.pet.amount.1 (slot 1) and petblocks.pet.amount.2 (slot 2) | +||
petblocks.gui.petblocks_main_menu | User | Allows to access the main GUI of PetBlocks. | @@ -670,26 +749,11 @@Allows to see the help messages. | |
petblocks.reload | -Admin | -Permission to use the /petblocks reload command. | -||
petblocks.pet.create | -Admin/User | -Allows to create a new pet. This command should probably be executed by a GUI / Sign / Server Management Plugin. If you set receivePetsOnJoin in the config.yml, you do not need this permission. | -||
petblocks.pet.call | User | Allows to call the pet to the owner. | ||
petblocks.pet.spawn | -User | -Minimum required permission a player has to have in order to have a pet. If you remove this permission from a player, the pet automatically despawns. | -||
petblocks.pet.ride | User | Allows to ride a pet. | @@ -710,11 +774,6 @@Allows to list the pets of a player | |
petblocks.pet.delete | -Admin/User | -Allows to delete a pet. It depends on the type of server if you want to give this permission to your players. This command should be executed by a GUI / Sign / Server Management Plugin. | -||
petblocks.pet.displayName | User | Allows to rename a pet. | @@ -730,6 +789,16 @@Allows to despawn at pet. | |
petblocks.pet.create | +Admin/User | +Allows to create a new pet. This command should probably be executed by a GUI / Sign / Server Management Plugin. If you set receivePetsOnJoin in the config.yml, you do not need this permission. | +||
petblocks.pet.delete | +Admin/User | +Allows to delete a pet. It depends on the type of server if you want to give this permission to your players. This command should be executed by a GUI / Sign / Server Management Plugin. | +||
petblocks.pet.skin | Admin/User | Allows to change the skin via command. This command should probably be executed by a GUI / Sign / Server Management Plugin. | @@ -795,11 +864,6 @@Allows to change the template of a pet. | |
petblocks.pet.manipulateOther | -Admin | -Allows to manipulate the pets of other players. e.g. Changing skins, etc. | -||
petblocks.pet.select | Admin/User | Allows to mark a pet as selected. This is helpful for placeholders. | @@ -815,11 +879,6 @@If you give your players access to petblocks.pet.create , each individual template is still locked by this permission. |
|
petblocks.pet.amount.[number] | -Admin/User | -If you give your players access to petblocks.pet.create , the access to the slot where the pet is stored. e.g. petblocks.pet.amount.1 (slot 1) and petblocks.pet.amount.2 (slot 2) |
-||
petblocks.pet.breakBlock | Admin/User | Allows to use the /petblocks breakblock command | @@ -864,6 +923,16 @@Admin | Allows to use the /petblocks variable command |
petblocks.pet.manipulateOther | +Admin | +Allows to manipulate the pets of other players. e.g. Changing skins, etc. | +||
petblocks.reload | +Admin | +Permission to use the /petblocks reload command. | +
classic
for you and makes it spawn in front of you. If you cannot see the pet, try executing /petblocks call pet
or review your permissions again.
Make sure your players have this permission to see their pet:
petblocks.pet.spawn
+petblocks.pet.amount.1
The next step is to decide, how you want your players to receive a pet. There are multiple options below.
PetBlocks is a Minecraft Bukkit plugin to use blocks as pets in minecraft.
PetBlocks v8 Docs
Are you looking for the old wiki? You can download it here. A copy can also be found in the web archive.
"},{"location":"#features","title":"Features","text":"PetBlocks offers a Developer Api, however it is not published to Maven Central or any other distribution system yet. You need to directly reference the PetBlocks.jar file.
"},{"location":"api/#usage","title":"Usage","text":"Add a dependency in your plugin.yml
softdepend: [ PetBlocks]\n
Take a look at the following example:
public class YourPlugin extends JavaPlugin {\n @Override\n public void onEnable() {\n // Always gets the same instance of the PetService.\n PetService petService = Bukkit.getServicesManager().load(PetService.class);\n\n Player player = Bukkit.getPlayer(\"YourPlayerName\");\n Plugin plugin = this;\n\n // GetPetsFromPlayerAsync may retrieve the pet from the Database or the InMemory cache.\n petService.getPetsFromPlayerAsync(player).thenAccept(pets -> {\n // Main Thread\n if (pets.size() > 0) {\n // Do not keep the pet instance in your plugin (e.g. in fields). Always retrieve it with getPetsFromPlayerAsync.\n // If you need to keep the pet instance in high performance scenarios, check if the pet has already been disposed before using it with pet.isDisposed().\n Pet pet = pets.get(0);\n\n // All pet methods are safe to be called regardless if the pet is currently spawned or not.\n pet.call();\n // Changes are automatically applied to the pet if it is spawned and automatically persisted.\n pet.setDisplayName(\"Hello World\");\n pet.setLoop(\"idle\");\n }\n }).exceptionally(error -> {\n plugin.getLogger().log(Level.SEVERE, \"Failed to load pets.\", error);\n return null;\n });\n }\n}\n
"},{"location":"commands/","title":"Commands","text":"PetBlocks is a command line based pet plugin. This means, you can fully control the pets using commands, which may be executed by players, console, other plugins, command blocks.
e.g. Letting the pet named pet
of player Steve98
move to a certain location from the console. (The pet has to be in a nearby location)
/petblocks moveto pet <x> <y> <z> <speed> [player]\n
petblocks moveto pet 250 5 300 0.2 Steve98\n
Removing the pet under certain conditions
You can always take a way the petblocks.pet.spawn
permission to remove the pet from players, if they enter certain areas (e.g. joining minigames, entering regions, etc.)
Required Permission: petblocks.command
Opens the main GUI of petblocks. You can configure this command in the gui/petblocks_main_menu.yml
file.
Required Permission: petblocks.command
/petblocks create <name> <template> [player]\n
Creates a new pet for the player with the given pet template.
/petblocks delete <name> [player]\n
Deletes the pet of the player.
/petblocks list [player]\n
Lists all pets of a player.
/petblocks call <name> [player]\n
Spawns and teleports the pet in front of the owner.
/petblocks lookat <name> <x> <y> <z> [player]\n
Makes the pet look at the given location.
/petblocks lookatowner [player]\n
Makes the pet look at the owner.
/petblocks moveto <name> <x> <y> <z> <speed> [player]\n
Makes the pet walk to a given location.
/petblocks movetoowner <name> <speed> [player]\n
Makes the pet walk to the owner.
/petblocks hat <name> [player]\n
Makes the owner wear the pet.
/petblocks ride <name> [player]\n
Makes the owner ride the pet.
/petblocks unmount <name> [player]\n
Makes the owner unmount (stop riding/hat) the pet.
/petblocks teleport <name> <world> <x> <y> <z> <yaw> <pitch> [player]\n
Teleports the pet to the given location.
/petblocks velocity <name> <x> <y> <z> [player]\n
Launches the pet into the given direction.
/petblocks velocityrel <name> <mx> <my> <mz> [oy] [player]\n
Launches the pet into the current looking direction with the given multipliers.
/petblocks skintype <name> <material> [durability] [player]\"\n
Changes the material used as a head.
/petblocks skinnbt <name> <nbt> [player]\n
Changes the NBT tags of the head item.
Works in Minecraft versions below 1.20.5. Use the /petblocks skincomponent
command for Minecraft >= 1.20.5.
/petblocks skincomponent <name> <datacomponent> [player]\n
Changes the Data Component tags of the head item. Data Components replace NBT tags since the release of Minecraft 1.20.5.
See https://minecraft.wiki/w/Data_component_format for details. Use the /petblocks skinnbt
command for Minecraft server below 1.20.5.
/petblocks skinbase64 <name> <skin> [player]\n
Changes the head material to player_head and sets the base64 encoded texture url.
eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYThhZDZmYzEyNzA4NDQ2ZWI2NmM3NTY5ZTI4ZDVlMjUyMWQyMTQ2MzQ4YjQ4YmY2YzQ3ZjU0OGQ5ZWVjNDYwYSJ9fX0=
on https://minecraft-heads.com/custom-heads/humanoid/67436-beegsmol-mumei /petblocks skinheaddatabase <name> <hdbId> [player]\n
Changes the head material to player_head and sets the texture url from a skin loaded by the HeadDatabase plugin.
/petblocks rename <name> <displayname> [player]\n
Changes the display name of the pet. Does not accept spaces. Underlines '_' are automatically replaced by spaces. Allows values should be set in the config.yml
.
/petblocks visibility <name> <type> [player]\n
Changes who can see the pet.
ALL
, OWNER
, NOBODY
/petblocks loop <name> <loop> [player]\n
Changes which loop from the template is being executed by the pet. Example loops are idle
.
/petblocks template <name> <template> [player]\n
Changes the template of a pet without recreating the pet.
/petblocks spawn <name> [player]\n
Spawns the pet if it has not already spawned.
/petblocks despawn <name> [player]\n
Despawns the pet if it has not already despawned.
/petblocks toggle <name> [player]\n
Toggles the pet spawn state.
/petblocks select <name> [player]\n
Makes the owner select one of his pets as primary pet. This is only helpful if a single player has got multiple pets in PetBlocks-Premium.
/petblocks openheaddatabase <name> [player]\n
Opens the headDatabase inventory with a special hook, which applies the next item you select in the headdatabse gui to the pet.
/petblocks breakblock <name> <timeToBreak> <dropType> [player]\n
Breaks the block the pet is looking at. There is a placeholder, which contains the name of the block type. This command only works on blocks, if the player executing the command has got the permission to break this specific block. The command is cancel able using the cancel command. Breaking a block is automatically cancelled on certain actions. e.g. a pet looks at a player, a pet starts moving
/petblocks cancel <name> [player]\n
Cancels any long running actions like breaking a block.
/petblocks snap <name> [player]\n
Rotates the pet to the exact line of the nearest x or z axe.
/petblocks moveforward <name> <speed> [player]\n
Lets the pet move forward in its current direction. Executing the snap command before executing this is helpful to move in a straight direction. If the pet reaches a cliff (1 block difference), moving forward stops.
/petblocks rotaterel <name> <direction> <angle> [player]\n
Rotates the pet relative to its current rotation.
/petblocks entitytype <name> <entityType> [player]\n
Changes the entity type of the pet. The default type is minecraft:armor_stand
/petblocks entityvisible <name> <true/false> [player]\n
Changes if the body of an entity is visible. For armorstands this is false, for most of the other entities this should be true.
/petblocks groundoffset <name> <offset> [player]\n
Changes the offset of the body of the entity to the ground. Useful when configuring different entity types.
/petblocks variable <name> <key> <value> [player]\n
Sets the value of the variable with the given key. This is useful store arbitrary data into the pet. e.g. health, selected particle, selected sound, etc.
Required Permission: petblocks.command
/petblocksgui open <name> [arguments.../player]\n
Starts a new GUI session and opens the GUI with the given name for the executing player. If any other GUIs were open when executing this command, they get discarded from the navigation history.
Samples:
/petblocksgui open simple_sample_menu\n
/petblocksgui open simple_sample_menu / Pikachu\n
%petblocks_gui_param1%
is now 123456
./petblocksgui open simple_sample_menu 123456\n
%petblocks_gui_param1%
is now 123456
%petblocks_gui_param2%
is now abcde
./petblocksgui open simple_sample_menu 123456 abcde / Pikachu\n
"},{"location":"commands/#petblocksgui-next","title":"/petblocksgui next","text":"/petblocksgui next <name> [arguments.../player]\n
Reuses the existing GUI session (or starts a new one if it is not available) and opens the GUI with the given name for the executing player. If any other GUIs were open when executing this command, they get put into the navigation history. Executing /petblocksgui back
reopens the previous GUI.
/petblocksgui back [player]\n
Checks if the current GUI session contains a previously opened GUI. If that is the case, the previous GUI is opened and the current GUI is discarded. If not GUI is found, the current GUI is simply closed.
/petblocksgui close [player]\n
Closes the current GUI and clears the GUI session and navigation history.
PetBlocks can be used to build custom pets with custom models. A bee model is shown below.
"},{"location":"custommodels/#tutorial","title":"Tutorial","text":"Important
There are even more ways to achieve custom model pets in modern Minecraft versions. This is only one way to do it.
A pet in PetBlocks is an Armorstand with an item on its head. The NBT tags of this item can be freely manipulated in your pet.yml
. Therefore, we can add the NBT tag called CustomModelData
on the itemstack and display a custom model instead of the block item.
The first step is to create a resource pack. A good starting point to create a resource pack with CustomModelData can be found here: https://www.planetminecraft.com/forums/communities/texturing/new-1-14-custom-item-models-tuto-578834/
Secondly, update the NBT tags in the pet.yml
file.
nbt: '{CustomModelData:mycustommodelname}'
Pets in PetBlocks can be programmed in the pet.yml file to perform such behaviors. You would need a PlaceHolderApi placeholder which contains the location of the entity you want to attack (will be added in a future update to PetBlocks, but there may already be plugins out there, which provide that). Then, create a new loop where the pet moves to to the entity using the /petblocks moveTo <x> <y> <z>
command. Once the pet is near the entity, make it jump using /petblocks velocity <x> <y> <z>
and execute command to damage the entity /damage @e[type=zombie,limit=1,sort=nearest] 20
Maintaining backwards compatibility is very hard and actively discouraged by spigot. I do my best to add more and more workarounds. However, it has become so much work, that you can only download them by becoming a Patreon https://www.patreon.com/Shynixn.
"},{"location":"gui/","title":"GUI","text":"PetBlocks comes with a powerful embedded GUI plugin, which supports Minecraft 1.8.9 - Latest.
The default PetBlocks GUI can be opened with the command /petblock
. Make sure you have all the required permissions for all GUI pages.
The easiest way to get started is by editing the existing PetBlocks GUI and observing the changes.
The workflow is like that:
/PetBlocks/gui/simple_sample_menu.yml
file./PetBlocks/gui
folder./petblocks reload
./petblocksgui open <name>
simple_sample_menu.yml
and rename it to my_first_menu.yml
.my_first_menu.yml
in an editor like VSCode or NotePad++name: \"my_first_menu\"\n
.yml
files./petblocks reload\n
/petblocksgui open my_first_menu\n
my_first_menu.yml
or start over by deleting it./mycoolgui
.my_first_menu.yml
to your needs.command: \"mycoolgui\"\n
"},{"location":"gui/#customizing-the-gui-menu","title":"Customizing the GUI menu","text":"simple_sample_menu.yml
file again. Each available options is explained with a short comments.Required.
You need to set this property. If it says Optional
you do not need to set it.minecraft:gold_block
in your my_first_menu.yml
and replace it with minecraft:diamond_block
. After you gave done that simply execute /petblocks reload
again and open the GUI /mycoolgui
.The following permissions are available in PetBlocks.
"},{"location":"permission/#levels","title":"Levels","text":"petblocks.pet.create
, each individual template is still locked by this permission. petblocks.pet.amount.[number] Admin/User If you give your players access to petblocks.pet.create
, the access to the slot where the pet is stored. e.g. petblocks.pet.amount.1 (slot 1) and petblocks.pet.amount.2 (slot 2) petblocks.pet.breakBlock Admin/User Allows to use the /petblocks breakblock command petblocks.pet.cancel Admin/User Allows to use the /petblocks cancel command petblocks.pet.snap Admin/User Allows to use the /petblocks snap command petblocks.pet.moveRel Admin/User Allows to use the /petblocks moveforward command petblocks.pet.rotateRel Admin/User Allows to use the /petblocks rotaterel command petblocks.pet.entityType Admin/User Allows to use the /petblocks entitytype command petblocks.pet.entityVisibility Admin/User Allows to use the /petblocks entityvisible command petblocks.pet.groundOffset Admin/User Allows to use the /petblocks groundOffset command petblocks.pet.variable Admin Allows to use the /petblocks variable command"},{"location":"placeholders/","title":"PlaceHolders","text":"The following placeholders are available in PetBlocks and can also be used via PlaceHolderApi.
PlaceHolder Api
As PetBlocks supports multiple pets per player, you need to select the pet in your placeholders. You can do this by appending the pet slot _1
_2
etc. or use the /petblocks select <name>
command to set a pet as selected which can be retrieved using _selected
. This results into placeholders such as e.g. %petblocks_pet_displayName_1%
or %petblocks_pet_displayName_selected%
. This is only relevant in external plugins. For actions in PetBlocks, you can directly use the placeholders below.
Once you have setup the permission, join your server. The PetBlocks default configuration creates a pet with template classic
for you and makes it spawn in front of you. If you cannot see the pet, try executing /petblocks call pet
or review your permissions again.
Make sure your players have this permission to see their pet:
petblocks.pet.spawn\n
The next step is to decide, how you want your players to receive a pet. There are multiple options below.
"},{"location":"receivingpets/#receiving-a-pet-on-first-join","title":"Receiving a pet on first join","text":"This is enabled per default and can be changed in the config.yml
under pet/receivePetsOnJoin
. This creates a new database entry for each joining player, regardless if he has the spawn permission or not. The player requires the minimum petblocks.pet.spawn
to see their pet.
If you want to receive no pets on join and unlock pets later own (e.g. for shops or VIP perks), change this to:
pet:\n receivePetsOnJoin: []\n
If you want to receive multiple pets (PetBlocks-Premium only) on first join. Append other pets below it. They have to have different names.
pet:\n receivePetsOnJoin:\n - name: \"pet1\"\n template: \"classic\"\n - name: \"pet2\"\n template: \"classic\" \n
In order to configure, if the pet should automatically spawn in front of the player on creation, open the template plugins/PetBlocks/pets/pet_classic.yml
. Set pet/spawned
to true
or false
.
There are many ways how you can handle it. These are just examples below:
"},{"location":"receivingpets/#option-1-just-selling-skins-for-your-pet-easy","title":"Option 1 - Just selling skins for your pet (easy)","text":"petblocks.pettype.<yourpettype>
e.g. petblocks.pettype.pikachu
.petblocks.pettype.pikachu
petblocks.pettype.pikachu
/petblocks skinbase64 pet eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTdlYmNlZjQ2ODNjZGI3MTYzZTk2OWU0ZTIyNjlmMzY3M2E1ZDVlNmI3OGUwNmZhZWU0NWJjZjdjNDljMzk3In19fQ== %petblocks_owner_name%\n
"},{"location":"receivingpets/#option-2-state-handling-of-pets-hard","title":"Option 2 - State handling of pets (hard)","text":"petblocks.pettype.<yourpettype>
e.g. petblocks.pettype.pikachu
. petblocks.pettype.pikachu
petblocks.pettype.pikachu
permission./petblocks create <petName> <templateName> %petblocks_owner_name%\n
Executing the create command multiple times is fine, it does not do anything if the pet already exists.
"},{"location":"receivingpets/#option-3-free-creationdeletion-of-pets-for-players-easy","title":"Option 3 - Free creation/deletion of pets for players (easy)","text":"petblocks.pet.create\npetblocks.pet.delete\npetblocks.pet.amount.1\n
petblocks.pet.template.classic
./petblocks create <petName> classic
and /petblocks delete <petName>
. You can also setup this in a GUI.PetBlocks allows you to create templates, how a pet is going to look like and how it is going to behave. You can fully customize the behaviour and program the pets to perform certain actions.
PetBlocks provides you with a starting pet template called classic
, which can be found in the plugins/PetBlocks/pets/
folder. You can copy this template and start desigining your own pets. Make sure to give it a new unique template identifier.
Modify a template and execute /petblocks reload
to apply the changes to your pet.
Most of the static values are explained in the config file itself. Set them according to your needs.
Example for static values are name
, version
and all initial pet settings under pet:
.
Events define what actions to execute on certain events.
The following events are supported:
For example the leftClick
event gets executed when a player left-clicks on the pet. However, it may not be the owner, who clicks on a pet, therefore you need to check if the player is the owner first as a condition.
Example:
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"Open the pet GUI\" \n condition:\n type: STRING_EQUALS\n left: \"%petblocks_eventPlayer_name%\"\n right: \"%petblocks_owner_name%\"\n type: \"COMMAND\"\n level: \"PLAYER\"\n run:\n - \"/petblocks select %petblocks_pet_name%\"\n - \"/petblock\"\n
If you want to execute nothing when the player rightClicks on the pet, remove all actions.
events:\n rightClick:\n actions: []\n
"},{"location":"template/#building-a-new-action","title":"Building a new action","text":"PlaceHolders
You can use placeholders almost anywhere when building actions. You can even use PlaceHolderApi based placeholders.
Create a new action and give it an arbitrary name.
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n
Select the action type. Support actions are COMMAND
, DELAY
, JAVASCRIPT
.
Executes one or multiple commands as Console or Player.
Vanilla Commands
A vanilla command may automatically log to the console and to the chat of every op player. You can disable the output for op players using vanilla game rules such as /gamerule sendCommandFeedback false
, /gamerule logAdminCommands false
, /gamerule commandBlockOutput false
. If you want to hide the output in your console (not recommend), you need to install a LogFilter plugin.
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n type: \"COMMAND\" # Required action type.\n level: \"SERVER\" # Required for type COMMAND. Possible values are PLAYER (player level permission), SERVER (console level permission)\n
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n type: \"COMMAND\" # Required action type.\n level: \"SERVER\" # Required for type COMMAND. Possible values are PLAYER (player level permission), SERVER (console level permission)\n run: \n - \"/say Hello %petblocks_owner_name%\" # Required for type COMMAND. One or more commands are allowed.\n
"},{"location":"template/#delay","title":"DELAY","text":"Delays the next action for a certain amount of ticks.
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"Delay Action\" # Required arbitrary name.\n type: \"DELAY\" # Required action type.\n ticks: 60 # Required for type DELAY. 60 Ticks delay.\n
"},{"location":"template/#javascript","title":"JAVASCRIPT","text":"Executes JavaScript based Code for value calculation
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"JavaScript action\" # Required arbitrary name.\n type: \"JAVASCRIPT\" # Required action type.\n initial: \"Cool\" # Required for type JAVASCRIPT. The initial value of the result variable.\n variable: \"myVariable\" # Required for type JAVASCRIPT. The name of the result variable, which can be read using PlaceHolders.\n js: | # Required for type JAVASCRIPT. Actual multi line JavaScript code.\n function createText() {\n var text = \"%petblocks_js_myVariable%\" + \" Plugin\"\n return text\n }\n createText();\n
"},{"location":"template/#debugging-actions","title":"Debugging Actions","text":"When you start creating actions, it is very helpful to know, which action is currently being executed and how variables are evaluated. Every action can be logged to your server console by setting the optional debug: true
property of an action.
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"Delay Action\" # Required arbitrary name.\n type: \"DELAY\" # Required action type.\n ticks: 60 # Required for type DELAY. 60 Ticks delay.\n debug: true # Optional flag to log this action to the console.\n
"},{"location":"template/#restricting-actions","title":"Restricting Actions","text":""},{"location":"template/#permission","title":"Permission","text":"Actions can optionally have the permission tag:
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n permission: \"mycustom.permission\"\n type: \"COMMAND\" # Required action type.\n level: \"SERVER\" # Required for type COMMAND. Possible values are PLAYER (player level permission), SERVER (console level permission)\n run: \n - \"/say Hello %petblocks_owner_name%\" # Required for type COMMAND. One or more commands are allowed.\n
"},{"location":"template/#conditions","title":"Conditions","text":"Actions can optionally have conditions, which support the following types:
STRING_EQUALS
STRING_NOT_EQUALS
STRING_EQUALS_IGNORE_CASE
STRING_NOT_EQUALS_IGNORE_CASE
NUMBER_GREATER_THAN
NUMBER_GREATER_THAN_OR_EQUAL
NUMBER_LESS_THAN
NUMBER_LESS_THAN_OR_EQUAL
JAVASCRIPT
Try to avoid using JAVASCRIPT
because it requires more computation time. It should only be used if you want to create complex boolean expressions.
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n condition: # Optional condition tag.\n type: STRING_EQUALS # Required condition type.\n left: \"%petblocks_eventPlayer_name%\" \n right: \"%petblocks_owner_name%\"\n type: \"COMMAND\" # Required action type.\n level: \"SERVER\" # Required for type COMMAND. Possible values are PLAYER (player level permission), SERVER (console level permission)\n run: \n - \"/say Hello %petblocks_owner_name%\" # Required for type COMMAND. One or more commands are allowed.\n
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n condition: # Optional condition tag.\n type: JAVASCRIPT # Required condition type.\n js: \"Math.floor(Math.random() * 100) <= 50\" # 50% chance to execute this command.\n type: \"COMMAND\" # Required action type.\n level: \"SERVER\" # Required for type COMMAND. Possible values are PLAYER (player level permission), SERVER (console level permission)\n run: \n - \"/say Hello %petblocks_owner_name%\" # Required for type COMMAND. One or more commands are allowed.\n
"},{"location":"template/#loops","title":"Loops","text":"Loops define, what the pet should repeatedly do. You can customize and define your own loops using actions.
Programmable Pets
You can freely build new loops, delete loops and customize the behavior of pets. The actions allow full freedom to design your pets.
"},{"location":"template/#idle-loop","title":"Idle Loop","text":"The idle loop explained:
/petblocks lookatowner %petblocks_pet_name% %petblocks_owner_name%
/petblocks loop %petblocks_pet_name% moveToOwner %petblocks_owner_name%
, which switches the loop idle
to the loop called moveToOwner
.Delay Action
loops:\n idle: \n actions:\n - name: \"Delay Action\"\n type: \"DELAY\"\n ticks: 20\n - name: \"Look at owner with a 90% change.\"\n condition:\n type: JAVASCRIPT\n js: \"Math.floor(Math.random() * 100) <= 90\" # Calculate chance in JavaScript.\n type: \"COMMAND\"\n level: \"SERVER\"\n run:\n - \"/petblocks lookatowner %petblocks_pet_name% %petblocks_owner_name%\"\n - name: \"Switch to moveToOwner if pet is too far away\"\n condition:\n type: JAVASCRIPT\n js: \"%petblocks_pet_distanceToOwner% > 7\"\n type: \"COMMAND\"\n level: \"SERVER\"\n run:\n - \"/petblocks loop %petblocks_pet_name% moveToOwner %petblocks_owner_name%\"\n
"},{"location":"template/#movetoowner-loop","title":"MoveToOwner Loop","text":"As we noticed that the loop changes to the loop moveToOwner
, we take a look at this loop too.
/petblocks moveToOwner %petblocks_pet_name% 0.2 %petblocks_owner_name%
/petblocks loop %petblocks_pet_name% moveToOwner %petblocks_owner_name%
, which switches the loop moveToOwner
to the loop called idle
.Recalculate path and start moving to owner
loops:\n moveToOwner:\n actions:\n - name: \"Recalculate path and start moving to owner.\"\n type: \"COMMAND\"\n level: \"SERVER\"\n run:\n - \"/petblocks moveToOwner %petblocks_pet_name% 0.2 %petblocks_owner_name%\"\n - name: \"Switch to idle if the pet is beside the player\"\n condition:\n type: JAVASCRIPT\n js: \"%petblocks_pet_distanceToOwner% < 4\"\n type: \"COMMAND\"\n level: \"SERVER\"\n run:\n - \"/petblocks loop %petblocks_pet_name% idle %petblocks_owner_name%\"\n - name: \"Teleport pet to player if the pet is too far away for the pathfinder.\"\n condition:\n type: JAVASCRIPT\n js: \"%petblocks_pet_distanceToOwner% > 20\"\n type: \"COMMAND\"\n level: \"SERVER\"\n run:\n - \"/petblocks teleport %petblocks_pet_name% %petblocks_owner_locationWorld% %petblocks_owner_locationX% %petblocks_owner_locationY% %petblocks_owner_locationZ% %petblocks_owner_locationYaw% %petblocks_owner_locationPitch% %petblocks_owner_name%\"\n - name: \"Delay Action\"\n type: \"DELAY\"\n ticks: 20\n
"}]}
\ No newline at end of file
+{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Introduction","text":"PetBlocks is a Minecraft Bukkit plugin to use blocks as pets in minecraft.
PetBlocks v8 Docs
Are you looking for the old wiki? You can download it here. A copy can also be found in the web archive.
"},{"location":"#features","title":"Features","text":"PetBlocks offers a Developer Api, however it is not published to Maven Central or any other distribution system yet. You need to directly reference the PetBlocks.jar file.
"},{"location":"api/#usage","title":"Usage","text":"Add a dependency in your plugin.yml
softdepend: [ PetBlocks]\n
Take a look at the following example:
public class YourPlugin extends JavaPlugin {\n @Override\n public void onEnable() {\n // Always gets the same instance of the PetService.\n PetService petService = Bukkit.getServicesManager().load(PetService.class);\n\n Player player = Bukkit.getPlayer(\"YourPlayerName\");\n Plugin plugin = this;\n\n // GetPetsFromPlayerAsync may retrieve the pet from the Database or the InMemory cache.\n petService.getPetsFromPlayerAsync(player).thenAccept(pets -> {\n // Main Thread\n if (pets.size() > 0) {\n // Do not keep the pet instance in your plugin (e.g. in fields). Always retrieve it with getPetsFromPlayerAsync.\n // If you need to keep the pet instance in high performance scenarios, check if the pet has already been disposed before using it with pet.isDisposed().\n Pet pet = pets.get(0);\n\n // All pet methods are safe to be called regardless if the pet is currently spawned or not.\n pet.call();\n // Changes are automatically applied to the pet if it is spawned and automatically persisted.\n pet.setDisplayName(\"Hello World\");\n pet.setLoop(\"idle\");\n }\n }).exceptionally(error -> {\n plugin.getLogger().log(Level.SEVERE, \"Failed to load pets.\", error);\n return null;\n });\n }\n}\n
"},{"location":"commands/","title":"Commands","text":"PetBlocks is a command line based pet plugin. This means, you can fully control the pets using commands, which may be executed by players, console, other plugins, command blocks.
e.g. Letting the pet named pet
of player Steve98
move to a certain location from the console. (The pet has to be in a nearby location)
/petblocks moveto pet <x> <y> <z> <speed> [player]\n
petblocks moveto pet 250 5 300 0.2 Steve98\n
Removing the pet under certain conditions
You can always take a way the petblocks.pet.spawn
permission to remove the pet from players, if they enter certain areas (e.g. joining minigames, entering regions, etc.)
Required Permission: petblocks.command
Opens the main GUI of petblocks. You can configure this command in the gui/petblocks_main_menu.yml
file.
Required Permission: petblocks.command
/petblocks create <name> <template> [player]\n
Creates a new pet for the player with the given pet template.
/petblocks delete <name> [player]\n
Deletes the pet of the player.
/petblocks list [player]\n
Lists all pets of a player.
/petblocks call <name> [player]\n
Spawns and teleports the pet in front of the owner.
/petblocks lookat <name> <x> <y> <z> [player]\n
Makes the pet look at the given location.
/petblocks lookatowner [player]\n
Makes the pet look at the owner.
/petblocks moveto <name> <x> <y> <z> <speed> [player]\n
Makes the pet walk to a given location.
/petblocks movetoowner <name> <speed> [player]\n
Makes the pet walk to the owner.
/petblocks hat <name> [player]\n
Makes the owner wear the pet.
/petblocks ride <name> [player]\n
Makes the owner ride the pet.
/petblocks unmount <name> [player]\n
Makes the owner unmount (stop riding/hat) the pet.
/petblocks teleport <name> <world> <x> <y> <z> <yaw> <pitch> [player]\n
Teleports the pet to the given location.
/petblocks velocity <name> <x> <y> <z> [player]\n
Launches the pet into the given direction.
/petblocks velocityrel <name> <mx> <my> <mz> [oy] [player]\n
Launches the pet into the current looking direction with the given multipliers.
/petblocks skintype <name> <material> [durability] [player]\"\n
Changes the material used as a head.
/petblocks skinnbt <name> <nbt> [player]\n
Changes the NBT tags of the head item.
Works in Minecraft versions below 1.20.5. Use the /petblocks skincomponent
command for Minecraft >= 1.20.5.
/petblocks skincomponent <name> <datacomponent> [player]\n
Changes the Data Component tags of the head item. Data Components replace NBT tags since the release of Minecraft 1.20.5.
See https://minecraft.wiki/w/Data_component_format for details. Use the /petblocks skinnbt
command for Minecraft server below 1.20.5.
/petblocks skinbase64 <name> <skin> [player]\n
Changes the head material to player_head and sets the base64 encoded texture url.
eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYThhZDZmYzEyNzA4NDQ2ZWI2NmM3NTY5ZTI4ZDVlMjUyMWQyMTQ2MzQ4YjQ4YmY2YzQ3ZjU0OGQ5ZWVjNDYwYSJ9fX0=
on https://minecraft-heads.com/custom-heads/humanoid/67436-beegsmol-mumei /petblocks skinheaddatabase <name> <hdbId> [player]\n
Changes the head material to player_head and sets the texture url from a skin loaded by the HeadDatabase plugin.
/petblocks rename <name> <displayname> [player]\n
Changes the display name of the pet. Does not accept spaces. Underlines '_' are automatically replaced by spaces. Allows values should be set in the config.yml
.
/petblocks visibility <name> <type> [player]\n
Changes who can see the pet.
ALL
, OWNER
, NOBODY
/petblocks loop <name> <loop> [player]\n
Changes which loop from the template is being executed by the pet. Example loops are idle
.
/petblocks template <name> <template> [player]\n
Changes the template of a pet without recreating the pet.
/petblocks spawn <name> [player]\n
Spawns the pet if it has not already spawned.
/petblocks despawn <name> [player]\n
Despawns the pet if it has not already despawned.
/petblocks toggle <name> [player]\n
Toggles the pet spawn state.
/petblocks select <name> [player]\n
Makes the owner select one of his pets as primary pet. This is only helpful if a single player has got multiple pets in PetBlocks-Premium.
/petblocks openheaddatabase <name> [player]\n
Opens the headDatabase inventory with a special hook, which applies the next item you select in the headdatabse gui to the pet.
/petblocks breakblock <name> <timeToBreak> <dropType> [player]\n
Breaks the block the pet is looking at. There is a placeholder, which contains the name of the block type. This command only works on blocks, if the player executing the command has got the permission to break this specific block. The command is cancel able using the cancel command. Breaking a block is automatically cancelled on certain actions. e.g. a pet looks at a player, a pet starts moving
/petblocks cancel <name> [player]\n
Cancels any long running actions like breaking a block.
/petblocks snap <name> [player]\n
Rotates the pet to the exact line of the nearest x or z axe.
/petblocks moveforward <name> <speed> [player]\n
Lets the pet move forward in its current direction. Executing the snap command before executing this is helpful to move in a straight direction. If the pet reaches a cliff (1 block difference), moving forward stops.
/petblocks rotaterel <name> <direction> <angle> [player]\n
Rotates the pet relative to its current rotation.
/petblocks entitytype <name> <entityType> [player]\n
Changes the entity type of the pet. The default type is minecraft:armor_stand
/petblocks entityvisible <name> <true/false> [player]\n
Changes if the body of an entity is visible. For armorstands this is false, for most of the other entities this should be true.
/petblocks groundoffset <name> <offset> [player]\n
Changes the offset of the body of the entity to the ground. Useful when configuring different entity types.
/petblocks variable <name> <key> <value> [player]\n
Sets the value of the variable with the given key. This is useful store arbitrary data into the pet. e.g. health, selected particle, selected sound, etc.
Required Permission: petblocks.command
/petblocksgui open <name> [arguments.../player]\n
Starts a new GUI session and opens the GUI with the given name for the executing player. If any other GUIs were open when executing this command, they get discarded from the navigation history.
Samples:
/petblocksgui open simple_sample_menu\n
/petblocksgui open simple_sample_menu / Pikachu\n
%petblocks_gui_param1%
is now 123456
./petblocksgui open simple_sample_menu 123456\n
%petblocks_gui_param1%
is now 123456
%petblocks_gui_param2%
is now abcde
./petblocksgui open simple_sample_menu 123456 abcde / Pikachu\n
"},{"location":"commands/#petblocksgui-next","title":"/petblocksgui next","text":"/petblocksgui next <name> [arguments.../player]\n
Reuses the existing GUI session (or starts a new one if it is not available) and opens the GUI with the given name for the executing player. If any other GUIs were open when executing this command, they get put into the navigation history. Executing /petblocksgui back
reopens the previous GUI.
/petblocksgui back [player]\n
Checks if the current GUI session contains a previously opened GUI. If that is the case, the previous GUI is opened and the current GUI is discarded. If not GUI is found, the current GUI is simply closed.
/petblocksgui close [player]\n
Closes the current GUI and clears the GUI session and navigation history.
PetBlocks can be used to build custom pets with custom models. A bee model is shown below.
"},{"location":"custommodels/#tutorial","title":"Tutorial","text":"Important
There are even more ways to achieve custom model pets in modern Minecraft versions. This is only one way to do it.
A pet in PetBlocks is an Armorstand with an item on its head. The NBT tags of this item can be freely manipulated in your pet.yml
. Therefore, we can add the NBT tag called CustomModelData
on the itemstack and display a custom model instead of the block item.
The first step is to create a resource pack. A good starting point to create a resource pack with CustomModelData can be found here: https://www.planetminecraft.com/forums/communities/texturing/new-1-14-custom-item-models-tuto-578834/
Secondly, update the NBT tags in the pet.yml
file.
nbt: '{CustomModelData:mycustommodelname}'
Pets in PetBlocks can be programmed in the pet.yml file to perform such behaviors. You would need a PlaceHolderApi placeholder which contains the location of the entity you want to attack (will be added in a future update to PetBlocks, but there may already be plugins out there, which provide that). Then, create a new loop where the pet moves to to the entity using the /petblocks moveTo <x> <y> <z>
command. Once the pet is near the entity, make it jump using /petblocks velocity <x> <y> <z>
and execute command to damage the entity /damage @e[type=zombie,limit=1,sort=nearest] 20
Maintaining backwards compatibility is very hard and actively discouraged by spigot. I do my best to add more and more workarounds. However, it has become so much work, that you can only download them by becoming a Patreon https://www.patreon.com/Shynixn.
"},{"location":"gui/","title":"GUI","text":"PetBlocks comes with a powerful embedded GUI plugin, which supports Minecraft 1.8.9 - Latest.
The default PetBlocks GUI can be opened with the command /petblock
. Make sure you have all the required permissions for all GUI pages.
The easiest way to get started is by editing the existing PetBlocks GUI and observing the changes.
The workflow is like that:
/PetBlocks/gui/simple_sample_menu.yml
file./PetBlocks/gui
folder./petblocks reload
./petblocksgui open <name>
simple_sample_menu.yml
and rename it to my_first_menu.yml
.my_first_menu.yml
in an editor like VSCode or NotePad++name: \"my_first_menu\"\n
.yml
files./petblocks reload\n
/petblocksgui open my_first_menu\n
my_first_menu.yml
or start over by deleting it./mycoolgui
.my_first_menu.yml
to your needs.command: \"mycoolgui\"\n
"},{"location":"gui/#customizing-the-gui-menu","title":"Customizing the GUI menu","text":"simple_sample_menu.yml
file again. Each available options is explained with a short comments.Required.
You need to set this property. If it says Optional
you do not need to set it.minecraft:gold_block
in your my_first_menu.yml
and replace it with minecraft:diamond_block
. After you gave done that simply execute /petblocks reload
again and open the GUI /mycoolgui
.The following permissions are available in PetBlocks.
"},{"location":"permission/#levels","title":"Levels","text":"petblocks.pet.create
, each individual template is still locked by this permission. petblocks.pet.breakBlock Admin/User Allows to use the /petblocks breakblock command petblocks.pet.cancel Admin/User Allows to use the /petblocks cancel command petblocks.pet.snap Admin/User Allows to use the /petblocks snap command petblocks.pet.moveRel Admin/User Allows to use the /petblocks moveforward command petblocks.pet.rotateRel Admin/User Allows to use the /petblocks rotaterel command petblocks.pet.entityType Admin/User Allows to use the /petblocks entitytype command petblocks.pet.entityVisibility Admin/User Allows to use the /petblocks entityvisible command petblocks.pet.groundOffset Admin/User Allows to use the /petblocks groundOffset command petblocks.pet.variable Admin Allows to use the /petblocks variable command petblocks.pet.manipulateOther Admin Allows to manipulate the pets of other players. e.g. Changing skins, etc. petblocks.reload Admin Permission to use the /petblocks reload command."},{"location":"placeholders/","title":"PlaceHolders","text":"The following placeholders are available in PetBlocks and can also be used via PlaceHolderApi.
PlaceHolder Api
As PetBlocks supports multiple pets per player, you need to select the pet in your placeholders. You can do this by appending the pet slot _1
_2
etc. or use the /petblocks select <name>
command to set a pet as selected which can be retrieved using _selected
. This results into placeholders such as e.g. %petblocks_pet_displayName_1%
or %petblocks_pet_displayName_selected%
. This is only relevant in external plugins. For actions in PetBlocks, you can directly use the placeholders below.
Once you have setup the permission, join your server. The PetBlocks default configuration creates a pet with template classic
for you and makes it spawn in front of you. If you cannot see the pet, try executing /petblocks call pet
or review your permissions again.
Make sure your players have this permission to see their pet:
petblocks.pet.spawn\npetblocks.pet.amount.1 \n
The next step is to decide, how you want your players to receive a pet. There are multiple options below.
"},{"location":"receivingpets/#receiving-a-pet-on-first-join","title":"Receiving a pet on first join","text":"This is enabled per default and can be changed in the config.yml
under pet/receivePetsOnJoin
. This creates a new database entry for each joining player, regardless if he has the spawn permission or not. The player requires the minimum petblocks.pet.spawn
to see their pet.
If you want to receive no pets on join and unlock pets later own (e.g. for shops or VIP perks), change this to:
pet:\n receivePetsOnJoin: []\n
If you want to receive multiple pets (PetBlocks-Premium only) on first join. Append other pets below it. They have to have different names.
pet:\n receivePetsOnJoin:\n - name: \"pet1\"\n template: \"classic\"\n - name: \"pet2\"\n template: \"classic\" \n
In order to configure, if the pet should automatically spawn in front of the player on creation, open the template plugins/PetBlocks/pets/pet_classic.yml
. Set pet/spawned
to true
or false
.
There are many ways how you can handle it. These are just examples below:
"},{"location":"receivingpets/#option-1-just-selling-skins-for-your-pet-easy","title":"Option 1 - Just selling skins for your pet (easy)","text":"petblocks.pettype.<yourpettype>
e.g. petblocks.pettype.pikachu
.petblocks.pettype.pikachu
petblocks.pettype.pikachu
/petblocks skinbase64 pet eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTdlYmNlZjQ2ODNjZGI3MTYzZTk2OWU0ZTIyNjlmMzY3M2E1ZDVlNmI3OGUwNmZhZWU0NWJjZjdjNDljMzk3In19fQ== %petblocks_owner_name%\n
"},{"location":"receivingpets/#option-2-state-handling-of-pets-hard","title":"Option 2 - State handling of pets (hard)","text":"petblocks.pettype.<yourpettype>
e.g. petblocks.pettype.pikachu
. petblocks.pettype.pikachu
petblocks.pettype.pikachu
permission./petblocks create <petName> <templateName> %petblocks_owner_name%\n
Executing the create command multiple times is fine, it does not do anything if the pet already exists.
"},{"location":"receivingpets/#option-3-free-creationdeletion-of-pets-for-players-easy","title":"Option 3 - Free creation/deletion of pets for players (easy)","text":"petblocks.pet.create\npetblocks.pet.delete\npetblocks.pet.amount.1\n
petblocks.pet.template.classic
./petblocks create <petName> classic
and /petblocks delete <petName>
. You can also setup this in a GUI.PetBlocks allows you to create templates, how a pet is going to look like and how it is going to behave. You can fully customize the behaviour and program the pets to perform certain actions.
PetBlocks provides you with a starting pet template called classic
, which can be found in the plugins/PetBlocks/pets/
folder. You can copy this template and start desigining your own pets. Make sure to give it a new unique template identifier.
Modify a template and execute /petblocks reload
to apply the changes to your pet.
Most of the static values are explained in the config file itself. Set them according to your needs.
Example for static values are name
, version
and all initial pet settings under pet:
.
Events define what actions to execute on certain events.
The following events are supported:
For example the leftClick
event gets executed when a player left-clicks on the pet. However, it may not be the owner, who clicks on a pet, therefore you need to check if the player is the owner first as a condition.
Example:
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"Open the pet GUI\" \n condition:\n type: STRING_EQUALS\n left: \"%petblocks_eventPlayer_name%\"\n right: \"%petblocks_owner_name%\"\n type: \"COMMAND\"\n level: \"PLAYER\"\n run:\n - \"/petblocks select %petblocks_pet_name%\"\n - \"/petblock\"\n
If you want to execute nothing when the player rightClicks on the pet, remove all actions.
events:\n rightClick:\n actions: []\n
"},{"location":"template/#building-a-new-action","title":"Building a new action","text":"PlaceHolders
You can use placeholders almost anywhere when building actions. You can even use PlaceHolderApi based placeholders.
Create a new action and give it an arbitrary name.
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n
Select the action type. Support actions are COMMAND
, DELAY
, JAVASCRIPT
.
Executes one or multiple commands as Console or Player.
Vanilla Commands
A vanilla command may automatically log to the console and to the chat of every op player. You can disable the output for op players using vanilla game rules such as /gamerule sendCommandFeedback false
, /gamerule logAdminCommands false
, /gamerule commandBlockOutput false
. If you want to hide the output in your console (not recommend), you need to install a LogFilter plugin.
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n type: \"COMMAND\" # Required action type.\n level: \"SERVER\" # Required for type COMMAND. Possible values are PLAYER (player level permission), SERVER (console level permission)\n
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n type: \"COMMAND\" # Required action type.\n level: \"SERVER\" # Required for type COMMAND. Possible values are PLAYER (player level permission), SERVER (console level permission)\n run: \n - \"/say Hello %petblocks_owner_name%\" # Required for type COMMAND. One or more commands are allowed.\n
"},{"location":"template/#delay","title":"DELAY","text":"Delays the next action for a certain amount of ticks.
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"Delay Action\" # Required arbitrary name.\n type: \"DELAY\" # Required action type.\n ticks: 60 # Required for type DELAY. 60 Ticks delay.\n
"},{"location":"template/#javascript","title":"JAVASCRIPT","text":"Executes JavaScript based Code for value calculation
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"JavaScript action\" # Required arbitrary name.\n type: \"JAVASCRIPT\" # Required action type.\n initial: \"Cool\" # Required for type JAVASCRIPT. The initial value of the result variable.\n variable: \"myVariable\" # Required for type JAVASCRIPT. The name of the result variable, which can be read using PlaceHolders.\n js: | # Required for type JAVASCRIPT. Actual multi line JavaScript code.\n function createText() {\n var text = \"%petblocks_js_myVariable%\" + \" Plugin\"\n return text\n }\n createText();\n
"},{"location":"template/#debugging-actions","title":"Debugging Actions","text":"When you start creating actions, it is very helpful to know, which action is currently being executed and how variables are evaluated. Every action can be logged to your server console by setting the optional debug: true
property of an action.
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"Delay Action\" # Required arbitrary name.\n type: \"DELAY\" # Required action type.\n ticks: 60 # Required for type DELAY. 60 Ticks delay.\n debug: true # Optional flag to log this action to the console.\n
"},{"location":"template/#restricting-actions","title":"Restricting Actions","text":""},{"location":"template/#permission","title":"Permission","text":"Actions can optionally have the permission tag:
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n permission: \"mycustom.permission\"\n type: \"COMMAND\" # Required action type.\n level: \"SERVER\" # Required for type COMMAND. Possible values are PLAYER (player level permission), SERVER (console level permission)\n run: \n - \"/say Hello %petblocks_owner_name%\" # Required for type COMMAND. One or more commands are allowed.\n
"},{"location":"template/#conditions","title":"Conditions","text":"Actions can optionally have conditions, which support the following types:
STRING_EQUALS
STRING_NOT_EQUALS
STRING_EQUALS_IGNORE_CASE
STRING_NOT_EQUALS_IGNORE_CASE
NUMBER_GREATER_THAN
NUMBER_GREATER_THAN_OR_EQUAL
NUMBER_LESS_THAN
NUMBER_LESS_THAN_OR_EQUAL
JAVASCRIPT
Try to avoid using JAVASCRIPT
because it requires more computation time. It should only be used if you want to create complex boolean expressions.
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n condition: # Optional condition tag.\n type: STRING_EQUALS # Required condition type.\n left: \"%petblocks_eventPlayer_name%\" \n right: \"%petblocks_owner_name%\"\n type: \"COMMAND\" # Required action type.\n level: \"SERVER\" # Required for type COMMAND. Possible values are PLAYER (player level permission), SERVER (console level permission)\n run: \n - \"/say Hello %petblocks_owner_name%\" # Required for type COMMAND. One or more commands are allowed.\n
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"My new action\" # Required arbitrary name.\n condition: # Optional condition tag.\n type: JAVASCRIPT # Required condition type.\n js: \"Math.floor(Math.random() * 100) <= 50\" # 50% chance to execute this command.\n type: \"COMMAND\" # Required action type.\n level: \"SERVER\" # Required for type COMMAND. Possible values are PLAYER (player level permission), SERVER (console level permission)\n run: \n - \"/say Hello %petblocks_owner_name%\" # Required for type COMMAND. One or more commands are allowed.\n
"},{"location":"template/#loops","title":"Loops","text":"Loops define, what the pet should repeatedly do. You can customize and define your own loops using actions.
Programmable Pets
You can freely build new loops, delete loops and customize the behavior of pets. The actions allow full freedom to design your pets.
"},{"location":"template/#idle-loop","title":"Idle Loop","text":"The idle loop explained:
/petblocks lookatowner %petblocks_pet_name% %petblocks_owner_name%
/petblocks loop %petblocks_pet_name% moveToOwner %petblocks_owner_name%
, which switches the loop idle
to the loop called moveToOwner
.Delay Action
loops:\n idle: \n actions:\n - name: \"Delay Action\"\n type: \"DELAY\"\n ticks: 20\n - name: \"Look at owner with a 90% change.\"\n condition:\n type: JAVASCRIPT\n js: \"Math.floor(Math.random() * 100) <= 90\" # Calculate chance in JavaScript.\n type: \"COMMAND\"\n level: \"SERVER\"\n run:\n - \"/petblocks lookatowner %petblocks_pet_name% %petblocks_owner_name%\"\n - name: \"Switch to moveToOwner if pet is too far away\"\n condition:\n type: JAVASCRIPT\n js: \"%petblocks_pet_distanceToOwner% > 7\"\n type: \"COMMAND\"\n level: \"SERVER\"\n run:\n - \"/petblocks loop %petblocks_pet_name% moveToOwner %petblocks_owner_name%\"\n
"},{"location":"template/#movetoowner-loop","title":"MoveToOwner Loop","text":"As we noticed that the loop changes to the loop moveToOwner
, we take a look at this loop too.
/petblocks moveToOwner %petblocks_pet_name% 0.2 %petblocks_owner_name%
/petblocks loop %petblocks_pet_name% moveToOwner %petblocks_owner_name%
, which switches the loop moveToOwner
to the loop called idle
.Recalculate path and start moving to owner
loops:\n moveToOwner:\n actions:\n - name: \"Recalculate path and start moving to owner.\"\n type: \"COMMAND\"\n level: \"SERVER\"\n run:\n - \"/petblocks moveToOwner %petblocks_pet_name% 0.2 %petblocks_owner_name%\"\n - name: \"Switch to idle if the pet is beside the player\"\n condition:\n type: JAVASCRIPT\n js: \"%petblocks_pet_distanceToOwner% < 4\"\n type: \"COMMAND\"\n level: \"SERVER\"\n run:\n - \"/petblocks loop %petblocks_pet_name% idle %petblocks_owner_name%\"\n - name: \"Teleport pet to player if the pet is too far away for the pathfinder.\"\n condition:\n type: JAVASCRIPT\n js: \"%petblocks_pet_distanceToOwner% > 20\"\n type: \"COMMAND\"\n level: \"SERVER\"\n run:\n - \"/petblocks teleport %petblocks_pet_name% %petblocks_owner_locationWorld% %petblocks_owner_locationX% %petblocks_owner_locationY% %petblocks_owner_locationZ% %petblocks_owner_locationYaw% %petblocks_owner_locationPitch% %petblocks_owner_name%\"\n - name: \"Delay Action\"\n type: \"DELAY\"\n ticks: 20\n
"}]}
\ No newline at end of file
diff --git a/docs/wiki/site/sitemap.xml.gz b/docs/wiki/site/sitemap.xml.gz
index 82a04c4b1..bde1c4a66 100644
Binary files a/docs/wiki/site/sitemap.xml.gz and b/docs/wiki/site/sitemap.xml.gz differ