Rework TryToComplete class.

Remove unnecessary code.
This commit is contained in:
BONNe 2019-01-24 23:29:56 +02:00
parent 1375d13ae4
commit 52b02e06bf
4 changed files with 584 additions and 342 deletions

View File

@ -1,26 +1,26 @@
package world.bentobox.challenges.panel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.ChallengesManager;
import world.bentobox.challenges.database.object.ChallengeLevel;
import world.bentobox.challenges.utils.GuiUtils;
import world.bentobox.challenges.utils.LevelStatus;
import world.bentobox.challenges.commands.ChallengesCommand;
import world.bentobox.challenges.database.object.Challenge;
import world.bentobox.challenges.database.object.Challenge.ChallengeType;
import world.bentobox.bentobox.api.panels.Panel;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.ChallengesManager;
import world.bentobox.challenges.commands.ChallengesCommand;
import world.bentobox.challenges.database.object.Challenge;
import world.bentobox.challenges.database.object.Challenge.ChallengeType;
import world.bentobox.challenges.database.object.ChallengeLevel;
import world.bentobox.challenges.utils.GuiUtils;
import world.bentobox.challenges.utils.LevelStatus;
/**
@ -152,7 +152,7 @@ public class ChallengesPanels2 {
} else {
// Player click
itemBuilder.clickHandler((panel, player, c, s) -> {
new TryToComplete(addon, player, manager, challenge, world, permPrefix, label);
new TryToComplete(addon, player, challenge, world, label, permPrefix);
return true;
});
}

View File

@ -24,6 +24,7 @@ import world.bentobox.challenges.utils.GuiUtils;
/**
* This class contains all necessary methods that creates GUI and allow to edit challenges
* properties.
* TODO: ISLAND is not repeatable.
*/
public class EditChallengeGUI extends CommonGUI
{

View File

@ -14,10 +14,10 @@ import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.ChallengesManager;
import world.bentobox.challenges.utils.LevelStatus;
import world.bentobox.challenges.database.object.Challenge;
import world.bentobox.challenges.panel.CommonGUI;
import world.bentobox.challenges.panel.TryToComplete;
import world.bentobox.challenges.utils.LevelStatus;
/**
@ -324,11 +324,10 @@ public class ChallengesGUI extends CommonGUI
clickHandler((panel, user1, clickType, slot) -> {
new TryToComplete(this.addon,
this.user,
this.challengesManager,
challenge,
this.world,
this.permissionPrefix,
this.topLabel);
this.topLabel,
this.permissionPrefix);
return true;
}).
glow(this.challengesManager.isChallengeComplete(this.user, challenge)).