mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-06 00:38:18 +00:00
Remove unnecessary removeSlot parameter.
This commit is contained in:
@@ -463,30 +463,29 @@ public final class Inventory implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes {@code amount} of the item at the specified {@code slot}, under the condition that this item matches the
|
* Removes {@code amount} of the item at the specified {@code slot}. If the item is not stacked, it will only remove
|
||||||
* specified {@code id}. If the item is not stacked, it will only remove the single item at the slot (meaning it
|
* the single item at the slot (meaning it will ignore any amount higher than 1). This means that this method will
|
||||||
* will ignore any amount higher than 1). This means that this method will under no circumstances make any changes
|
* under no circumstances make any changes to other slots.
|
||||||
* to other slots.
|
|
||||||
*
|
*
|
||||||
* @param slot The slot.
|
* @param slot The slot.
|
||||||
* @param id The item id.
|
* @param id The item id.
|
||||||
* @param amount The amount to remove.
|
* @param amount The amount to remove.
|
||||||
* @return The amount that was removed (0 if nothing was removed).
|
* @return The amount that was removed (0 if nothing was removed).
|
||||||
*/
|
*/
|
||||||
public int removeSlot(int slot, int id, int amount) {
|
public int removeSlot(int slot, int amount) {
|
||||||
if (amount == 0) {
|
if (amount == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item item = items[slot];
|
Item item = items[slot];
|
||||||
if (item != null && item.getId() == id) {
|
if (item != null) {
|
||||||
int currentAmount = item.getAmount();
|
int itemAmount = item.getAmount();
|
||||||
int removed = currentAmount;
|
int removed = itemAmount;
|
||||||
if (removed > amount) {
|
if (removed > amount) {
|
||||||
removed = amount;
|
removed = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
int remainder = currentAmount - removed;
|
int remainder = itemAmount - removed;
|
||||||
set(slot, remainder > 0 ? new Item(item.getId(), remainder) : null);
|
set(slot, remainder > 0 ? new Item(item.getId(), remainder) : null);
|
||||||
|
|
||||||
return removed;
|
return removed;
|
||||||
|
|||||||
Reference in New Issue
Block a user