mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-30 12:57:52 +01:00
Fix an issue when users could do challenges in other gamemodes.
Fix an issue when users could complete challenges outside their island.
This commit is contained in:
parent
a55a2f536e
commit
ab22651425
@ -302,11 +302,18 @@ public class TryToComplete
|
||||
ChallengeType type = this.challenge.getChallengeType();
|
||||
|
||||
// Check the world
|
||||
if (!this.challenge.getUniqueId().startsWith(Util.getWorld(this.world).getName()))
|
||||
if (Util.getWorld(this.world) != Util.getWorld(this.user.getWorld()) ||
|
||||
!this.challenge.getUniqueId().startsWith(Util.getWorld(this.world).getName()))
|
||||
{
|
||||
this.user.sendMessage("general.errors.wrong-world");
|
||||
result = EMPTY_RESULT;
|
||||
}
|
||||
// Player is not on island
|
||||
else if (!this.addon.getIslands().userIsOnIsland(this.user.getWorld(), this.user))
|
||||
{
|
||||
this.user.sendMessage("challenges.error.not-on-island");
|
||||
result = EMPTY_RESULT;
|
||||
}
|
||||
// Check if user has unlocked challenges level.
|
||||
else if (!this.challenge.getLevel().equals(ChallengesManager.FREE) &&
|
||||
!this.manager.isLevelUnlocked(this.user, this.world, this.manager.getLevel(this.challenge.getLevel())))
|
||||
@ -556,7 +563,7 @@ public class TryToComplete
|
||||
{
|
||||
ChallengeResult result;
|
||||
|
||||
if (!this.addon.getIslands().userIsOnIsland(this.world, this.user))
|
||||
if (!this.addon.getIslands().userIsOnIsland(this.user.getWorld(), this.user))
|
||||
{
|
||||
// Player is not on island
|
||||
this.user.sendMessage("challenges.error.not-on-island");
|
||||
|
Loading…
Reference in New Issue
Block a user