Compare commits

...

8 Commits

Author SHA1 Message Date
Auxilor
ebac75b0ee Updated to 6.20.2 2022-01-18 08:41:04 +00:00
Auxilor
02d0fa85b5 Updated plugin.yml 2022-01-18 08:40:53 +00:00
Auxilor
168915868c Added support for CustomCrafting and ExecutableItems 2022-01-18 08:40:38 +00:00
Auxilor
d62d598fd6 Merge branch '0ft3n_master' into develop
# Conflicts:
#	eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt
2022-01-18 08:38:53 +00:00
0ft3n
06561c5387 Removed unneeded event call 2022-01-18 02:00:10 +03:00
Auxilor
c9805e91b4 Updated to 6.20.1 2022-01-17 17:09:06 +00:00
Auxilor
e3be95ca4d Added soft faliures to config updating 2022-01-17 17:08:57 +00:00
often
c0547a7c34 Readded and fixed CustomItems support, added ExecutableItems support 2022-01-02 13:19:35 +03:00
10 changed files with 87 additions and 11 deletions

View File

@@ -20,7 +20,7 @@ open class EcoUpdatableJSONConfig(
fun update() {
super.clearCache()
this.init(configFile)
val newConfig = configInJar
val newConfig = configInJar ?: return
if (newConfig.getKeys(true) == this.getKeys(true)) {
return
}
@@ -43,9 +43,9 @@ open class EcoUpdatableJSONConfig(
this.save()
}
private val configInJar: YamlConfiguration
private val configInJar: YamlConfiguration?
get() {
val newIn = this.source.getResourceAsStream(resourcePath) ?: throw NullPointerException("$name is null?")
val newIn = this.source.getResourceAsStream(resourcePath) ?: return null
val reader = BufferedReader(InputStreamReader(newIn, StandardCharsets.UTF_8))
val newConfig = YamlConfiguration()
newConfig.load(reader)

View File

@@ -20,7 +20,7 @@ class EcoUpdatableYamlConfig(
fun update() {
super.clearCache()
this.handle.load(configFile)
val newConfig = configInJar
val newConfig = configInJar ?: return
if (newConfig.getKeys(true) == this.handle.getKeys(true)) {
return
}
@@ -43,9 +43,9 @@ class EcoUpdatableYamlConfig(
this.handle.save(configFile)
}
private val configInJar: YamlConfiguration
private val configInJar: YamlConfiguration?
get() {
val newIn = source.getResourceAsStream(resourcePath) ?: throw NullPointerException("$name is null?")
val newIn = source.getResourceAsStream(resourcePath) ?: return null
val reader = BufferedReader(InputStreamReader(newIn, StandardCharsets.UTF_8))
val newConfig = YamlConfiguration()
newConfig.load(reader)

View File

@@ -73,12 +73,10 @@ open class EcoDropQueue(val player: Player) : InternalDropQueue {
world.dropItem(location, drop!!).velocity = Vector()
}
if (xp > 0) {
val event = PlayerExpChangeEvent(player, xp)
Bukkit.getPluginManager().callEvent(event)
val orb =
world.spawnEntity(player.location.add(0.0, 0.2, 0.0), EntityType.EXPERIENCE_ORB) as ExperienceOrb
orb.velocity = Vector(0, 0, 0)
orb.experience = event.amount
orb.experience = xp
}
} else {
for (drop in items) {
@@ -94,4 +92,4 @@ open class EcoDropQueue(val player: Player) : InternalDropQueue {
init {
location = player.location
}
}
}

View File

@@ -26,6 +26,7 @@ dependencies {
compileOnly 'com.gmail.nossr50.mcMMO:mcMMO:2.1.202'
compileOnly 'me.clip:placeholderapi:2.10.10'
compileOnly 'com.github.oraxen:oraxen:bd81ace154'
compileOnly 'com.github.Ssomar-Developement:ExecutableItems:master-SNAPSHOT'
compileOnly 'com.github.brcdev-minecraft:shopgui-api:2.2.0'
compileOnly 'com.github.LoneDev6:API-ItemsAdder:2.4.7'
compileOnly 'com.arcaniax:HeadDatabase-API:1.3.0'

View File

@@ -84,6 +84,8 @@ import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefSuperiorSk
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefTowny
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefWorldGuard
import com.willfp.eco.internal.spigot.integrations.customentities.CustomEntitiesMythicMobs
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsCustomCrafting
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsExecutableItems
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsHeadDatabase
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsItemsAdder
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsOraxen
@@ -249,6 +251,8 @@ abstract class EcoSpigotPlugin : EcoPlugin(
IntegrationLoader("Oraxen") { CustomItemsManager.register(CustomItemsOraxen()) },
IntegrationLoader("ItemsAdder") { CustomItemsManager.register(CustomItemsItemsAdder()) },
IntegrationLoader("HeadDatabase") { CustomItemsManager.register(CustomItemsHeadDatabase(this)) },
IntegrationLoader("ExecutableItems") { CustomItemsManager.register(CustomItemsExecutableItems()) },
IntegrationLoader("CustomCrafting") { CustomItemsManager.register(CustomItemsCustomCrafting()) },
// Shop
IntegrationLoader("ShopGUIPlus") { ShopManager.register(ShopShopGuiPlus()) },

View File

@@ -0,0 +1,38 @@
package com.willfp.eco.internal.spigot.integrations.customitems
import com.willfp.eco.core.integrations.customitems.CustomItemsWrapper
import com.willfp.eco.core.items.CustomItem
import com.willfp.eco.core.items.Items
import com.willfp.eco.core.items.TestableItem
import com.willfp.eco.core.items.provider.ItemProvider
import com.willfp.eco.util.NamespacedKeyUtils
import me.wolfyscript.utilities.util.NamespacedKey
import me.wolfyscript.utilities.util.Registry
import org.bukkit.inventory.ItemStack
import java.util.function.Predicate
class CustomItemsCustomCrafting: CustomItemsWrapper {
override fun registerAllItems() {
Items.registerItemProvider(CustomCraftingProvider())
}
override fun getPluginName(): String {
return "CustomCrafting"
}
private class CustomCraftingProvider : ItemProvider("customcrafting") {
override fun provideForKey(key: String): TestableItem? {
val nKey = key.replace("customcrafting:", "", ignoreCase = true)
val itemKey = NamespacedKey("customcrafting", nKey)
val item = Registry.CUSTOM_ITEMS.get(itemKey) ?: return null
val namespacedKey = NamespacedKeyUtils.create("customcrafting", key)
val stack = item.create(1)
return CustomItem(
namespacedKey,
Predicate { test: ItemStack ->
val customStack = me.wolfyscript.utilities.api.inventory.custom_items.CustomItem.getByItemStack(test) ?: return@Predicate false
val iKey = customStack.namespacedKey ?: return@Predicate false
iKey.equals(key)
},
stack
)
}
}
}

View File

@@ -0,0 +1,33 @@
package com.willfp.eco.internal.spigot.integrations.customitems
import com.ssomar.score.api.ExecutableItemsAPI
import com.willfp.eco.core.integrations.customitems.CustomItemsWrapper
import com.willfp.eco.core.items.CustomItem
import com.willfp.eco.core.items.Items
import com.willfp.eco.core.items.TestableItem
import com.willfp.eco.core.items.provider.ItemProvider
import com.willfp.eco.util.NamespacedKeyUtils
import org.bukkit.inventory.ItemStack
import java.util.function.Predicate
class CustomItemsExecutableItems: CustomItemsWrapper {
override fun registerAllItems() {
Items.registerItemProvider(ExecutableItemsProvider())
}
override fun getPluginName(): String {
return "ExecutableItems"
}
private class ExecutableItemsProvider : ItemProvider("executableitems") {
override fun provideForKey(key: String): TestableItem? {
val item = ExecutableItemsAPI.getExecutableItem(key) ?: return null
val namespacedKey = NamespacedKeyUtils.create("executableitems", key)
return CustomItem(
namespacedKey,
Predicate { test: ItemStack ->
val customStack = ExecutableItemsAPI.getExecutableItemConfig(test) ?: return@Predicate false
customStack.id.equals(key, ignoreCase = true)
},
item
)
}
}
}

View File

@@ -40,6 +40,8 @@ softdepend:
- CrashClaim
- DecentHolograms
- MythicMobs
- CustomCrafting
- ExecutableItems
libraries:
- 'org.reflections:reflections:0.9.12'
- 'org.apache.maven:maven-artifact:3.0.3'

View File

@@ -1,3 +1,3 @@
version = 6.20.0
version = 6.20.2
plugin-name = eco
kotlin.code.style = official

BIN
lib/SCore-1.6.0.9.jar Normal file

Binary file not shown.