Skip to content

Commit

Permalink
Update resource pack API and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
EsotericEnderman committed Nov 3, 2024
1 parent b8add48 commit a126244
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerJoinEvent
import java.net.URI

/**
* This class listens to players joining the server, at which point it sends the plugin's resource pack to the player.
* @param plugin The plugin class. This must implement the ResourcePackPlugin interface.
* @param resourcePackServer The HTTP server manager associated with this plugin.
*/
class ResourcePackListener(resourcePackServer: ResourcePackServer) : Listener {
internal class ResourcePackListener(resourcePackServer: ResourcePackServer) : Listener {
private val resourcePackInfo = ResourcePackInfo.resourcePackInfo()
.hash(resourcePackServer.resourcePackManager.zipFile.sha1())
.uri(URI.create("http://" + resourcePackServer.socketAddress + "/")).build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import kotlin.io.path.Path

/**
* A class that helps your plugin to implement custom resources via a resource pack.
*
* @param plugin The plugin that intends to implement a resource pack. Note that it must implement the FileManagedPlugin interface.
* This plugin must also have a resource pack in it's `resources` directory. It is recommended to make your resource pack in a
* @param plugin The plugin that intends to implement a resource pack.
* This plugin **must** have a resource pack in it's `resources` directory. It is recommended to make your resource pack in a
* separate Git repository and add it as a submodule. The resource pack directory **MUST** be named `plugin.name + "ResourcePack"`.
* For example, if your plugin's name (the name that appears in-game when running `/plugins`) is SCPPlugin, then the resource pack
* For example, if your plugin's name (the name that appears in-game when running `/plugins`) is `SCPPlugin`, then the resource pack
* must be named `SCPPluginResourcePack`.
* @author Esoteric Enderman
*/
class ResourcePackManager(internal val plugin: JavaPlugin) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ import java.io.FileInputStream
import java.io.IOException
import java.net.InetSocketAddress

/**
* This class handles sending the resource pack to clients.
*
* @param plugin The plugin that implements this resource pack.
*/
class ResourcePackServer(internal val resourcePackManager: ResourcePackManager) {
internal class ResourcePackServer(internal val resourcePackManager: ResourcePackManager) {

private val successResponseCode = 200
private val notFoundResponseCode = 404
Expand Down

0 comments on commit a126244

Please sign in to comment.