Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7fa0ecf26 | ||
|
|
a65f16cfac | ||
|
|
49965c091b | ||
|
|
5627582bd5 | ||
|
|
ab8065d06e | ||
|
|
444764e481 | ||
|
|
c240e94a6b | ||
|
|
9da28a1dff | ||
|
|
109347a601 | ||
|
|
43bef762bf | ||
|
|
69a2e0e247 | ||
|
|
bbbf19c041 |
@@ -357,15 +357,18 @@ public abstract class EcoPlugin extends JavaPlugin {
|
||||
Eco.getHandler().registerBStats(this);
|
||||
}
|
||||
|
||||
Set<String> enabledPlugins = Arrays.stream(Bukkit.getPluginManager().getPlugins()).map(Plugin::getName).collect(Collectors.toSet());
|
||||
Set<String> enabledPlugins = Arrays.stream(Bukkit.getPluginManager().getPlugins())
|
||||
.map(Plugin::getName)
|
||||
.map(String::toLowerCase)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
if (enabledPlugins.contains("PlaceholderAPI")) {
|
||||
if (enabledPlugins.contains("PlaceholderAPI".toLowerCase())) {
|
||||
this.loadedIntegrations.add("PlaceholderAPI");
|
||||
PlaceholderManager.addIntegration(Eco.getHandler().createPAPIIntegration(this));
|
||||
}
|
||||
|
||||
this.loadIntegrationLoaders().forEach((integrationLoader -> {
|
||||
if (enabledPlugins.contains(integrationLoader.getPluginName())) {
|
||||
if (enabledPlugins.contains(integrationLoader.getPluginName().toLowerCase())) {
|
||||
this.loadedIntegrations.add(integrationLoader.getPluginName());
|
||||
integrationLoader.load();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.willfp.eco.core.integrations.shop;
|
||||
|
||||
import com.willfp.eco.core.integrations.Integration;
|
||||
|
||||
/**
|
||||
* Wrapper class for shop integrations.
|
||||
*/
|
||||
public interface ShopWrapper {
|
||||
public interface ShopWrapper extends Integration {
|
||||
/**
|
||||
* Register eco item provider for shop plugins.
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.willfp.eco.util;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -10,18 +11,37 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
@UtilityClass
|
||||
public class LightningUtils {
|
||||
|
||||
/**
|
||||
* Strike lightning on player without fire.
|
||||
*
|
||||
* @param victim The entity to smite.
|
||||
* @param damage The damage to deal.
|
||||
* @param silent If the lightning sound should be played locally
|
||||
*/
|
||||
public void strike(@NotNull final LivingEntity victim,
|
||||
final double damage,
|
||||
final boolean silent) {
|
||||
Location loc = victim.getLocation();
|
||||
|
||||
if (silent) {
|
||||
victim.getWorld().spigot().strikeLightningEffect(loc, true);
|
||||
victim.getWorld().playSound(loc, Sound.ENTITY_LIGHTNING_BOLT_IMPACT, 1, 1);
|
||||
} else {
|
||||
victim.getWorld().strikeLightningEffect(loc);
|
||||
}
|
||||
|
||||
victim.damage(damage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strike lightning on a victim without fire.
|
||||
*
|
||||
* @param victim The entity to smite.
|
||||
* @param damage The damage to deal.
|
||||
*/
|
||||
public void strike(@NotNull final LivingEntity victim,
|
||||
final double damage) {
|
||||
Location loc = victim.getLocation();
|
||||
|
||||
victim.getWorld().strikeLightningEffect(loc);
|
||||
|
||||
victim.damage(damage);
|
||||
strike(victim, damage, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.willfp.eco.spigot.eventlisteners.*
|
||||
import com.willfp.eco.spigot.gui.GUIListener
|
||||
import com.willfp.eco.spigot.integrations.anticheat.*
|
||||
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.mcmmo.McmmoIntegrationImpl
|
||||
@@ -90,6 +89,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
||||
|
||||
override fun handleAfterLoad() {
|
||||
CustomItemsManager.registerAllItems()
|
||||
ShopManager.registerEcoProvider()
|
||||
}
|
||||
|
||||
override fun loadIntegrationLoaders(): List<IntegrationLoader> {
|
||||
@@ -123,10 +123,9 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
||||
// Custom Items
|
||||
IntegrationLoader("Oraxen") { CustomItemsManager.register(CustomItemsOraxen()) },
|
||||
IntegrationLoader("ItemsAdder") { CustomItemsManager.register(CustomItemsItemsAdder(this)) },
|
||||
IntegrationLoader("HeadDatabase") { CustomItemsManager.register(CustomItemsHeadDatabase()) },
|
||||
|
||||
// Shop
|
||||
IntegrationLoader("ShopGuiPlus") { ShopManager.register(ShopShopGuiPlus()) },
|
||||
IntegrationLoader("ShopGUIPlus") { ShopManager.register(ShopShopGuiPlus()) },
|
||||
|
||||
// Misc
|
||||
IntegrationLoader("mcMMO") { McmmoManager.register(McmmoIntegrationImpl()) }
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.willfp.eco.spigot.integrations.customitems
|
||||
|
||||
import com.willfp.eco.core.integrations.customitems.CustomItemsWrapper
|
||||
import com.willfp.eco.core.items.CustomItem
|
||||
import com.willfp.eco.util.NamespacedKeyUtils
|
||||
import me.arcaniax.hdb.api.HeadDatabaseAPI
|
||||
import me.arcaniax.hdb.enums.CategoryEnum
|
||||
import java.util.function.Predicate
|
||||
|
||||
class CustomItemsHeadDatabase : CustomItemsWrapper {
|
||||
private val api = HeadDatabaseAPI()
|
||||
|
||||
override fun registerAllItems() {
|
||||
for (categoryEnum in CategoryEnum.values()) {
|
||||
for (head in api.getHeads(categoryEnum).toList()) {
|
||||
val stack = head.head
|
||||
val id = head.id
|
||||
val key = NamespacedKeyUtils.create("headdb", id.lowercase());
|
||||
CustomItem(
|
||||
key,
|
||||
Predicate { test ->
|
||||
val headId = api.getItemID(test) ?: return@Predicate false
|
||||
headId.equals(id, ignoreCase = true)
|
||||
},
|
||||
stack
|
||||
).register()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getPluginName(): String {
|
||||
return "HeadDatabase"
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,15 @@ import com.willfp.eco.util.NamespacedKeyUtils
|
||||
import io.th0rgal.oraxen.items.OraxenItems
|
||||
import org.bukkit.NamespacedKey
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import java.util.*
|
||||
import java.util.function.Predicate
|
||||
|
||||
class CustomItemsOraxen : CustomItemsWrapper {
|
||||
override fun registerAllItems() {
|
||||
for (item in OraxenItems.getItems()) {
|
||||
val stack = item.build()
|
||||
val id: String = OraxenItems.getIdByItem(item)
|
||||
val id: String = Objects.requireNonNullElse(OraxenItems.getIdByItem(item), "")
|
||||
if (id.isEmpty()) continue
|
||||
val key: NamespacedKey = NamespacedKeyUtils.create("oraxen", id.lowercase())
|
||||
CustomItem(
|
||||
key, Predicate { test: ItemStack ->
|
||||
|
||||
@@ -28,4 +28,8 @@ class ShopShopGuiPlus : ShopWrapper {
|
||||
return Items.getCustomItem(itemStack1)?.key == Items.getCustomItem(itemStack2)?.key
|
||||
}
|
||||
}
|
||||
|
||||
override fun getPluginName(): String {
|
||||
return "ShopGUIPlus"
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ softdepend:
|
||||
- PlaceholderAPI
|
||||
- mcMMO
|
||||
- CombatLogX
|
||||
- ShopGuiPlus
|
||||
- ShopGUIPlus
|
||||
- ItemsAdder
|
||||
- Oraxen
|
||||
- HeadDatabase
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 6.7.2
|
||||
version = 6.7.5
|
||||
plugin-name = eco
|
||||
Reference in New Issue
Block a user