Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge changes to master --release #601

Merged
merged 2 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "com.github.shynixn"
version = "9.11.0"
version = "9.11.1"

repositories {
mavenCentral()
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/com/github/shynixn/petblocks/impl/PetEntityImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,17 @@ class PetEntityImpl(

this.petMeta.lastStoredLocation = physicsComponent.position.copy()
this.velocity = physicsComponent.motion.copy()
physicsComponent.tickMinecraft()

try {
physicsComponent.tickMinecraft()
} catch (e: Exception) {
// Can happen if an invalid world reference exists. e.g. pet references unloaded world
this.petMeta.lastStoredLocation = pet.player.location.toVector3d()
this.physicsComponent.position = pet.player.location.toVector3d()
this.pet.call()
return
}

playerComponent.tickMinecraft()
entityComponent.tickMinecraft()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,6 @@ class PetListener @Inject constructor(
)
}
}

// Fix references of pet to world which does not exist anymore. e.g. Cross Servers
for (pet in pets) {
var resetToOwnerPosition = false

try {
if (pet.location.world == null) {
resetToOwnerPosition = true
}
} catch (e: Exception) {
// Exception handling is important here.
resetToOwnerPosition = true
}

if (resetToOwnerPosition) {
pet.location = player.location
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,12 @@ class PetBlocksPlaceHolderProvider(

if (playerPlaceHolderFunctions.containsKey(placeHolderText)) {
locatedPlaceHolders[placeHolderText] =
if (pet != null && placeHolderText.contains("PLAYER_OWNER_")) {
if (placeHolderText.contains("_eventPlayer_")) {
playerPlaceHolderFunctions[placeHolderText]!!.invoke(player)
} else if (pet != null) {
playerPlaceHolderFunctions[placeHolderText]!!.invoke(pet.player)
} else {
playerPlaceHolderFunctions[placeHolderText]!!.invoke(player)
""
}
} else if (petPlaceHolderFunctions.containsKey(placeHolderText) && pet != null) {
locatedPlaceHolders[placeHolderText] = petPlaceHolderFunctions[placeHolderText]!!.invoke(pet)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin-legacy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: PetBlocks
version: 9.11.0
version: 9.11.1
author: Shynixn
main: com.github.shynixn.petblocks.PetBlocksPlugin
softdepend: [ PlaceholderAPI, HeadDatabase]
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: PetBlocks
version: 9.11.0
version: 9.11.1
author: Shynixn
main: com.github.shynixn.petblocks.PetBlocksPlugin
softdepend: [ PlaceholderAPI, HeadDatabase]
Expand Down
Loading