mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2025-01-04 07:18:41 +01:00
Change spacing from tab to space.
This commit is contained in:
parent
c2051d23e5
commit
3dd23addc4
@ -94,7 +94,7 @@ public class TryToComplete {
|
|||||||
|
|
||||||
// Give money
|
// Give money
|
||||||
this.addon.getPlugin().getVault().ifPresent(
|
this.addon.getPlugin().getVault().ifPresent(
|
||||||
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRewardMoney()));
|
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRewardMoney()));
|
||||||
|
|
||||||
// Give exp
|
// Give exp
|
||||||
user.getPlayer().giveExp(challenge.getRewardExp());
|
user.getPlayer().giveExp(challenge.getRewardExp());
|
||||||
@ -113,9 +113,9 @@ public class TryToComplete {
|
|||||||
user.getInventory().addItem(reward).forEach((k,v) -> user.getWorld().dropItem(user.getLocation(), v));
|
user.getInventory().addItem(reward).forEach((k,v) -> user.getWorld().dropItem(user.getLocation(), v));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give money
|
// Give money
|
||||||
this.addon.getPlugin().getVault().ifPresent(
|
this.addon.getPlugin().getVault().ifPresent(
|
||||||
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRepeatMoneyReward()));
|
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRepeatMoneyReward()));
|
||||||
|
|
||||||
// Give exp
|
// Give exp
|
||||||
user.getPlayer().giveExp(challenge.getRepeatExpReward());
|
user.getPlayer().giveExp(challenge.getRepeatExpReward());
|
||||||
@ -157,9 +157,9 @@ public class TryToComplete {
|
|||||||
user.getInventory().addItem(reward).forEach((k,v) -> user.getWorld().dropItem(user.getLocation(), v));
|
user.getInventory().addItem(reward).forEach((k,v) -> user.getWorld().dropItem(user.getLocation(), v));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give money
|
// Give money
|
||||||
this.addon.getPlugin().getVault().ifPresent(
|
this.addon.getPlugin().getVault().ifPresent(
|
||||||
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRewardMoney()));
|
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRewardMoney()));
|
||||||
|
|
||||||
// Give exp
|
// Give exp
|
||||||
user.getPlayer().giveExp(challenge.getRewardExp());
|
user.getPlayer().giveExp(challenge.getRewardExp());
|
||||||
@ -179,8 +179,8 @@ public class TryToComplete {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Give money
|
// Give money
|
||||||
this.addon.getPlugin().getVault().ifPresent(
|
this.addon.getPlugin().getVault().ifPresent(
|
||||||
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRepeatMoneyReward()));
|
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRepeatMoneyReward()));
|
||||||
|
|
||||||
// Give exp
|
// Give exp
|
||||||
user.getPlayer().giveExp(challenge.getRepeatExpReward());
|
user.getPlayer().giveExp(challenge.getRepeatExpReward());
|
||||||
@ -222,23 +222,23 @@ public class TryToComplete {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check money
|
// Check money
|
||||||
Optional<VaultHook> vaultHook = this.addon.getPlugin().getVault();
|
Optional<VaultHook> vaultHook = this.addon.getPlugin().getVault();
|
||||||
|
|
||||||
if (vaultHook.isPresent())
|
if (vaultHook.isPresent())
|
||||||
{
|
{
|
||||||
if (!vaultHook.get().has(this.user, this.challenge.getReqMoney()))
|
if (!vaultHook.get().has(this.user, this.challenge.getReqMoney()))
|
||||||
{
|
{
|
||||||
this.user.sendMessage("challenges.not-enough-money");
|
this.user.sendMessage("challenges.not-enough-money");
|
||||||
return new ChallengeResult();
|
return new ChallengeResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check exp
|
// Check exp
|
||||||
if (this.user.getPlayer().getTotalExperience() < this.challenge.getReqExp())
|
if (this.user.getPlayer().getTotalExperience() < this.challenge.getReqExp())
|
||||||
{
|
{
|
||||||
this.user.sendMessage("challenges.not-enough-exp");
|
this.user.sendMessage("challenges.not-enough-exp");
|
||||||
return new ChallengeResult();
|
return new ChallengeResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (challenge.getChallengeType()) {
|
switch (challenge.getChallengeType()) {
|
||||||
case INVENTORY:
|
case INVENTORY:
|
||||||
@ -285,29 +285,29 @@ public class TryToComplete {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// process money removal
|
// process money removal
|
||||||
this.removeMoney();
|
this.removeMoney();
|
||||||
|
|
||||||
// Return the result
|
// Return the result
|
||||||
return new ChallengeResult().setMeetsRequirements().setRepeat(manager.isChallengeComplete(user, challenge.getUniqueId(), world));
|
return new ChallengeResult().setMeetsRequirements().setRepeat(manager.isChallengeComplete(user, challenge.getUniqueId(), world));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method withdraw user money, if challenge Required Money is larger then 0, and
|
* This method withdraw user money, if challenge Required Money is larger then 0, and
|
||||||
* it is set to removal.
|
* it is set to removal.
|
||||||
* This works only if vaultHook is enabled.
|
* This works only if vaultHook is enabled.
|
||||||
*/
|
*/
|
||||||
private void removeMoney()
|
private void removeMoney()
|
||||||
{
|
{
|
||||||
Optional<VaultHook> vaultHook = this.addon.getPlugin().getVault();
|
Optional<VaultHook> vaultHook = this.addon.getPlugin().getVault();
|
||||||
|
|
||||||
if (vaultHook.isPresent() &&
|
if (vaultHook.isPresent() &&
|
||||||
this.challenge.isTakeMoney() &&
|
this.challenge.isTakeMoney() &&
|
||||||
this.challenge.getReqMoney() > 0)
|
this.challenge.getReqMoney() > 0)
|
||||||
{
|
{
|
||||||
vaultHook.get().withdraw(this.user, this.challenge.getReqMoney());
|
vaultHook.get().withdraw(this.user, this.challenge.getReqMoney());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -347,9 +347,9 @@ public class TryToComplete {
|
|||||||
long level = addon.getAddonByName("Level")
|
long level = addon.getAddonByName("Level")
|
||||||
.map(l -> ((Level)l).getIslandLevel(world, user.getUniqueId())).orElse(0L);
|
.map(l -> ((Level)l).getIslandLevel(world, user.getUniqueId())).orElse(0L);
|
||||||
if (level >= challenge.getReqIslandlevel()) {
|
if (level >= challenge.getReqIslandlevel()) {
|
||||||
// process money removal
|
// process money removal
|
||||||
this.removeMoney();
|
this.removeMoney();
|
||||||
return new ChallengeResult().setMeetsRequirements();
|
return new ChallengeResult().setMeetsRequirements();
|
||||||
} else {
|
} else {
|
||||||
user.sendMessage("challenges.error.island-level", TextVariables.NUMBER, String.valueOf(challenge.getReqIslandlevel()));
|
user.sendMessage("challenges.error.island-level", TextVariables.NUMBER, String.valueOf(challenge.getReqIslandlevel()));
|
||||||
return new ChallengeResult();
|
return new ChallengeResult();
|
||||||
@ -370,10 +370,10 @@ public class TryToComplete {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result.meetsRequirements && this.challenge.isTakeMoney())
|
if (result.meetsRequirements && this.challenge.isTakeMoney())
|
||||||
{
|
{
|
||||||
// process money removal
|
// process money removal
|
||||||
this.removeMoney();
|
this.removeMoney();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user