Merge branch 'development'

This commit is contained in:
Christian Koop 2023-04-29 12:54:16 +02:00
commit e018710208
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
2 changed files with 20 additions and 4 deletions

View File

@ -6,7 +6,7 @@
<groupId>com.songoda</groupId>
<artifactId>UltimateKits</artifactId>
<version>2.7.6</version>
<version>2.7.7</version>
<name>UltimateKits</name>
<description>Creating and displaying your servers kits has never been easier</description>
@ -118,7 +118,7 @@
<dependency>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore</artifactId>
<version>2.6.19</version>
<version>2.6.21</version>
<scope>compile</scope>
</dependency>

View File

@ -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) {