Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fa209a981 | ||
|
|
b3a0634ad0 | ||
|
|
97d7acc0a9 | ||
|
|
ebac75b0ee | ||
|
|
02d0fa85b5 | ||
|
|
168915868c | ||
|
|
d62d598fd6 | ||
|
|
06561c5387 | ||
|
|
c0547a7c34 |
@@ -73,12 +73,10 @@ open class EcoDropQueue(val player: Player) : InternalDropQueue {
|
|||||||
world.dropItem(location, drop!!).velocity = Vector()
|
world.dropItem(location, drop!!).velocity = Vector()
|
||||||
}
|
}
|
||||||
if (xp > 0) {
|
if (xp > 0) {
|
||||||
val event = PlayerExpChangeEvent(player, xp)
|
|
||||||
Bukkit.getPluginManager().callEvent(event)
|
|
||||||
val orb =
|
val orb =
|
||||||
world.spawnEntity(player.location.add(0.0, 0.2, 0.0), EntityType.EXPERIENCE_ORB) as ExperienceOrb
|
world.spawnEntity(player.location.add(0.0, 0.2, 0.0), EntityType.EXPERIENCE_ORB) as ExperienceOrb
|
||||||
orb.velocity = Vector(0, 0, 0)
|
orb.velocity = Vector(0, 0, 0)
|
||||||
orb.experience = event.amount
|
orb.experience = xp
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (drop in items) {
|
for (drop in items) {
|
||||||
@@ -94,4 +92,4 @@ open class EcoDropQueue(val player: Player) : InternalDropQueue {
|
|||||||
init {
|
init {
|
||||||
location = player.location
|
location = player.location
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ dependencies {
|
|||||||
compileOnly 'com.gmail.nossr50.mcMMO:mcMMO:2.1.202'
|
compileOnly 'com.gmail.nossr50.mcMMO:mcMMO:2.1.202'
|
||||||
compileOnly 'me.clip:placeholderapi:2.10.10'
|
compileOnly 'me.clip:placeholderapi:2.10.10'
|
||||||
compileOnly 'com.github.oraxen:oraxen:bd81ace154'
|
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.brcdev-minecraft:shopgui-api:2.2.0'
|
||||||
compileOnly 'com.github.LoneDev6:API-ItemsAdder:2.4.7'
|
compileOnly 'com.github.LoneDev6:API-ItemsAdder:2.4.7'
|
||||||
compileOnly 'com.arcaniax:HeadDatabase-API:1.3.0'
|
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.AntigriefTowny
|
||||||
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefWorldGuard
|
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.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.CustomItemsHeadDatabase
|
||||||
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsItemsAdder
|
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.customitems.CustomItemsOraxen
|
||||||
@@ -249,6 +251,8 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
|||||||
IntegrationLoader("Oraxen") { CustomItemsManager.register(CustomItemsOraxen()) },
|
IntegrationLoader("Oraxen") { CustomItemsManager.register(CustomItemsOraxen()) },
|
||||||
IntegrationLoader("ItemsAdder") { CustomItemsManager.register(CustomItemsItemsAdder()) },
|
IntegrationLoader("ItemsAdder") { CustomItemsManager.register(CustomItemsItemsAdder()) },
|
||||||
IntegrationLoader("HeadDatabase") { CustomItemsManager.register(CustomItemsHeadDatabase(this)) },
|
IntegrationLoader("HeadDatabase") { CustomItemsManager.register(CustomItemsHeadDatabase(this)) },
|
||||||
|
IntegrationLoader("ExecutableItems") { CustomItemsManager.register(CustomItemsExecutableItems()) },
|
||||||
|
IntegrationLoader("CustomCrafting") { CustomItemsManager.register(CustomItemsCustomCrafting()) },
|
||||||
|
|
||||||
// Shop
|
// Shop
|
||||||
IntegrationLoader("ShopGUIPlus") { ShopManager.register(ShopShopGuiPlus()) },
|
IntegrationLoader("ShopGUIPlus") { ShopManager.register(ShopShopGuiPlus()) },
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.comphenix.protocol.events.PacketContainer
|
|||||||
import com.comphenix.protocol.events.PacketEvent
|
import com.comphenix.protocol.events.PacketEvent
|
||||||
import com.google.common.util.concurrent.ThreadFactoryBuilder
|
import com.google.common.util.concurrent.ThreadFactoryBuilder
|
||||||
import com.willfp.eco.core.AbstractPacketAdapter
|
import com.willfp.eco.core.AbstractPacketAdapter
|
||||||
|
import com.willfp.eco.core.Eco
|
||||||
import com.willfp.eco.core.EcoPlugin
|
import com.willfp.eco.core.EcoPlugin
|
||||||
import com.willfp.eco.core.display.Display
|
import com.willfp.eco.core.display.Display
|
||||||
import com.willfp.eco.core.fast.FastItemStack
|
import com.willfp.eco.core.fast.FastItemStack
|
||||||
@@ -47,17 +48,10 @@ class PacketWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packe
|
|||||||
handleRateLimit(player)
|
handleRateLimit(player)
|
||||||
|
|
||||||
if (usingAsync(player)) {
|
if (usingAsync(player)) {
|
||||||
|
val newPacket = packet.deepClone()
|
||||||
|
|
||||||
executor.execute {
|
executor.execute {
|
||||||
runCatching {
|
runCatchingWithLogs { modifyAndSend(newPacket, itemStacks, windowId, player) }
|
||||||
modifyAndSend(packet.shallowClone(), itemStacks, windowId, player)
|
|
||||||
}.onFailure {
|
|
||||||
if (this.getPlugin().configYml.getBool("async-display.log-errors")) {
|
|
||||||
this.getPlugin().logger.warning(
|
|
||||||
"Error happened in async processing! Disable async display (/plugins/eco/config.yml)" +
|
|
||||||
"if this is a frequent issue. (Remember to disable ratelimit and emergency too)"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
modifyPacket(packet, itemStacks, windowId, player)
|
modifyPacket(packet, itemStacks, windowId, player)
|
||||||
@@ -82,7 +76,7 @@ class PacketWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packe
|
|||||||
modifyPacket(packet, itemStacks, windowId, player)
|
modifyPacket(packet, itemStacks, windowId, player)
|
||||||
ignorePacketList.add(player.name)
|
ignorePacketList.add(player.name)
|
||||||
this.getPlugin().scheduler.run {
|
this.getPlugin().scheduler.run {
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet)
|
runCatchingWithLogs { ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,4 +163,15 @@ class PacketWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packe
|
|||||||
|
|
||||||
return itemStacks
|
return itemStacks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private inline fun <T> runCatchingWithLogs(toRun: () -> T): Result<T> {
|
||||||
|
return runCatching { toRun() }.onFailure {
|
||||||
|
if (Eco.getHandler().ecoPlugin.configYml.getBool("async-display.log-errors")) {
|
||||||
|
Eco.getHandler().ecoPlugin.logger.warning(
|
||||||
|
"Error happened in async processing! Disable async display (/plugins/eco/config.yml)" +
|
||||||
|
"if this is a frequent issue. (Remember to disable ratelimit and emergency too)"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,14 +69,14 @@ async-display:
|
|||||||
# If emergency async should be used.
|
# If emergency async should be used.
|
||||||
enabled: true
|
enabled: true
|
||||||
# Below this TPS value, emergency async display will be used.
|
# Below this TPS value, emergency async display will be used.
|
||||||
cutoff: 18
|
cutoff: 17
|
||||||
|
|
||||||
# If players with a large amount of display packets should have their processing
|
# If players with a large amount of display packets should have their processing
|
||||||
# done asynchronously. This will help if a player is trying to crash the server
|
# done asynchronously. This will help if a player is trying to crash the server
|
||||||
# by overloading the display system.
|
# by overloading the display system.
|
||||||
ratelimit:
|
ratelimit:
|
||||||
# If rate limit async display should be used.
|
# If rate limit async display should be used.
|
||||||
enabled: true
|
enabled: false
|
||||||
# The amount of window items packets per timeframe needed to enable async display
|
# The amount of window items packets per timeframe needed to enable async display
|
||||||
# for a specified player.
|
# for a specified player.
|
||||||
cutoff: 4
|
cutoff: 4
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ softdepend:
|
|||||||
- CrashClaim
|
- CrashClaim
|
||||||
- DecentHolograms
|
- DecentHolograms
|
||||||
- MythicMobs
|
- MythicMobs
|
||||||
|
- CustomCrafting
|
||||||
|
- ExecutableItems
|
||||||
libraries:
|
libraries:
|
||||||
- 'org.reflections:reflections:0.9.12'
|
- 'org.reflections:reflections:0.9.12'
|
||||||
- 'org.apache.maven:maven-artifact:3.0.3'
|
- 'org.apache.maven:maven-artifact:3.0.3'
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version = 6.20.1
|
version = 6.20.3
|
||||||
plugin-name = eco
|
plugin-name = eco
|
||||||
kotlin.code.style = official
|
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