Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebac75b0ee | ||
|
|
02d0fa85b5 | ||
|
|
168915868c | ||
|
|
d62d598fd6 | ||
|
|
06561c5387 | ||
|
|
c9805e91b4 | ||
|
|
e3be95ca4d | ||
|
|
c0547a7c34 |
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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()) },
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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'
|
||||
|
||||
@@ -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
BIN
lib/SCore-1.6.0.9.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user