mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-13 06:05:46 +01:00
Fix issue when completing challenge was not displayed in ChallengesGUI. (#60)
This commit is contained in:
parent
7384afa262
commit
9918752589
@ -152,7 +152,7 @@ public class ChallengesPanels2 {
|
||||
} else {
|
||||
// Player click
|
||||
itemBuilder.clickHandler((panel, player, c, s) -> {
|
||||
new TryToComplete(addon, player, challenge, world, label, permPrefix);
|
||||
new TryToComplete(addon, player, challenge, world, label, permPrefix).build();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -161,8 +161,28 @@ public class TryToComplete
|
||||
this.manager = addon.getChallengesManager();
|
||||
this.challenge = challenge;
|
||||
this.topLabel = topLabel;
|
||||
}
|
||||
|
||||
this.build();
|
||||
|
||||
/**
|
||||
* This static method allows complete challenge and get result about completion.
|
||||
* @param addon - Challenges Addon.
|
||||
* @param user - User who performs challenge.
|
||||
* @param challenge - Challenge that should be completed.
|
||||
* @param world - World where completion may occur.
|
||||
* @param topLabel - Label of the top command.
|
||||
* @param permissionPrefix - Permission prefix for GameMode addon.
|
||||
* @return true, if challenge is completed, otherwise false.
|
||||
*/
|
||||
public static boolean complete(ChallengesAddon addon,
|
||||
User user,
|
||||
Challenge challenge,
|
||||
World world,
|
||||
String topLabel,
|
||||
String permissionPrefix)
|
||||
{
|
||||
return new TryToComplete(addon, user, challenge, world, topLabel, permissionPrefix).
|
||||
build().meetsRequirements;
|
||||
}
|
||||
|
||||
|
||||
|
@ -325,12 +325,16 @@ public class ChallengesGUI extends CommonGUI
|
||||
name(challenge.getFriendlyName().isEmpty() ? challenge.getUniqueId() : challenge.getFriendlyName()).
|
||||
description(GuiUtils.stringSplit(this.createChallengeDescription(challenge))).
|
||||
clickHandler((panel, user1, clickType, slot) -> {
|
||||
new TryToComplete(this.addon,
|
||||
if (TryToComplete.complete(this.addon,
|
||||
this.user,
|
||||
challenge,
|
||||
this.world,
|
||||
this.topLabel,
|
||||
this.permissionPrefix);
|
||||
this.permissionPrefix))
|
||||
{
|
||||
this.build();
|
||||
}
|
||||
|
||||
return true;
|
||||
}).
|
||||
glow(this.challengesManager.isChallengeComplete(this.user, challenge)).
|
||||
|
Loading…
Reference in New Issue
Block a user