Puts on a band-aid to fix Crates+Keys to give all Items on Amount -1

The KitAmount is still broken with this and I just don't understand what the algorithm and
expected behaviour is supposed to be...

I don't have much time for this stuff right now - The plugin needs a recode/heavy refractor
This commit is contained in:
Christian Koop 2023-04-29 12:33:24 +02:00
parent ca3f893fba
commit 2fde27e0df
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3

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