Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
b5d1c21
Implement basic of paycheck management system with admin commands and…
Qbiterv Oct 11, 2025
2ec3945
Enhance paycheck system: add price argument resolver, improve paychec…
Qbiterv Oct 12, 2025
57297af
Refactor paycheck system to withdraw system: rename classes and updat…
Qbiterv Oct 12, 2025
a6c2134
Refactor withdraw system: rename classes, update dependencies, and im…
Qbiterv Oct 13, 2025
632c26b
Refactor withdraw system: update message handling, improve price argu…
Qbiterv Oct 13, 2025
dc22d8b
Refactor withdraw system: update plugin metadata handling, adjust ite…
Qbiterv Oct 13, 2025
de005b7
Fix price validation logic in PriceArgumentResolver: update threshold…
Qbiterv Oct 13, 2025
e84550c
Refactor command argument handling: update amount argument to use Pri…
Qbiterv Oct 13, 2025
e558053
Refactor AdminSetCommand: improve method parameter formatting for bet…
Qbiterv Oct 13, 2025
292a847
Refactor WithdrawItemService: ensure default item type is set to PAPE…
Qbiterv Oct 13, 2025
2aba885
Implement WithdrawItemService interface and create WithdrawItemServic…
Qbiterv Oct 15, 2025
40bf52c
Refactor PluginConfig and command classes: replace ItemStack with Con…
Qbiterv Oct 15, 2025
94d83d2
Refactor WithdrawService: update texture assignment to handle absence…
Qbiterv Oct 15, 2025
55aa9b6
Refactor command argument handling: replace PriceArgumentResolver wit…
Qbiterv Oct 17, 2025
df22aa5
Refactor message formatting: streamline chat notices for improved rea…
Qbiterv Oct 18, 2025
4b312cd
Review. Use proper paper-api loader, fix multiple bug's.
vLuckyyy Nov 4, 2025
43aed79
Fix tabulation. Remove useless changes.
vLuckyyy Nov 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
object Versions {

const val SPIGOT_API = "1.19.4-R0.1-SNAPSHOT"
const val PAPER_API = "1.19.4-R0.1-SNAPSHOT"

const val OKAERI_CONFIGS = "5.0.5"
const val LITE_COMMANDS = "3.10.5"
Expand Down
2 changes: 1 addition & 1 deletion eternaleconomy-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

dependencies {
compileOnly("org.spigotmc:spigot-api:${Versions.SPIGOT_API}")
compileOnly("org.spigotmc:spigot-api:${Versions.PAPER_API}")
api("org.jetbrains:annotations:${Versions.JETBRAINS_ANNOTATIONS}")
}

22 changes: 17 additions & 5 deletions eternaleconomy-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@ plugins {
id("me.champeau.jmh")
}


repositories {
maven {
name = "papermc"
url = uri("https://repo.papermc.io/repository/maven-public/")
}
}

dependencies {
// api module
implementation(project(":eternaleconomy-api"))

// spigot-api
compileOnly("org.spigotmc:spigot-api:${Versions.SPIGOT_API}")
// paper-api
compileOnly("io.papermc.paper:paper-api:${Versions.PAPER_API}")

// eternalcode commons
implementation("com.eternalcode:eternalcode-commons-adventure:${Versions.ETERNALCODE_COMMONS}")
Expand All @@ -40,15 +48,16 @@ dependencies {
implementation("com.eternalcode:multification-okaeri:${Versions.MULTIFICATION}")

// kyori
implementation("net.kyori:adventure-platform-bukkit:${Versions.ADVENTURE_PLATFORM_BUKKIT}")
implementation("net.kyori:adventure-text-minimessage:${Versions.ADVENTURE_API}")
// implementation("net.kyori:adventure-platform-bukkit:${Versions.ADVENTURE_PLATFORM_BUKKIT}")
// implementation("net.kyori:adventure-text-minimessage:${Versions.ADVENTURE_API}")

// vault
compileOnly("com.github.MilkBowl:VaultAPI:${Versions.VAULT_API}")

// okaeri configs
implementation("eu.okaeri:okaeri-configs-yaml-snakeyaml:${Versions.OKAERI_CONFIGS}")
implementation("eu.okaeri:okaeri-configs-serdes-commons:${Versions.OKAERI_CONFIGS}")
implementation("eu.okaeri:okaeri-configs-serdes-bukkit:${Versions.OKAERI_CONFIGS}")

compileOnly("me.clip:placeholderapi:${Versions.PLACEHOLDER_API}")

Expand Down Expand Up @@ -87,6 +96,9 @@ bukkit {

tasks.runServer {
minecraftVersion("1.21.8")
downloadPlugins {
url("https://github.com/MilkBowl/Vault/releases/download/1.7.3/Vault.jar")
}
}

tasks.shadowJar {
Expand All @@ -103,7 +115,7 @@ tasks.shadowJar {
"eu.okaeri",
"panda",
"org.yaml",
"net.kyori",
// "net.kyori",
"com.eternalcode.commons",
"net.jodah",
).forEach { relocate(it, prefix) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,53 @@
import com.eternalcode.economy.account.database.AccountRepository;
import com.eternalcode.economy.account.database.AccountRepositoryImpl;
import com.eternalcode.economy.bridge.BridgeManager;
import com.eternalcode.economy.command.impl.admin.AdminAddCommand;
import com.eternalcode.economy.command.impl.admin.AdminBalanceCommand;
import com.eternalcode.economy.command.impl.admin.AdminRemoveCommand;
import com.eternalcode.economy.command.impl.admin.AdminResetCommand;
import com.eternalcode.economy.command.impl.admin.AdminSetCommand;
import com.eternalcode.economy.command.argument.AccountArgument;
import com.eternalcode.economy.command.argument.PriceArgumentResolver;
import com.eternalcode.economy.command.context.AccountContext;
import com.eternalcode.economy.command.cooldown.CommandCooldownEditor;
import com.eternalcode.economy.command.cooldown.CommandCooldownMessage;
import com.eternalcode.economy.command.handler.InvalidUsageHandlerImpl;
import com.eternalcode.economy.command.handler.MissingPermissionHandlerImpl;
import com.eternalcode.economy.command.message.InvalidBigDecimalMessage;
import com.eternalcode.economy.command.impl.MoneyBalanceCommand;
import com.eternalcode.economy.command.impl.MoneyTransferCommand;
import com.eternalcode.economy.database.DatabaseManager;
import com.eternalcode.economy.leaderboard.LeaderboardCommand;
import com.eternalcode.economy.command.impl.admin.AdminAddCommand;
import com.eternalcode.economy.command.impl.admin.AdminBalanceCommand;
import com.eternalcode.economy.command.impl.admin.AdminRemoveCommand;
import com.eternalcode.economy.command.impl.admin.AdminResetCommand;
import com.eternalcode.economy.command.impl.admin.AdminSetCommand;
import com.eternalcode.economy.command.message.InvalidBigDecimalMessage;
import com.eternalcode.economy.command.validator.notsender.NotSender;
import com.eternalcode.economy.command.validator.notsender.NotSenderValidator;
import com.eternalcode.economy.config.ConfigService;
import com.eternalcode.economy.config.implementation.CommandsConfig;
import com.eternalcode.economy.config.implementation.PluginConfig;
import com.eternalcode.economy.config.implementation.messages.MessageConfig;
import com.eternalcode.economy.database.DatabaseManager;
import com.eternalcode.economy.format.DecimalFormatter;
import com.eternalcode.economy.format.DecimalFormatterImpl;
import com.eternalcode.economy.leaderboard.LeaderboardCommand;
import com.eternalcode.economy.multification.NoticeBroadcastHandler;
import com.eternalcode.economy.multification.NoticeHandler;
import com.eternalcode.economy.multification.NoticeService;
import com.eternalcode.economy.vault.VaultEconomyProvider;
import com.eternalcode.economy.withdraw.WithdrawCommand;
import com.eternalcode.economy.withdraw.WithdrawItemService;
import com.eternalcode.economy.withdraw.WithdrawService;
import com.eternalcode.economy.withdraw.WithdrawSetItemCommand;
import com.eternalcode.economy.withdraw.controller.WithdrawAnvilController;
import com.eternalcode.economy.withdraw.controller.WithdrawController;
import com.eternalcode.multification.notice.Notice;
import com.eternalcode.multification.notice.NoticeBroadcast;
import com.google.common.base.Stopwatch;
import dev.rollczi.litecommands.LiteCommands;
import dev.rollczi.litecommands.argument.ArgumentKey;
import dev.rollczi.litecommands.bukkit.LiteBukkitFactory;
import dev.rollczi.litecommands.jakarta.LiteJakartaExtension;
import dev.rollczi.litecommands.message.LiteMessages;
import jakarta.validation.constraints.Positive;
import java.io.File;
import java.math.BigDecimal;
import java.time.Duration;
import net.kyori.adventure.platform.AudienceProvider;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Server;
Expand All @@ -64,7 +70,7 @@ public class EconomyBukkitPlugin extends JavaPlugin {

private static final String PLUGIN_STARTED = "EternalEconomy has been enabled in %dms.";

private AudienceProvider audienceProvider;
// private AudienceProvider audienceProvider;
private DatabaseManager databaseManager;

private LiteCommands<CommandSender> liteCommands;
Expand All @@ -74,7 +80,7 @@ public void onEnable() {
Stopwatch started = Stopwatch.createStarted();
Server server = this.getServer();

this.audienceProvider = BukkitAudiences.create(this);
// this.audienceProvider = BukkitAudiences.create(this);
MiniMessage miniMessage = MiniMessage.builder()
.postProcessor(new AdventureUrlPostProcessor())
.postProcessor(new AdventureLegacyColorPostProcessor())
Expand All @@ -86,9 +92,10 @@ public void onEnable() {
ConfigService configService = new ConfigService();
MessageConfig messageConfig = configService.create(MessageConfig.class, new File(dataFolder, "messages.yml"));
PluginConfig pluginConfig = configService.create(PluginConfig.class, new File(dataFolder, "config.yml"));
CommandsConfig commandsConfig = configService.create(CommandsConfig.class, new File(dataFolder, "commands.yml"));
CommandsConfig commandsConfig =
configService.create(CommandsConfig.class, new File(dataFolder, "commands.yml"));

NoticeService noticeService = new NoticeService(messageConfig, this.audienceProvider, miniMessage);
NoticeService noticeService = new NoticeService(messageConfig, miniMessage);

Scheduler scheduler = EconomySchedulerAdapter.getAdaptiveScheduler(this);

Expand All @@ -101,13 +108,19 @@ public void onEnable() {
DecimalFormatter decimalFormatter = new DecimalFormatterImpl(pluginConfig);
AccountPaymentService accountPaymentService = new AccountPaymentService(accountManager, pluginConfig);

WithdrawItemService withdrawItemService = new WithdrawItemService(this, pluginConfig, decimalFormatter, miniMessage);
WithdrawService withdrawService = new WithdrawService(
server, noticeService, pluginConfig, decimalFormatter,
withdrawItemService, accountPaymentService, accountManager, miniMessage);

VaultEconomyProvider vaultEconomyProvider =
new VaultEconomyProvider(this, decimalFormatter, accountPaymentService, accountManager);
server.getServicesManager().register(Economy.class, vaultEconomyProvider, this, ServicePriority.Highest);

this.liteCommands = LiteBukkitFactory.builder("eternaleconomy", this, server)
.extension(new LiteJakartaExtension<>(), settings -> settings
.violationMessage(Positive.class, BigDecimal.class, new InvalidBigDecimalMessage<>(noticeService))
.extension(
new LiteJakartaExtension<>(), settings -> settings
.violationMessage(Positive.class, BigDecimal.class, new InvalidBigDecimalMessage<>(noticeService))
)

.annotations(extension -> extension.validator(
Expand All @@ -119,10 +132,11 @@ public void onEnable() {
.invalidUsage(new InvalidUsageHandlerImpl(noticeService))

.message(LiteMessages.COMMAND_COOLDOWN, new CommandCooldownMessage(noticeService, commandsConfig))
.message(LiteMessages.INVALID_NUMBER, (invocation, amount) -> noticeService.create()
.notice(messageConfig.positiveNumberRequired)
.placeholder("{AMOUNT}", amount)
.viewer(invocation.sender()))
.message(
LiteMessages.INVALID_NUMBER, (invocation, amount) -> noticeService.create()
.notice(messageConfig.positiveNumberRequired)
.placeholder("{AMOUNT}", amount)
.viewer(invocation.sender()))
.editorGlobal(new CommandCooldownEditor(commandsConfig))

.commands(
Expand All @@ -131,6 +145,8 @@ public void onEnable() {
new AdminSetCommand(accountPaymentService, decimalFormatter, noticeService),
new AdminResetCommand(accountPaymentService, noticeService),
new AdminBalanceCommand(noticeService, decimalFormatter),
new WithdrawSetItemCommand(withdrawService),
new WithdrawCommand(withdrawService, noticeService, decimalFormatter),
new MoneyBalanceCommand(noticeService, decimalFormatter),
new MoneyTransferCommand(accountPaymentService, decimalFormatter, noticeService, pluginConfig),
new EconomyReloadCommand(configService, noticeService),
Expand All @@ -140,15 +156,23 @@ public void onEnable() {
.context(Account.class, new AccountContext(accountManager, messageConfig))
.argument(Account.class, new AccountArgument(accountManager, noticeService, server))

.argument(
BigDecimal.class,
ArgumentKey.of(PriceArgumentResolver.KEY),
new PriceArgumentResolver(pluginConfig, messageConfig))

.result(Notice.class, new NoticeHandler(noticeService))
.result(NoticeBroadcast.class, new NoticeBroadcastHandler())

.build();

server.getPluginManager().registerEvents(new AccountController(accountManager), this);

server.getPluginManager().registerEvents(new WithdrawController(withdrawService, withdrawItemService), this);
server.getPluginManager().registerEvents(new WithdrawAnvilController(withdrawItemService, noticeService), this);

BridgeManager bridgeManager = new BridgeManager(
this.getDescription(),
this.getPluginMeta(),
accountManager,
decimalFormatter,
server,
Expand All @@ -163,9 +187,9 @@ public void onEnable() {

@Override
public void onDisable() {
if (this.audienceProvider != null) {
this.audienceProvider.close();
}
// if (this.audienceProvider != null) {
// this.audienceProvider.close();
// }

if (this.liteCommands != null) {
this.liteCommands.unregister();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ public class EconomyPermissionConstant {
public static final String ADMIN_REMOVE_PERMISSION = "eternaleconomy.admin.remove";
public static final String ADMIN_SET_PERMISSION = "eternaleconomy.admin.set";
public static final String ADMIN_RELOAD_PERMISSION = "eternaleconomy.admin.reload";
public static final String ADMIN_ITEM_PERMISSION = "eternaleconomy.admin.item";

public static final String PLAYER_BALANCE_PERMISSION = "eternaleconomy.player.balance";
public static final String PLAYER_BALANCE_OTHER_PERMISSION = "eternaleconomy.player.balance.other";
public static final String PLAYER_PAY_PERMISSION = "eternaleconomy.player.pay";
public static final String PLAYER_BALANCE_TOP_PERMISSION = "eternaleconomy.player.balance.top";
public static final String PLAYER_WITHDRAW_PERMISSION = "eternaleconomy.player.withdraw";
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.eternalcode.economy.account.AccountManager;
import com.eternalcode.economy.bridge.placeholderapi.PlaceholderEconomyExpansion;
import com.eternalcode.economy.format.DecimalFormatter;
import io.papermc.paper.plugin.configuration.PluginMeta;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Server;
Expand All @@ -12,7 +13,7 @@

public class BridgeManager {

private final PluginDescriptionFile pluginDescriptionFile;
private final PluginMeta pluginMeta;

private final AccountManager accountManager;
private final DecimalFormatter decimalFormatter;
Expand All @@ -22,14 +23,14 @@ public class BridgeManager {
private final Logger logger;

public BridgeManager(
PluginDescriptionFile pluginDescriptionFile,
PluginMeta pluginMeta,
AccountManager accountManager,
DecimalFormatter decimalFormatter,
Server server,
Plugin plugin,
Logger logger
) {
this.pluginDescriptionFile = pluginDescriptionFile;
this.pluginMeta = pluginMeta;
this.accountManager = accountManager;
this.decimalFormatter = decimalFormatter;
this.server = server;
Expand All @@ -44,7 +45,7 @@ public void init() {
Bukkit.getScheduler().runTask(this.plugin, () -> {
this.setupBridge("PlaceholderAPI", () -> {
PlaceholderEconomyExpansion placeholderEconomyExpansion = new PlaceholderEconomyExpansion(
this.pluginDescriptionFile,
this.pluginMeta,
this.accountManager,
this.decimalFormatter
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,42 @@
import com.eternalcode.economy.account.AccountManager;
import com.eternalcode.economy.bridge.BridgeInitializer;
import com.eternalcode.economy.format.DecimalFormatter;
import io.papermc.paper.plugin.configuration.PluginMeta;
import java.util.UUID;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.OfflinePlayer;
import org.bukkit.plugin.PluginDescriptionFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class PlaceholderEconomyExpansion extends PlaceholderExpansion implements BridgeInitializer {

private final PluginDescriptionFile pluginDescriptionFile;
private final PluginMeta pluginMeta;
private final AccountManager accountManager;
private final DecimalFormatter decimalFormatter;

public PlaceholderEconomyExpansion(
PluginDescriptionFile pluginDescriptionFile,
PluginMeta pluginMeta,
AccountManager accountManager,
DecimalFormatter decimalFormatter
) {
this.pluginDescriptionFile = pluginDescriptionFile;
this.pluginMeta = pluginMeta;
this.accountManager = accountManager;
this.decimalFormatter = decimalFormatter;
}

@Override
public @NotNull String getIdentifier() {
return this.pluginDescriptionFile.getName().toLowerCase();
return this.pluginMeta.getName().toLowerCase();
}

@Override
public @NotNull String getAuthor() {
return this.pluginDescriptionFile.getAuthors().get(0);
return this.pluginMeta.getAuthors().get(0);
}

@Override
public @NotNull String getVersion() {
return this.pluginDescriptionFile.getVersion();
return this.pluginMeta.getVersion();
}

@Override
Expand Down
Loading