Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
3 changes: 3 additions & 0 deletions eternaleconomy-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ bukkit {

tasks.runServer {
minecraftVersion("1.21.1")
downloadPlugins {
github("MilkBowl", "Vault", "1.7.3", "Vault.jar")
}
}

tasks.shadowJar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package com.eternalcode.economy.command.cooldown;

import com.eternalcode.economy.config.implementation.messages.MessageConfig;
import com.eternalcode.multification.notice.Notice;
import eu.okaeri.configs.OkaeriConfig;
import eu.okaeri.configs.annotation.Comment;

import java.time.Duration;

import static com.eternalcode.economy.config.implementation.messages.MessageConfig.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually don't use * in imports. Try to apply MessageConfig via constructor in main class


public class CommandCooldownConfig extends OkaeriConfig {
@Comment("Duration of the cooldown (e.g. 5s, 10m, 1h)")
public Duration duration = Duration.ofSeconds(5);
@Comment("Permission for admins to bypass the cooldown")
public String bypassPermission = "eternaleconomy.player.pay.bypass";
public Notice message = Notice.builder()
.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> "
+ "<white>You must wait <gradient:#00FFA2:#34AE00>{TIME}</gradient> before using /pay again.")
.chat(messagesPrefix + "<white>You must wait <gradient:#00FFA2:#34AE00>{TIME}</gradient> before using /pay again.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this import is needed only for this, maybe try package private and access the variable directly or via method. @Rollczi please think if there is a better way to do it

.actionBar("<gradient:#00FFA2:#34AE00>Wait {TIME}!</gradient>")
.build();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,30 @@
import eu.okaeri.configs.OkaeriConfig;
import eu.okaeri.configs.annotation.Header;

import static com.eternalcode.economy.config.implementation.messages.MessageConfig.*;

@Header("Messages for the admin section.")
public class MessageAdminSubSection extends OkaeriConfig {

public Notice insufficientFunds =
Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> "
+ "<white>Player {PLAYER} has insufficient funds, they are missing <gradient:#00FFA2:#34AE00>{MISSING_BALANCE}</gradient>.</white>");

public Notice added = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> "
+ "<white>Added <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> to "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice removed = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray>"
+ " <white>Removed <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> from "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice set = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> "
+ "<white>Set <gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance to "
+ "<gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>.</white>");
public Notice reset = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> "
+ "<white>Reset <gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance.</white>");
public Notice balance = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray>"
+ " <white><gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance is "
+ "<gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
Notice.chat(messagesPrefix + "<white>Player {PLAYER} has insufficient funds,"
+ "they are missing <gradient:#00FFA2:#34AE00>{MISSING_BALANCE}</gradient>.</white>");


public Notice added =
Notice.chat(messagesPrefix + "<white>Added <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> to "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice removed =
Notice.chat(messagesPrefix + " <white>Removed <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> from "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice set =
Notice.chat(messagesPrefix + "<white>Set <gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance to "
+ "<gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>.</white>");
public Notice reset =
Notice.chat(messagesPrefix + "<white>Reset <gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance.</white>");
public Notice balance =
Notice.chat(messagesPrefix + " <white><gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance is "
+ "<gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
}


Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@

import com.eternalcode.multification.notice.Notice;
import eu.okaeri.configs.OkaeriConfig;
import eu.okaeri.configs.annotation.Comment;

@SuppressWarnings({"FieldMayBeFinal", "FieldCanBeLocal"})
public class MessageConfig extends OkaeriConfig {

@Comment("Messages prefix")
public static String messagesPrefix =
"<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> ";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove static

public Notice invalidAmount = Notice.chat(
"<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> <white>Invalid amount, please provide a valid number.</white>");
messagesPrefix + "<white>Invalid amount, please provide a valid number.</white>");
public Notice invalidPlayer = Notice.chat(
"<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> <white>Invalid player, please provide a valid player.</white>");
messagesPrefix + "<white>Invalid player, please provide a valid player.</white>");
public Notice notSender = Notice.chat(
"<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> <white>You cannot perform this action on yourself.</white>");
messagesPrefix + "<white>You cannot perform this action on yourself.</white>");

