mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-28 05:25:21 +01:00
Fix issue with Reward Item changing (#84).
This issue may happened because Player#getInventory()#addItem(ItemStack) tries to add element into existing items in player inventory. If it did not manage to add it, it splits it in parts. This splitting created this issue. It was fixed, by using clone of reward items, instead of using original elements.
This commit is contained in:
parent
e0022b5c12
commit
e26c957797
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>world.bentobox</groupId>
|
||||
<artifactId>challenges</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>0.5.1</version>
|
||||
|
||||
<name>Challenges</name>
|
||||
<description>Challenges is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock, AcidIsland or CaveBlock.</description>
|
||||
|
@ -210,7 +210,9 @@ public class TryToComplete
|
||||
// Item rewards
|
||||
for (ItemStack reward : this.challenge.getRewardItems())
|
||||
{
|
||||
this.user.getInventory().addItem(reward).forEach((k, v) ->
|
||||
// Clone is necessary because otherwise it will chane reward itemstack
|
||||
// amount.
|
||||
this.user.getInventory().addItem(reward.clone()).forEach((k, v) ->
|
||||
this.user.getWorld().dropItem(this.user.getLocation(), v));
|
||||
}
|
||||
|
||||
@ -247,7 +249,9 @@ public class TryToComplete
|
||||
// Item Repeat Rewards
|
||||
for (ItemStack reward : this.challenge.getRepeatItemReward())
|
||||
{
|
||||
this.user.getInventory().addItem(reward).forEach((k, v) ->
|
||||
// Clone is necessary because otherwise it will chane reward itemstack
|
||||
// amount.
|
||||
this.user.getInventory().addItem(reward.clone()).forEach((k, v) ->
|
||||
this.user.getWorld().dropItem(this.user.getLocation(), v));
|
||||
}
|
||||
|
||||
@ -280,7 +284,9 @@ public class TryToComplete
|
||||
// Item rewards
|
||||
for (ItemStack reward : level.getRewardItems())
|
||||
{
|
||||
this.user.getInventory().addItem(reward).forEach((k, v) ->
|
||||
// Clone is necessary because otherwise it will chane reward itemstack
|
||||
// amount.
|
||||
this.user.getInventory().addItem(reward.clone()).forEach((k, v) ->
|
||||
this.user.getWorld().dropItem(this.user.getLocation(), v));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user