-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d81471
commit 3c7693d
Showing
15 changed files
with
182 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
api/bukkit-api/src/main/java/kr/toxicity/hud/api/bukkit/pack/BukkitResourcePackHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package kr.toxicity.hud.api.bukkit.pack; | ||
|
||
import org.bukkit.plugin.Plugin; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public interface BukkitResourcePackHandler { | ||
void handle(@NotNull Plugin plugin); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# BetterHud 1.9 | ||
|
||
## Notice | ||
- Drop support about 1.17, 1.17.1, 1.18.1 | ||
|
||
## Updates | ||
|
||
- If your server has Polymer, BetterHud's resource pack will automatically be merged. (Fabric) | ||
- If your server has Oraxen, BetterHud's resource pack will automatically be merged. (Bukkit) | ||
|
||
**Caution**: | ||
- Please set 'pack-type' in config.yml to 'none' if you want to use Polymer or Oraxen. | ||
- If your server uses Polymer, you have to use '/polymer generate-pack' instead of '/hud reload'. | ||
- If your server uses Oraxen, you have to use '/oraxen reload all' instead of '/hud reload'. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
repositories { | ||
maven("https://repo.oraxen.com/releases") //Oraxen | ||
} | ||
|
||
dependencies { | ||
compileOnly("io.th0rgal:oraxen:1.183.0") | ||
} |
46 changes: 46 additions & 0 deletions
46
.../src/main/kotlin/kr/toxicity/hud/bootstrap/bukkit/compatibility/oraxen/OraxenR1Handler.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package kr.toxicity.hud.bootstrap.bukkit.compatibility.oraxen | ||
|
||
import io.th0rgal.oraxen.api.events.OraxenPackGeneratedEvent | ||
import io.th0rgal.oraxen.utils.VirtualFile | ||
import kr.toxicity.hud.api.BetterHudAPI | ||
import kr.toxicity.hud.api.bukkit.pack.BukkitResourcePackHandler | ||
import kr.toxicity.hud.api.plugin.ReloadState.* | ||
import org.bukkit.Bukkit | ||
import org.bukkit.event.EventHandler | ||
import org.bukkit.event.Listener | ||
import org.bukkit.plugin.Plugin | ||
import java.io.ByteArrayInputStream | ||
|
||
class OraxenR1Handler : BukkitResourcePackHandler { | ||
override fun handle(plugin: Plugin) { | ||
val api = BetterHudAPI.inst() | ||
val logger = BetterHudAPI.inst().bootstrap().logger() | ||
Bukkit.getPluginManager().registerEvents(object : Listener { | ||
@EventHandler | ||
fun generate(event: OraxenPackGeneratedEvent) { | ||
when (val state = api.reload()) { | ||
is Success -> { | ||
val output = event.output | ||
state.resourcePack.forEach { | ||
output.add( | ||
VirtualFile( | ||
it.key.substringBeforeLast('/'), | ||
it.key.substringAfterLast('/'), | ||
ByteArrayInputStream(it.value).buffered() | ||
) | ||
) | ||
} | ||
logger.info("Successfully merged with Oraxen: (${state.time} ms)") | ||
} | ||
is Failure -> { | ||
logger.warn( | ||
"Fail to merge the resource pack with Oraxen.", | ||
"Reason: ${state.throwable.message ?: state.throwable.javaClass.simpleName}" | ||
) | ||
} | ||
is OnReload -> logger.warn("This plugin is still on reload!") | ||
} | ||
} | ||
}, plugin) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
repositories { | ||
maven("https://repo.oraxen.com/snapshots") //Oraxen | ||
} | ||
|
||
dependencies { | ||
compileOnly("io.th0rgal:oraxen:2.0-SNAPSHOT") | ||
compileOnly("team.unnamed:creative-api:1.7.3") | ||
} |
42 changes: 42 additions & 0 deletions
42
.../src/main/kotlin/kr/toxicity/hud/bootstrap/bukkit/compatibility/oraxen/OraxenR2Handler.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package kr.toxicity.hud.bootstrap.bukkit.compatibility.oraxen | ||
|
||
import io.th0rgal.oraxen.api.events.resourcepack.OraxenPrePackGenerateEvent | ||
import kr.toxicity.hud.api.BetterHudAPI | ||
import kr.toxicity.hud.api.bukkit.pack.BukkitResourcePackHandler | ||
import kr.toxicity.hud.api.plugin.ReloadState.* | ||
import org.bukkit.Bukkit | ||
import org.bukkit.event.EventHandler | ||
import org.bukkit.event.Listener | ||
import org.bukkit.plugin.Plugin | ||
import team.unnamed.creative.ResourcePack | ||
|
||
class OraxenR2Handler : BukkitResourcePackHandler { | ||
override fun handle(plugin: Plugin) { | ||
val api = BetterHudAPI.inst() | ||
val logger = BetterHudAPI.inst().bootstrap().logger() | ||
Bukkit.getPluginManager().registerEvents(object : Listener { | ||
@EventHandler | ||
fun generate(event: OraxenPrePackGenerateEvent) { | ||
when (val state = api.reload()) { | ||
is Success -> { | ||
val pack = ResourcePack.resourcePack() | ||
state.resourcePack.forEach { | ||
pack.unknownFile(it.key) { stream -> | ||
stream.write(it.value) | ||
} | ||
} | ||
event.addResourcePack(pack) | ||
logger.info("Successfully merged with Oraxen: (${state.time} ms)") | ||
} | ||
is Failure -> { | ||
logger.warn( | ||
"Fail to merge the resource pack with Oraxen.", | ||
"Reason: ${state.throwable.message ?: state.throwable.javaClass.simpleName}" | ||
) | ||
} | ||
is OnReload -> logger.warn("This plugin is still on reload!") | ||
} | ||
} | ||
}, plugin) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters