diff --git a/pom.xml b/pom.xml index f2927a3..2edf8e4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.songoda UltimateKits - 2.7.6 + 2.7.7 UltimateKits Creating and displaying your servers kits has never been easier @@ -118,7 +118,7 @@ com.songoda SongodaCore - 2.6.19 + 2.6.21 compile diff --git a/src/main/java/com/songoda/ultimatekits/kit/Kit.java b/src/main/java/com/songoda/ultimatekits/kit/Kit.java index e39e408..cd80103 100644 --- a/src/main/java/com/songoda/ultimatekits/kit/Kit.java +++ b/src/main/java/com/songoda/ultimatekits/kit/Kit.java @@ -283,11 +283,27 @@ public class Kit implements Cloneable { } private boolean giveKit(Player player, Key key) { - return key == null ? giveKit(player) : giveKit(player, key.getAmount(), key.getKitAmount()); + if (key == null) { + return giveKit(player); + } + + int amount = key.getAmount(); + if (amount == -1) { + // FIXME: I don't understand how Crates, Keys, etc. actually are supposed to work. + // I think the give-algorithms are generally wrongly implemented and confusing naming is making it hard to understand. + amount = contents.size(); + } + return giveKit(player, amount, key.getKitAmount()); } private boolean giveKit(Player player, Crate crate) { - return giveKit(player, crate.getAmount(), crate.getKitAmount()); + int amount = crate.getAmount(); + if (amount == -1) { + // FIXME: I don't understand how Crates, Keys, etc. actually are supposed to work. + // I think the give-algorithms are generally wrongly implemented and confusing naming is making it hard to understand. + amount = contents.size(); + } + return giveKit(player, amount, crate.getKitAmount()); } private boolean giveKit(Player player, int itemAmount, int kitAmount) {