Added in hologram integrations for CMI/GHolo/HolographicDisplays
This commit is contained in:
@@ -9,15 +9,15 @@ dependencies {
|
||||
// Adventure
|
||||
compileOnly 'net.kyori:adventure-platform-bukkit:4.0.0'
|
||||
compileOnly 'net.kyori:adventure-text-minimessage:4.1.0-SNAPSHOT'
|
||||
compileOnly 'net.kyori:adventure-api:4.9.1'
|
||||
compileOnly 'net.kyori:adventure-api:4.9.2'
|
||||
compileOnly 'net.kyori:adventure-text-serializer-gson:4.9.2'
|
||||
compileOnly 'net.kyori:adventure-text-serializer-legacy:4.8.1'
|
||||
compileOnly 'net.kyori:adventure-text-serializer-legacy:4.9.2'
|
||||
|
||||
// Other
|
||||
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
|
||||
compileOnly 'org.apache.maven:maven-artifact:3.0.3'
|
||||
compileOnly 'org.apache.maven:maven-artifact:3.8.1'
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.7.1-SNAPSHOT'
|
||||
compileOnly 'com.google.code.gson:gson:2.8.7'
|
||||
compileOnly 'com.google.code.gson:gson:2.8.8'
|
||||
}
|
||||
|
||||
java {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.willfp.eco.core.integrations.hologram;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Dummy hologram, created if no integrations are present on the server.
|
||||
*/
|
||||
class DummyHologram implements Hologram {
|
||||
@Override
|
||||
public void remove() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContents(@NotNull List<String> contents) {
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.willfp.eco.core.integrations.hologram;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Wrapper class for plugin-specific holograms.
|
||||
*/
|
||||
public interface Hologram {
|
||||
/**
|
||||
* Remove the hologram.
|
||||
*/
|
||||
void remove();
|
||||
|
||||
/**
|
||||
* Set the hologram contents.
|
||||
*
|
||||
* @param contents The contents.
|
||||
*/
|
||||
void setContents(@NotNull List<String> contents);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.willfp.eco.core.integrations.hologram;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Location;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Class to handle hologram integrations.
|
||||
*/
|
||||
@UtilityClass
|
||||
public class HologramManager {
|
||||
/**
|
||||
* A set of all registered integrations.
|
||||
*/
|
||||
private final Set<HologramWrapper> registered = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Register a new integration.
|
||||
*
|
||||
* @param integration The integration to register.
|
||||
*/
|
||||
public void register(@NotNull final HologramWrapper integration) {
|
||||
registered.add(integration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create hologram.
|
||||
*
|
||||
* @param location The location.
|
||||
* @param contents The contents for the hologram.
|
||||
* @return The hologram.
|
||||
*/
|
||||
public Hologram createHologram(@NotNull final Location location,
|
||||
@NotNull final List<String> contents) {
|
||||
for (HologramWrapper wrapper : registered) {
|
||||
return wrapper.createHologram(location, contents);
|
||||
}
|
||||
|
||||
return new DummyHologram();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.willfp.eco.core.integrations.hologram;
|
||||
|
||||
import com.willfp.eco.core.integrations.Integration;
|
||||
import org.bukkit.Location;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Wrapper class for hologram integrations.
|
||||
*/
|
||||
public interface HologramWrapper extends Integration {
|
||||
/**
|
||||
* Create hologram.
|
||||
*
|
||||
* @param location The location.
|
||||
* @param contents The contents for the hologram.
|
||||
* @return The hologram.
|
||||
*/
|
||||
Hologram createHologram(@NotNull final Location location,
|
||||
@NotNull final List<String> contents);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.willfp.eco.core.integrations.mcmmo;
|
||||
|
||||
import com.willfp.eco.core.integrations.Integration;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Event;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -7,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Wrapper class for mcmmo integrations.
|
||||
*/
|
||||
public interface McmmoWrapper {
|
||||
public interface McmmoWrapper extends Integration {
|
||||
/**
|
||||
* Get bonus drop count of block.
|
||||
*
|
||||
|
||||
@@ -7,11 +7,11 @@ dependencies {
|
||||
exclude group: 'net.kyori', module: 'adventure-api'
|
||||
}
|
||||
compileOnly 'net.kyori:adventure-platform-bukkit:4.0.0'
|
||||
compileOnly 'net.kyori:adventure-api:4.9.1'
|
||||
compileOnly 'net.kyori:adventure-api:4.9.2'
|
||||
compileOnly 'net.kyori:adventure-text-serializer-gson:4.9.2'
|
||||
compileOnly 'net.kyori:adventure-text-serializer-legacy:4.8.1'
|
||||
compileOnly 'org.apache.maven:maven-artifact:3.0.3'
|
||||
compileOnly 'com.google.code.gson:gson:2.8.7'
|
||||
compileOnly 'net.kyori:adventure-text-serializer-legacy:4.9.2'
|
||||
compileOnly 'org.apache.maven:maven-artifact:3.8.1'
|
||||
compileOnly 'com.google.code.gson:gson:2.8.8'
|
||||
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
|
||||
compileOnly project(":eco-core:core-proxy")
|
||||
compileOnly project(":eco-core:core-backend")
|
||||
@@ -19,7 +19,7 @@ dependencies {
|
||||
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.7-SNAPSHOT'
|
||||
compileOnly 'com.github.TechFortress:GriefPrevention:16.17.1'
|
||||
compileOnly 'com.massivecraft:Factions:1.6.9.5-U0.5.10'
|
||||
compileOnly 'com.github.cryptomorin:kingdoms:1.10.14'
|
||||
compileOnly 'com.github.cryptomorin:kingdoms:1.11.18'
|
||||
compileOnly 'com.github.TownyAdvanced:Towny:0.97.2.6'
|
||||
compileOnly 'com.github.angeschossen:LandsAPI:5.15.2'
|
||||
compileOnly 'fr.neatmonster:nocheatplus:3.16.1-SNAPSHOT'
|
||||
@@ -30,10 +30,11 @@ dependencies {
|
||||
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'
|
||||
compileOnly 'org.jetbrains.exposed:exposed-core:0.34.1'
|
||||
compileOnly 'org.jetbrains.exposed:exposed-dao:0.34.1'
|
||||
compileOnly 'org.jetbrains.exposed:exposed-jdbc:0.34.1'
|
||||
compileOnly 'mysql:mysql-connector-java:5.1.48'
|
||||
compileOnly 'org.jetbrains.exposed:exposed-core:0.35.1'
|
||||
compileOnly 'org.jetbrains.exposed:exposed-dao:0.35.1'
|
||||
compileOnly 'org.jetbrains.exposed:exposed-jdbc:0.35.1'
|
||||
compileOnly 'mysql:mysql-connector-java:8.0.25'
|
||||
compileOnly 'com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.4.0'
|
||||
|
||||
// CombatLogX V10 + NewbieHelper Expansion
|
||||
compileOnly 'com.SirBlobman.combatlogx:CombatLogX-API:10.0.0.0-SNAPSHOT'
|
||||
|
||||
@@ -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'
|
||||
|
||||
BIN
lib/CMIAPI8.7.8.2.jar
Normal file
BIN
lib/CMIAPI8.7.8.2.jar
Normal file
Binary file not shown.
BIN
lib/CMILib1.0.4.1.jar
Normal file
BIN
lib/CMILib1.0.4.1.jar
Normal file
Binary file not shown.
BIN
lib/GHolo.jar
Normal file
BIN
lib/GHolo.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user