Skip to content

Commit

Permalink
v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Apehum authored Oct 8, 2024
2 parents d72e2c9 + 60e338a commit 5a81fd1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
5 changes: 2 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
- Update to Plasmo Voice 2.1.0. This version is not compatible with PV 2.0.x.
- Experimental goat horn support. Disabled by default. Set `goat_horn.enabled` to `true` to enable. For now horns are burned same as the discs using `/disc burn` command, but it'll be changed later.
- HTTP proxy support.
- Fix `/disc burn` produces broken goat horns in 1.20.1. This fix will not repair broken horns, so you need to do it manually by using command: `/item replace entity @p weapon.mainhand with minecraft:goat_horn{instrument:"empty"}`.
- Disallow burning custom goat horn with tracks exceeding the maximum duration defined in the config.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.koin.core.component.inject
import su.plo.slib.api.chat.component.McTextComponent
import su.plo.slib.api.permission.PermissionDefault
import su.plo.voice.api.server.player.VoicePlayer
import su.plo.voice.discs.GoatHornManager
import su.plo.voice.discs.command.SubCommand
import su.plo.voice.discs.item.GoatHornHelper
import su.plo.voice.discs.utils.extend.asPlayer
Expand All @@ -28,7 +29,8 @@ import su.plo.voice.discs.utils.extend.toPlainText
class BurnCommand : SubCommand() {

private val plugin: JavaPlugin by inject()
private val goatHornHelper: GoatHornHelper by inject()
private val hornHelper: GoatHornHelper by inject()
private val hornManager: GoatHornManager by inject()

override val name = "burn"

Expand Down Expand Up @@ -113,6 +115,13 @@ class BurnCommand : SubCommand() {

val isGoatHorn = item.type.name == "GOAT_HORN"

if (isGoatHorn && !hornManager.canPlay(track)) {
voicePlayer.instance.sendTranslatable(
"pv.addon.discs.error.horn_too_long", config.goatHorn.maxDurationSeconds
)
return@launch
}

plugin.suspendSync(player.location) {
item.editMeta { meta ->
meta.addItemFlags(*ItemFlag.values())
Expand All @@ -129,7 +138,7 @@ class BurnCommand : SubCommand() {
}

if (isGoatHorn) {
goatHornHelper.getInstrument(item)
hornHelper.getInstrument(item)
.takeIf { it.isNotEmpty() }
?.let {
meta.persistentDataContainer.set(
Expand All @@ -150,7 +159,7 @@ class BurnCommand : SubCommand() {
}

if (isGoatHorn) {
goatHornHelper.setEmptyInstrument(item)
hornHelper.setEmptyInstrument(item)
}

voicePlayer.instance.sendTranslatable("pv.addon.discs.success.burn", name)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=su.plo.voice.discs
version=1.1.0
version=1.1.1
mavenArtifactId=discs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GoatHornHelperImpl : GoatHornHelper {

val compoundTag = ReflectionProxies.itemStack.getOrCreateTag(mcItem)

ReflectionProxies.compoundTag.putString(compoundTag, "instrument", "")
ReflectionProxies.compoundTag.putString(compoundTag, "instrument", "empty")
}

override fun getInstrument(item: ItemStack): String {
Expand Down

0 comments on commit 5a81fd1

Please sign in to comment.