diff --git a/src/main/java/com/alttd/playerutils/commands/playerutils_subcommands/XPCheque.java b/src/main/java/com/alttd/playerutils/commands/playerutils_subcommands/XPCheque.java
index ac9c8f6..3c9602b 100644
--- a/src/main/java/com/alttd/playerutils/commands/playerutils_subcommands/XPCheque.java
+++ b/src/main/java/com/alttd/playerutils/commands/playerutils_subcommands/XPCheque.java
@@ -44,6 +44,11 @@ public class XPCheque extends SubCommand {
return false;
}
+ if ((xpValue <= 0)) {
+ commandSender.sendMiniMessage(Messages.XP_CHEQUE.NEGATIVE, null);
+ return true;
+ }
+
int totalExperience = player.getTotalExperience();
if (totalExperience < xpValue) {
commandSender.sendMiniMessage(Messages.XP_CHEQUE.NOT_ENOUGH_XP, Placeholder.parsed("xp", String.valueOf(totalExperience)));
diff --git a/src/main/java/com/alttd/playerutils/config/Messages.java b/src/main/java/com/alttd/playerutils/config/Messages.java
index 94f9d60..97d1bc1 100644
--- a/src/main/java/com/alttd/playerutils/config/Messages.java
+++ b/src/main/java/com/alttd/playerutils/config/Messages.java
@@ -66,6 +66,7 @@ public class Messages extends AbstractConfig {
private static final String prefix = "pu-command.xp-cheque.";
public static String FAILED_STORAGE = "Unable to create custom item for xp cheque";
+ public static String NEGATIVE = "You cannot enter a negative value for xp.";
public static String NOT_ENOUGH_XP = "Not enough xp, you have ";
public static String NOT_HOLDING_BOTTLE = "You need to hold an empty glass bottle while executing this command";
public static String DISPLAY_NAME = "Xp bottle containing xp";
@@ -74,6 +75,7 @@ public class Messages extends AbstractConfig {
@SuppressWarnings("unused")
private static void load() {
FAILED_STORAGE = config.getString(prefix, "failed-storage", FAILED_STORAGE);
+ NEGATIVE = config.getString(prefix, "negative", NEGATIVE);
NOT_ENOUGH_XP = config.getString(prefix, "not-enough-xp", NOT_ENOUGH_XP);
NOT_HOLDING_BOTTLE = config.getString(prefix, "not-holding-bottle", NOT_HOLDING_BOTTLE);
DISPLAY_NAME = config.getString(prefix, "display-name", DISPLAY_NAME);