Skip to content

Commit

Permalink
Merge pull request #569 from Shynixn/development
Browse files Browse the repository at this point in the history
Merge changes to master --release
  • Loading branch information
Shynixn authored Jan 5, 2024
2 parents dc81f77 + b86b215 commit 950dc0c
Show file tree
Hide file tree
Showing 32 changed files with 1,071 additions and 358 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "com.github.shynixn"
version = "9.1.0"
version = "9.2.0"

repositories {
mavenCentral()
Expand Down Expand Up @@ -41,7 +41,7 @@ dependencies {

// Custom dependencies
implementation("com.github.shynixn.mcutils:common:1.0.44")
implementation("com.github.shynixn.mcutils:packet:1.0.67")
implementation("com.github.shynixn.mcutils:packet:1.0.68")
implementation("com.github.shynixn.mcutils:database:1.0.14")
implementation("com.github.shynixn.mcutils:pathfinder:1.0.19")

Expand Down
1 change: 1 addition & 0 deletions docs/wiki/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PetBlocks is a Minecraft Bukkit plugin to use blocks as pets in minecraft.

!!! note "PetBlocks v8 Docs"
Are you looking for the old wiki? You can download it [here.](https://shynixn.github.io/PetBlocks/8.0.0/wiki.zip)
A copy can also be found in the [web archive.](https://web.archive.org/web/20200929094049/https://shynixn.github.io/PetBlocks/build/html/index.html)

## Features

Expand Down
Binary file added docs/wiki/docs/assets/bee-gif-1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/wiki/docs/assets/bee-gif-2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions docs/wiki/docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,66 @@ Opens the headDatabase inventory with a special hook, which applies the next ite
* Player: Optional player_name/player_UUID parameter targeting a player from the console or command block.


### /petblocks breakblock

```
/petblocks breakblock <name> <timeToBreak> <dropType> [player]
```

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

* Name: Identifier of a pet
* TimeToBreak: Time in ticks (20 ticks = 1 second) to break a block
* DropType: Describes what happens to the dropped item (VANISH, DROP, SEND_TO_OWNER_INVENTORY). Multiple drop types can be specified by comma separation. e.g. SEND_TO_OWNER_INVENTORY,DROP tries to send it to the owner inventory first, if full, it drops it
* Player: Optional player_name/player_UUID parameter targeting a player from the console or command block.

### /petblocks cancel

```
/petblocks cancel <name> [player]
```

Cancels any long running actions like breaking a block.

* Name: Identifier of a pet
* Player: Optional player_name/player_UUID parameter targeting a player from the console or command block.

### /petblocks snap

```
/petblocks snap <name> [player]
```

Rotates the pet to the exact line of the nearest x or z axe.

* Name: Identifier of a pet
* Player: Optional player_name/player_UUID parameter targeting a player from the console or command block.

### /petblocks moveforward

```
/petblocks moveforward <name> <speed> [player]
```

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.

* Name: Identifier of a pet
* Speed: Speed parameter, should be comma values e.g. 0.3
* Player: Optional player_name/player_UUID parameter targeting a player from the console or command block.

### /petblocks rotaterel

```
/petblocks rotaterel <name> <direction> <angle> [player]
```

Rotates the pet relative to its current rotation.

* Name: Identifier of a pet
* Direction: LEFT, RIGHT, UP, DOWN
* Angle: Angle in degrees e.g. 45, 90
* Player: Optional player_name/player_UUID parameter targeting a player from the console or command block.
26 changes: 26 additions & 0 deletions docs/wiki/docs/custommodels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Custom Models

PetBlocks can be used to build custom pets with custom models. A bee model is shown below.

![Gif](assets/custom-textures-bee-inventory.png)

![Gif](assets/custom-textures-bee-flying.png)

![Gif](assets/bee-gif-1.gif)

![Gif](assets/bee-gif-2.gif)

## Tutorial

!!! note "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/](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}'```
79 changes: 43 additions & 36 deletions docs/wiki/docs/permission.md

Large diffs are not rendered by default.

72 changes: 37 additions & 35 deletions docs/wiki/docs/placeholders.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,40 @@ The following placeholders are available in PetBlocks and can also be used via P
| %petblocks_owner_locationZ% | Z coordinate of the owner of a pet. |
| %petblocks_owner_locationYaw% | Yaw rotation of the owner of a pet. |
| %petblocks_owner_locationPitch% | Yaw rotation of the owner of a pet. |

| Pet PlaceHolders | Description |
|---------------------------------|------------------------------------------------------------------------------------------------------|
| %petblocks_pet_name% | Id of a pet |
| %petblocks_pet_displayName% | Displayname of a pet |
| %petblocks_pet_distanceToOwner% | Distance from the pet to the owner. If the owner is in another world, this value becomes very high. |
| %petblocks_pet_exists% | True if the pet exists, false if not. |
| %petblocks_pet_isSpawned% | True if the pet is spawned, false if not. |
| %petblocks_pet_template% | Name of the template a pet uses. |
| %petblocks_pet_visibility% | Visibility Type a pet uses. |
| %petblocks_pet_isMounted% | True if the owner rides the pet or uses it as a hat. |
| %petblocks_pet_loop% | Name of the loop a pet currently executes. |
| %petblocks_pet_locationWorld% | Name of the world the pet is inside. |
| %petblocks_pet_locationX% | X coordinate of the pet. |
| %petblocks_pet_locationY% | Y coordinate of the pet. |
| %petblocks_pet_locationZ% | Z coordinate of the pet. |
| %petblocks_pet_locationYaw% | Yaw rotation of the pet. |
| %petblocks_pet_locationPitch% | Yaw rotation of the pet. |
| %petblocks_pet_itemType% | The head item type of the pet. |
| %petblocks_pet_itemNbt% | The head item NBT of the pet. |
| %petblocks_pet_itemHeadBase64% | The head item Base64 Skin Url of the pet. |

| Event Player PlaceHolders | Description |
|---------------------------------|-------------------------------------------------|
| %petblocks_eventPlayer_name% | Player name of the owner of a pet. |
| %petblocks_eventPlayer_displayName% | Player displayName of the owner of a pet. |
| %petblocks_eventPlayer_locationWorld% | Name of the world the owner of a pet is inside. |
| %petblocks_eventPlayer_locationX% | X coordinate of the owner of a pet. |
| %petblocks_eventPlayer_locationY% | Y coordinate of the owner of a pet. |
| %petblocks_eventPlayer_locationZ% | Z coordinate of the owner of a pet. |
| %petblocks_eventPlayer_locationYaw% | Yaw rotation of the owner of a pet. |
| %petblocks_eventPlayer_locationPitch% | Yaw rotation of the owner of a pet. |



| %petblocks_owner_itemMainHand_type% | Name of the item type in the owner's main hand |

| Pet PlaceHolders | Description |
|---------------------------------|-----------------------------------------------------------------------------------------------------|
| %petblocks_pet_name% | Id of a pet |
| %petblocks_pet_displayName% | Displayname of a pet |
| %petblocks_pet_distanceToOwner% | Distance from the pet to the owner. If the owner is in another world, this value becomes very high. |
| %petblocks_pet_exists% | True if the pet exists, false if not. |
| %petblocks_pet_isSpawned% | True if the pet is spawned, false if not. |
| %petblocks_pet_template% | Name of the template a pet uses. |
| %petblocks_pet_visibility% | Visibility Type a pet uses. |
| %petblocks_pet_isMounted% | True if the owner rides the pet or uses it as a hat. |
| %petblocks_pet_loop% | Name of the loop a pet currently executes. |
| %petblocks_pet_locationWorld% | Name of the world the pet is inside. |
| %petblocks_pet_locationX% | X coordinate of the pet. |
| %petblocks_pet_locationY% | Y coordinate of the pet. |
| %petblocks_pet_locationZ% | Z coordinate of the pet. |
| %petblocks_pet_locationYaw% | Yaw rotation of the pet. |
| %petblocks_pet_locationPitch% | Yaw rotation of the pet. |
| %petblocks_pet_itemType% | The head item type of the pet. |
| %petblocks_pet_itemNbt% | The head item NBT of the pet. |
| %petblocks_pet_itemHeadBase64% | The head item Base64 Skin Url of the pet. |
| %petblocks_pet_isBreakingBlock% | True if the pet is currently breaking a block, false if not. |
| %petblocks_pet_blockInFrontType% | Name of the block type the pet is looking at |


| Event Player PlaceHolders | Description |
|---------------------------------|------------------------------------------------------------|
| %petblocks_eventPlayer_name% | Player name of the event trigger player. |
| %petblocks_eventPlayer_displayName% | Player displayName of the event trigger player. |
| %petblocks_eventPlayer_locationWorld% | Name of the world event trigger player of a pet is inside. |
| %petblocks_eventPlayer_locationX% | X coordinate of the event trigger player. |
| %petblocks_eventPlayer_locationY% | Y coordinate of the event trigger player. |
| %petblocks_eventPlayer_locationZ% | Z coordinate of the event trigger player. |
| %petblocks_eventPlayer_locationYaw% | Yaw rotation of the event trigger player. |
| %petblocks_eventPlayer_locationPitch% | Yaw rotation of the event trigger player. |
| %petblocks_eventPlayer_itemMainHand_type% | Name of the item type in the players's main hand |
3 changes: 1 addition & 2 deletions docs/wiki/docs/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ Select the action type. Support actions are ``COMMAND``, ``DELAY``, ``JAVASCRIPT
Executes one or multiple commands as Console or Player.
!!! note "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.
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.
```yaml
events:
Expand Down
1 change: 1 addition & 0 deletions docs/wiki/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ nav:
- Templates: template.md
- GUI: gui.md
- PlaceHolders: placeholders.md
- Custom Models: custommodels.md
- Developer Api: api.md
- 'FAQ': faq.md
theme:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class PetBlocksDependencyInjectionBinder(private val plugin: PetBlocksPlugin) :
// Repositories
val templateRepositoryImpl = YamlFileRepositoryImpl<PetTemplate>(plugin,
"pets",
listOf(Pair("pets/pet_classic.yml", "pet_classic.yml")),
listOf(Pair("pets/pet_classic.yml", "pet_classic.yml"),Pair("pets/pet_mining.yml", "pet_mining.yml")),
emptyList(),
object : TypeReference<PetTemplate>() {})
val cacheTemplateRepository = CachedRepositoryImpl(templateRepositoryImpl)
Expand Down Expand Up @@ -95,6 +95,7 @@ class PetBlocksDependencyInjectionBinder(private val plugin: PetBlocksPlugin) :
bind(ItemService::class.java).toInstance(ItemServiceImpl())
bind(PathfinderService::class.java).toInstance(PathfinderServiceImpl(CubeWorldSnapshotServiceImpl()))

bind(BreakBlockService::class.java).to(BreakBlockServiceImpl::class.java).`in`(Scopes.SINGLETON)
bind(PetService::class.java).to(PetServiceImpl::class.java).`in`(Scopes.SINGLETON)
bind(PetEntityFactory::class.java).to(PetEntityFactoryImpl::class.java).`in`(Scopes.SINGLETON)
bind(PetActionExecutionService::class.java).to(PetActionExecutionServiceImpl::class.java).`in`(Scopes.SINGLETON)
Expand Down
19 changes: 17 additions & 2 deletions src/main/java/com/github/shynixn/petblocks/PetBlocksLanguage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ object PetBlocksLanguage {
/** [&9PetBlocks&f] The skin of pet %1$1s has been changed. **/
var petSkinNbtChanged : String = "[&9PetBlocks&f] The skin of pet %1$1s has been changed."

/** [&9PetBlocks&f] The pet has been rotated. **/
var rotationRelMessage : String = "[&9PetBlocks&f] The pet has been rotated."

/** [&9PetBlocks&f] Pet with name %1$1s has been spawned. **/
var petSpawnedMessage : String = "[&9PetBlocks&f] Pet with name %1$1s has been spawned."

Expand Down Expand Up @@ -37,6 +40,9 @@ object PetBlocksLanguage {
/** [&9PetBlocks&f] Selected pet %1$1s. **/
var petSelectedMessage : String = "[&9PetBlocks&f] Selected pet %1$1s."

/** [&9PetBlocks&f] &cOnly the direction types %1$1s are supported. **/
var petRotationTypeNotFound : String = "[&9PetBlocks&f] &cOnly the direction types %1$1s are supported."

/** [&9PetBlocks&f] Pet with name %1$1s has been removed. **/
var petDespawnedMessage : String = "[&9PetBlocks&f] Pet with name %1$1s has been removed."

Expand Down Expand Up @@ -82,6 +88,12 @@ object PetBlocksLanguage {
/** [&9PetBlocks&f] &cCannot parse template file. See console log for details. **/
var errorLoadingTemplatesMessage : String = "[&9PetBlocks&f] &cCannot parse template file. See console log for details."

/** [&9PetBlocks&f] Cancelled action. **/
var cancelMessage : String = "[&9PetBlocks&f] Cancelled action."

/** [&9PetBlocks&f] Pet is walking forward. **/
var petMoveForwardMessage : String = "[&9PetBlocks&f] Pet is walking forward."

/** [&9PetBlocks&f] PetBlocks has been reloaded. **/
var reloadMessage : String = "[&9PetBlocks&f] PetBlocks has been reloaded."

Expand Down Expand Up @@ -118,6 +130,9 @@ object PetBlocksLanguage {
/** [&9PetBlocks&f] Pet is walking to location. **/
var petWalkToLocationMessage : String = "[&9PetBlocks&f] Pet is walking to location."

/** [&9PetBlocks&f] &cDropType %1$1s not found. **/
var dropTypeNotFound : String = "[&9PetBlocks&f] &cDropType %1$1s not found."
/** [&9PetBlocks&f] &cOnly the drop types %1$1s are supported. **/
var dropTypeNotFound : String = "[&9PetBlocks&f] &cOnly the drop types %1$1s are supported."

/** [&9PetBlocks&f] The pet has been snapped to a coordinate axe. **/
var snapMessage : String = "[&9PetBlocks&f] The pet has been snapped to a coordinate axe."
}
15 changes: 7 additions & 8 deletions src/main/java/com/github/shynixn/petblocks/PetBlocksPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,14 @@ class PetBlocksPlugin : JavaPlugin() {
listOf(Version.VERSION_1_20_R3)
}

if (!Version.serverVersion.isCompatible(*versions.toTypedArray())
) {
if (!Version.serverVersion.isCompatible(*versions.toTypedArray())) {
immidiateDisable = true
Bukkit.getServer().consoleSender.sendMessage(org.bukkit.ChatColor.RED.toString() + "================================================")
Bukkit.getServer().consoleSender.sendMessage(org.bukkit.ChatColor.RED.toString() + "PetBlocks does not support your server version")
Bukkit.getServer().consoleSender.sendMessage(org.bukkit.ChatColor.RED.toString() + "Install v" + versions[0].id + " - v" + versions[versions.size - 1].id)
Bukkit.getServer().consoleSender.sendMessage(org.bukkit.ChatColor.RED.toString() + "Need support for a particular version? Go to https://www.patreon.com/Shynixn")
Bukkit.getServer().consoleSender.sendMessage(org.bukkit.ChatColor.RED.toString() + "Plugin gets now disabled!")
Bukkit.getServer().consoleSender.sendMessage(org.bukkit.ChatColor.RED.toString() + "================================================")
logger.log(Level.SEVERE, "================================================")
logger.log(Level.SEVERE, "PetBlocks does not support your server version")
logger.log(Level.SEVERE, "Install v" + versions[0].id + " - v" + versions[versions.size - 1].id)
logger.log(Level.SEVERE, "Need support for a particular version? Go to https://www.patreon.com/Shynixn")
logger.log(Level.SEVERE, "Plugin gets now disabled!")
logger.log(Level.SEVERE, "================================================")
Bukkit.getPluginManager().disablePlugin(this)
return
}
Expand Down
Loading

0 comments on commit 950dc0c

Please sign in to comment.