-
Notifications
You must be signed in to change notification settings - Fork 56
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
Showing
37 changed files
with
1,213 additions
and
37 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 |
---|---|---|
|
@@ -14,11 +14,11 @@ jobs: | |
id: vars | ||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | ||
|
||
- name: Set up JDK 17 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
java-version: 21 | ||
|
||
- name: Setup build cache | ||
uses: actions/[email protected] | ||
|
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 |
---|---|---|
|
@@ -12,11 +12,11 @@ jobs: | |
- name: Checkout latest code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 17 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
java-version: 21 | ||
|
||
- name: Setup build cache | ||
uses: actions/[email protected] | ||
|
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 |
---|---|---|
|
@@ -14,11 +14,11 @@ jobs: | |
id: vars | ||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | ||
|
||
- name: Set up JDK 17 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
java-version: 21 | ||
|
||
- name: Setup build cache | ||
uses: actions/[email protected] | ||
|
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
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,54 @@ | ||
plugins { | ||
id("io.papermc.paperweight.userdev") | ||
} | ||
|
||
group = "com.willfp" | ||
version = rootProject.version | ||
|
||
dependencies { | ||
implementation(project(":eco-core:core-nms:nms-common")) | ||
paperweight.paperDevBundle("1.20.6-R0.1-SNAPSHOT") | ||
|
||
implementation("net.kyori:adventure-text-minimessage:4.11.0") { | ||
version { | ||
strictly("4.11.0") | ||
} | ||
exclude(group = "net.kyori", module = "adventure-api") | ||
} | ||
|
||
// I know this is the wrong version, but org.bukkit.Material refused to work | ||
compileOnly("io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT") | ||
} | ||
|
||
tasks { | ||
build { | ||
dependsOn(reobfJar) | ||
} | ||
|
||
reobfJar { | ||
mustRunAfter(shadowJar) | ||
} | ||
|
||
shadowJar { | ||
relocate( | ||
"com.willfp.eco.internal.spigot.proxy.common", | ||
"com.willfp.eco.internal.spigot.proxy.v1_20_6.common" | ||
) | ||
relocate( | ||
"net.kyori.adventure.text.minimessage", | ||
"com.willfp.eco.internal.spigot.proxy.v1_20_6.minimessage" | ||
) | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_21 | ||
targetCompatibility = JavaVersion.VERSION_21 | ||
withSourcesJar() | ||
} | ||
|
||
compileKotlin { | ||
kotlinOptions { | ||
jvmTarget = "21" | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...ms/v1_20_6/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/v1_20_6/BukkitCommands.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,35 @@ | ||
package com.willfp.eco.internal.spigot.proxy.v1_20_6 | ||
|
||
import com.willfp.eco.core.command.PluginCommandBase | ||
import com.willfp.eco.internal.spigot.proxy.BukkitCommandsProxy | ||
import org.bukkit.Bukkit | ||
import org.bukkit.command.Command | ||
import org.bukkit.command.SimpleCommandMap | ||
import org.bukkit.craftbukkit.CraftServer | ||
import java.lang.reflect.Field | ||
|
||
class BukkitCommands : BukkitCommandsProxy { | ||
private val knownCommandsField: Field by lazy { | ||
SimpleCommandMap::class.java.getDeclaredField("knownCommands") | ||
.apply { | ||
isAccessible = true | ||
} | ||
} | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
private val knownCommands: MutableMap<String, Command> | ||
get() = knownCommandsField.get(getCommandMap()) as MutableMap<String, Command> | ||
|
||
override fun getCommandMap(): SimpleCommandMap { | ||
return (Bukkit.getServer() as CraftServer).commandMap | ||
} | ||
|
||
override fun syncCommands() { | ||
(Bukkit.getServer() as CraftServer).syncCommands() | ||
} | ||
|
||
override fun unregisterCommand(command: PluginCommandBase) { | ||
knownCommands.remove(command.name) | ||
knownCommands.remove("${command.plugin.name.lowercase()}:${command.name}") | ||
} | ||
} |
Oops, something went wrong.