public Notice correctUsage =
Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> Correct usage:");
Notice.chat(messagesPrefix + "Correct usage:");
public Notice correctUsageHeader = Notice.chat("<dark_gray>➤</dark_gray> &fCorrect usage:");
public Notice correctUsageEntry = Notice.chat("<dark_gray>➤</dark_gray> &f{USAGE}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

🛠️ Refactor suggestion

You're right - the styling needs to be unified

Looking at the code, there are indeed inconsistent styles:

  • The main prefix uses a gradient-styled "ECONOMY" with an arrow
  • Some messages use this full prefix
  • Others use just a simple arrow

The review suggestion to unify the style is valid, and it would be better to stick with the main prefix style for consistency.

🔗 Analysis chain

Consider unifying the styling approach

The usage-related notices mix different styles - some use the prefix while others use a simple arrow. It might be clearer to stick to one approach.

Consider updating all usage messages to use the prefix:

-    public Notice correctUsageHeader = Notice.chat("<dark_gray>➤</dark_gray> &fCorrect usage:");
-    public Notice correctUsageEntry = Notice.chat("<dark_gray>➤</dark_gray> &f{USAGE}");
+    public Notice correctUsageHeader = Notice.chat(messagesPrefix + "Correct usage:");
+    public Notice correctUsageEntry = Notice.chat(messagesPrefix + "{USAGE}");

Let me check the actual usage patterns in these files to make a more informed decision.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are other inconsistent styling patterns
rg -l "dark_gray>➤" 

Length of output: 213


Script:

#!/bin/bash
# Check the context of arrow usage in both files
rg "dark_gray>➤" -B 2 -A 2

Length of output: 2510


public Notice missingPermission = Notice.chat(
"<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> <white>Missing permission: <gradient:#00FFA2:#34AE00>{PERMISSION}</gradient>.</white>");
public Notice missingPermission =
Notice.chat(messagesPrefix + "<white>Missing permission: <gradient:#00FFA2:#34AE00>{PERMISSION}</gradient>.</white>");

public MessageAdminSubSection admin = new MessageAdminSubSection();
public MessagesPlayerSubSection player = new MessagesPlayerSubSection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,33 @@
import com.eternalcode.multification.notice.Notice;
import eu.okaeri.configs.OkaeriConfig;

import static com.eternalcode.economy.config.implementation.messages.MessageConfig.*;

public class MessagesPlayerSubSection extends OkaeriConfig {

public Notice added = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> "
+ "<white>Added <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> to your account.</white>");
public Notice removed = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray>"
+ " <white>Removed <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> from your account.</white>");
public Notice set = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> "
+ "<white>Set your balance to <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>.</white>");
public Notice reset = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray> "
+ "<white>Resetted your balance.</white>");
public Notice balance = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray>"
+ " <white>Your balance is <gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
public Notice added =
Notice.chat(messagesPrefix + "<white>Added <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>"
+ "to your account.</white>");
public Notice removed =
Notice.chat(messagesPrefix + " <white>Removed <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>"
+ "from your account.</white>");
public Notice set =
Notice.chat(messagesPrefix + "<white>Set your balance to <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>.</white>");
public Notice reset =
Notice.chat(messagesPrefix + "<white>Your balance was reset.</white>");
public Notice balance =
Notice.chat(messagesPrefix + " <white>Your balance is <gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
public Notice balanceOther =
Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray>"
+ " <white><gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance is <gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
public Notice insufficientBalance = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> "
+ "<dark_gray>➤</dark_gray> <white>Insufficient funds,"
Notice.chat(messagesPrefix + " <white><gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance is"
+ "<gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
public Notice insufficientBalance = Notice.chat(messagesPrefix + "<white>Insufficient funds,"
+ " you are missing <gradient:#00FFA2:#34AE00> {MISSING_BALANCE}</gradient>.</white>");
public Notice transferSuccess = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray"
+ ">➤</dark_gray> <white>Successfully transferred <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> to "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice transferReceived = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> "
+ "<dark_gray>➤</dark_gray> <white>Received <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> from "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice transferLimit = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray>"
+ " <white>Transaction limit is <gradient:#00FFA2:#34AE00>{LIMIT}</gradient>.</white>");
public Notice transferSuccess =
Notice.chat(messagesPrefix + "<white>Successfully transferred <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> to "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice transferReceived =
Notice.chat(messagesPrefix + "<white>Received <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> from "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice transferLimit =
Notice.chat(messagesPrefix + "<white>Transaction limit is <gradient:#00FFA2:#34AE00>{LIMIT}</gradient>.</white>");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix inconsistent spacing after prefix.

Some messages have an extra space after the prefix while others don't. Let's make this consistent.

Here's a simple fix for the spacing issues:

-    public Notice removed =
-        Notice.chat(messagesPrefix + " <white>Removed <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>"
+    public Notice removed =
+        Notice.chat(messagesPrefix + "<white>Removed <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>"

-    public Notice balance =
-        Notice.chat(messagesPrefix + " <white>Your balance is <gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
+    public Notice balance =
+        Notice.chat(messagesPrefix + "<white>Your balance is <gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");

-    public Notice balanceOther =
-        Notice.chat(messagesPrefix + " <white><gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance is"
+    public Notice balanceOther =
+        Notice.chat(messagesPrefix + "<white><gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance is"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public Notice added =
Notice.chat(messagesPrefix + "<white>Added <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>"
+ "to your account.</white>");
public Notice removed =
Notice.chat(messagesPrefix + " <white>Removed <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>"
+ "from your account.</white>");
public Notice set =
Notice.chat(messagesPrefix + "<white>Set your balance to <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>.</white>");
public Notice reset =
Notice.chat(messagesPrefix + "<white>Your balance was reset.</white>");
public Notice balance =
Notice.chat(messagesPrefix + " <white>Your balance is <gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
public Notice balanceOther =
Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray>"
+ " <white><gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance is <gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
public Notice insufficientBalance = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> "
+ "<dark_gray>➤</dark_gray> <white>Insufficient funds,"
Notice.chat(messagesPrefix + " <white><gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance is"
+ "<gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
public Notice insufficientBalance = Notice.chat(messagesPrefix + "<white>Insufficient funds,"
+ " you are missing <gradient:#00FFA2:#34AE00> {MISSING_BALANCE}</gradient>.</white>");
public Notice transferSuccess = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray"
+ ">➤</dark_gray> <white>Successfully transferred <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> to "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice transferReceived = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> "
+ "<dark_gray>➤</dark_gray> <white>Received <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> from "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice transferLimit = Notice.chat("<b><gradient:#00FFA2:#34AE00>ECONOMY</gradient></b> <dark_gray>➤</dark_gray>"
+ " <white>Transaction limit is <gradient:#00FFA2:#34AE00>{LIMIT}</gradient>.</white>");
public Notice transferSuccess =
Notice.chat(messagesPrefix + "<white>Successfully transferred <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> to "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice transferReceived =
Notice.chat(messagesPrefix + "<white>Received <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> from "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice transferLimit =
Notice.chat(messagesPrefix + "<white>Transaction limit is <gradient:#00FFA2:#34AE00>{LIMIT}</gradient>.</white>");
public Notice added =
Notice.chat(messagesPrefix + "<white>Added <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>"
+ "to your account.</white>");
public Notice removed =
Notice.chat(messagesPrefix + "<white>Removed <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>"
+ "from your account.</white>");
public Notice set =
Notice.chat(messagesPrefix + "<white>Set your balance to <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient>.</white>");
public Notice reset =
Notice.chat(messagesPrefix + "<white>Your balance was reset.</white>");
public Notice balance =
Notice.chat(messagesPrefix + "<white>Your balance is <gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
public Notice balanceOther =
Notice.chat(messagesPrefix + "<white><gradient:#00FFA2:#34AE00>{PLAYER}</gradient>'s balance is"
+ "<gradient:#00FFA2:#34AE00>{BALANCE}</gradient>.</white>");
public Notice insufficientBalance = Notice.chat(messagesPrefix + "<white>Insufficient funds,"
+ " you are missing <gradient:#00FFA2:#34AE00> {MISSING_BALANCE}</gradient>.</white>");
public Notice transferSuccess =
Notice.chat(messagesPrefix + "<white>Successfully transferred <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> to "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice transferReceived =
Notice.chat(messagesPrefix + "<white>Received <gradient:#00FFA2:#34AE00>{AMOUNT}</gradient> from "
+ "<gradient:#00FFA2:#34AE00>{PLAYER}</gradient>.</white>");
public Notice transferLimit =
Notice.chat(messagesPrefix + "<white>Transaction limit is <gradient:#00FFA2:#34AE00>{LIMIT}</gradient>.</white>");

}