mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-25 12:15:59 +01:00
Halt prematurely taking item requirements of duplicate type, fixes #1402
This commit is contained in:
parent
a53a8996f6
commit
bc7d6b0aae
@ -441,6 +441,7 @@ public class Quester {
|
|||||||
* @param q The quest to start
|
* @param q The quest to start
|
||||||
* @param ignoreReqs Whether to ignore Requirements
|
* @param ignoreReqs Whether to ignore Requirements
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void takeQuest(final Quest q, final boolean ignoreReqs) {
|
public void takeQuest(final Quest q, final boolean ignoreReqs) {
|
||||||
if (q == null) {
|
if (q == null) {
|
||||||
return;
|
return;
|
||||||
@ -552,10 +553,13 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
final Player p = getPlayer();
|
final Player p = getPlayer();
|
||||||
|
final ItemStack[] original = p.getInventory().getContents().clone();
|
||||||
for (final ItemStack is : reqs.getItems()) {
|
for (final ItemStack is : reqs.getItems()) {
|
||||||
if (reqs.getRemoveItems().get(reqs.getItems().indexOf(is)) == true) {
|
if (reqs.getRemoveItems().get(reqs.getItems().indexOf(is)) == true) {
|
||||||
if (InventoryUtil.removeItem(p.getInventory(), is) == false) {
|
if (InventoryUtil.removeItem(p.getInventory(), is) == false) {
|
||||||
if (InventoryUtil.stripItem(p.getEquipment(), is) == false) {
|
if (InventoryUtil.stripItem(p.getEquipment(), is) == false) {
|
||||||
|
p.getInventory().setContents(original);
|
||||||
|
p.updateInventory();
|
||||||
p.sendMessage(Lang.get(p, "requirementsItemFail"));
|
p.sendMessage(Lang.get(p, "requirementsItemFail"));
|
||||||
hardQuit(q);
|
hardQuit(q);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user