Skip to content

Commit

Permalink
[CI Skip] traffic optimize.
Browse files Browse the repository at this point in the history
  • Loading branch information
toxicity188 committed Nov 18, 2024
1 parent 1b81b5d commit 11f1f83
Show file tree
Hide file tree
Showing 31 changed files with 290 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import java.util.UUID;

/**
* Checks some HudPlayer is bedrock hudPlayer.
* Checks some player is bedrock player.
*/
public interface BedrockAdapter {
/**
* Returns whether given uuid's HudPlayer is from bedrock.
* Returns whether given uuid's player is from bedrock.
* @param uuid player's uuid
* @return whether This player is from bedrock client
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public record WidthComponent(@NotNull TextComponent.Builder component, int width
* @return Merged component
*/
public @NotNull WidthComponent plus(@NotNull WidthComponent other) {
return new WidthComponent(component.append(other.component), width + other.width);
return other.component.content().isEmpty() && other.component.children().isEmpty() ? this : new WidthComponent(component.append(other.component), width + other.width);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public interface Hud extends HudObject {

/**
* Returns the output of hud.
* @param hudPlayer target HudPlayer
* @param player target player
* @return component of hud
*/
@NotNull List<WidthComponent> getComponents(@NotNull HudPlayer hudPlayer);
@NotNull List<WidthComponent> getComponents(@NotNull HudPlayer player);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
*/
public interface HudListener {
/**
* Gets the index of given hudPlayer.
* Gets the index of given player.
* value must be 0..1.
* @param hudPlayer target HudPlayer
* @param player target player
* @return index range
*/
double getValue(@NotNull HudPlayer hudPlayer);
double getValue(@NotNull HudPlayer player);
HudListener ZERO = p -> 0;

HudListener EMPTY = p -> -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public interface Popup extends HudObject {
int getMaxStack();

/**
* Shows popup to some hudPlayer.
* Shows popup to some player.
* @param reason causes
* @param hudPlayer target HudPlayer
* @param player target player
* @return updater of popup or null if showing has failed.
*/
@Nullable PopupUpdater show(@NotNull UpdateEvent reason, @NotNull HudPlayer hudPlayer);
@Nullable PopupUpdater show(@NotNull UpdateEvent reason, @NotNull HudPlayer player);

/**
* Hides popup to some hudPlayer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,38 @@

public interface VolatileCodeHandler {
/**
* Injects hudPlayer.
* This method calls when HudPlayer joined.
* @param hudPlayer target HudPlayer
* Injects player.
* This method calls when player joined.
* @param player target player
* @param color bar's color
*/
void inject(@NotNull HudPlayer hudPlayer, @NotNull BossBar.Color color);
void inject(@NotNull HudPlayer player, @NotNull BossBar.Color color);
/**
* Shows bar to some hudPlayer.
* @param hudPlayer target HudPlayer
* Shows bar to some player.
* @param player target player
* @param color bar's color
* @param component bar's title
*/
void showBossBar(@NotNull HudPlayer hudPlayer, @NotNull BossBar.Color color, @NotNull Component component);
void showBossBar(@NotNull HudPlayer player, @NotNull BossBar.Color color, @NotNull Component component);

/**
* Removes bar from hudPlayer.
* @param hudPlayer target HudPlayer
* Removes bar from player.
* @param player target player
*/
void removeBossBar(@NotNull HudPlayer hudPlayer);
void removeBossBar(@NotNull HudPlayer player);


/**
* Gets textures value of player's game profile.
* @param hudPlayer target HudPlayer
* @param player target player
* @return textures value
*/
@NotNull String getTextureValue(@NotNull HudPlayer hudPlayer);
@NotNull String getTextureValue(@NotNull HudPlayer player);

/**
* Reloads player's boss bar.
* @param hudPlayer target HudPlayer
* @param player target player
* @param color color
*/
void reloadBossBar(@NotNull HudPlayer hudPlayer, @NotNull BossBar.Color color);
void reloadBossBar(@NotNull HudPlayer player, @NotNull BossBar.Color color);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ class HudPlayerBukkit(
player.world.uid
)

@Suppress("DEPRECATION")
override fun locale(): Locale = player.locale.let {
val split = it.split('_')
if (split.size == 1) Locale.of(split[0].lowercase()) else Locale.of(split[0].lowercase(), split[1].uppercase())
if (split.size == 1) Locale(split[0].lowercase()) else Locale(split[0].lowercase(), split[1].uppercase())
}

override fun location(): LocationWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ class HudPlayerFabric(

override fun audience(): Audience = audience

@Suppress("DEPRECATION")
override fun locale(): Locale {
val split = player.clientInformation().language.split('_')
return if (split.size == 1) Locale.of(split[0].lowercase()) else Locale.of(split[0].lowercase(), split[1].uppercase())
return if (split.size == 1) Locale(split[0].lowercase()) else Locale.of(split[0].lowercase(), split[1].uppercase())
}

override fun hasPermission(perm: String): Boolean = player.hasPermission(perm)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ allprojects {
apply(plugin = "org.jetbrains.dokka")

group = "kr.toxicity.hud"
version = "1.9" + (System.getenv("BUILD_NUMBER")?.let { ".DEV-$it" } ?: "")
version = "1.9.1" + (System.getenv("BUILD_NUMBER")?.let { ".DEV-$it" } ?: "")

repositories {
mavenCentral()
Expand Down
8 changes: 7 additions & 1 deletion changelog/1.10.md → changelog/1.9.1.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# BetterHud 1.10
# BetterHud 1.9.1

## Notice
- Version support about 1.18 will be dropped soon.

## Fix
- More optimized compass and image (above 1.19)
- Now load-minecraft-default-textures is restored.
- Fix a problem that built core shader has comment.
- Fix mmocore_casting_slot placeholder.
- Fix compass pointer (Fabric)
- Fix locale problem in Java 17

## Add
- Add more uniform value in shaders json.
Loading

0 comments on commit 11f1f83

Please sign in to comment.