Skip to content

Commit

Permalink
1.4.0
Browse files Browse the repository at this point in the history
- Added refund system for bounties
- Added /ck and /ckit aliases to /clearkit
- Added Speed I to Cactus kit
- Changed various kit descriptions
- Increased the Spiderman kit cooldown to 20 seconds
  • Loading branch information
Foulest committed Oct 20, 2024
1 parent c108bb2 commit fcbc58d
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 20 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.9'
version = '1.4.0'
description = 'KitPvP'

// Set the project's language level
Expand Down
28 changes: 22 additions & 6 deletions src/main/java/net/foulest/kitpvp/cmds/BountyCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
public class BountyCmd {

@SuppressWarnings("MethodMayBeStatic")
@Command(name = "bounty", aliases = "bounties", description = "Allows players to place bounties on each other.", permission = "kitpvp.bounties", usage = "/bounty [player]", inGameOnly = true)
@Command(name = "bounty", aliases = "bounties",
description = "Allows players to place bounties on each other.",
permission = "kitpvp.bounties", usage = "/bounty [player]", inGameOnly = true)
public void onCommand(@NotNull CommandArgs args) {
CommandSender sender = args.getSender();
Player player = args.getPlayer();
Expand Down Expand Up @@ -94,11 +96,6 @@ public void onCommand(@NotNull CommandArgs args) {

// TODO: Implement cooldown in between placing bounties.

if (targetData.getBounty() != 0 || targetData.getBenefactor() != null) {
MessageUtil.messagePlayer(player, "&c" + target.getName() + " already has a bounty on their head.");
return;
}

if (!StringUtils.isNumeric(args.getArgs(2))) {
MessageUtil.messagePlayer(player, "&c'" + args.getArgs(3) + "' is not a valid amount.");
return;
Expand All @@ -123,6 +120,11 @@ public void onCommand(@NotNull CommandArgs args) {
return;
}

if (targetData.getBounty() > amount) {
MessageUtil.messagePlayer(player, "&c" + target.getName() + " already has a higher bounty.");
return;
}

MessageUtil.messagePlayer(player, "&aYou set a $" + amount + " bounty on " + target.getName() + "'s head.");

MessageUtil.messagePlayer(target, "");
Expand All @@ -137,5 +139,19 @@ public void onCommand(@NotNull CommandArgs args) {

targetData.addBounty(amount, player.getUniqueId());
playerData.removeCoins(amount);

// Refund the original benefactor if they set a new bounty on the same player.
if (targetData.getBenefactor() != null) {
Player targetBenefactor = Bukkit.getPlayer(targetData.getBenefactor());
PlayerData targetBenefactorData = PlayerDataManager.getPlayerData(targetBenefactor);

if (targetBenefactor.isOnline()) {
MessageUtil.messagePlayer(targetBenefactor, "&aYour bounty on " + target.getName() + "'s head has been refunded.");
} else {
targetBenefactorData.load();
}

targetBenefactorData.addCoins(targetData.getBounty());
}
}
}
1 change: 1 addition & 0 deletions src/main/java/net/foulest/kitpvp/cmds/ClearKitCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class ClearKitCmd {

@SuppressWarnings("MethodMayBeStatic")
@Command(name = "clearkit", description = "Clears your kit.",
aliases = {"ck", "ckit"},
permission = "kitpvp.clearkit", usage = "/clearkit (player)", inGameOnly = true)
public void onCommand(@NotNull CommandArgs args) {
CommandSender sender = args.getSender();
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/net/foulest/kitpvp/kits/type/Cactus.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -53,7 +54,9 @@ public ItemStack getDisplayItem() {

@Override
public PotionEffect[] getPotionEffects() {
return new PotionEffect[0];
return new PotionEffect[]{
new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 0, false, false)
};
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/foulest/kitpvp/kits/type/Dragon.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public PotionEffect[] getPotionEffects() {
public List<ItemBuilder> getItems() {
ItemBuilder sword = new ItemBuilder(Material.STONE_SWORD).unbreakable(true).hideInfo();
ItemBuilder special = new ItemBuilder(Material.FIREBALL).name("&aDragon's Breath &7(Right Click)")
.lore("&7Emits a powerful fiery breath.");
.lore("&7Emits a powerful, fiery breath.");
return Arrays.asList(sword, special);
}

Expand All @@ -81,7 +81,7 @@ public ItemBuilder[] getArmor() {

@Override
public List<String> getLore() {
return new ArrayList<>(Arrays.asList("&7Style: &aOffensive", "", "&7Emits a powerful fiery breath."));
return new ArrayList<>(Arrays.asList("&7Style: &aOffensive", "", "&7Emits a powerful, fiery breath."));
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/foulest/kitpvp/kits/type/Imprisoner.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public PotionEffect[] getPotionEffects() {
public List<ItemBuilder> getItems() {
ItemBuilder sword = new ItemBuilder(Material.STONE_SWORD).unbreakable(true).hideInfo();
ItemBuilder special = new ItemBuilder(Material.DISPENSER).name("&aLava Prison &7(Right Click)")
.lore("&7Sends players to jail.");
.lore("&7Sends enemy players to jail.");
return Arrays.asList(sword, special);
}

Expand All @@ -78,7 +78,7 @@ public ItemBuilder[] getArmor() {

@Override
public List<String> getLore() {
return new ArrayList<>(Arrays.asList("&7Style: &aOffensive", "", "&7Sends players to lava jail."));
return new ArrayList<>(Arrays.asList("&7Style: &aOffensive", "", "&7Sends enemy players to jail."));
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/foulest/kitpvp/kits/type/Summoner.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public PotionEffect[] getPotionEffects() {
public List<ItemBuilder> getItems() {
ItemBuilder sword = new ItemBuilder(Material.WOOD_SWORD).unbreakable(true).hideInfo();
ItemBuilder special = new ItemBuilder(Material.IRON_BLOCK).name("&aSummon Golem &7(Right Click)")
.lore("&7Summon your very own Iron Golem.");
.lore("&7Summons an Iron Golem.");
return Arrays.asList(sword, special);
}

Expand All @@ -77,7 +77,7 @@ public ItemBuilder[] getArmor() {

@Override
public List<String> getLore() {
return new ArrayList<>(Arrays.asList("&7Style: &aDefensive", "", "&7Summon your very own Iron Golem."));
return new ArrayList<>(Arrays.asList("&7Style: &aDefensive", "", "&7Summons an Iron Golem."));
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/foulest/kitpvp/kits/type/Tamer.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public PotionEffect[] getPotionEffects() {
@Override
public List<ItemBuilder> getItems() {
ItemBuilder sword = new ItemBuilder(Material.STONE_SWORD).unbreakable(true).hideInfo();
ItemBuilder special = new ItemBuilder(Material.BONE).name("&aSummon Dogs &7(Right Click)")
.lore("&7Summon the hounds.");
ItemBuilder special = new ItemBuilder(Material.BONE).name("&aSummon Wolves &7(Right Click)")
.lore("&7Summons a pack of wolves.");
return Arrays.asList(sword, special);
}

Expand All @@ -78,7 +78,7 @@ public ItemBuilder[] getArmor() {

@Override
public List<String> getLore() {
return new ArrayList<>(Arrays.asList("&7Style: &aMixed", "", "&7Summon the hounds."));
return new ArrayList<>(Arrays.asList("&7Style: &aMixed", "", "&7Summons a pack of wolves."));
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/foulest/kitpvp/kits/type/Thor.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public PotionEffect[] getPotionEffects() {
@Override
public List<ItemBuilder> getItems() {
ItemBuilder sword = new ItemBuilder(Material.IRON_AXE).name("&aMjolnir &7(Right Click)")
.lore("&7Strike your opponents with lightning.").unbreakable(true).hideInfo();
.lore("&7Strike enemies with lightning.").unbreakable(true).hideInfo();
return Collections.singletonList(sword);
}

Expand All @@ -73,7 +73,7 @@ public ItemBuilder[] getArmor() {

@Override
public List<String> getLore() {
return new ArrayList<>(Arrays.asList("&7Style: &aOffensive", "", "&7Strike your opponents with lightning."));
return new ArrayList<>(Arrays.asList("&7Style: &aOffensive", "", "&7Strike enemies with lightning."));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ kitpvp:
enabled: true
cost: 250
ability:
cooldown: 15
cooldown: 20
duration: 5
summoner:
enabled: true
Expand Down

0 comments on commit fcbc58d

Please sign in to comment.