Compare commits

..

14 Commits

Author SHA1 Message Date
Auxilor
364550d228 Pain 2022-04-06 13:47:01 +01:00
Auxilor
d5e8cbaf33 Updated to 6.32.1 2022-04-06 13:35:34 +01:00
Auxilor
c4d532fda9 Removed MySQL relocation 2022-04-06 13:34:33 +01:00
Auxilor
aa097cf7e2 Fixed wrong MySQL driver class 2022-04-06 13:08:29 +01:00
Auxilor
6f4ca40a94 Changed load order for custom items 2022-04-05 16:29:13 +01:00
Auxilor
2ef9b4033c Updated to 6.32.0 2022-04-05 15:38:44 +01:00
Auxilor
9aa22ffc86 Added Items#mergeFrom 2022-04-05 15:38:34 +01:00
Auxilor
d81c1e6fcb Added comment 2022-04-05 13:22:13 +01:00
Auxilor
ac72e0770a Undid last commit 2022-04-05 13:17:29 +01:00
Auxilor
5e3e09c4bc Moved adventure api to api configuration 2022-04-05 13:17:07 +01:00
Auxilor
ee945d5901 Updated to 6.31.4 2022-04-05 13:14:48 +01:00
Auxilor
7f747f3afc Fixed & color code 2022-04-05 13:12:49 +01:00
Auxilor
2d47593f51 More build changes 2022-04-05 13:12:29 +01:00
Auxilor
df529ba239 Minimized use of the lib-loader 2022-04-05 13:01:05 +01:00
19 changed files with 161 additions and 50 deletions

View File

@@ -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 {

View File

@@ -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'
}

View File

@@ -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!");
}
});

View File

@@ -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");
}

View File

@@ -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.
}
}

View File

@@ -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");
}

View File

@@ -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)

View File

@@ -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'
}

View File

@@ -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'])
}

View File

@@ -178,6 +178,8 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
NumberUtils.initCrunch { expression, player, statics -> evaluateExpression(expression, player, statics) }
CustomItemsManager.registerProviders()
postInit()
}

View File

@@ -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")

View File

@@ -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())
}

View File

@@ -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())
}

View File

@@ -23,7 +23,7 @@ class CustomItemsHeadDatabase(
plugin.eventManager.registerListener(provider)
}
override fun registerAllItems() {
override fun registerProvider() {
Items.registerItemProvider(HeadDBProvider())
}

View File

@@ -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())
}

View File

@@ -26,10 +26,6 @@ class CustomItemsMythicMobs(
return "MythicMobs"
}
override fun registerAllItems() {
// Do nothing.
}
@EventHandler
fun onLoad(event: MythicDropLoadEvent) {
val name = event.dropName

View File

@@ -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())
}

View File

@@ -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

View File

@@ -1,3 +1,3 @@
version = 6.31.3
version = 6.32.1
plugin-name = eco
kotlin.code.style = official