Skip to content

Commit 0c57725

Browse files
committed
Adds 'parties_is_leader' placeholder.
1 parent a331320 commit 0c57725

File tree

6 files changed

+129
-75
lines changed

6 files changed

+129
-75
lines changed

BANNER.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<div align="center">
2+
3+
![-0001-export](https://github.com/toxicity188/BetterHud/assets/114675706/ccbf4bd3-9133-44ee-b277-985eae4349ae)
4+
5+
Welcome to BetterHud!
6+
7+
[SpigotMC](https://www.spigotmc.org/resources/115559/) | [Hangar](https://hangar.papermc.io/toxicity188/BetterHud) | [Modrinth](https://modrinth.com/plugin/betterhud2) | [Github](https://github.com/toxicity188/BetterHud)
8+
9+
[![GitHub Release](https://img.shields.io/github/v/release/toxicity188/BetterHud?display_name=release&style=for-the-badge&logo=kotlin)](https://github.com/toxicity188/BetterHud/releases/latest)
10+
[![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.com/invite/rePyFESDbk)
11+
[![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/toxicity188/BetterHud?style=for-the-badge&logo=github)](https://github.com/toxicity188/BetterHud/issues)
12+
[![bStats Servers](https://img.shields.io/bstats/servers/21287?style=for-the-badge&logo=minecraft&label=bStats&color=0%2C150%2C136%2C0)](https://bstats.org/plugin/bukkit/BetterHud/21287)
13+
[![Static Badge](https://img.shields.io/badge/WIKI-blue?style=for-the-badge)](https://github.com/toxicity188/BetterHud/wiki)
14+
[![Static Badge](https://img.shields.io/badge/paypal-toxicity-blue?style=for-the-badge&logo=paypal)](https://www.paypal.com/paypalme/toxicity188?country.x=KR&locale.x=en_US)
15+
16+
</div>
17+
18+
![156ab45b912cc836](https://github.com/toxicity188/BetterHud/assets/114675706/9ff14900-9c8a-46b1-952b-8c401f0b5973)
19+
20+
21+
### Making your own hud
22+
This plugin allows you to create a HUD without any mods.
23+
24+
### Extremely fast
25+
The following plugin operates completely asynchronously and does not cause any server TPS degradation.
26+
27+
### Easy to learn
28+
This plugin provides users with ease of use based on powerful features such as TTF support.
29+
30+
### High customizable
31+
The following plugin enables various effects previously unseen in existing plugins, based on an enhanced popup system.
32+
33+
### Auto resource pack build
34+
The following plugin supports automatic resource pack generation system.
35+
36+
### No boss bar affect
37+
![녹화_2024_03_10_22_38_28_861](https://github.com/toxicity188/BetterHud/assets/114675706/23019cf7-e845-4a44-a957-a6e153f587ea)
38+
This plugin utilizes a boss bar, but you can still use the first boss bar.
39+
40+
### And much more!
41+
✅ TTF support
42+
✅ async task
43+
✅ free
44+
✅ open source
45+
✅ public api
46+
✅ animation
47+
✅ gif
48+
✅ relocate hotbar
49+
✅ remove xp text
50+
51+
![0](https://github.com/toxicity188/BetterHud/assets/114675706/b9723d82-fe50-4aa3-8c06-11d24bf26c10)
52+
53+
![1](https://github.com/toxicity188/BetterHud/assets/114675706/5c2e3fc3-1a52-4c48-81a6-981f5a702f0a)
54+
![2](https://github.com/toxicity188/BetterHud/assets/114675706/3518b4eb-5b09-41f5-ad84-07942e446abb)
55+
![3](https://github.com/toxicity188/BetterHud/assets/114675706/f3663739-a1b5-4cb2-904e-9770283cae1f)
56+
![4](https://github.com/toxicity188/BetterHud/assets/114675706/a86238f9-2367-4286-b461-d8ae4b8e110b)
57+
![5](https://github.com/toxicity188/BetterHud/assets/114675706/b4d45ab3-072b-488b-8a9e-c030e913056a)
58+
![2024_03_09_17_33_45_816](https://github.com/toxicity188/BetterHud/assets/114675706/e99d1522-4975-4f3d-8bea-eb93bb62fd21)
59+
60+
### Dependency
61+
No
62+
63+
### Version
64+
Plugin: 1.17-1.21.3
65+
Fabric mod: server 1.21.3

README.md

+38-67
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,74 @@
11
<div align="center">
22

3-
![-0001-export](https://github.com/toxicity188/BetterHud/assets/114675706/ccbf4bd3-9133-44ee-b277-985eae4349ae)
3+
![-0001-export](https://github.com/toxicity188/BetterHud/assets/114675706/ccbf4bd3-9133-44ee-b277-985eae4349ae)
44

55
Welcome to BetterHud!
66

77
[SpigotMC](https://www.spigotmc.org/resources/115559/) | [Hangar](https://hangar.papermc.io/toxicity188/BetterHud) | [Modrinth](https://modrinth.com/plugin/betterhud2) | [Github](https://github.com/toxicity188/BetterHud)
88

99
[![GitHub Release](https://img.shields.io/github/v/release/toxicity188/BetterHud?display_name=release&style=for-the-badge&logo=kotlin)](https://github.com/toxicity188/BetterHud/releases/latest)
10-
[![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.com/invite/rePyFESDbk)
11-
[![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/toxicity188/BetterHud?style=for-the-badge&logo=github)](https://github.com/toxicity188/BetterHud/issues)
12-
[![bStats Servers](https://img.shields.io/bstats/servers/21287?style=for-the-badge&logo=minecraft&label=bStats&color=0%2C150%2C136%2C0)](https://bstats.org/plugin/bukkit/BetterHud/21287)
10+
[![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.com/invite/rePyFESDbk)
11+
[![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/toxicity188/BetterHud?style=for-the-badge&logo=github)](https://github.com/toxicity188/BetterHud/issues)
1312
[![Static Badge](https://img.shields.io/badge/WIKI-blue?style=for-the-badge)](https://github.com/toxicity188/BetterHud/wiki)
14-
[![Static Badge](https://img.shields.io/badge/paypal-toxicity-blue?style=for-the-badge&logo=paypal)](https://www.paypal.com/paypalme/toxicity188?country.x=KR&locale.x=en_US)
13+
![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/toxicity188/BetterHud?style=for-the-badge)
1514

16-
</div>
17-
18-
![156ab45b912cc836](https://github.com/toxicity188/BetterHud/assets/114675706/9ff14900-9c8a-46b1-952b-8c401f0b5973)
19-
20-
21-
### Making your own hud
22-
This plugin allows you to create a HUD without any mods.
23-
24-
### Extremely fast
25-
The following plugin operates completely asynchronously and does not cause any server TPS degradation.
26-
27-
### Easy to learn
28-
This plugin provides users with ease of use based on powerful features such as TTF support.
2915

30-
### High customizable
31-
The following plugin enables various effects previously unseen in existing plugins, based on an enhanced popup system.
32-
33-
### Auto resource pack build
34-
The following plugin supports automatic resource pack generation system.
16+
</div>
3517

36-
### No boss bar affect
37-
![녹화_2024_03_10_22_38_28_861](https://github.com/toxicity188/BetterHud/assets/114675706/23019cf7-e845-4a44-a957-a6e153f587ea)
38-
This plugin utilizes a boss bar, but you can still use the first boss bar.
18+
### Multi-platform server-side HUD implementation of Minecraft.
19+
This project implements a server-side HUD.
3920

40-
### And much more!
41-
✅ TTF support
42-
✅ async task
43-
✅ free
44-
✅ open source
45-
✅ public api
46-
✅ animation
47-
✅ gif
48-
✅ relocate hotbar
49-
✅ remove xp text
21+
- Supports auto-generating resource pack.
22+
- Supports display image(include png sequence), display, head.
23+
- Supports animation.
5024

51-
![0](https://github.com/toxicity188/BetterHud/assets/114675706/b9723d82-fe50-4aa3-8c06-11d24bf26c10)
25+
### Platform
26+
- Bukkit(including Folia) 1.17-1.21.3
27+
- Velocity 3.3-3.4
28+
- Fabric server 1.21.3
5229

53-
![1](https://github.com/toxicity188/BetterHud/assets/114675706/5c2e3fc3-1a52-4c48-81a6-981f5a702f0a)
54-
![2](https://github.com/toxicity188/BetterHud/assets/114675706/3518b4eb-5b09-41f5-ad84-07942e446abb)
55-
![3](https://github.com/toxicity188/BetterHud/assets/114675706/f3663739-a1b5-4cb2-904e-9770283cae1f)
56-
![4](https://github.com/toxicity188/BetterHud/assets/114675706/a86238f9-2367-4286-b461-d8ae4b8e110b)
57-
![5](https://github.com/toxicity188/BetterHud/assets/114675706/b4d45ab3-072b-488b-8a9e-c030e913056a)
58-
![2024_03_09_17_33_45_816](https://github.com/toxicity188/BetterHud/assets/114675706/e99d1522-4975-4f3d-8bea-eb93bb62fd21)
30+
### Library
31+
- [kotlin stdlib](https://github.com/JetBrains/kotlin): Implements better functional programming.
32+
- [adventure](https://github.com/KyoriPowered/adventure): Implements multi-platform component.
33+
- [bstats](https://bstats.org/getting-started/include-metrics): Implements metrics.
34+
- [exp4j](https://github.com/fasseg/exp4j): Implements equation.
35+
- [negative space font](https://github.com/AmberWat/NegativeSpaceFont): Implements space font in minecraft legacy version.
36+
- [snakeyaml](https://github.com/snakeyaml): Implements yaml parser.
37+
- [gson](https://github.com/google/gson): Implements json parser/writer.
38+
- [better command](https://github.com/toxicity188/BetterCommand): Implements multi-platform supporting command.
5939

60-
### Dependency
61-
No
6240

63-
### Version
64-
Plugin: 1.17-1.21.3
65-
Fabric mod: server 1.21.3
41+
## Dependency
42+
- Bukkit: No
43+
- Velocity: No
44+
- Fabric server: [Fabric API](https://modrinth.com/mod/fabric-api)
6645

6746
### Build
6847
Requires Java 17, 21 Eclipse Adoptium.
6948

70-
Builds all available jar: ./gradlew build
71-
Builds Bukkit plugin: ./gradlew pluginJar
72-
Builds Fabric server side mod: ./gradlew fabricJar
73-
Builds source code jar: ./gradlew sourceJar
74-
Builds dokka-based docs jar: ./gradlew dokkaJar
49+
- Build all available jar: ./gradlew build
50+
- Build Bukkit plugin: ./gradlew pluginJar
51+
- Build Fabric server side mod: ./gradlew fabricJar
52+
- Build source code jar: ./gradlew sourceJar
53+
- Build dokka-based docs jar: ./gradlew dokkaJar
7554

7655
### API
56+
[![](https://jitpack.io/v/toxicity188/BetterHud.svg)](https://jitpack.io/#toxicity188/BetterHud)
7757
``` kotlin
7858
repositories {
7959
mavenCentral()
8060
maven("https://jitpack.io")
8161
}
8262

8363
dependencies {
84-
compileOnly("com.github.toxicity188:BetterHud:VERSION")
64+
compileOnly("net.kyori:adventure-api:VERSION") //Adventure api.
65+
compileOnly("com.github.toxicity188:BetterHud:VERSION") //BetterHud.
66+
compileOnly("com.github.toxicity188:BetterCommand:VERSION") //BetterCommand library.
8567
}
8668
```
8769

8870
### Use BetterHud with Skript
71+
[Go to download Skript](https://github.com/SkriptLang/Skript/releases)
8972
```
9073
command /pointadd:
9174
trigger:
@@ -104,16 +87,4 @@ command /popup:
10487
#show popup with custom event
10588
set {_o::rand} to random integer between 1 to 100
10689
show popup "test_popup" to player with variable of {_o::*}
107-
```
108-
109-
### Contirbuting
110-
111-
You should make a pull-request to the **"dev"** branch.
112-
113-
- Fork BetterHud on GitHub
114-
- Clone your forked repository (git clone)
115-
- Create your feature branch (git checkout -b my-feature)
116-
- Commit your changes (git commit -am 'Add my feature')
117-
- Push to the branch (git push origin my-feature)
118-
- Create a new Pull Request to the **"dev"*** branch
119-
- Wait for your pull request to be reviewed and merged
90+
```

bootstrap/bukkit/src/main/kotlin/kr/toxicity/hud/bootstrap/bukkit/compatibility/parties/PartiesCompatibility.kt

+10-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,16 @@ class PartiesCompatibility : Compatibility {
5555
}
5656
)
5757
override val booleans: Map<String, HudPlaceholder<Boolean>>
58-
get() = mapOf()
58+
get() = mapOf(
59+
"is_leader" to HudPlaceholder.of { _, _ ->
60+
Function get@ { p ->
61+
val uuid = p.bukkitPlayer.uniqueId
62+
val player = parties.playerManager.getPlayer(uuid) ?: return@get false
63+
val party = parties.partyManager.getPartyOfPlayer(player) ?: return@get false
64+
party.leader == player.playerUUID
65+
}
66+
}
67+
)
5968

6069
override fun start() {
6170
parties = Class.forName("com.alessiodp.parties.core.bukkit.bootstrap.ADPBukkitBootstrap").getDeclaredField("plugin").run {

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,5 @@ modrinth {
435435
)
436436
gameVersions = supportedMinecraftVersions
437437
loaders = listOf("bukkit", "spigot", "paper", "purpur", "folia", "velocity")
438-
syncBodyFrom = rootProject.file("README.md").readText()
438+
syncBodyFrom = rootProject.file("BANNER.md").readText()
439439
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package kr.toxicity.hud.command
2+
3+
data class CompassIcon(val string: String)

dist/src/main/kotlin/kr/toxicity/hud/manager/CommandManager.kt

+12-6
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ object CommandManager : BetterHudManager {
108108
.nullMessage(CommandMessage("betterhud.null.vector", Component.text("Invalid vector: [value]")))
109109
.build()
110110
)
111+
.addSerializer(CompassIcon::class.java, ClassSerializer.builder { _, s -> CompassIcon(s) }
112+
.name("icon")
113+
.suggests { if (it is HudPlayer) it.pointers().map { s -> s.name } else emptyList() }
114+
.nullMessage(CommandMessage("betterhud.null.icon", Component.text("Unable to find this icon: [icon]")))
115+
.build()
116+
)
111117

112118
@Suppress("UNUSED")
113119
val module = library.module<BetterCommandSource>("hud")
@@ -411,8 +417,8 @@ object CommandManager : BetterHudManager {
411417
@Description(key = "betterhud.turn.on.description", defaultValue = "Turns on your HUD.")
412418
@Permission("hud.turn.on")
413419
@Sender(type = [SenderType.PLAYER])
414-
fun on(@Source me: BetterCommandSource) {
415-
(me as HudPlayer).isHudEnabled = true
420+
fun on(@Source me: HudPlayer) {
421+
me.isHudEnabled = true
416422
on_success.send(me)
417423
}
418424
//Turn on
@@ -423,8 +429,8 @@ object CommandManager : BetterHudManager {
423429
@Description(key = "betterhud.turn.off.description", defaultValue = "Turns off your HUD.")
424430
@Permission("hud.turn.off")
425431
@Sender(type = [SenderType.PLAYER])
426-
fun off(@Source me: BetterCommandSource) {
427-
(me as HudPlayer).isHudEnabled = false
432+
fun off(@Source me: HudPlayer) {
433+
me.isHudEnabled = false
428434
off_success.send(me)
429435
}
430436
//Turn off
@@ -439,11 +445,11 @@ object CommandManager : BetterHudManager {
439445
@Command
440446
@Description(key = "betterhud.pointer.set.description", defaultValue = "Sets the compass pointer location of some player.")
441447
@Permission("hud.pointer.set")
442-
fun set(@Source me: BetterCommandSource, players: HudPlayerStack, name: String, world: WorldWrapper, vector: Vec3, @Option icon: String?) {
448+
fun set(@Source me: BetterCommandSource, players: HudPlayerStack, name: String, world: WorldWrapper, vector: Vec3, @Option icon: CompassIcon?) {
443449
val loc = PointedLocation(
444450
PointedLocationSource.INTERNAL,
445451
name,
446-
icon,
452+
icon?.string,
447453
LocationWrapper(
448454
world,
449455
vector.x,

0 commit comments

Comments
 (0)