Added in hologram integrations for CMI/GHolo/HolographicDisplays
This commit is contained in:
@@ -9,6 +9,7 @@ import com.willfp.eco.core.integrations.IntegrationLoader
|
||||
import com.willfp.eco.core.integrations.anticheat.AnticheatManager
|
||||
import com.willfp.eco.core.integrations.antigrief.AntigriefManager
|
||||
import com.willfp.eco.core.integrations.customitems.CustomItemsManager
|
||||
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
|
||||
@@ -39,6 +40,9 @@ import com.willfp.eco.spigot.integrations.antigrief.*
|
||||
import com.willfp.eco.spigot.integrations.customitems.CustomItemsHeadDatabase
|
||||
import com.willfp.eco.spigot.integrations.customitems.CustomItemsItemsAdder
|
||||
import com.willfp.eco.spigot.integrations.customitems.CustomItemsOraxen
|
||||
import com.willfp.eco.spigot.integrations.hologram.HologramCMI
|
||||
import com.willfp.eco.spigot.integrations.hologram.HologramGHolo
|
||||
import com.willfp.eco.spigot.integrations.hologram.HologramHolographicDisplays
|
||||
import com.willfp.eco.spigot.integrations.mcmmo.McmmoIntegrationImpl
|
||||
import com.willfp.eco.spigot.integrations.multiverseinventories.MultiverseInventoriesIntegration
|
||||
import com.willfp.eco.spigot.integrations.shop.ShopShopGuiPlus
|
||||
@@ -175,6 +179,11 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
||||
// Shop
|
||||
IntegrationLoader("ShopGUIPlus") { ShopManager.register(ShopShopGuiPlus()) },
|
||||
|
||||
// Hologram
|
||||
IntegrationLoader("HolographicDisplays") { HologramManager.register(HologramHolographicDisplays(this)) },
|
||||
IntegrationLoader("CMI") { HologramManager.register(HologramCMI()) },
|
||||
IntegrationLoader("GHolo") { HologramManager.register(HologramGHolo()) },
|
||||
|
||||
// Misc
|
||||
IntegrationLoader("mcMMO") { McmmoManager.register(McmmoIntegrationImpl()) },
|
||||
IntegrationLoader("Multiverse-Inventories") {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.willfp.eco.spigot.integrations.hologram
|
||||
|
||||
import com.Zrips.CMI.CMI
|
||||
import com.Zrips.CMI.Modules.Holograms.CMIHologram
|
||||
import com.willfp.eco.core.integrations.hologram.Hologram
|
||||
import com.willfp.eco.core.integrations.hologram.HologramWrapper
|
||||
import net.Zrips.CMILib.Container.CMILocation
|
||||
import org.bukkit.Location
|
||||
import java.util.*
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
class HologramCMI : HologramWrapper {
|
||||
override fun createHologram(location: Location, contents: MutableList<String>): Hologram {
|
||||
val cmiHolo = CMIHologram(UUID.randomUUID().toString(), CMILocation(location))
|
||||
cmiHolo.enable()
|
||||
CMI.getInstance().hologramManager.addHologram(cmiHolo)
|
||||
|
||||
val holo = HologramImplCMI(cmiHolo)
|
||||
holo.setContents(contents)
|
||||
|
||||
return holo
|
||||
}
|
||||
|
||||
override fun getPluginName(): String {
|
||||
return "CMI"
|
||||
}
|
||||
|
||||
class HologramImplCMI(
|
||||
private val handle: CMIHologram
|
||||
) : Hologram {
|
||||
override fun remove() {
|
||||
CMI.getInstance().hologramManager.removeHolo(handle)
|
||||
}
|
||||
|
||||
override fun setContents(contents: MutableList<String>) {
|
||||
handle.lines = contents
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.willfp.eco.spigot.integrations.hologram
|
||||
|
||||
import com.willfp.eco.core.integrations.hologram.Hologram
|
||||
import com.willfp.eco.core.integrations.hologram.HologramWrapper
|
||||
import me.gholo.api.GHoloAPI
|
||||
import org.bukkit.Location
|
||||
import java.util.*
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
class HologramGHolo : HologramWrapper {
|
||||
companion object {
|
||||
private val api = GHoloAPI()
|
||||
}
|
||||
|
||||
override fun createHologram(location: Location, contents: MutableList<String>): Hologram {
|
||||
val id = UUID.randomUUID().toString()
|
||||
|
||||
api.insertHolo(id, location, contents)
|
||||
|
||||
return HologramImplGHolo(id)
|
||||
}
|
||||
|
||||
override fun getPluginName(): String {
|
||||
return "GHolo"
|
||||
}
|
||||
|
||||
class HologramImplGHolo(
|
||||
private val id: String
|
||||
) : Hologram {
|
||||
override fun remove() {
|
||||
api.removeHolo(id)
|
||||
}
|
||||
|
||||
override fun setContents(contents: MutableList<String>) {
|
||||
api.getHolo(id)?.content = contents
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.willfp.eco.spigot.integrations.hologram
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.HologramsAPI
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.integrations.hologram.Hologram
|
||||
import com.willfp.eco.core.integrations.hologram.HologramWrapper
|
||||
import org.bukkit.Location
|
||||
|
||||
class HologramHolographicDisplays(
|
||||
private val plugin: EcoPlugin
|
||||
) : HologramWrapper {
|
||||
|
||||
override fun createHologram(location: Location, contents: MutableList<String>): Hologram {
|
||||
val hologram = HologramImplHolographicDisplays(
|
||||
HologramsAPI.createHologram(plugin, location)
|
||||
)
|
||||
|
||||
hologram.setContents(contents)
|
||||
|
||||
return hologram
|
||||
}
|
||||
|
||||
override fun getPluginName(): String {
|
||||
return "HolographicDisplays"
|
||||
}
|
||||
|
||||
class HologramImplHolographicDisplays(
|
||||
private val handle: com.gmail.filoghost.holographicdisplays.api.Hologram
|
||||
) : Hologram {
|
||||
override fun remove() {
|
||||
handle.delete()
|
||||
}
|
||||
|
||||
override fun setContents(contents: MutableList<String>) {
|
||||
handle.clearLines()
|
||||
for (line in contents) {
|
||||
handle.appendTextLine(line)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,14 +27,17 @@ softdepend:
|
||||
- HeadDatabase
|
||||
- Multiverse-Inventories
|
||||
- Alice
|
||||
- HolographicDisplays
|
||||
- GHolo
|
||||
- CMI
|
||||
libraries:
|
||||
- 'org.reflections:reflections:0.9.12'
|
||||
- 'org.apache.maven:maven-artifact:3.0.3'
|
||||
- 'org.jetbrains.kotlin:kotlin-stdlib:1.5.31'
|
||||
- 'net.kyori:adventure-platform-bukkit:4.0.0'
|
||||
- 'net.kyori:adventure-api:4.9.1'
|
||||
- 'net.kyori:adventure-api:4.9.2'
|
||||
- 'net.kyori:adventure-text-serializer-gson:4.9.2'
|
||||
- 'net.kyori:adventure-text-serializer-legacy:4.8.1'
|
||||
- 'net.kyori:adventure-text-serializer-legacy:4.9.2'
|
||||
- 'org.jetbrains.kotlin:kotlin-stdlib:1.5.21'
|
||||
- 'org.jetbrains.exposed:exposed-core:0.34.1'
|
||||
- 'org.jetbrains.exposed:exposed-dao:0.34.1'
|
||||
|
||||
Reference in New Issue
Block a user