Merge pull request #40 from peacefulfarms/master

Cancel gift command if partner's inventory is full
This commit is contained in:
lenis0012 2020-04-27 17:38:52 +02:00 committed by GitHub
commit 814827beaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -36,6 +36,11 @@ public class CommandGift extends Command {
reply(Message.NO_ITEM);
return;
}
if(partner.getInventory().firstEmpty() == -1) {
reply(Message.PARTNER_INVENTORY_FULL);
return;
}
partner.getInventory().addItem(item.clone());
player.setItemInHand(null);

View File

@ -55,6 +55,7 @@ public enum Message {
CONFIG_RELOAD("&aConfiguration settings were reloaded, please note that some settings may not apply until reboot."),
GENDER_ALREADY_CHANGED("&cYou have already specified your gender, you can only do this once."),
TELEPORT_UNSAFE("&cThe location you are trying to teleport to is unsafe or obstructed"),
PARTNER_INVENTORY_FULL("&cYour partner's inventory is full!"),
// COMMANDS
COMMAND_MARRY("Request a marriage with another player"),
@ -105,4 +106,4 @@ public enum Message {
config.save();
}
}
}