diff --git a/docs/wiki/site/index.html b/docs/wiki/site/index.html index 880a3b699..dcc3ea43c 100644 --- a/docs/wiki/site/index.html +++ b/docs/wiki/site/index.html @@ -599,6 +599,10 @@
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.
+PetBlocks is a Minecraft Bukkit plugin to use blocks as pets in minecraft.
"},{"location":"#features","title":"Features","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.)
PetBlocks does only have 1 command, which is restricted using permissions.
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 for 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 skintype <name> <material> [player]\"\n
Changes the material used as a head.
/petblocks skinnbt <name> <nbt> [player]\n
Changes the NBT tags of the head item.
/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
/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.
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 does no longer have its own GUI, because PetBlocks wants to focus on being a pet plugin instead of a GUI plugin.
There are many very good GUI plugins outthere. One popular example is DeluxeMenu. PetBlocks distributes a pre-made DeluxeMenu GUI, to get the old PetBlocks GUI back.
"},{"location":"gui/#installing-the-classic-petblocks-gui","title":"Installing the classic PetBlocks GUI","text":"plugins/PetBlocks/thirdparty/DeluxeMenu
folder to the plugins/DeluxeMenu
folder. Restart the server. Execute /petblocksmenu
with the permission petblocks.deluxemenu
.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. 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)"},{"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:
Building GUIS with DeluxeMenu
PetBlocks distributes premade DeluxeMenu based inventories, which may help you design your own inventories. See the GUI page for more details.
"},{"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
DeluxeMenu e.g.:
[console] petblocks skinbase64 %petblocks_pet_name_selected% 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
DeluxeMenu e.g.:
[console] petblocks create pet classic %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 happens on certain events. Currently only leftClick and rightClick on the pet is supported. These actions get executed when a player left clicks on the pet. However, it may not be the owner, who clicks on a pet, therefore it needs to be checked if you only want to allow certain actions for the owner of the pet.
Example:
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"Open the DeluxeMenu based pet inventory\" # You need to install the plugin DeluxeMenu for this to work and copy the premade PetBlocks inventory from the thirdparty folder.\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 - \"/dm open petblocks_menu %petblocks_eventPlayer_name%\"\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.
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/#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 2 types: STRING_EQUALS
and JAVASCRIPT
. Prefer using STRING_EQUALS
over JAVASCRIPT
. STRING_EQUALS
checks if the 2 values in left
and right
are the same. JAVASCRIPT
evaluates a boolean expression.
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.
"},{"location":"#features","title":"Features","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.)
PetBlocks does only have 1 command, which is restricted using permissions.
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 for 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 skintype <name> <material> [player]\"\n
Changes the material used as a head.
/petblocks skinnbt <name> <nbt> [player]\n
Changes the NBT tags of the head item.
/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
/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.
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 does no longer have its own GUI, because PetBlocks wants to focus on being a pet plugin instead of a GUI plugin.
There are many very good GUI plugins outthere. One popular example is DeluxeMenu. PetBlocks distributes a pre-made DeluxeMenu GUI, to get the old PetBlocks GUI back.
"},{"location":"gui/#installing-the-classic-petblocks-gui","title":"Installing the classic PetBlocks GUI","text":"plugins/PetBlocks/thirdparty/DeluxeMenu
folder to the plugins/DeluxeMenu
folder. Restart the server. Execute /petblocksmenu
with the permission petblocks.deluxemenu
.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. 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)"},{"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:
Building GUIS with DeluxeMenu
PetBlocks distributes premade DeluxeMenu based inventories, which may help you design your own inventories. See the GUI page for more details.
"},{"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
DeluxeMenu e.g.:
[console] petblocks skinbase64 %petblocks_pet_name_selected% 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
DeluxeMenu e.g.:
[console] petblocks create pet classic %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 happens on certain events. Currently only leftClick and rightClick on the pet is supported. These actions get executed when a player left clicks on the pet. However, it may not be the owner, who clicks on a pet, therefore it needs to be checked if you only want to allow certain actions for the owner of the pet.
Example:
events:\n rightClick:\n actions: # You can add/remove actions as you want here.\n - name: \"Open the DeluxeMenu based pet inventory\" # You need to install the plugin DeluxeMenu for this to work and copy the premade PetBlocks inventory from the thirdparty folder.\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 - \"/dm open petblocks_menu %petblocks_eventPlayer_name%\"\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.
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/#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 2 types: STRING_EQUALS
and JAVASCRIPT
. Prefer using STRING_EQUALS
over JAVASCRIPT
. STRING_EQUALS
checks if the 2 values in left
and right
are the same. JAVASCRIPT
evaluates a boolean expression.
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 525dcd3d1..923446137 100644
Binary files a/docs/wiki/site/sitemap.xml.gz and b/docs/wiki/site/sitemap.xml.gz differ