Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
364550d228 | ||
|
|
d5e8cbaf33 | ||
|
|
c4d532fda9 | ||
|
|
aa097cf7e2 | ||
|
|
6f4ca40a94 | ||
|
|
2ef9b4033c | ||
|
|
9aa22ffc86 | ||
|
|
d81c1e6fcb | ||
|
|
ac72e0770a | ||
|
|
5e3e09c4bc | ||
|
|
ee945d5901 | ||
|
|
7f747f3afc | ||
|
|
2d47593f51 | ||
|
|
df529ba239 |
@@ -85,21 +85,25 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(kotlin("stdlib", version = "1.6.10"))
|
||||
// Included in spigot jar, no need to move to implementation
|
||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||
compileOnly("com.google.guava:guava:31.1-jre")
|
||||
|
||||
// Test
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
|
||||
|
||||
|
||||
// Adventure
|
||||
compileOnly("net.kyori:adventure-api:4.10.0")
|
||||
compileOnly("net.kyori:adventure-text-serializer-gson:4.10.0")
|
||||
compileOnly("net.kyori:adventure-text-serializer-legacy:4.10.0")
|
||||
implementation("net.kyori:adventure-api:4.10.1")
|
||||
implementation("net.kyori:adventure-text-serializer-gson:4.10.1") {
|
||||
exclude("com.google.code.gson", "gson") // Prevent shading into the jar
|
||||
}
|
||||
implementation("net.kyori:adventure-text-serializer-legacy:4.10.1")
|
||||
|
||||
// Other
|
||||
compileOnly("com.google.guava:guava:31.1-jre")
|
||||
compileOnly("com.github.ben-manes.caffeine:caffeine:3.0.5")
|
||||
implementation("com.github.ben-manes.caffeine:caffeine:3.0.6")
|
||||
implementation("org.apache.maven:maven-artifact:3.8.4")
|
||||
implementation(kotlin("stdlib", version = "1.6.10"))
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
@@ -115,10 +119,11 @@ allprojects {
|
||||
exclude(group = "com.darkblade12", module = "particleeffect")
|
||||
exclude(group = "com.github.cryptomorin", module = "XSeries")
|
||||
exclude(group = "net.wesjd", module = "anvilgui")
|
||||
exclude(group = "org.slf4j", module = "slf4j-api")
|
||||
}
|
||||
|
||||
configurations.testImplementation {
|
||||
setExtendsFrom(listOf(configurations.compileOnly.get()))
|
||||
setExtendsFrom(listOf(configurations.compileOnly.get(), configurations.implementation.get()))
|
||||
}
|
||||
|
||||
tasks {
|
||||
@@ -133,6 +138,28 @@ allprojects {
|
||||
shadowJar {
|
||||
relocate("org.bstats", "com.willfp.eco.libs.bstats")
|
||||
relocate("redempt.crunch", "com.willfp.eco.libs.crunch")
|
||||
relocate("org.apache.commons.lang3", "com.willfp.eco.libs.lang3")
|
||||
relocate("org.apache.maven", "com.willfp.eco.libs.maven")
|
||||
relocate("org.checkerframework", "com.willfp.eco.libs.checkerframework")
|
||||
relocate("org.intellij", "com.willfp.eco.libs.intellij")
|
||||
relocate("org.jetbrains.annotations", "com.willfp.eco.libs.jetbrains.annotations")
|
||||
//relocate("org.jetbrains.exposed", "com.willfp.eco.libs.exposed")
|
||||
relocate("org.objenesis", "com.willfp.eco.libs.objenesis")
|
||||
relocate("org.reflections", "com.willfp.eco.libs.reflections")
|
||||
relocate("javassist", "com.willfp.eco.libs.javassist")
|
||||
relocate("javax.annotation", "com.willfp.eco.libs.annotation")
|
||||
relocate("com.google.errorprone", "com.willfp.eco.libs.errorprone")
|
||||
relocate("com.google.j2objc", "com.willfp.eco.libs.j2objc")
|
||||
relocate("com.google.thirdparty", "com.willfp.eco.libs.google.thirdparty")
|
||||
relocate("com.google.protobuf", "com.willfp.eco.libs.google.protobuf") // No I don't know either
|
||||
relocate("google.protobuf", "com.willfp.eco.libs.protobuf") // Still don't know
|
||||
relocate("com.zaxxer.hikari", "com.willfp.eco.libs.hikari")
|
||||
//relocate("com.mysql", "com.willfp.eco.libs.mysql")
|
||||
|
||||
/*
|
||||
Kotlin and caffeine are not shaded so that they can be accessed directly by eco plugins.
|
||||
Also, not relocating adventure, because it's a pain in the ass, and it doesn't *seem* to be causing loader constraint violations.
|
||||
*/
|
||||
}
|
||||
|
||||
compileJava {
|
||||
|
||||
@@ -4,7 +4,6 @@ dependencies {
|
||||
|
||||
// Other
|
||||
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
|
||||
compileOnly 'org.apache.maven:maven-artifact:3.8.1'
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.1-SNAPSHOT'
|
||||
compileOnly 'com.google.code.gson:gson:2.8.8'
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ public abstract class EcoPlugin extends JavaPlugin implements PluginLike {
|
||||
if (!(currentVersion.compareTo(mostRecentVersion) > 0 || currentVersion.equals(mostRecentVersion))) {
|
||||
this.outdated = true;
|
||||
this.getLogger().warning(this.getName() + " is out of date! (Version " + this.getDescription().getVersion() + ")");
|
||||
this.getLogger().warning("The newest version is &f" + version);
|
||||
this.getLogger().warning("The newest version is " + version);
|
||||
this.getLogger().warning("Download the new version!");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,6 +34,17 @@ public final class CustomItemsManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all the custom items for a specific plugin into eco.
|
||||
*
|
||||
* @see com.willfp.eco.core.items.Items
|
||||
*/
|
||||
public static void registerProviders() {
|
||||
for (CustomItemsWrapper customItemsWrapper : REGISTERED) {
|
||||
customItemsWrapper.registerProvider();
|
||||
}
|
||||
}
|
||||
|
||||
private CustomItemsManager() {
|
||||
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
|
||||
}
|
||||
|
||||
@@ -11,5 +11,14 @@ public interface CustomItemsWrapper extends Integration {
|
||||
*
|
||||
* @see com.willfp.eco.core.items.Items
|
||||
*/
|
||||
void registerAllItems();
|
||||
default void registerAllItems() {
|
||||
// Override when needed.
|
||||
}
|
||||
|
||||
/**
|
||||
* Register {@link com.willfp.eco.core.items.provider.ItemProvider}s.
|
||||
*/
|
||||
default void registerProvider() {
|
||||
// Override when needed.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.willfp.eco.util.NamespacedKeyUtils;
|
||||
import com.willfp.eco.util.NumberUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -430,6 +431,64 @@ public final class Items {
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge ItemStack onto another ItemStack.
|
||||
*
|
||||
* @param from The ItemStack to merge from.
|
||||
* @param to The ItemStack to merge onto.
|
||||
* @return The ItemStack, merged (same instance as to).
|
||||
*/
|
||||
@NotNull
|
||||
public static ItemStack mergeFrom(@NotNull final ItemStack from,
|
||||
@NotNull final ItemStack to) {
|
||||
ItemMeta fromMeta = from.getItemMeta();
|
||||
ItemMeta toMeta = to.getItemMeta();
|
||||
|
||||
if (fromMeta == null || toMeta == null) {
|
||||
return to;
|
||||
}
|
||||
|
||||
ItemMeta newMeta = mergeFrom(fromMeta, toMeta);
|
||||
|
||||
to.setItemMeta(newMeta);
|
||||
to.setType(from.getType());
|
||||
to.setAmount(from.getAmount());
|
||||
return to;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge ItemMeta onto other ItemMeta.
|
||||
*
|
||||
* @param from The ItemMeta to merge from.
|
||||
* @param to The ItemMeta to merge onto.
|
||||
* @return The ItemMeta, merged (same instance as to).
|
||||
*/
|
||||
@NotNull
|
||||
public static ItemMeta mergeFrom(@NotNull final ItemMeta from,
|
||||
@NotNull final ItemMeta to) {
|
||||
if (from.hasDisplayName()) {
|
||||
to.setDisplayName(from.getDisplayName());
|
||||
}
|
||||
|
||||
to.setLore(from.getLore());
|
||||
|
||||
for (Enchantment enchant : to.getEnchants().keySet()) {
|
||||
to.removeEnchant(enchant);
|
||||
}
|
||||
|
||||
for (Map.Entry<Enchantment, Integer> entry : from.getEnchants().entrySet()) {
|
||||
to.addEnchant(entry.getKey(), entry.getValue(), true);
|
||||
}
|
||||
|
||||
if (from.hasCustomModelData()) {
|
||||
to.setCustomModelData(from.getCustomModelData());
|
||||
} else {
|
||||
to.setCustomModelData(null);
|
||||
}
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
private Items() {
|
||||
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
|
||||
}
|
||||
|
||||
@@ -3,9 +3,22 @@
|
||||
package com.willfp.eco.core.items
|
||||
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.inventory.meta.ItemMeta
|
||||
|
||||
/**
|
||||
* @see Items.toLookupString
|
||||
*/
|
||||
fun ItemStack?.toLookupString(): String =
|
||||
Items.toLookupString(this)
|
||||
|
||||
/**
|
||||
* @see Items.mergeFrom
|
||||
*/
|
||||
fun ItemStack.mergeFrom(other: ItemStack): ItemStack =
|
||||
Items.mergeFrom(other, this)
|
||||
|
||||
/**
|
||||
* @see Items.mergeFrom
|
||||
*/
|
||||
fun ItemMeta.mergeFrom(other: ItemMeta): ItemMeta =
|
||||
Items.mergeFrom(other, this)
|
||||
|
||||
@@ -2,10 +2,12 @@ group 'com.willfp'
|
||||
version rootProject.version
|
||||
|
||||
dependencies {
|
||||
// Libraries
|
||||
implementation 'org.reflections:reflections:0.9.12'
|
||||
implementation 'org.objenesis:objenesis:3.2'
|
||||
|
||||
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
|
||||
compileOnly 'me.clip:placeholderapi:2.10.10'
|
||||
compileOnly 'org.reflections:reflections:0.9.12'
|
||||
compileOnly 'net.kyori:adventure-text-minimessage:4.10.0'
|
||||
compileOnly 'net.kyori:adventure-platform-bukkit:4.1.0'
|
||||
compileOnly 'org.objenesis:objenesis:3.2'
|
||||
}
|
||||
@@ -2,13 +2,23 @@ group 'com.willfp'
|
||||
version rootProject.version
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.Redempt:Crunch:1.1.2'
|
||||
compileOnly 'net.kyori:adventure-platform-bukkit:4.1.0'
|
||||
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")
|
||||
|
||||
// Libraries
|
||||
implementation 'com.github.Redempt:Crunch:1.1.2'
|
||||
implementation 'mysql:mysql-connector-java:8.0.25'
|
||||
implementation 'org.jetbrains.exposed:exposed-core:0.37.3'
|
||||
implementation 'org.jetbrains.exposed:exposed-dao:0.37.3'
|
||||
implementation 'org.jetbrains.exposed:exposed-jdbc:0.37.3'
|
||||
implementation 'com.zaxxer:HikariCP:5.0.0'
|
||||
implementation 'net.kyori:adventure-platform-bukkit:4.1.0'
|
||||
|
||||
// Included in spigot jar
|
||||
compileOnly 'com.google.code.gson:gson:2.8.8'
|
||||
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
|
||||
|
||||
// Plugin dependencies
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.1-SNAPSHOT'
|
||||
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.7-SNAPSHOT'
|
||||
compileOnly 'com.github.TechFortress:GriefPrevention:16.17.1'
|
||||
@@ -26,11 +36,6 @@ 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.37.3'
|
||||
compileOnly 'org.jetbrains.exposed:exposed-dao:0.37.3'
|
||||
compileOnly 'org.jetbrains.exposed:exposed-jdbc:0.37.3'
|
||||
compileOnly 'mysql:mysql-connector-java:8.0.25'
|
||||
compileOnly 'com.zaxxer:HikariCP:5.0.0'
|
||||
compileOnly 'com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.4.0'
|
||||
compileOnly 'com.github.EssentialsX:Essentials:2.18.2'
|
||||
compileOnly 'com.bgsoftware:SuperiorSkyblockAPI:1.8.3'
|
||||
@@ -40,6 +45,8 @@ dependencies {
|
||||
compileOnly 'com.github.WhipDevelopment:CrashClaim:f9cd7d92eb'
|
||||
compileOnly 'com.wolfyscript.wolfyutilities:wolfyutilities:3.16.0.0'
|
||||
compileOnly 'com.github.decentsoftware-eu:decentholograms:2.1.2'
|
||||
|
||||
// MythicMobs
|
||||
compileOnly 'io.lumine:Mythic:5.0.1'
|
||||
compileOnly 'io.lumine:LumineUtils:1.16.1-SNAPSHOT'
|
||||
|
||||
@@ -54,6 +61,7 @@ dependencies {
|
||||
// LibsDisguises
|
||||
compileOnly 'LibsDisguises:LibsDisguises:10.0.26'
|
||||
|
||||
// All other libs
|
||||
compileOnly fileTree(dir: '../../lib', include: ['*.jar'])
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +178,8 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
|
||||
|
||||
NumberUtils.initCrunch { expression, player, statics -> evaluateExpression(expression, player, statics) }
|
||||
|
||||
CustomItemsManager.registerProviders()
|
||||
|
||||
postInit()
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ class MySQLDataHandler(
|
||||
private val serverHandler: ImplementedMySQLHandler
|
||||
|
||||
init {
|
||||
|
||||
val config = HikariConfig()
|
||||
config.driverClassName = "com.mysql.cj.jdbc.Driver"
|
||||
config.username = plugin.configYml.getString("mysql.user")
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.bukkit.inventory.ItemStack
|
||||
import java.util.function.Predicate
|
||||
|
||||
class CustomItemsCustomCrafting : CustomItemsWrapper {
|
||||
override fun registerAllItems() {
|
||||
override fun registerProvider() {
|
||||
Items.registerItemProvider(CustomCraftingProvider())
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.bukkit.inventory.ItemStack
|
||||
import java.util.function.Predicate
|
||||
|
||||
class CustomItemsExecutableItems : CustomItemsWrapper {
|
||||
override fun registerAllItems() {
|
||||
override fun registerProvider() {
|
||||
Items.registerItemProvider(ExecutableItemsProvider())
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class CustomItemsHeadDatabase(
|
||||
plugin.eventManager.registerListener(provider)
|
||||
}
|
||||
|
||||
override fun registerAllItems() {
|
||||
override fun registerProvider() {
|
||||
Items.registerItemProvider(HeadDBProvider())
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.bukkit.inventory.ItemStack
|
||||
import java.util.function.Predicate
|
||||
|
||||
class CustomItemsItemsAdder : CustomItemsWrapper {
|
||||
override fun registerAllItems() {
|
||||
override fun registerProvider() {
|
||||
Items.registerItemProvider(ItemsAdderProvider())
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,6 @@ class CustomItemsMythicMobs(
|
||||
return "MythicMobs"
|
||||
}
|
||||
|
||||
override fun registerAllItems() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun onLoad(event: MythicDropLoadEvent) {
|
||||
val name = event.dropName
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.willfp.eco.util.NamespacedKeyUtils
|
||||
import io.th0rgal.oraxen.items.OraxenItems
|
||||
|
||||
class CustomItemsOraxen : CustomItemsWrapper {
|
||||
override fun registerAllItems() {
|
||||
override fun registerProvider() {
|
||||
Items.registerItemProvider(OraxenProvider())
|
||||
}
|
||||
|
||||
|
||||
@@ -42,20 +42,4 @@ softdepend:
|
||||
- MythicMobs
|
||||
- CustomCrafting
|
||||
- ExecutableItems
|
||||
- RPGHorses
|
||||
libraries:
|
||||
- 'org.reflections:reflections:0.9.12'
|
||||
- 'org.apache.maven:maven-artifact:3.0.3'
|
||||
- 'org.jetbrains.kotlin:kotlin-stdlib:1.6.10'
|
||||
- 'net.kyori:adventure-platform-bukkit:4.1.0'
|
||||
- 'net.kyori:adventure-api:4.10.0'
|
||||
- 'net.kyori:adventure-text-serializer-gson:4.10.0'
|
||||
- 'net.kyori:adventure-text-serializer-legacy:4.10.0'
|
||||
- 'org.jetbrains.exposed:exposed-core:0.37.3'
|
||||
- 'org.jetbrains.exposed:exposed-dao:0.37.3'
|
||||
- 'org.jetbrains.exposed:exposed-jdbc:0.37.3'
|
||||
- 'mysql:mysql-connector-java:8.0.25'
|
||||
- 'com.google.guava:guava:31.1-jre'
|
||||
- 'com.zaxxer:HikariCP:5.0.0'
|
||||
- 'org.objenesis:objenesis:3.2'
|
||||
- 'com.github.ben-manes.caffeine:caffeine:3.0.5'
|
||||
- RPGHorses
|
||||
@@ -1,3 +1,3 @@
|
||||
version = 6.31.3
|
||||
version = 6.32.1
|
||||
plugin-name = eco
|
||||
kotlin.code.style = official
|
||||
Reference in New Issue
Block a user