-
Notifications
You must be signed in to change notification settings - Fork 0
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
a7b6a6d
commit f0cb0b1
Showing
11 changed files
with
94 additions
and
22 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
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
16 changes: 16 additions & 0 deletions
16
common/src/main/kotlin/fr/fabienhebuterne/pickspawner/module/commodore/CommodoreService.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,16 @@ | ||
package fr.fabienhebuterne.pickspawner.module.commodore | ||
|
||
import fr.fabienhebuterne.pickspawner.command.CommandsRegistration | ||
import me.lucko.commodore.CommodoreProvider | ||
import org.bukkit.command.PluginCommand | ||
import org.bukkit.plugin.java.JavaPlugin | ||
|
||
class CommodoreService { | ||
|
||
fun init(plugin: JavaPlugin, commandsRegistration: CommandsRegistration, command: PluginCommand?) { | ||
val commodoreBuild = commandsRegistration.getCommodoreBuild() | ||
val commodore = CommodoreProvider.getCommodore(plugin) | ||
commodore.register(command, commodoreBuild) { commandsRegistration.hasCommodorePermission(it) } | ||
} | ||
|
||
} |
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,9 @@ | ||
plugins { | ||
kotlin("jvm") | ||
} | ||
|
||
dependencies { | ||
compileOnly(project(":nms:interfaces")) | ||
compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT") | ||
compileOnly(files("../../tmp/1.21/spigot-1.21-R0.1-SNAPSHOT.jar")) | ||
} |
38 changes: 38 additions & 0 deletions
38
nms/v1_21_R1/src/main/kotlin/fr/fabienhebuterne/pickspawner/nms/Utils_1_21_R1.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,38 @@ | ||
package fr.fabienhebuterne.pickspawner.nms | ||
|
||
import net.minecraft.core.component.DataComponentMap | ||
import net.minecraft.core.component.DataComponents | ||
import net.minecraft.world.item.EnumItemRarity | ||
import net.minecraft.world.item.Item | ||
import net.minecraft.world.item.component.ItemAttributeModifiers | ||
import net.minecraft.world.item.component.ItemLore | ||
import net.minecraft.world.item.enchantment.ItemEnchantments | ||
import net.minecraft.world.level.block.Blocks | ||
import org.bukkit.Bukkit | ||
import java.lang.reflect.Field | ||
|
||
class Utils_1_21_R1 : Utils { | ||
|
||
override fun setMaxStackSize(maxStack: Int) { | ||
try { | ||
/** | ||
* DataComponents.c is maxStackSize, other var is default value for blocks, see [DataComponents.ag] | ||
*/ | ||
val dataComponentsUpdated: DataComponentMap = DataComponentMap.a() | ||
.a(DataComponents.c, maxStack) | ||
.a(DataComponents.i, ItemLore.a) | ||
.a(DataComponents.k, ItemEnchantments.a) | ||
.a(DataComponents.r, 0) | ||
.a(DataComponents.n, ItemAttributeModifiers.a) | ||
.a(DataComponents.j, EnumItemRarity.a) | ||
.a() | ||
val dataComponentMapField: Field = Item::class.java.getDeclaredField("c") | ||
dataComponentMapField.isAccessible = true | ||
dataComponentMapField.set(Blocks.ct.r(), dataComponentsUpdated) | ||
} catch (e: Exception) { | ||
Bukkit.getLogger().warning("Can't update maxStackSize for spawner because : $e") | ||
e.printStackTrace() | ||
} | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -10,4 +10,5 @@ include( | |
"nms:v1_20_R2", | ||
"nms:v1_20_R3", | ||
"nms:v1_20_R4", | ||
"nms:v1_21_R1", | ||
) |