mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
commit
d2599492a3
5 changed files with 145 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ package xyz.alexcrea.cuanvil.dependency.datapack
|
||||||
|
|
||||||
import io.papermc.paper.datapack.Datapack
|
import io.papermc.paper.datapack.Datapack
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
|
import org.bukkit.packs.DataPack
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
object DataPackTester {
|
object DataPackTester {
|
||||||
|
|
@ -21,6 +22,13 @@ object DataPackTester {
|
||||||
.stream().map { obj: Datapack -> obj.name }
|
.stream().map { obj: Datapack -> obj.name }
|
||||||
.toList()
|
.toList()
|
||||||
} catch (e: NoSuchMethodException) {
|
} catch (e: NoSuchMethodException) {
|
||||||
|
try {
|
||||||
|
DataPack::class.java.getDeclaredMethod("getKey")
|
||||||
|
} catch (e: NoSuchMethodException) {
|
||||||
|
System.err.println("Could not find compatible datapack manager")
|
||||||
|
System.err.println("If you are using a datapack that should be compatible with CustomAnvil. It will not get detected...")
|
||||||
|
return emptyList()
|
||||||
|
}
|
||||||
return legacyNames
|
return legacyNames
|
||||||
} catch (e: Exception){
|
} catch (e: Exception){
|
||||||
// Assume cause UnimplementedOperationException on mock server
|
// Assume cause UnimplementedOperationException on mock server
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,8 @@ object DataPackDependency {
|
||||||
* Map of the latest CustomAnvil update related to the pack
|
* Map of the latest CustomAnvil update related to the pack
|
||||||
*/
|
*/
|
||||||
private val LASTEST_VERSION = mapOf(
|
private val LASTEST_VERSION = mapOf(
|
||||||
Pair("bracken", Version(1, 11, 0))
|
Pair("bracken", Version(1, 11, 0)),
|
||||||
|
Pair("enchantplus", Version(1, 13, 0))
|
||||||
)
|
)
|
||||||
|
|
||||||
val enabledDatapacks: List<String>
|
val enabledDatapacks: List<String>
|
||||||
|
|
@ -47,6 +48,11 @@ object DataPackDependency {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (packName.contains("neoenchant", ignoreCase = true)) {
|
||||||
|
handlePack("enchantplus")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,9 +66,12 @@ object DataPackDependency {
|
||||||
private fun handlePackInitialConfig(pack: String) {
|
private fun handlePackInitialConfig(pack: String) {
|
||||||
val defConfig = ConfigHolder.DEFAULT_CONFIG
|
val defConfig = ConfigHolder.DEFAULT_CONFIG
|
||||||
val version = LASTEST_VERSION[pack]
|
val version = LASTEST_VERSION[pack]
|
||||||
|
if(version == null) {
|
||||||
|
throw RuntimeException("The pack $pack has no latest version hard coded in the plugin")
|
||||||
|
}
|
||||||
|
|
||||||
val currentVersion = Version.fromString(defConfig.config.getString("datapack.$pack"))
|
val currentVersion = Version.fromString(defConfig.config.getString("datapack.$pack"))
|
||||||
if (currentVersion.greaterEqual(version!!)) {
|
if (currentVersion.greaterEqual(version)) {
|
||||||
handleEnchantAllConflict(pack)
|
handleEnchantAllConflict(pack)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
"enchantplus:bow/echo_shot": ['#enchantplus_bow']
|
||||||
|
"enchantplus:bow/storm_arrow": ['#enchantplus_bow']
|
||||||
|
"enchantplus:bow/eternal_frost": ['#enchantplus_bow']
|
||||||
|
"enchantplus:bow/breezing_arrow": ['#enchantplus_bow']
|
||||||
|
"enchantplus:bow/explosive_arrow": ['#enchantplus_bow']
|
||||||
|
"enchantplus:mace/teluric_wave": ['#enchantplus_mace']
|
||||||
|
"enchantplus:armor/fury": ['#enchantplus_armor']
|
||||||
|
"enchantplus:armor/lifeplus": ['#enchantplus_armor']
|
||||||
|
"enchantplus:armor/venom_protection": ['#protection_enchant_conflict']
|
||||||
|
"enchantplus:boots/lava_walker": ['#boot_conflict']
|
||||||
|
"enchantplus:boots/step_assist": ['#boot_conflict']
|
||||||
|
"enchantplus:sword/fear": ['#enchantplus_sword_effect']
|
||||||
|
"enchantplus:sword/pull": ['#enchantplus_sword_effect']
|
||||||
|
"enchantplus:sword/reach": ['#enchantplus_sword_attribute']
|
||||||
|
"enchantplus:sword/critical": ['#enchantplus_sword_attribute']
|
||||||
|
"enchantplus:sword/xp_boost": ['#enchantplus_experience']
|
||||||
|
"enchantplus:sword/last_hope": ['#enchantplus_sword_effect']
|
||||||
|
"enchantplus:sword/life_steal": ['#enchantplus_sword_effect']
|
||||||
|
"enchantplus:sword/death_touch": ['#enchantplus_sword_effect']
|
||||||
|
"enchantplus:sword/attack_speed": ['#enchantplus_sword_attribute']
|
||||||
|
"enchantplus:sword/poison_aspect": ['#enchantplus_aspect']
|
||||||
|
"enchantplus:sword/runic_despair": ['#enchantplus_sword_attribute']
|
||||||
|
"enchantplus:sword/dimensional_hit": ['#enchantplus_sword_attribute']
|
||||||
|
"enchantplus:sword/tears_of_asflors": ['#enchantplus_sword_effect']
|
||||||
|
"enchantplus:tools/auto_smelt": ['minecraft:silk_touch']
|
||||||
|
"enchantplus:tools/miningplus": ['#enchantplus_mining']
|
||||||
|
"enchantplus:pickaxe/vein_miner": ['#enchantplus_mining']
|
||||||
|
"enchantplus:pickaxe/spawner_touch": ['#enchantplus_mining']
|
||||||
|
"enchantplus:pickaxe/bedrock_breaker": ['#enchantplus_mining']
|
||||||
|
"enchantplus:trident/gungnir_breath": ['#enchantplus_trident']
|
||||||
|
"enchantplus:leggings/dwarfed": ['#enchantplus_size']
|
||||||
|
"enchantplus:leggings/oversize": ['#enchantplus_size']
|
||||||
|
"enchantplus:durability/curse_of_enchant": ['#enchantplus_durability']
|
||||||
|
"enchantplus:durability/curse_of_breaking": ['#enchantplus_durability']
|
||||||
|
"minecraft:mending": ['#enchantplus_durability', '#enchantplus_experience']
|
||||||
|
"minecraft:unbreaking": ['#enchantplus_durability']
|
||||||
|
"minecraft:fire_aspect": ['#enchantplus_aspect']
|
||||||
|
"minecraft:wind_burst": ['#enchantplus_mace']
|
||||||
|
"minecraft:quick_charge": ['#enchantplus_bow']
|
||||||
|
"minecraft:channeling": ['#enchantplus_trident']
|
||||||
|
"minecraft:protection": ['#enchantplus_armor']
|
||||||
55
src/main/resources/datapack/enchantplus/item_conflict.yml
Normal file
55
src/main/resources/datapack/enchantplus/item_conflict.yml
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
"enchantplus:axe/timber": ['axes']
|
||||||
|
"enchantplus:bow/rebound": ['bow', 'crossbow']
|
||||||
|
"enchantplus:bow/echo_shot": ['bow', 'crossbow']
|
||||||
|
"enchantplus:bow/storm_arrow": ['bow', 'crossbow']
|
||||||
|
"enchantplus:bow/accuracy_shot": ['bow', 'crossbow']
|
||||||
|
"enchantplus:bow/eternal_frost": ['bow', 'crossbow']
|
||||||
|
"enchantplus:bow/breezing_arrow": ['bow', 'crossbow']
|
||||||
|
"enchantplus:bow/explosive_arrow": ['bow', 'crossbow']
|
||||||
|
"enchantplus:hoe/harvest": ['hoes']
|
||||||
|
"enchantplus:hoe/scyther": ['hoes']
|
||||||
|
"enchantplus:mace/striker": ['mace']
|
||||||
|
"enchantplus:mace/teluric_wave": ['mace']
|
||||||
|
"enchantplus:mace/wind_propulsion": ['mace']
|
||||||
|
"enchantplus:armor/fury": ['armors']
|
||||||
|
"enchantplus:armor/lifeplus": ['armors']
|
||||||
|
"enchantplus:armor/venom_protection": ['armors']
|
||||||
|
"enchantplus:boots/agility": ['boots']
|
||||||
|
"enchantplus:boots/lava_walker": ['boots']
|
||||||
|
"enchantplus:boots/step_assist": ['boots']
|
||||||
|
"enchantplus:sword/fear": ['swords']
|
||||||
|
"enchantplus:sword/pull": ['melee_weapons']
|
||||||
|
"enchantplus:sword/reach": ['swords']
|
||||||
|
"enchantplus:sword/critical": ['swords']
|
||||||
|
"enchantplus:sword/xp_boost": ['mining_and_damage']
|
||||||
|
"enchantplus:sword/last_hope": ['swords']
|
||||||
|
"enchantplus:sword/life_steal": ['melee_weapons']
|
||||||
|
"enchantplus:sword/death_touch": ['melee_weapons']
|
||||||
|
"enchantplus:sword/attack_speed": ['swords']
|
||||||
|
"enchantplus:sword/poison_aspect": ['melee_weapons']
|
||||||
|
"enchantplus:sword/runic_despair": ['swords']
|
||||||
|
"enchantplus:sword/dimensional_hit": ['swords']
|
||||||
|
"enchantplus:sword/tears_of_asflors": ['swords']
|
||||||
|
"enchantplus:tools/auto_smelt": ['axes', 'pickaxes', 'shovels', 'hoes']
|
||||||
|
"enchantplus:tools/miningplus": ['axes', 'pickaxes', 'shovels', 'hoes']
|
||||||
|
"enchantplus:elytra/armored": ['elytra']
|
||||||
|
"enchantplus:elytra/kinetic_protection": ['elytra']
|
||||||
|
"enchantplus:helmet/voidless": ['helmets']
|
||||||
|
"enchantplus:helmet/auto_feed": ['helmets']
|
||||||
|
"enchantplus:helmet/bright_vision": ['helmets']
|
||||||
|
"enchantplus:mounted/velocity": ['mounted_armor']
|
||||||
|
"enchantplus:mounted/steel_fang": ['wolf_armor']
|
||||||
|
"enchantplus:mounted/cavalier_egis": ['mounted_armor']
|
||||||
|
"enchantplus:mounted/ethereal_leap": ['mounted_armor']
|
||||||
|
"enchantplus:pickaxe/vein_miner": ['pickaxes']
|
||||||
|
"enchantplus:pickaxe/spawner_touch": ['pickaxes']
|
||||||
|
"enchantplus:pickaxe/bedrock_breaker": ['pickaxes']
|
||||||
|
"enchantplus:trident/gungnir_breath": ['trident']
|
||||||
|
"enchantplus:leggings/dwarfed": ['leggings']
|
||||||
|
"enchantplus:leggings/leaping": ['leggings']
|
||||||
|
"enchantplus:leggings/oversize": ['leggings']
|
||||||
|
"enchantplus:leggings/fast_swim": ['leggings']
|
||||||
|
"enchantplus:chestplate/builder_arm": ['chestplate']
|
||||||
|
"enchantplus:durability/curse_of_enchant": ['can_unbreak']
|
||||||
|
"enchantplus:durability/curse_of_breaking": ['can_unbreak']
|
||||||
|
"enchantplus:midas_touch": ['stick']
|
||||||
30
src/main/resources/datapack/enchantplus/item_groups.yml
Normal file
30
src/main/resources/datapack/enchantplus/item_groups.yml
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
mining_and_damage:
|
||||||
|
groups:
|
||||||
|
- melee_weapons
|
||||||
|
- mace
|
||||||
|
- bow
|
||||||
|
- crossbow
|
||||||
|
- mace
|
||||||
|
- trident
|
||||||
|
- tools
|
||||||
|
|
||||||
|
stick:
|
||||||
|
items:
|
||||||
|
- stick
|
||||||
|
|
||||||
|
wolf_armor:
|
||||||
|
items:
|
||||||
|
- wolf_armor
|
||||||
|
|
||||||
|
mounted_armor:
|
||||||
|
items:
|
||||||
|
- diamond_horse_armor
|
||||||
|
- golden_horse_armor
|
||||||
|
- iron_horse_armor
|
||||||
|
- leather_horse_armor
|
||||||
|
groups:
|
||||||
|
- wolf_armor
|
||||||
|
|
||||||
|
elytra:
|
||||||
|
items:
|
||||||
|
- elytra
|
||||||
Loading…
Add table
Add a link
Reference in a new issue