Skip to content

Commit

Permalink
1.3.9
Browse files Browse the repository at this point in the history
- Added minimum bounty amount
- Fixed eco command issue
- Fixed coin addition bug
  • Loading branch information
Foulest committed Oct 15, 2024
1 parent ee332a7 commit 4f75564
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = 'net.foulest'
version = '1.3.8'
version = '1.3.9'
description = 'KitPvP'

// Set the project's language level
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/foulest/kitpvp/cmds/BountyCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void onCommand(@NotNull CommandArgs args) {
}

int amount = Integer.parseInt(args.getArgs(2));
int minCoins = 50;
int minCoins = Settings.bountiesMinAmount;
int maxCoins = Settings.bountiesMaxAmount;

if (amount < minCoins) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/foulest/kitpvp/cmds/EcoCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void onCommand(@NotNull CommandArgs args) {
PlayerData targetData = PlayerDataManager.getPlayerData(target);

// Checks if the amount is a number.
if (!StringUtils.isNumeric(args.getArgs(1))) {
if (!StringUtils.isNumeric(args.getArgs(2))) {
MessageUtil.messagePlayer(args.getSender(), "&c'" + args.getArgs(1) + "' is not a valid amount.");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/foulest/kitpvp/data/PlayerData.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public void removeExperience(int value) {
* @param value The amount of coins to add.
*/
public void addCoins(int value) {
coins += Math.max(0, coins + value);
coins = Math.max(0, coins + value);

// Updates values in the PlayerStats table.
DatabaseUtil.updatePlayerStatsTable(this);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/foulest/kitpvp/util/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public final class Settings {
// Bounties settings
public static boolean bountiesEnabled;
public static int bountiesCooldown;
public static int bountiesMinAmount;
public static int bountiesMaxAmount;

// Economy settings
Expand Down Expand Up @@ -315,6 +316,7 @@ public static void loadConfigValues() {
// Bounties settings
bountiesEnabled = config.getBoolean("kitpvp.bounties.enabled");
bountiesCooldown = config.getInt("kitpvp.bounties.cooldown");
bountiesMinAmount = config.getInt("kitpvp.bounties.min-amount");
bountiesMaxAmount = config.getInt("kitpvp.bounties.max-amount");

// Economy settings
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ kitpvp:
bounties:
enabled: true
cooldown: 60
min-amount: 50
max-amount: 1000
# -----------------------------------------------
# Economy Settings
Expand Down

0 comments on commit 4f75564

Please sign in to comment.