Skip to content

Commit 3f814dc

Browse files
committed
Forever fix compatibility with other plugins.
1 parent 5bc160a commit 3f814dc

File tree

4 files changed

+39
-16
lines changed

4 files changed

+39
-16
lines changed

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@ object Versions {
22

33
const val SPIGOT_API = "1.19.4-R0.1-SNAPSHOT"
44

5-
const val OKAERI_CONFIGS = "5.0.5"
6-
const val LITE_COMMANDS = "3.7.1"
5+
const val OKAERI_CONFIGS = "5.0.3"
6+
const val LITE_COMMANDS = "3.6.0-SNAPSHOT"
77

8-
const val ETERNALCODE_COMMONS = "1.1.4"
9-
const val MULTIFICATION = "1.1.4"
8+
const val ETERNALCODE_COMMONS = "1.1.5"
9+
const val MULTIFICATION = "1.1.3"
1010

11-
const val JETBRAINS_ANNOTATIONS = "26.0.1"
11+
const val JETBRAINS_ANNOTATIONS = "24.1.0"
1212

13-
const val ADVENTURE_PLATFORM_BUKKIT = "4.3.4"
13+
const val ADVENTURE_PLATFORM_BUKKIT = "4.3.3"
1414
const val ADVENTURE_API = "4.17.0"
1515

16-
const val VAULT_API = "1.7.1"
16+
const val VAULT_API = "1.7"
1717

1818
const val PLACEHOLDER_API = "2.11.6"
1919

2020
const val MARIA_DB = "3.4.1"
21-
const val POSTGRESQL = "42.7.4"
22-
const val H2 = "2.3.232"
21+
const val POSTGRESQL = "42.7.3"
22+
const val H2 = "2.1.214"
2323
const val ORMLITE = "6.1"
24-
const val HIKARI_CP = "6.0.0"
24+
const val HIKARI_CP = "5.1.0"
2525
}

eternaleconomy-core/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
2+
13
plugins {
24
`economy-java`
35
`economy-repositories`
@@ -68,6 +70,10 @@ bukkit {
6870
author = "EternalCodeTeam"
6971
name = "EternalEconomy"
7072
website = "www.eternalcode.pl"
73+
// Enabling this option previously caused issues where the plugin was loaded before Vault,
74+
// preventing the Vault Economy Provider from registering and causing dependent plugins to malfunction.
75+
// Setting the load order to startup ensures the economy plugin is one of the first to load, avoiding these issues.
76+
load = BukkitPluginDescription.PluginLoadOrder.STARTUP
7177
version = "${project.version}"
7278

7379
depend = listOf("Vault")

eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyBukkitPlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public void onEnable() {
146146
accountManager,
147147
decimalFormatter,
148148
server,
149+
this,
149150
this.getLogger()
150151
);
151152
bridgeManager.init();

eternaleconomy-core/src/main/java/com/eternalcode/economy/bridge/BridgeManager.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import com.eternalcode.economy.bridge.placeholderapi.PlaceholderEconomyExpansion;
55
import com.eternalcode.economy.format.DecimalFormatter;
66
import java.util.logging.Logger;
7+
import org.bukkit.Bukkit;
78
import org.bukkit.Server;
9+
import org.bukkit.plugin.Plugin;
810
import org.bukkit.plugin.PluginDescriptionFile;
911
import org.bukkit.plugin.PluginManager;
1012

@@ -16,30 +18,44 @@ public class BridgeManager {
1618
private final DecimalFormatter decimalFormatter;
1719

1820
private final Server server;
21+
private final Plugin plugin;
1922
private final Logger logger;
2023

2124
public BridgeManager(
2225
PluginDescriptionFile pluginDescriptionFile,
2326
AccountManager accountManager,
2427
DecimalFormatter decimalFormatter,
2528
Server server,
29+
Plugin plugin,
2630
Logger logger
2731
) {
2832
this.pluginDescriptionFile = pluginDescriptionFile;
2933
this.accountManager = accountManager;
3034
this.decimalFormatter = decimalFormatter;
3135
this.server = server;
36+
this.plugin = plugin;
3237
this.logger = logger;
3338
}
3439

3540
public void init() {
36-
this.setupBridge("PlaceholderAPI", () -> {
37-
new PlaceholderEconomyExpansion(
38-
this.pluginDescriptionFile,
39-
this.accountManager,
40-
this.decimalFormatter
41-
).initialize();
41+
// Using "load: STARTUP" in plugin.yml causes the plugin to load before PlaceholderAPI.
42+
// Therefore, we need to delay the bridge initialization until the server is fully started.
43+
// The scheduler runs the code after the "Done" message, ensuring the server is fully operational.
44+
Bukkit.getScheduler().runTask(this.plugin, () -> {
45+
this.setupBridge("PlaceholderAPI", () -> {
46+
PlaceholderEconomyExpansion placeholderEconomyExpansion = new PlaceholderEconomyExpansion(
47+
this.pluginDescriptionFile,
48+
this.accountManager,
49+
this.decimalFormatter
50+
);
51+
52+
placeholderEconomyExpansion.register();
53+
54+
System.out.println("PlaceholderAPI bridge initialized!");
55+
});
4256
});
57+
58+
// other bridges (do not put bridges in the scheduler if not needed)
4359
}
4460

4561
private void setupBridge(String pluginName, BridgeInitializer bridge) {

0 commit comments

Comments
 (0)