Skip to content

Commit

Permalink
Add constraint 'pack-type: none' in auto merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
toxicity188 committed Dec 16, 2024
1 parent 02dd911 commit 3972017
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,21 @@ public interface HudObject {
default List<WidthComponent> getComponentsByType(@NotNull HudPlayer hudPlayer) {
return getType().invoke(this, hudPlayer);
}

/**
* Adds this object to player.
* @param player target player
* @return whether to success or not
*/
default boolean add(@NotNull HudPlayer player) {
return player.getHudObjects().add(this);
}
/**
* Removes this object to player.
* @param player target player
* @return whether to success or not
*/
default boolean remove(@NotNull HudPlayer player) {
return player.getHudObjects().remove(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import kr.toxicity.hud.api.yaml.YamlObject
import kr.toxicity.hud.bootstrap.bukkit.BukkitBootstrapImpl
import kr.toxicity.hud.bootstrap.bukkit.compatibility.Compatibility
import kr.toxicity.hud.bootstrap.bukkit.util.registerListener
import kr.toxicity.hud.manager.ConfigManagerImpl
import kr.toxicity.hud.pack.PackType
import kr.toxicity.hud.util.BOOTSTRAP
import kr.toxicity.hud.util.PLUGIN
import kr.toxicity.hud.util.info
Expand All @@ -37,7 +39,7 @@ class NexoCompatibility : Compatibility {
registerListener(object : Listener {
@EventHandler
fun NexoPrePackGenerateEvent.generate() {
when (val state = PLUGIN.reload()) {
if (ConfigManagerImpl.packType == PackType.NONE) when (val state = PLUGIN.reload()) {
is Success -> {
state.resourcePack.forEach {
addUnknownFile(it.key, it.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import kr.toxicity.hud.api.yaml.YamlObject
import kr.toxicity.hud.bootstrap.bukkit.BukkitBootstrapImpl
import kr.toxicity.hud.bootstrap.bukkit.compatibility.Compatibility
import kr.toxicity.hud.bootstrap.bukkit.util.registerListener
import kr.toxicity.hud.manager.ConfigManagerImpl
import kr.toxicity.hud.pack.PackType
import kr.toxicity.hud.util.BOOTSTRAP
import kr.toxicity.hud.util.PLUGIN
import kr.toxicity.hud.util.info
Expand Down Expand Up @@ -39,7 +41,7 @@ class OraxenCompatibility : Compatibility {
registerListener(object : Listener {
@EventHandler
fun OraxenPackGeneratedEvent.generate() {
when (val state = PLUGIN.reload()) {
if (ConfigManagerImpl.packType == PackType.NONE) when (val state = PLUGIN.reload()) {
is Success -> {
val output = output
state.resourcePack.forEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import kr.toxicity.hud.api.trigger.HudTrigger
import kr.toxicity.hud.api.update.UpdateEvent
import kr.toxicity.hud.api.yaml.YamlObject
import kr.toxicity.hud.manager.ConfigManagerImpl
import kr.toxicity.hud.pack.PackType
import kr.toxicity.hud.util.PLUGIN
import kr.toxicity.hud.util.info
import kr.toxicity.hud.util.warn
Expand All @@ -29,7 +30,7 @@ class PolymerResourcePackCompatibility : Compatibility {

override fun start() {
PolymerResourcePackUtils.RESOURCE_PACK_CREATION_EVENT.register { builder ->
when (val state = PLUGIN.reload()) {
if (ConfigManagerImpl.packType == PackType.NONE) when (val state = PLUGIN.reload()) {
is Success -> {
state.resourcePack.forEach {
builder.addData(it.key, it.value)
Expand Down
1 change: 1 addition & 0 deletions changelog/1.11.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ entity_health_white:
expiring-second: 10 #Clean player map time.
```
- Provide more detailed example HUD.
- Add constraint 'pack-type: none' in auto merge.
## Fix
- text identifier fix.
Expand Down

0 comments on commit 3972017

Please sign in to comment.