-
Notifications
You must be signed in to change notification settings - Fork 2
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
39aa9e2
commit dcaa8fa
Showing
340 changed files
with
71,364 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Publish adventure-api Plugin | ||
on: [workflow_dispatch] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "adopt" | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
- name: Publish with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: ":adventure-api:publish" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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,23 @@ | ||
name: Publish adventure Plugin | ||
on: [workflow_dispatch] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "adopt" | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
- name: Publish with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: ":adventure:publish" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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,23 @@ | ||
name: Publish command-alias Plugin | ||
on: [workflow_dispatch] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "adopt" | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
- name: Publish with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: ":command-alias:publish" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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,23 @@ | ||
name: Publish data-source Plugin | ||
on: [workflow_dispatch] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "adopt" | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
- name: Publish with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: ":data-source:publish" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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,23 @@ | ||
name: Publish econ-api Plugin | ||
on: [workflow_dispatch] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "adopt" | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
- name: Publish with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: ":econ-api:publish" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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,23 @@ | ||
name: Publish econ Plugin | ||
on: [workflow_dispatch] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "adopt" | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
- name: Publish with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: ":econ:publish" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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,23 @@ | ||
name: Publish gui Plugin | ||
on: [workflow_dispatch] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "adopt" | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
- name: Publish with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: ":gui:publish" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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,23 @@ | ||
name: Publish papi-briar Plugin | ||
on: [workflow_dispatch] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "adopt" | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
- name: Publish with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: ":papi-briar:publish" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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,23 @@ | ||
name: Publish region-difficulty Plugin | ||
on: [workflow_dispatch] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "adopt" | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
- name: Publish with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: ":region-difficulty:publish" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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,23 @@ | ||
name: Publish region-scan Plugin | ||
on: [workflow_dispatch] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "adopt" | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
- name: Publish with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: ":region-scan:publish" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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,23 @@ | ||
name: Publish return-to-wild Plugin | ||
on: [workflow_dispatch] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "adopt" | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
- name: Publish with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: ":return-to-wild:publish" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
# Ignore Gradle build output directory | ||
build | ||
run | ||
run* | ||
|
||
plugins | ||
|
||
|
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,3 @@ | ||
# Adventure Plugin API | ||
|
||
TODO |
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,10 @@ | ||
plugins { | ||
id("briarcode.kotlin-plugin-api") | ||
} | ||
|
||
version = "1.1" | ||
description = "" | ||
|
||
dependencies { | ||
api(project(":kotlin")) | ||
} |
24 changes: 24 additions & 0 deletions
24
adventure-api/src/main/kotlin/com/briarcraft/adventure/api/Util.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,24 @@ | ||
package com.briarcraft.adventure.api | ||
|
||
import org.bukkit.enchantments.Enchantment | ||
|
||
const val BYTE_TRUE = 1.toByte() | ||
const val BYTE_FALSE = 0.toByte() | ||
|
||
fun registerEnchantment(enchantment: Enchantment) { | ||
unlockEnchantmentRegistration() | ||
Enchantment.registerEnchantment(enchantment) | ||
} | ||
|
||
fun registerEnchantments(vararg enchantments: Enchantment) { | ||
unlockEnchantmentRegistration() | ||
enchantments.forEach { enchantment -> Enchantment.registerEnchantment(enchantment) } | ||
} | ||
|
||
private fun unlockEnchantmentRegistration() { | ||
if (!Enchantment.isAcceptingRegistrations()) { | ||
val field = Enchantment::class.java.getDeclaredField("acceptingNew") | ||
field.isAccessible = true | ||
field.set(null, true) | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
adventure-api/src/main/kotlin/com/briarcraft/adventure/api/enchant/AbstractEnchantment.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,48 @@ | ||
package com.briarcraft.adventure.api.enchant | ||
|
||
import com.briarcraft.adventure.api.enchant.usage.EnchantmentUsage | ||
import io.papermc.paper.enchantments.EnchantmentRarity | ||
import net.kyori.adventure.text.Component | ||
import net.kyori.adventure.text.TextComponent | ||
import net.kyori.adventure.text.format.Style | ||
import net.kyori.adventure.text.format.TextColor | ||
import org.bukkit.NamespacedKey | ||
import org.bukkit.enchantments.Enchantment | ||
import org.bukkit.entity.EntityCategory | ||
import org.bukkit.inventory.ItemStack | ||
|
||
abstract class AbstractEnchantment(key: NamespacedKey): Enchantment(key) { | ||
abstract val enchantName: String | ||
abstract val displayColor: TextColor | ||
abstract val usage: EnchantmentUsage | ||
|
||
final override fun translationKey() = "enchant.${key.namespace}.${key.key}" | ||
|
||
override fun isTreasure() = false | ||
override fun isTradeable() = false | ||
override fun isDiscoverable() = false | ||
|
||
override fun getItemTarget() = usage.target | ||
override fun canEnchantItem(item: ItemStack) = usage.canEnchant(item) | ||
override fun getActiveSlots() = usage.activeSlots | ||
|
||
override fun getRarity() = EnchantmentRarity.VERY_RARE | ||
|
||
override fun getDamageIncrease(level: Int, entityCategory: EntityCategory) = 0.0f | ||
|
||
final override fun getStartLevel() = 1 | ||
|
||
@Deprecated("Deprecated in Java", ReplaceWith("displayName(level)")) | ||
final override fun getName() = enchantName | ||
|
||
final override fun displayName(level: Int): TextComponent { | ||
return if (level == 1 && maxLevel == 1) { | ||
Component.text(enchantName, Style.style(displayColor)) | ||
} else if (level > 10) { | ||
Component.text("$enchantName $level", Style.style(displayColor)) | ||
} else { | ||
Component.text("$enchantName ", Style.style(displayColor)) | ||
.append(Component.translatable("enchantment.level.$level", Style.style(displayColor))) | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
adventure-api/src/main/kotlin/com/briarcraft/adventure/api/enchant/BaseEnchantment.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,13 @@ | ||
package com.briarcraft.adventure.api.enchant | ||
|
||
import org.bukkit.NamespacedKey | ||
import org.bukkit.enchantments.Enchantment | ||
|
||
abstract class BaseEnchantment( | ||
key: NamespacedKey, | ||
private val maxLevel: Int, | ||
private val conflicts: Set<Enchantment> | ||
): AbstractEnchantment(key) { | ||
override fun getMaxLevel() = maxLevel | ||
override fun conflictsWith(other: Enchantment) = conflicts.contains(other) | ||
} |
19 changes: 19 additions & 0 deletions
19
adventure-api/src/main/kotlin/com/briarcraft/adventure/api/enchant/BlessEnchantment.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,19 @@ | ||
package com.briarcraft.adventure.api.enchant | ||
|
||
import com.briarcraft.adventure.api.enchant.usage.EnchantmentUsage | ||
import net.kyori.adventure.text.format.NamedTextColor | ||
import net.kyori.adventure.text.format.TextColor | ||
import org.bukkit.NamespacedKey | ||
import org.bukkit.enchantments.Enchantment | ||
|
||
open class BlessEnchantment( | ||
key: NamespacedKey, | ||
maxLevel: Int, | ||
override val enchantName: String, | ||
override val usage: EnchantmentUsage, | ||
conflicts: Set<Enchantment> = setOf() | ||
): BaseEnchantment(key, maxLevel, conflicts) { | ||
override val displayColor: TextColor = NamedTextColor.GRAY | ||
|
||
override fun isCursed() = false | ||
} |
Oops, something went wrong.