Merge branch 'master' into master
This commit is contained in:
@@ -15,18 +15,22 @@ import com.willfp.eco.core.integrations.hologram.HologramManager
|
||||
import com.willfp.eco.core.integrations.mcmmo.McmmoManager
|
||||
import com.willfp.eco.core.integrations.shop.ShopManager
|
||||
import com.willfp.eco.core.items.Items
|
||||
import com.willfp.eco.core.items.args.CustomModelDataArgParser
|
||||
import com.willfp.eco.core.items.args.EnchantmentArgParser
|
||||
import com.willfp.eco.core.items.args.LeatherArmorColorArgParser
|
||||
import com.willfp.eco.core.items.args.TextureArgParser
|
||||
import com.willfp.eco.internal.display.EcoDisplayHandler
|
||||
import com.willfp.eco.internal.drops.DropManager
|
||||
import com.willfp.eco.internal.items.ArgParserColor
|
||||
import com.willfp.eco.internal.items.ArgParserCustomModelData
|
||||
import com.willfp.eco.internal.items.ArgParserEnchantment
|
||||
import com.willfp.eco.internal.items.ArgParserFlag
|
||||
import com.willfp.eco.internal.items.ArgParserName
|
||||
import com.willfp.eco.internal.items.ArgParserTexture
|
||||
import com.willfp.eco.internal.items.ArgParserUnbreakable
|
||||
import com.willfp.eco.internal.spigot.arrows.ArrowDataListener
|
||||
import com.willfp.eco.internal.spigot.data.DataListener
|
||||
import com.willfp.eco.internal.spigot.data.PlayerBlockListener
|
||||
import com.willfp.eco.internal.spigot.data.storage.ProfileSaver
|
||||
import com.willfp.eco.internal.spigot.display.PacketAutoRecipe
|
||||
import com.willfp.eco.internal.spigot.display.PacketChat
|
||||
import com.willfp.eco.internal.spigot.display.PacketHeldWindowItems
|
||||
import com.willfp.eco.internal.spigot.display.PacketOpenWindowMerchant
|
||||
import com.willfp.eco.internal.spigot.display.PacketSetCreativeSlot
|
||||
import com.willfp.eco.internal.spigot.display.PacketSetSlot
|
||||
@@ -60,13 +64,11 @@ import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefLands
|
||||
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefSuperiorSkyblock2
|
||||
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.customitems.CustomItemsCustomCrafting
|
||||
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
|
||||
import com.willfp.eco.internal.spigot.integrations.economy.EconomyVault
|
||||
import com.willfp.eco.internal.spigot.integrations.hologram.HologramCMI
|
||||
import com.willfp.eco.internal.spigot.integrations.hologram.HologramDecentHolograms
|
||||
import com.willfp.eco.internal.spigot.integrations.hologram.HologramHolographicDisplays
|
||||
import com.willfp.eco.internal.spigot.integrations.mcmmo.McmmoIntegrationImpl
|
||||
import com.willfp.eco.internal.spigot.integrations.multiverseinventories.MultiverseInventoriesIntegration
|
||||
@@ -93,10 +95,13 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
||||
"&a"
|
||||
) {
|
||||
init {
|
||||
Items.registerArgParser(EnchantmentArgParser())
|
||||
Items.registerArgParser(TextureArgParser())
|
||||
Items.registerArgParser(CustomModelDataArgParser())
|
||||
Items.registerArgParser(LeatherArmorColorArgParser())
|
||||
Items.registerArgParser(ArgParserEnchantment())
|
||||
Items.registerArgParser(ArgParserColor())
|
||||
Items.registerArgParser(ArgParserTexture())
|
||||
Items.registerArgParser(ArgParserCustomModelData())
|
||||
Items.registerArgParser(ArgParserFlag())
|
||||
Items.registerArgParser(ArgParserUnbreakable())
|
||||
Items.registerArgParser(ArgParserName())
|
||||
|
||||
val skullProxy = getProxy(SkullProxy::class.java)
|
||||
SkullUtils.initialize(
|
||||
@@ -206,7 +211,6 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
||||
IntegrationLoader("Oraxen") { CustomItemsManager.register(CustomItemsOraxen()) },
|
||||
IntegrationLoader("ItemsAdder") { CustomItemsManager.register(CustomItemsItemsAdder()) },
|
||||
IntegrationLoader("HeadDatabase") { CustomItemsManager.register(CustomItemsHeadDatabase(this)) },
|
||||
IntegrationLoader("CustomCrafting") { CustomItemsManager.register(CustomItemsCustomCrafting()) },
|
||||
|
||||
// Shop
|
||||
IntegrationLoader("ShopGUIPlus") { ShopManager.register(ShopShopGuiPlus()) },
|
||||
@@ -214,7 +218,6 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
||||
// Hologram
|
||||
IntegrationLoader("HolographicDisplays") { HologramManager.register(HologramHolographicDisplays(this)) },
|
||||
IntegrationLoader("CMI") { HologramManager.register(HologramCMI()) },
|
||||
IntegrationLoader("DecentHolograms") { HologramManager.register(HologramDecentHolograms()) },
|
||||
//IntegrationLoader("GHolo") { HologramManager.register(HologramGHolo()) },
|
||||
|
||||
// AFK
|
||||
@@ -246,6 +249,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
||||
PacketSetCreativeSlot(this),
|
||||
PacketSetSlot(this),
|
||||
PacketWindowItems(this),
|
||||
PacketHeldWindowItems(this),
|
||||
PacketOpenWindowMerchant(this)
|
||||
)
|
||||
}
|
||||
@@ -260,7 +264,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
||||
GUIListener(this),
|
||||
ArrowDataListener(this),
|
||||
ArmorChangeEventListeners(this),
|
||||
DataListener(),
|
||||
DataListener(this),
|
||||
PlayerBlockListener(this)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.willfp.eco.internal.spigot.data
|
||||
|
||||
import com.willfp.eco.core.Eco
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.util.PlayerUtils
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
@@ -8,16 +9,19 @@ import org.bukkit.event.player.PlayerJoinEvent
|
||||
import org.bukkit.event.player.PlayerLoginEvent
|
||||
import org.bukkit.event.player.PlayerQuitEvent
|
||||
|
||||
class DataListener : Listener {
|
||||
class DataListener(
|
||||
private val plugin: EcoPlugin
|
||||
) : Listener {
|
||||
@EventHandler
|
||||
fun onLeave(event: PlayerQuitEvent) {
|
||||
PlayerUtils.updateSavedDisplayName(event.player)
|
||||
Eco.getHandler().playerProfileHandler.unloadPlayer(event.player.uniqueId)
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun onJoin(event: PlayerJoinEvent) {
|
||||
PlayerUtils.updateSavedDisplayName(event.player)
|
||||
plugin.scheduler.runLater({
|
||||
PlayerUtils.updateSavedDisplayName(event.player)
|
||||
}, 5)
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.jetbrains.exposed.sql.select
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
import org.jetbrains.exposed.sql.update
|
||||
import java.util.UUID
|
||||
import java.util.concurrent.Callable
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@@ -114,13 +115,21 @@ class MySQLDataHandler(
|
||||
}
|
||||
|
||||
override fun <T> read(uuid: UUID, key: NamespacedKey): T? {
|
||||
var value: T? = null
|
||||
transaction {
|
||||
val player = getPlayer(uuid)
|
||||
value = player[getColumn(key.toString())] as T?
|
||||
val doRead = Callable<T?> {
|
||||
var value: T? = null
|
||||
transaction {
|
||||
val player = getPlayer(uuid)
|
||||
value = player[getColumn(key.toString())] as T?
|
||||
}
|
||||
|
||||
return@Callable value
|
||||
}
|
||||
|
||||
return value
|
||||
return if (Eco.getHandler().ecoPlugin.configYml.getBool("mysql.async-reads")) {
|
||||
executor.submit(doRead).get()
|
||||
} else {
|
||||
doRead.call()
|
||||
}
|
||||
}
|
||||
|
||||
object Players : UUIDTable("eco_players")
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.willfp.eco.internal.spigot.display
|
||||
|
||||
import com.comphenix.protocol.PacketType
|
||||
import com.comphenix.protocol.events.PacketContainer
|
||||
import com.comphenix.protocol.events.PacketEvent
|
||||
import com.willfp.eco.core.AbstractPacketAdapter
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.Prerequisite
|
||||
import com.willfp.eco.core.display.Display
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
class PacketHeldWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, PacketType.Play.Server.WINDOW_ITEMS, false) {
|
||||
override fun onSend(
|
||||
packet: PacketContainer,
|
||||
player: Player,
|
||||
event: PacketEvent
|
||||
) {
|
||||
if (!Prerequisite.HAS_1_17.isMet) {
|
||||
return
|
||||
}
|
||||
|
||||
packet.itemModifier.modify(0) { item: ItemStack? ->
|
||||
Display.display(
|
||||
item!!, player
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
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 dev.lone.itemsadder.api.CustomStack
|
||||
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(ItemsAdderProvider())
|
||||
}
|
||||
|
||||
override fun getPluginName(): String {
|
||||
return "CustomCrafting"
|
||||
}
|
||||
|
||||
private class ItemsAdderProvider : 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 = CustomStack.byItemStack(test) ?: return@Predicate false
|
||||
customStack.id.equals(nKey, ignoreCase = true)
|
||||
},
|
||||
stack
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ mysql:
|
||||
# very high numbers can cause issues with OS configuration. If writes are taking
|
||||
# too long, increase this value.
|
||||
threads: 2
|
||||
# If read operations should be ran in the thread pool. Runs on main thread by default.
|
||||
async-reads: false
|
||||
host: localhost
|
||||
port: 3306
|
||||
database: database
|
||||
|
||||
@@ -41,12 +41,11 @@ softdepend:
|
||||
libraries:
|
||||
- 'org.reflections:reflections:0.9.12'
|
||||
- 'org.apache.maven:maven-artifact:3.0.3'
|
||||
- 'org.jetbrains.kotlin:kotlin-stdlib:1.5.31'
|
||||
- 'org.jetbrains.kotlin:kotlin-stdlib:1.6.0'
|
||||
- 'net.kyori:adventure-platform-bukkit:4.0.0'
|
||||
- 'net.kyori:adventure-api:4.9.2'
|
||||
- 'net.kyori:adventure-text-serializer-gson:4.9.2'
|
||||
- 'net.kyori:adventure-text-serializer-legacy:4.9.2'
|
||||
- 'org.jetbrains.kotlin:kotlin-stdlib:1.5.21'
|
||||
- 'net.kyori:adventure-api:4.9.3'
|
||||
- 'net.kyori:adventure-text-serializer-gson:4.9.3'
|
||||
- 'net.kyori:adventure-text-serializer-legacy:4.9.3'
|
||||
- 'org.jetbrains.exposed:exposed-core:0.36.2'
|
||||
- 'org.jetbrains.exposed:exposed-dao:0.36.2'
|
||||
- 'org.jetbrains.exposed:exposed-jdbc:0.36.2'
|
||||
|
||||
Reference in New Issue
Block a user