2 second function overload fix

This commit is contained in:
ceikry 2021-12-21 18:24:58 -06:00
parent 67cb61b871
commit b0c231459b
4 changed files with 3 additions and 14 deletions

View file

@ -54,7 +54,7 @@ public abstract class Consumable implements Plugin<Object> {
} else removeItem(player, item, Container.INVENTORY);
if (nextItemId != -1) {
addItem(player, nextItemId, 1);
addItem(player, nextItemId, 1, Container.INVENTORY);
}
final int initialLifePoints = player.getSkills().getLifepoints();
Consumables.getConsumableById(item.getId()).effect.activate(player);

View file

@ -8,6 +8,7 @@ import core.game.content.quest.tutorials.tutorialisland.TutorialSession;
import core.game.content.quest.tutorials.tutorialisland.TutorialStage;
import core.game.node.entity.player.Player;
import core.plugin.Plugin;
import org.rs09.consts.Items;
/**
* @author 'Vexia

View file

@ -41,7 +41,7 @@ public final class HerbCleanPlugin extends OptionHandler {
double exp = herb.getExperience();
if (removeItem(player, node.asItem(), Container.INVENTORY)){
player.getSkills().addExperience(Skills.HERBLORE, exp, true);
addItem(player, herb.getProduct().getId(), 1);
addItem(player, herb.getProduct().getId(), 1, Container.INVENTORY);
player.getAudioManager().send(SFX_IDS[RandomFunction.random(SFX_IDS.length)], 1);
player.getPacketDispatch().sendMessage("You clean the dirt from the " + herb.getProduct().getName().toLowerCase().replace("clean", "").trim() + " leaf.");
}

View file

@ -145,18 +145,6 @@ fun <T> removeItem(player: Player, item: T, container: Container = Container.INV
}
}
/**
* Add an item to a player's inventory
* @param player the player whose inventory to add an item to
* @param id the ID of the item to add
* @param amount the amount of the item to add, defaults to 1
* @return true if the item exists in the given amount in the player's inventory
*/
fun addItem(player: Player, id: Int, amount: Int = 1): Boolean{
return addItem(player, id, amount)
}
/**
* Add an item to the given player's given container
* @param player the player whose container to modify