mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-31 21:48:00 +01:00
Fixes a crash that prevented STATISTICS entity and material/item challenges to be completed.
This commit is contained in:
parent
5ba7c681de
commit
ee8eaf8e84
@ -495,45 +495,54 @@ public class TryToComplete
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ITEM, BLOCK -> {
|
case ITEM, BLOCK -> {
|
||||||
int statistic = this.user.getPlayer().getStatistic(requirements.getStatistic());
|
|
||||||
|
|
||||||
if (requirements.getMaterial() == null)
|
if (requirements.getMaterial() == null)
|
||||||
{
|
{
|
||||||
// Just a sanity check. Material cannot be null at this point of code.
|
// Just a sanity check. Material cannot be null at this point of code.
|
||||||
removeAmount = 0;
|
removeAmount = 0;
|
||||||
}
|
}
|
||||||
else if (removeAmount >= statistic)
|
|
||||||
{
|
|
||||||
this.user.getPlayer().setStatistic(requirements.getStatistic(), requirements.getMaterial(), 0);
|
|
||||||
removeAmount -= statistic;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.user.getPlayer().setStatistic(requirements.getStatistic(),
|
int statistic = this.user.getPlayer().getStatistic(requirements.getStatistic(),
|
||||||
requirements.getMaterial(),
|
requirements.getMaterial());
|
||||||
statistic - removeAmount);
|
|
||||||
removeAmount = 0;
|
if (removeAmount >= statistic)
|
||||||
|
{
|
||||||
|
this.user.getPlayer()
|
||||||
|
.setStatistic(requirements.getStatistic(), requirements.getMaterial(), 0);
|
||||||
|
removeAmount -= statistic;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.user.getPlayer().setStatistic(requirements.getStatistic(),
|
||||||
|
requirements.getMaterial(),
|
||||||
|
statistic - removeAmount);
|
||||||
|
removeAmount = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ENTITY -> {
|
case ENTITY -> {
|
||||||
int statistic = this.user.getPlayer().getStatistic(requirements.getStatistic());
|
|
||||||
|
|
||||||
if (requirements.getEntity() == null)
|
if (requirements.getEntity() == null)
|
||||||
{
|
{
|
||||||
// Just a sanity check. Entity cannot be null at this point of code.
|
// Just a sanity check. Entity cannot be null at this point of code.
|
||||||
removeAmount = 0;
|
removeAmount = 0;
|
||||||
}
|
}
|
||||||
else if (removeAmount >= statistic)
|
|
||||||
{
|
|
||||||
this.user.getPlayer().setStatistic(requirements.getStatistic(), requirements.getEntity(), 0);
|
|
||||||
removeAmount -= statistic;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.user.getPlayer().setStatistic(requirements.getStatistic(),
|
int statistic = this.user.getPlayer().getStatistic(requirements.getStatistic(),
|
||||||
requirements.getEntity(),
|
requirements.getEntity());
|
||||||
statistic - removeAmount);
|
|
||||||
removeAmount = 0;
|
if (removeAmount >= statistic)
|
||||||
|
{
|
||||||
|
this.user.getPlayer().setStatistic(requirements.getStatistic(), requirements.getEntity(), 0);
|
||||||
|
removeAmount -= statistic;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.user.getPlayer().setStatistic(requirements.getStatistic(),
|
||||||
|
requirements.getEntity(),
|
||||||
|
statistic - removeAmount);
|
||||||
|
removeAmount = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -577,45 +586,57 @@ public class TryToComplete
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ITEM, BLOCK -> {
|
case ITEM, BLOCK -> {
|
||||||
int statistic = player.getStatistic(requirements.getStatistic());
|
|
||||||
|
|
||||||
if (requirements.getMaterial() == null)
|
if (requirements.getMaterial() == null)
|
||||||
{
|
{
|
||||||
// Just a sanity check. Entity cannot be null at this point of code.
|
// Just a sanity check. Entity cannot be null at this point of code.
|
||||||
removeAmount = 0;
|
removeAmount = 0;
|
||||||
}
|
}
|
||||||
else if (removeAmount >= statistic)
|
|
||||||
{
|
|
||||||
removeAmount -= statistic;
|
|
||||||
player.setStatistic(requirements.getStatistic(), requirements.getMaterial(), 0);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.setStatistic(requirements.getStatistic(),
|
int statistic = player.getStatistic(requirements.getStatistic(),
|
||||||
requirements.getMaterial(),
|
requirements.getMaterial());
|
||||||
statistic - removeAmount);
|
|
||||||
removeAmount = 0;
|
if (removeAmount >= statistic)
|
||||||
|
{
|
||||||
|
removeAmount -= statistic;
|
||||||
|
player.setStatistic(requirements.getStatistic(),
|
||||||
|
requirements.getMaterial(),
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setStatistic(requirements.getStatistic(),
|
||||||
|
requirements.getMaterial(),
|
||||||
|
statistic - removeAmount);
|
||||||
|
removeAmount = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ENTITY -> {
|
case ENTITY -> {
|
||||||
int statistic = player.getStatistic(requirements.getStatistic());
|
|
||||||
|
|
||||||
if (requirements.getEntity() == null)
|
if (requirements.getEntity() == null)
|
||||||
{
|
{
|
||||||
// Just a sanity check. Entity cannot be null at this point of code.
|
// Just a sanity check. Entity cannot be null at this point of code.
|
||||||
removeAmount = 0;
|
removeAmount = 0;
|
||||||
}
|
}
|
||||||
else if (removeAmount >= statistic)
|
|
||||||
{
|
|
||||||
removeAmount -= statistic;
|
|
||||||
player.setStatistic(requirements.getStatistic(), requirements.getEntity(), 0);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.setStatistic(requirements.getStatistic(),
|
int statistic = player.getStatistic(requirements.getStatistic(),
|
||||||
requirements.getEntity(),
|
requirements.getEntity());
|
||||||
statistic - removeAmount);
|
|
||||||
removeAmount = 0;
|
if (removeAmount >= statistic)
|
||||||
|
{
|
||||||
|
removeAmount -= statistic;
|
||||||
|
player.setStatistic(requirements.getStatistic(),
|
||||||
|
requirements.getEntity(),
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setStatistic(requirements.getStatistic(),
|
||||||
|
requirements.getEntity(),
|
||||||
|
statistic - removeAmount);
|
||||||
|
removeAmount = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user