Rework Challenges Addon Language structure.

Reorganize structure.
Add missing translations.
Add colors.
This commit is contained in:
BONNe 2019-02-12 01:38:16 +02:00
parent b2201ec48d
commit ab3275cd69
33 changed files with 968 additions and 650 deletions

View File

@ -56,14 +56,14 @@ public class ChallengesImportManager
public boolean importChallenges(User user, World world, boolean overwrite) { public boolean importChallenges(User user, World world, boolean overwrite) {
File challengeFile = new File(addon.getDataFolder(), "challenges.yml"); File challengeFile = new File(addon.getDataFolder(), "challenges.yml");
if (!challengeFile.exists()) { if (!challengeFile.exists()) {
user.sendMessage("challenges.admin.import.no-file"); user.sendMessage("challenges.errors.import-no-file");
return false; return false;
} }
chal = new YamlConfiguration(); chal = new YamlConfiguration();
try { try {
chal.load(challengeFile); chal.load(challengeFile);
} catch (IOException | InvalidConfigurationException e) { } catch (IOException | InvalidConfigurationException e) {
user.sendMessage("challenges.admin.import.no-load","[message]", e.getMessage()); user.sendMessage("challenges.errors.no-load","[message]", e.getMessage());
return false; return false;
} }
makeLevels(user, world, overwrite); makeLevels(user, world, overwrite);
@ -76,7 +76,7 @@ public class ChallengesImportManager
// Parse the levels // Parse the levels
String levels = chal.getString("challenges.levels", ""); String levels = chal.getString("challenges.levels", "");
if (!levels.isEmpty()) { if (!levels.isEmpty()) {
user.sendMessage("challenges.admin.import.levels", "[levels]", levels); user.sendMessage("challenges.messages.import-levels");
String[] lvs = levels.split(" "); String[] lvs = levels.split(" ");
int order = 0; int order = 0;
for (String level : lvs) { for (String level : lvs) {
@ -99,7 +99,7 @@ public class ChallengesImportManager
addon.getChallengesManager().loadLevel(challengeLevel, overwrite, user, false); addon.getChallengesManager().loadLevel(challengeLevel, overwrite, user, false);
} }
} else { } else {
user.sendMessage("challenges.admin.import.no-levels"); user.sendMessage("challenges.messages.no-levels");
} }
} }
@ -111,6 +111,8 @@ public class ChallengesImportManager
int size = 0; int size = 0;
// Parse the challenge file // Parse the challenge file
ConfigurationSection chals = chal.getConfigurationSection("challenges.challengeList"); ConfigurationSection chals = chal.getConfigurationSection("challenges.challengeList");
user.sendMessage("challenges.messages.import-challenges");
for (String challenge : chals.getKeys(false)) { for (String challenge : chals.getKeys(false)) {
Challenge newChallenge = new Challenge(); Challenge newChallenge = new Challenge();
newChallenge.setUniqueId(Util.getWorld(world).getName() + "_" + challenge); newChallenge.setUniqueId(Util.getWorld(world).getName() + "_" + challenge);
@ -165,7 +167,7 @@ public class ChallengesImportManager
} }
} }
user.sendMessage("challenges.admin.import.number", "[number]", String.valueOf(size)); user.sendMessage("challenges.messages.import-number", "[number]", String.valueOf(size));
} }
/** /**

View File

@ -163,8 +163,8 @@ public class ChallengesManager
{ {
if (!silent) if (!silent)
{ {
user.sendMessage("challenges.admin.import.skipping", user.sendMessage("challenges.messages.load-skipping",
"[object]", challenge.getFriendlyName()); "[value]", challenge.getFriendlyName());
} }
return false; return false;
@ -173,8 +173,8 @@ public class ChallengesManager
{ {
if (!silent) if (!silent)
{ {
user.sendMessage("challenges.admin.import.overwriting", user.sendMessage("challenges.messages.load-overwriting",
"[challenge]", challenge.getFriendlyName()); "[value]", challenge.getFriendlyName());
} }
} }
} }
@ -182,8 +182,8 @@ public class ChallengesManager
{ {
if (!silent) if (!silent)
{ {
user.sendMessage("challenges.admin.import.add", user.sendMessage("challenges.messages.load-add",
"[object]", challenge.getFriendlyName()); "[value]", challenge.getFriendlyName());
} }
} }
@ -218,8 +218,8 @@ public class ChallengesManager
{ {
if (user != null) if (user != null)
{ {
user.sendMessage("challenges.admin.import.error", user.sendMessage("challenges.errors.load-error",
"[object]", level.getFriendlyName()); "[value]", level.getFriendlyName());
} }
else else
{ {
@ -235,8 +235,8 @@ public class ChallengesManager
{ {
if (!silent) if (!silent)
{ {
user.sendMessage("challenges.admin.import.skipping", user.sendMessage("challenges.messages.load-skipping",
"[object]", level.getFriendlyName()); "[value]", level.getFriendlyName());
} }
return false; return false;
@ -245,8 +245,8 @@ public class ChallengesManager
{ {
if (!silent) if (!silent)
{ {
user.sendMessage("challenges.admin.import.overwriting", user.sendMessage("challenges.messages.load-overwriting",
"[challenge]", level.getFriendlyName()); "[value]", level.getFriendlyName());
} }
} }
} }
@ -254,8 +254,8 @@ public class ChallengesManager
{ {
if (!silent) if (!silent)
{ {
user.sendMessage("challenges.admin.import.add", user.sendMessage("challenges.messages.load-add",
"[object]", level.getFriendlyName()); "[value]", level.getFriendlyName());
} }
} }
@ -281,7 +281,6 @@ public class ChallengesManager
} }
} }
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Section: Other storing related methods // Section: Other storing related methods
// --------------------------------------------------------------------- // ---------------------------------------------------------------------

View File

@ -66,12 +66,27 @@ public class Settings implements DataObject
@ConfigComment("") @ConfigComment("")
private String uniqueId = "config"; private String uniqueId = "config";
/**
* Configuration version
*/
@ConfigComment("")
private String configVersion = "v1.0";
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Section: Methods // Section: Methods
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
/**
* This method returns the configVersion object.
* @return the configVersion object.
*/
public String getConfigVersion()
{
return configVersion;
}
@Override @Override
public String getUniqueId() public String getUniqueId()
{ {
@ -143,6 +158,16 @@ public class Settings implements DataObject
} }
/**
* This method sets the configVersion object value.
* @param configVersion the configVersion object new value.
*/
public void setConfigVersion(String configVersion)
{
this.configVersion = configVersion;
}
@Override @Override
public void setUniqueId(String uniqueId) public void setUniqueId(String uniqueId)
{ {

View File

@ -34,8 +34,8 @@ public class ChallengesCommand extends CompositeCommand {
@Override @Override
public void setup() { public void setup() {
this.setPermission(CHALLENGE_COMMAND); this.setPermission(CHALLENGE_COMMAND);
this.setParametersHelp(CHALLENGE_COMMAND + ".parameters"); this.setParametersHelp("challenges.commands.user.parameters");
this.setDescription(CHALLENGE_COMMAND + ".description"); this.setDescription("challenges.commands.user.description");
} }

View File

@ -21,8 +21,8 @@ public class Challenges extends CompositeCommand {
@Override @Override
public void setup() { public void setup() {
this.setPermission("admin.challenges"); this.setPermission("admin.challenges");
this.setParametersHelp("challeneges.admin.parameters"); this.setParametersHelp("challenges.commands.admin.main.parameters");
this.setDescription("challenges.admin.description"); this.setDescription("challenges.commands.admin.main.description");
// Register sub commands // Register sub commands
new ImportCommand(getAddon(), this); new ImportCommand(getAddon(), this);
// new CompleteChallenge(getAddon(), this); // new CompleteChallenge(getAddon(), this);

View File

@ -28,8 +28,8 @@ public class CompleteChallenge extends CompositeCommand {
@Override @Override
public void setup() { public void setup() {
this.setPermission("admin.challenges"); this.setPermission("admin.challenges");
this.setParametersHelp("challenges.admin.complete.parameters"); this.setParametersHelp("challenges.commands.admin.complete.parameters");
this.setDescription("challenges.admin.complete.description"); this.setDescription("challenges.commands.admin.complete.description");
manager = ((ChallengesAddon)getAddon()).getChallengesManager(); manager = ((ChallengesAddon)getAddon()).getChallengesManager();
} }

View File

@ -29,15 +29,15 @@ public class CreateChallenge extends CompositeCommand {
public void setup() { public void setup() {
this.setOnlyPlayer(true); this.setOnlyPlayer(true);
this.setPermission("admin.challenges"); this.setPermission("admin.challenges");
this.setParametersHelp("challaneges.admin.create.parameters"); this.setParametersHelp("challenges.commands.admin.create.parameters");
this.setDescription("challenges.admin.create.description"); this.setDescription("challenges.commands.admin.create.description");
} }
@Override @Override
public boolean execute(User user, String label, List<String> args) { public boolean execute(User user, String label, List<String> args) {
if (args.isEmpty()) { if (args.isEmpty()) {
user.sendRawMessage("not enough args"); user.sendMessage("challenges.errors.no-name");
return false; return false;
} }
new PanelBuilder() new PanelBuilder()

View File

@ -45,18 +45,18 @@ public class CreateSurrounding extends CompositeCommand implements Listener {
public void setup() { public void setup() {
this.setOnlyPlayer(true); this.setOnlyPlayer(true);
this.setPermission("admin.challenges"); this.setPermission("admin.challenges");
this.setParametersHelp("challaneges.admin.create.surrounding.parameters"); this.setParametersHelp("challenges.commands.admin.surrounding.parameters");
this.setDescription("challenges.admin.create.surrounding.description"); this.setDescription("challenges.commands.admin.surrounding.description");
} }
@Override @Override
public boolean execute(User user, String label, List<String> args) { public boolean execute(User user, String label, List<String> args) {
if (args.isEmpty()) { if (args.isEmpty()) {
user.sendMessage("challenges.admin.error.no-name"); user.sendMessage("challenges.errors.no-name");
return false; return false;
} }
// Tell user to hit objects to add to the surrounding object requirements // Tell user to hit objects to add to the surrounding object requirements
user.sendMessage("challenges.admin.create.surrounding.hit-things"); user.sendMessage("challenges.messages.admin.hit-things");
inProgress.put(user.getUniqueId(), new SurroundChallengeBuilder((ChallengesAddon) getAddon()).owner(user).name(args.get(0))); inProgress.put(user.getUniqueId(), new SurroundChallengeBuilder((ChallengesAddon) getAddon()).owner(user).name(args.get(0)));
return true; return true;
} }
@ -77,7 +77,7 @@ public class CreateSurrounding extends CompositeCommand implements Listener {
// Prevent damage // Prevent damage
e.setCancelled(true); e.setCancelled(true);
inProgress.get(e.getPlayer().getUniqueId()).addBlock(e.getClickedBlock().getType()); inProgress.get(e.getPlayer().getUniqueId()).addBlock(e.getClickedBlock().getType());
User.getInstance(e.getPlayer()).sendMessage("challenges.admin.you-added", "[thing]", Util.prettifyText(e.getClickedBlock().getType().toString())); User.getInstance(e.getPlayer()).sendMessage("challenges.messages.admin.you-added", "[thing]", Util.prettifyText(e.getClickedBlock().getType().toString()));
return true; return true;
} }
@ -92,7 +92,7 @@ public class CreateSurrounding extends CompositeCommand implements Listener {
e.setCancelled(true); e.setCancelled(true);
boolean status = inProgress.get(uuid).build(); boolean status = inProgress.get(uuid).build();
if (status) { if (status) {
inProgress.get(uuid).getOwner().sendMessage("challenges.admin.challenge-created", "[challenge]", inProgress.get(uuid).getName()); inProgress.get(uuid).getOwner().sendMessage("challenges.messages.admin.challenge-created", "[challenge]", inProgress.get(uuid).getName());
} }
inProgress.remove(uuid); inProgress.remove(uuid);
return status; return status;
@ -115,7 +115,7 @@ public class CreateSurrounding extends CompositeCommand implements Listener {
// Prevent damage // Prevent damage
e.setCancelled(true); e.setCancelled(true);
inProgress.get(player.getUniqueId()).addEntity(e.getEntityType()); inProgress.get(player.getUniqueId()).addEntity(e.getEntityType());
User.getInstance(player).sendMessage("challenges.admin.you-added", "[thing]", Util.prettifyText(e.getEntityType().toString())); User.getInstance(player).sendMessage("challenges.messages.admin.you-added", "[thing]", Util.prettifyText(e.getEntityType().toString()));
return true; return true;
} }
return false; return false;

View File

@ -29,8 +29,8 @@ public class ImportCommand extends CompositeCommand {
@Override @Override
public void setup() { public void setup() {
this.setPermission("challenges.admin"); this.setPermission("challenges.admin");
this.setParametersHelp("challenges.admin.import.parameters"); this.setParametersHelp("challenges.commands.admin.import.parameters");
this.setDescription("challenges.admin.import.description"); this.setDescription("challenges.commands.admin.import.description");
} }
@Override @Override

View File

@ -23,8 +23,8 @@ public class ReloadChallenges extends CompositeCommand {
@Override @Override
public void setup() { public void setup() {
this.setPermission("admin.challenges"); this.setPermission("admin.challenges");
this.setParametersHelp("challenges.admin.reload.parameters"); this.setParametersHelp("challenges.commands.admin.reload.parameters");
this.setDescription("challenges.admin.reload.description"); this.setDescription("challenges.commands.admin.reload.description");
manager = ((ChallengesAddon)getAddon()).getChallengesManager(); manager = ((ChallengesAddon)getAddon()).getChallengesManager();
} }

View File

@ -33,8 +33,8 @@ public class ResetChallenge extends CompositeCommand {
@Override @Override
public void setup() { public void setup() {
this.setPermission("admin.challenges"); this.setPermission("admin.challenges");
this.setParametersHelp("challenges.admin.reset.parameters"); this.setParametersHelp("challenges.commands.admin.reset.parameters");
this.setDescription("challenges.admin.reset.description"); this.setDescription("challenges.commands.admin.reset.description");
manager = ((ChallengesAddon)getAddon()).getChallengesManager(); manager = ((ChallengesAddon)getAddon()).getChallengesManager();
} }
@ -57,7 +57,7 @@ public class ResetChallenge extends CompositeCommand {
} }
// Check for valid challenge name // Check for valid challenge name
if (!manager.containsChallenge(args.get(1))) { if (!manager.containsChallenge(args.get(1))) {
user.sendMessage("challenges.admin.complete.unknown-challenge"); user.sendMessage("challenges.errors.unknown-challenge");
return false; return false;
} }
// Complete challenge // Complete challenge

View File

@ -21,8 +21,8 @@ public class ShowChallenges extends CompositeCommand {
@Override @Override
public void setup() { public void setup() {
this.setPermission("admin.challenges"); this.setPermission("admin.challenges");
this.setParametersHelp("challaneges.admin.show.parameters"); this.setParametersHelp("challenges.commands.admin.show.parameters");
this.setDescription("challenges.admin.show.description"); this.setDescription("challenges.commands.admin.show.description");
} }

View File

@ -157,7 +157,7 @@ public abstract class CommonGUI
this.pageIndex = 0; this.pageIndex = 0;
this.returnButton = new PanelItemBuilder(). this.returnButton = new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.buttons.back")). name(this.user.getTranslation("challenges.gui.buttons.return")).
icon(Material.OAK_DOOR). icon(Material.OAK_DOOR).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
if (this.parentGUI == null) if (this.parentGUI == null)

View File

@ -226,7 +226,7 @@ public class TryToComplete
// Run commands // Run commands
this.runCommands(this.challenge.getRewardCommands()); this.runCommands(this.challenge.getRewardCommands());
this.user.sendMessage("challenges.you-completed", "[challenge]", this.challenge.getFriendlyName()); this.user.sendMessage("challenges.messages.you-completed-challenge", "[value]", this.challenge.getFriendlyName());
if (this.addon.getChallengesSettings().isBroadcastMessages()) if (this.addon.getChallengesSettings().isBroadcastMessages())
{ {
@ -235,8 +235,9 @@ public class TryToComplete
// Only other players should see message. // Only other players should see message.
if (!player.getUniqueId().equals(this.user.getUniqueId())) if (!player.getUniqueId().equals(this.user.getUniqueId()))
{ {
User.getInstance(player).sendMessage("challenges.name-has-completed", User.getInstance(player).sendMessage("challenges.messages.name-has-completed-challenge",
"[name]", this.user.getName(), "[challenge]", this.challenge.getFriendlyName()); "[name]", this.user.getName(),
"[value]", this.challenge.getFriendlyName());
} }
} }
} }
@ -262,7 +263,7 @@ public class TryToComplete
// Run commands // Run commands
this.runCommands(this.challenge.getRepeatRewardCommands()); this.runCommands(this.challenge.getRepeatRewardCommands());
this.user.sendMessage("challenges.you-repeated", "[challenge]", this.challenge.getFriendlyName()); this.user.sendMessage("challenges.messages.you-repeated-challenge", "[value]", this.challenge.getFriendlyName());
} }
// Mark as complete // Mark as complete
@ -295,7 +296,7 @@ public class TryToComplete
// Run commands // Run commands
this.runCommands(level.getRewardCommands()); this.runCommands(level.getRewardCommands());
this.user.sendMessage("challenges.you-completed-level", "[level]", level.getFriendlyName()); this.user.sendMessage("challenges.messages.you-completed-level", "[value]", level.getFriendlyName());
if (this.addon.getChallengesSettings().isBroadcastMessages()) if (this.addon.getChallengesSettings().isBroadcastMessages())
{ {
@ -304,8 +305,8 @@ public class TryToComplete
// Only other players should see message. // Only other players should see message.
if (!player.getUniqueId().equals(this.user.getUniqueId())) if (!player.getUniqueId().equals(this.user.getUniqueId()))
{ {
User.getInstance(player).sendMessage("challenges.name-has-completed-level", User.getInstance(player).sendMessage("challenges.messages.name-has-completed-level",
"[name]", this.user.getName(), "[level]", level.getFriendlyName()); "[name]", this.user.getName(), "[value]", level.getFriendlyName());
} }
} }
} }
@ -332,7 +333,7 @@ public class TryToComplete
// Check the world // Check the world
if (!this.challenge.isDeployed()) if (!this.challenge.isDeployed())
{ {
this.user.sendMessage("challenges.error.not-deployed"); this.user.sendMessage("challenges.errors.not-deployed");
result = EMPTY_RESULT; result = EMPTY_RESULT;
} }
else if (Util.getWorld(this.world) != Util.getWorld(this.user.getWorld()) || else if (Util.getWorld(this.world) != Util.getWorld(this.user.getWorld()) ||
@ -344,7 +345,7 @@ public class TryToComplete
// Player is not on island // Player is not on island
else if (!this.addon.getIslands().userIsOnIsland(this.user.getWorld(), this.user)) else if (!this.addon.getIslands().userIsOnIsland(this.user.getWorld(), this.user))
{ {
this.user.sendMessage("challenges.error.not-on-island"); this.user.sendMessage("challenges.errors.not-on-island");
result = EMPTY_RESULT; result = EMPTY_RESULT;
} }
// Check if user has unlocked challenges level. // Check if user has unlocked challenges level.
@ -358,13 +359,13 @@ public class TryToComplete
else if (this.challenge.isRepeatable() && this.challenge.getMaxTimes() > 0 && else if (this.challenge.isRepeatable() && this.challenge.getMaxTimes() > 0 &&
this.manager.getChallengeTimes(this.user, this.challenge) >= this.challenge.getMaxTimes()) this.manager.getChallengeTimes(this.user, this.challenge) >= this.challenge.getMaxTimes())
{ {
this.user.sendMessage("challenges.not-repeatable"); this.user.sendMessage("challenges.errors.not-repeatable");
result = EMPTY_RESULT; result = EMPTY_RESULT;
} }
// Check repeatability // Check repeatability
else if (!this.challenge.isRepeatable() && this.manager.isChallengeComplete(this.user, this.challenge)) else if (!this.challenge.isRepeatable() && this.manager.isChallengeComplete(this.user, this.challenge))
{ {
this.user.sendMessage("challenges.not-repeatable"); this.user.sendMessage("challenges.errors.not-repeatable");
result = EMPTY_RESULT; result = EMPTY_RESULT;
} }
// Check environment // Check environment
@ -503,7 +504,7 @@ public class TryToComplete
if (numInInventory < req.getAmount()) if (numInInventory < req.getAmount())
{ {
this.user.sendMessage("challenges.error.not-enough-items", this.user.sendMessage("challenges.errors.not-enough-items",
"[items]", "[items]",
Util.prettifyText(req.getType().toString())); Util.prettifyText(req.getType().toString()));
return EMPTY_RESULT; return EMPTY_RESULT;
@ -513,7 +514,7 @@ public class TryToComplete
// General checking // General checking
if (!this.user.getInventory().containsAtLeast(req, req.getAmount())) if (!this.user.getInventory().containsAtLeast(req, req.getAmount()))
{ {
this.user.sendMessage("challenges.error.not-enough-items", this.user.sendMessage("challenges.errors.not-enough-items",
"[items]", "[items]",
Util.prettifyText(req.getType().toString())); Util.prettifyText(req.getType().toString()));
return EMPTY_RESULT; return EMPTY_RESULT;
@ -598,7 +599,7 @@ public class TryToComplete
if (!this.addon.getIslands().userIsOnIsland(this.user.getWorld(), this.user)) if (!this.addon.getIslands().userIsOnIsland(this.user.getWorld(), this.user))
{ {
// Player is not on island // Player is not on island
this.user.sendMessage("challenges.error.not-on-island"); this.user.sendMessage("challenges.errors.not-on-island");
result = EMPTY_RESULT; result = EMPTY_RESULT;
} }
else else
@ -662,9 +663,9 @@ public class TryToComplete
return new ChallengeResult().setMeetsRequirements(); return new ChallengeResult().setMeetsRequirements();
} }
this.user.sendMessage("challenges.error.not-close-enough", "[number]", String.valueOf(searchRadius)); this.user.sendMessage("challenges.errors.not-close-enough", "[number]", String.valueOf(searchRadius));
blocks.forEach((k, v) -> user.sendMessage("challenges.error.you-still-need", blocks.forEach((k, v) -> user.sendMessage("challenges.errors.you-still-need",
"[amount]", String.valueOf(v), "[amount]", String.valueOf(v),
"[item]", Util.prettifyText(k.toString()))); "[item]", Util.prettifyText(k.toString())));
@ -693,7 +694,7 @@ public class TryToComplete
return new ChallengeResult().setMeetsRequirements(); return new ChallengeResult().setMeetsRequirements();
} }
entities.forEach((reqEnt, amount) -> this.user.sendMessage("challenges.error.you-still-need", entities.forEach((reqEnt, amount) -> this.user.sendMessage("challenges.errors.you-still-need",
"[amount]", String.valueOf(amount), "[amount]", String.valueOf(amount),
"[item]", Util.prettifyText(reqEnt.toString()))); "[item]", Util.prettifyText(reqEnt.toString())));
@ -767,38 +768,38 @@ public class TryToComplete
if (!this.addon.isLevelProvided() && if (!this.addon.isLevelProvided() &&
this.challenge.getRequiredIslandLevel() != 0) this.challenge.getRequiredIslandLevel() != 0)
{ {
this.user.sendMessage("challenges.missing-addon"); this.user.sendMessage("challenges.errors.missing-addon");
} }
else if (!this.addon.isEconomyProvided() && else if (!this.addon.isEconomyProvided() &&
this.challenge.getRequiredMoney() != 0) this.challenge.getRequiredMoney() != 0)
{ {
this.user.sendMessage("challenges.missing-addon"); this.user.sendMessage("challenges.errors.missing-addon");
} }
else if (this.addon.isEconomyProvided() && this.challenge.getRequiredMoney() < 0) else if (this.addon.isEconomyProvided() && this.challenge.getRequiredMoney() < 0)
{ {
this.user.sendMessage("challenges.incorrect"); this.user.sendMessage("challenges.errors.incorrect");
} }
else if (this.addon.isEconomyProvided() && else if (this.addon.isEconomyProvided() &&
!this.addon.getEconomyProvider().has(this.user, this.challenge.getRequiredMoney())) !this.addon.getEconomyProvider().has(this.user, this.challenge.getRequiredMoney()))
{ {
this.user.sendMessage("challenges.not-enough-money", this.user.sendMessage("challenges.errors.not-enough-money",
"[money]", "[value]",
Integer.toString(this.challenge.getRequiredMoney())); Integer.toString(this.challenge.getRequiredMoney()));
} }
else if (this.challenge.getRequiredExperience() < 0) else if (this.challenge.getRequiredExperience() < 0)
{ {
this.user.sendMessage("challenges.incorrect"); this.user.sendMessage("challenges.errors.incorrect");
} }
else if (this.user.getPlayer().getTotalExperience() < this.challenge.getRequiredExperience()) else if (this.user.getPlayer().getTotalExperience() < this.challenge.getRequiredExperience())
{ {
this.user.sendMessage("challenges.not-enough-exp", this.user.sendMessage("challenges.errors.not-enough-experience",
"[xp]", "[value]",
Integer.toString(this.challenge.getRequiredExperience())); Integer.toString(this.challenge.getRequiredExperience()));
} }
else if (this.addon.isLevelProvided() && else if (this.addon.isLevelProvided() &&
this.addon.getLevelAddon().getIslandLevel(this.world, this.user.getUniqueId()) < this.challenge.getRequiredIslandLevel()) this.addon.getLevelAddon().getIslandLevel(this.world, this.user.getUniqueId()) < this.challenge.getRequiredIslandLevel())
{ {
this.user.sendMessage("challenges.error.island-level", this.user.sendMessage("challenges.errors.island-level",
TextVariables.NUMBER, TextVariables.NUMBER,
String.valueOf(this.challenge.getRequiredIslandLevel())); String.valueOf(this.challenge.getRequiredIslandLevel()));
} }

View File

@ -4,8 +4,6 @@ package world.bentobox.challenges.panel.admin;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.Collections;
import java.util.List;
import net.wesjd.anvilgui.AnvilGUI; import net.wesjd.anvilgui.AnvilGUI;
import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.PanelItem;
@ -90,7 +88,7 @@ public class AdminGUI extends CommonGUI
public void build() public void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name( PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
this.user.getTranslation("challenges.admin.gui-title")); this.user.getTranslation("challenges.gui.title.admin.gui-title"));
GuiUtils.fillBorder(panelBuilder); GuiUtils.fillBorder(panelBuilder);
@ -132,7 +130,7 @@ public class AdminGUI extends CommonGUI
{ {
ItemStack icon; ItemStack icon;
String name; String name;
List<String> description; String description;
boolean glow; boolean glow;
PanelItem.ClickHandler clickHandler; PanelItem.ClickHandler clickHandler;
@ -143,8 +141,8 @@ public class AdminGUI extends CommonGUI
case COMPLETE_USER_CHALLENGES: case COMPLETE_USER_CHALLENGES:
permissionSuffix = COMPLETE; permissionSuffix = COMPLETE;
name = this.user.getTranslation("challenges.gui.admin.buttons.complete"); name = this.user.getTranslation("challenges.gui.buttons.admin.complete");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.complete");
icon = new ItemStack(Material.WRITTEN_BOOK); icon = new ItemStack(Material.WRITTEN_BOOK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new ListUsersGUI(this.addon, new ListUsersGUI(this.addon,
@ -163,8 +161,8 @@ public class AdminGUI extends CommonGUI
case RESET_USER_CHALLENGES: case RESET_USER_CHALLENGES:
permissionSuffix = RESET; permissionSuffix = RESET;
name = this.user.getTranslation("challenges.gui.admin.buttons.reset"); name = this.user.getTranslation("challenges.gui.buttons.admin.reset");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.reset");
icon = new ItemStack(Material.WRITABLE_BOOK); icon = new ItemStack(Material.WRITABLE_BOOK);
glow = this.resetAllMode; glow = this.resetAllMode;
@ -193,8 +191,8 @@ public class AdminGUI extends CommonGUI
case ADD_CHALLENGE: case ADD_CHALLENGE:
permissionSuffix = ADD; permissionSuffix = ADD;
name = this.user.getTranslation("challenges.gui.admin.buttons.add-challenge"); name = this.user.getTranslation("challenges.gui.buttons.admin.create-challenge");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.create-challenge");
icon = new ItemStack(Material.BOOK); icon = new ItemStack(Material.BOOK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new AnvilGUI(this.addon.getPlugin(), new AnvilGUI(this.addon.getPlugin(),
@ -229,8 +227,8 @@ public class AdminGUI extends CommonGUI
case ADD_LEVEL: case ADD_LEVEL:
permissionSuffix = ADD; permissionSuffix = ADD;
name = this.user.getTranslation("challenges.gui.admin.buttons.add-level"); name = this.user.getTranslation("challenges.gui.buttons.admin.create-level");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.create-level");
icon = new ItemStack(Material.BOOK); icon = new ItemStack(Material.BOOK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new AnvilGUI(this.addon.getPlugin(), new AnvilGUI(this.addon.getPlugin(),
@ -265,8 +263,8 @@ public class AdminGUI extends CommonGUI
case EDIT_CHALLENGE: case EDIT_CHALLENGE:
permissionSuffix = EDIT; permissionSuffix = EDIT;
name = this.user.getTranslation("challenges.gui.admin.buttons.edit-challenge"); name = this.user.getTranslation("challenges.gui.buttons.admin.edit-challenge");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.edit-challenge");
icon = new ItemStack(Material.ANVIL); icon = new ItemStack(Material.ANVIL);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new ListChallengesGUI(this.addon, new ListChallengesGUI(this.addon,
@ -286,8 +284,8 @@ public class AdminGUI extends CommonGUI
{ {
permissionSuffix = EDIT; permissionSuffix = EDIT;
name = this.user.getTranslation("challenges.gui.admin.buttons.edit-level"); name = this.user.getTranslation("challenges.gui.buttons.admin.edit-level");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.edit-level");
icon = new ItemStack(Material.ANVIL); icon = new ItemStack(Material.ANVIL);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new ListLevelsGUI(this.addon, new ListLevelsGUI(this.addon,
@ -308,8 +306,8 @@ public class AdminGUI extends CommonGUI
{ {
permissionSuffix = DELETE; permissionSuffix = DELETE;
name = this.user.getTranslation("challenges.gui.admin.buttons.delete-challenge"); name = this.user.getTranslation("challenges.gui.buttons.admin.delete-challenge");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.delete-challenge");
icon = new ItemStack(Material.LAVA_BUCKET); icon = new ItemStack(Material.LAVA_BUCKET);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new ListChallengesGUI(this.addon, new ListChallengesGUI(this.addon,
@ -330,8 +328,8 @@ public class AdminGUI extends CommonGUI
{ {
permissionSuffix = DELETE; permissionSuffix = DELETE;
name = this.user.getTranslation("challenges.gui.admin.buttons.delete-level"); name = this.user.getTranslation("challenges.gui.buttons.admin.delete-level");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.delete-level");
icon = new ItemStack(Material.LAVA_BUCKET); icon = new ItemStack(Material.LAVA_BUCKET);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new ListLevelsGUI(this.addon, new ListLevelsGUI(this.addon,
@ -352,8 +350,8 @@ public class AdminGUI extends CommonGUI
{ {
permissionSuffix = IMPORT; permissionSuffix = IMPORT;
name = this.user.getTranslation("challenges.gui.admin.buttons.import"); name = this.user.getTranslation("challenges.gui.buttons.admin.import");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.import");
icon = new ItemStack(Material.HOPPER); icon = new ItemStack(Material.HOPPER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
if (clickType.isRightClick()) if (clickType.isRightClick())
@ -377,8 +375,8 @@ public class AdminGUI extends CommonGUI
{ {
permissionSuffix = IMPORT; permissionSuffix = IMPORT;
name = this.user.getTranslation("challenges.gui.admin.buttons.backward"); name = this.user.getTranslation("challenges.gui.buttons.admin.backward");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.backward");
icon = new ItemStack(Material.HOPPER); icon = new ItemStack(Material.HOPPER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.addon.getImportManager(). this.addon.getImportManager().
@ -394,8 +392,8 @@ public class AdminGUI extends CommonGUI
{ {
permissionSuffix = SETTINGS; permissionSuffix = SETTINGS;
name = this.user.getTranslation("challenges.gui.admin.buttons.settings"); name = this.user.getTranslation("challenges.gui.buttons.admin.settings");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.settings");
icon = new ItemStack(Material.CRAFTING_TABLE); icon = new ItemStack(Material.CRAFTING_TABLE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new EditSettingsGUI(this.addon, new EditSettingsGUI(this.addon,
@ -428,6 +426,6 @@ public class AdminGUI extends CommonGUI
}; };
} }
return new PanelItem(icon, name, description, glow, clickHandler, false); return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength()), glow, clickHandler, false);
} }
} }

View File

@ -3,6 +3,7 @@ package world.bentobox.challenges.panel.admin;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.*; import java.util.*;
@ -80,7 +81,7 @@ public class EditChallengeGUI extends CommonGUI
public void build() public void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name( PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
this.user.getTranslation("challenges.gui.admin.edit-challenge-title")); this.user.getTranslation("challenges.gui.title.admin.edit-challenge-title"));
GuiUtils.fillBorder(panelBuilder); GuiUtils.fillBorder(panelBuilder);
@ -228,7 +229,7 @@ public class EditChallengeGUI extends CommonGUI
{ {
ItemStack icon; ItemStack icon;
String name; String name;
List<String> description; String description;
boolean glow; boolean glow;
PanelItem.ClickHandler clickHandler; PanelItem.ClickHandler clickHandler;
@ -236,8 +237,8 @@ public class EditChallengeGUI extends CommonGUI
{ {
case PROPERTIES: case PROPERTIES:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.properties"); name = this.user.getTranslation("challenges.gui.buttons.admin.properties");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.properties");
icon = new ItemStack(Material.CRAFTING_TABLE); icon = new ItemStack(Material.CRAFTING_TABLE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.currentMenuType = MenuType.PROPERTIES; this.currentMenuType = MenuType.PROPERTIES;
@ -250,8 +251,8 @@ public class EditChallengeGUI extends CommonGUI
} }
case REQUIREMENTS: case REQUIREMENTS:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.requirements"); name = this.user.getTranslation("challenges.gui.buttons.admin.requirements");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.requirements");
icon = new ItemStack(Material.HOPPER); icon = new ItemStack(Material.HOPPER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.currentMenuType = MenuType.REQUIREMENTS; this.currentMenuType = MenuType.REQUIREMENTS;
@ -264,8 +265,8 @@ public class EditChallengeGUI extends CommonGUI
} }
case REWARDS: case REWARDS:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.rewards"); name = this.user.getTranslation("challenges.gui.buttons.admin.rewards");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.rewards");
icon = new ItemStack(Material.DROPPER); icon = new ItemStack(Material.DROPPER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.currentMenuType = MenuType.REWARDS; this.currentMenuType = MenuType.REWARDS;
@ -303,16 +304,21 @@ public class EditChallengeGUI extends CommonGUI
{ {
case TYPE: case TYPE:
{ {
List<String> values = new ArrayList<>(Challenge.ChallengeType.values().length); name = this.user.getTranslation("challenges.gui.buttons.admin.type");
for (Challenge.ChallengeType type : Challenge.ChallengeType.values()) List<String> values = new ArrayList<>(5);
{ values.add(this.user.getTranslation("challenges.gui.descriptions.admin.type"));
values.add((this.challenge.getChallengeType().equals(type) ? "&2" : "&c") +
this.user.getTranslation("challenges.gui.admin.descriptions." + type.name().toLowerCase())); values.add((this.challenge.getChallengeType().equals(Challenge.ChallengeType.ISLAND) ? "&2" : "&c") +
} this.user.getTranslation("challenges.gui.descriptions.type.island"));
values.add((this.challenge.getChallengeType().equals(Challenge.ChallengeType.INVENTORY) ? "&2" : "&c") +
this.user.getTranslation("challenges.gui.descriptions.type.inventory"));
values.add((this.challenge.getChallengeType().equals(Challenge.ChallengeType.OTHER) ? "&2" : "&c") +
this.user.getTranslation("challenges.gui.descriptions.type.other"));
values.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", this.challenge.getChallengeType().name()));
name = this.user.getTranslation("challenges.gui.admin.buttons.type",
"[value]", this.challenge.getChallengeType().name());
description = values; description = values;
if (this.challenge.getChallengeType().equals(Challenge.ChallengeType.ISLAND)) if (this.challenge.getChallengeType().equals(Challenge.ChallengeType.ISLAND))
@ -353,16 +359,15 @@ public class EditChallengeGUI extends CommonGUI
} }
case DEPLOYED: case DEPLOYED:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.deployed"); name = this.user.getTranslation("challenges.gui.buttons.admin.deployment");
if (this.challenge.isDeployed()) description = new ArrayList<>(2);
{ description.add(this.user.getTranslation("challenges.gui.descriptions.admin.deployment"));
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.enabled")); description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
} "[value]",
else this.challenge.isDeployed() ?
{ this.user.getTranslation("challenges.gui.descriptions.enabled") :
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.disabled")); this.user.getTranslation("challenges.gui.descriptions.disabled")));
}
icon = new ItemStack(Material.LEVER); icon = new ItemStack(Material.LEVER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
@ -376,8 +381,9 @@ public class EditChallengeGUI extends CommonGUI
} }
case ICON: case ICON:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.icon"); name = this.user.getTranslation("challenges.gui.buttons.admin.icon");
description = Collections.emptyList(); description = Collections.singletonList(this.user.getTranslation(
"challenges.gui.descriptions.admin.icon-challenge"));
icon = this.challenge.getIcon(); icon = this.challenge.getIcon();
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new AnvilGUI(this.addon.getPlugin(), new AnvilGUI(this.addon.getPlugin(),
@ -406,8 +412,8 @@ public class EditChallengeGUI extends CommonGUI
} }
case DESCRIPTION: case DESCRIPTION:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.description"); name = this.user.getTranslation("challenges.gui.buttons.admin.description");
description = Collections.emptyList(); description = Collections.singletonList(this.user.getTranslation("challenges.gui.descriptions.admin.description"));
icon = new ItemStack(Material.WRITTEN_BOOK); icon = new ItemStack(Material.WRITTEN_BOOK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new StringListGUI(this.user, this.challenge.getDescription(), lineLength, (status, value) -> { new StringListGUI(this.user, this.challenge.getDescription(), lineLength, (status, value) -> {
@ -426,11 +432,12 @@ public class EditChallengeGUI extends CommonGUI
} }
case ORDER: case ORDER:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.order"); name = this.user.getTranslation("challenges.gui.buttons.admin.order");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.order", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.order"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challenge.getOrder()))); "[value]", Integer.toString(this.challenge.getOrder())));
icon = new ItemStack(Material.DROPPER); icon = new ItemStack(Material.DROPPER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challenge.getOrder(), -1, 54, (status, value) -> { new NumberGUI(this.user, this.challenge.getOrder(), -1, 54, (status, value) -> {
@ -449,16 +456,18 @@ public class EditChallengeGUI extends CommonGUI
} }
case ENVIRONMENT: case ENVIRONMENT:
{ {
List<String> values = new ArrayList<>(World.Environment.values().length); name = this.user.getTranslation("challenges.gui.buttons.admin.environment");
for (World.Environment environment : World.Environment.values()) description = new ArrayList<>(4);
{ description.add(this.user.getTranslation("challenges.gui.descriptions.admin.environment"));
values.add((this.challenge.getEnvironment().contains(environment.name()) ? "&2" : "&c") +
this.user.getTranslation("challenges.gui.admin.descriptions." + environment.name().toLowerCase())); description.add((this.challenge.getEnvironment().contains(World.Environment.NORMAL) ? "&2" : "&c") +
} this.user.getTranslation("challenges.gui.descriptions.normal"));
description.add((this.challenge.getEnvironment().contains(World.Environment.NETHER) ? "&2" : "&c") +
this.user.getTranslation("challenges.gui.descriptions.nether"));
description.add((this.challenge.getEnvironment().contains(World.Environment.THE_END) ? "&2" : "&c") +
this.user.getTranslation("challenges.gui.descriptions.the-end"));
name = this.user.getTranslation("challenges.gui.admin.buttons.environment");
description = values;
icon = new ItemStack(Material.DROPPER); icon = new ItemStack(Material.DROPPER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new SelectEnvironmentGUI(this.user, this.challenge.getEnvironment(), (status, value) -> { new SelectEnvironmentGUI(this.user, this.challenge.getEnvironment(), (status, value) -> {
@ -477,8 +486,14 @@ public class EditChallengeGUI extends CommonGUI
} }
case REMOVE_ON_COMPLETE: case REMOVE_ON_COMPLETE:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.remove-on-complete"); name = this.user.getTranslation("challenges.gui.buttons.admin.remove-on-complete");
description = Collections.emptyList(); description = new ArrayList<>(2);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.remove-on-complete"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]",
this.challenge.isRemoveWhenCompleted() ?
this.user.getTranslation("challenges.gui.descriptions.enabled") :
this.user.getTranslation("challenges.gui.descriptions.disabled")));
if (this.challenge.isRemoveWhenCompleted()) if (this.challenge.isRemoveWhenCompleted())
{ {
@ -500,8 +515,12 @@ public class EditChallengeGUI extends CommonGUI
} }
case NAME: case NAME:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.name"); name = this.user.getTranslation("challenges.gui.buttons.admin.name");
description = Collections.emptyList(); description = new ArrayList<>(2);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.name-challenge"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", this.challenge.getFriendlyName()));
icon = new ItemStack(Material.DROPPER); icon = new ItemStack(Material.DROPPER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new AnvilGUI(this.addon.getPlugin(), new AnvilGUI(this.addon.getPlugin(),
@ -521,15 +540,18 @@ public class EditChallengeGUI extends CommonGUI
case REQUIRED_ENTITIES: case REQUIRED_ENTITIES:
{ {
List<String> values = new ArrayList<>(this.challenge.getRequiredEntities().size()); name = this.user.getTranslation("challenges.gui.buttons.admin.required-entities");
description = new ArrayList<>(this.challenge.getRequiredEntities().size() + 1);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.required-entities"));
for (Map.Entry<EntityType, Integer> entry : this.challenge.getRequiredEntities().entrySet()) for (Map.Entry<EntityType, Integer> entry : this.challenge.getRequiredEntities().entrySet())
{ {
values.add(entry.getKey().name() + " " + entry.getValue()); description.add(this.user.getTranslation("challenges.gui.descriptions.entity",
"[entity]", entry.getKey().name(),
"[count]", Integer.toString(entry.getValue())));
} }
name = this.user.getTranslation("challenges.gui.admin.buttons.entities");
description = values;
icon = new ItemStack(Material.CREEPER_HEAD); icon = new ItemStack(Material.CREEPER_HEAD);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new ManageEntitiesGUI(this.addon, new ManageEntitiesGUI(this.addon,
@ -547,16 +569,14 @@ public class EditChallengeGUI extends CommonGUI
} }
case REMOVE_ENTITIES: case REMOVE_ENTITIES:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.remove-entities"); name = this.user.getTranslation("challenges.gui.buttons.admin.remove-entities");
description = new ArrayList<>(2);
if (this.challenge.isRemoveEntities()) description.add(this.user.getTranslation("challenges.gui.descriptions.admin.remove-entities"));
{ description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.enabled")); "[value]",
} this.challenge.isRemoveEntities() ?
else this.user.getTranslation("challenges.gui.descriptions.enabled") :
{ this.user.getTranslation("challenges.gui.descriptions.disabled")));
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.disabled"));
}
icon = new ItemStack(Material.LEVER); icon = new ItemStack(Material.LEVER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
@ -570,15 +590,18 @@ public class EditChallengeGUI extends CommonGUI
} }
case REQUIRED_BLOCKS: case REQUIRED_BLOCKS:
{ {
List<String> values = new ArrayList<>(this.challenge.getRequiredBlocks().size()); name = this.user.getTranslation("challenges.gui.buttons.admin.required-blocks");
description = new ArrayList<>(this.challenge.getRequiredEntities().size() + 1);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.required-blocks"));
for (Map.Entry<Material, Integer> entry : this.challenge.getRequiredBlocks().entrySet()) for (Map.Entry<Material, Integer> entry : this.challenge.getRequiredBlocks().entrySet())
{ {
values.add(entry.getKey().name() + " " + entry.getValue()); description.add(this.user.getTranslation("challenges.gui.descriptions.block",
"[block]", entry.getKey().name(),
"[count]", Integer.toString(entry.getValue())));
} }
name = this.user.getTranslation("challenges.gui.admin.buttons.blocks");
description = values;
icon = new ItemStack(Material.STONE); icon = new ItemStack(Material.STONE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new ManageBlocksGUI(this.addon, new ManageBlocksGUI(this.addon,
@ -596,16 +619,14 @@ public class EditChallengeGUI extends CommonGUI
} }
case REMOVE_BLOCKS: case REMOVE_BLOCKS:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.remove-blocks"); name = this.user.getTranslation("challenges.gui.buttons.admin.remove-blocks");
description = new ArrayList<>(2);
if (this.challenge.isRemoveBlocks()) description.add(this.user.getTranslation("challenges.gui.descriptions.admin.remove-blocks"));
{ description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.enabled")); "[value]",
} this.challenge.isRemoveBlocks() ?
else this.user.getTranslation("challenges.gui.descriptions.enabled") :
{ this.user.getTranslation("challenges.gui.descriptions.disabled")));
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.disabled"));
}
icon = new ItemStack(Material.LEVER); icon = new ItemStack(Material.LEVER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
@ -619,11 +640,12 @@ public class EditChallengeGUI extends CommonGUI
} }
case SEARCH_RADIUS: case SEARCH_RADIUS:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.search-radius"); name = this.user.getTranslation("challenges.gui.buttons.admin.search-radius");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.search-radius", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.search-radius"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challenge.getSearchRadius()))); "[value]", Integer.toString(this.challenge.getSearchRadius())));
icon = new ItemStack(Material.COBBLESTONE_WALL); icon = new ItemStack(Material.COBBLESTONE_WALL);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challenge.getSearchRadius(), 0, (status, value) -> { new NumberGUI(this.user, this.challenge.getSearchRadius(), 0, (status, value) -> {
@ -642,8 +664,17 @@ public class EditChallengeGUI extends CommonGUI
} }
case REQUIRED_PERMISSIONS: case REQUIRED_PERMISSIONS:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.permissions"); name = this.user.getTranslation("challenges.gui.buttons.admin.required-permissions");
description = new ArrayList<>(this.challenge.getRequiredPermissions()); description = new ArrayList<>(this.challenge.getRequiredPermissions().size() + 1);
description.add(this.user.getTranslation(
"challenges.gui.descriptions.admin.required-permissions"));
for (String permission : this.challenge.getRequiredPermissions())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.permission",
"[permission]", permission));
}
icon = new ItemStack(Material.REDSTONE_LAMP); icon = new ItemStack(Material.REDSTONE_LAMP);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new StringListGUI(this.user, this.challenge.getRequiredPermissions(), lineLength, (status, value) -> { new StringListGUI(this.user, this.challenge.getRequiredPermissions(), lineLength, (status, value) -> {
@ -662,15 +693,30 @@ public class EditChallengeGUI extends CommonGUI
} }
case REQUIRED_ITEMS: case REQUIRED_ITEMS:
{ {
List<String> values = new ArrayList<>(this.challenge.getRequiredItems().size()); name = this.user.getTranslation("challenges.gui.buttons.admin.required-items");
description = new ArrayList<>(this.challenge.getRequiredEntities().size() + 1);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.required-items"));
for (ItemStack itemStack : this.challenge.getRequiredItems()) for (ItemStack itemStack : this.challenge.getRequiredItems())
{ {
values.add(itemStack.getType().name() + " " + itemStack.getAmount()); description.add(this.user.getTranslation("challenges.gui.descriptions.item",
"[item]", itemStack.getType().name(),
"[count]", Integer.toString(itemStack.getAmount())));
if (itemStack.hasItemMeta() && itemStack.getEnchantments().isEmpty())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.item-meta",
"[meta]", itemStack.getItemMeta().toString()));
}
for (Map.Entry<Enchantment, Integer> entry : itemStack.getEnchantments().entrySet())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.item-enchant",
"[enchant]", entry.getKey().getKey().getKey(), "[level]", Integer.toString(entry.getValue())));
}
} }
name = this.user.getTranslation("challenges.gui.admin.buttons.required-items");
description = values;
icon = new ItemStack(Material.CHEST); icon = new ItemStack(Material.CHEST);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new ItemSwitchGUI(this.user, this.challenge.getRequiredItems(), lineLength, (status, value) -> { new ItemSwitchGUI(this.user, this.challenge.getRequiredItems(), lineLength, (status, value) -> {
@ -689,16 +735,14 @@ public class EditChallengeGUI extends CommonGUI
} }
case REMOVE_ITEMS: case REMOVE_ITEMS:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.remove-items"); name = this.user.getTranslation("challenges.gui.buttons.admin.remove-items");
description = new ArrayList<>(2);
if (this.challenge.isTakeItems()) description.add(this.user.getTranslation("challenges.gui.descriptions.admin.remove-items"));
{ description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.enabled")); "[value]",
} this.challenge.isTakeItems() ?
else this.user.getTranslation("challenges.gui.descriptions.enabled") :
{ this.user.getTranslation("challenges.gui.descriptions.disabled")));
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.disabled"));
}
icon = new ItemStack(Material.LEVER); icon = new ItemStack(Material.LEVER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
@ -712,11 +756,12 @@ public class EditChallengeGUI extends CommonGUI
} }
case REQUIRED_EXPERIENCE: case REQUIRED_EXPERIENCE:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.required-exp"); name = this.user.getTranslation("challenges.gui.buttons.admin.required-experience");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.required-exp", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.required-experience"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challenge.getRequiredExperience()))); "[value]", Integer.toString(this.challenge.getRequiredExperience())));
icon = new ItemStack(Material.EXPERIENCE_BOTTLE); icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challenge.getRequiredExperience(), 0, (status, value) -> { new NumberGUI(this.user, this.challenge.getRequiredExperience(), 0, (status, value) -> {
@ -734,16 +779,14 @@ public class EditChallengeGUI extends CommonGUI
} }
case REMOVE_EXPERIENCE: case REMOVE_EXPERIENCE:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.remove-exp"); name = this.user.getTranslation("challenges.gui.buttons.admin.remove-experience");
description = new ArrayList<>(2);
if (this.challenge.isTakeExperience()) description.add(this.user.getTranslation("challenges.gui.descriptions.admin.remove-experience"));
{ description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.enabled")); "[value]",
} this.challenge.isTakeExperience() ?
else this.user.getTranslation("challenges.gui.descriptions.enabled") :
{ this.user.getTranslation("challenges.gui.descriptions.disabled")));
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.disabled"));
}
icon = new ItemStack(Material.LEVER); icon = new ItemStack(Material.LEVER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
@ -757,11 +800,11 @@ public class EditChallengeGUI extends CommonGUI
} }
case REQUIRED_LEVEL: case REQUIRED_LEVEL:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.required-level"); name = this.user.getTranslation("challenges.gui.buttons.admin.required-level");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.required-level", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.required-level"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Long.toString(this.challenge.getRequiredIslandLevel()))); "[value]", Long.toString(this.challenge.getRequiredIslandLevel())));
if (this.addon.isLevelProvided()) if (this.addon.isLevelProvided())
{ {
@ -790,11 +833,11 @@ public class EditChallengeGUI extends CommonGUI
} }
case REQUIRED_MONEY: case REQUIRED_MONEY:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.required-money"); name = this.user.getTranslation("challenges.gui.buttons.admin.required-money");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.required-money", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.required-money"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challenge.getRequiredMoney()))); "[value]", Long.toString(this.challenge.getRequiredIslandLevel())));
if (this.addon.isEconomyProvided()) if (this.addon.isEconomyProvided())
{ {
@ -822,18 +865,14 @@ public class EditChallengeGUI extends CommonGUI
} }
case REMOVE_MONEY: case REMOVE_MONEY:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.remove-money"); name = this.user.getTranslation("challenges.gui.buttons.admin.remove-money");
description = new ArrayList<>(2);
if (this.challenge.isTakeMoney()) description.add(this.user.getTranslation("challenges.gui.descriptions.admin.remove-money"));
{ description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
description = Collections.singletonList(this.user "[value]",
.getTranslation("challenges.gui.admin.descriptions.enabled")); this.challenge.isTakeMoney() ?
} this.user.getTranslation("challenges.gui.descriptions.enabled") :
else this.user.getTranslation("challenges.gui.descriptions.disabled")));
{
description = Collections.singletonList(this.user
.getTranslation("challenges.gui.admin.descriptions.disabled"));
}
if (this.addon.isEconomyProvided()) if (this.addon.isEconomyProvided())
{ {
@ -857,8 +896,12 @@ public class EditChallengeGUI extends CommonGUI
case REWARD_TEXT: case REWARD_TEXT:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.reward-text"); name = this.user.getTranslation("challenges.gui.buttons.admin.reward-text");
description = Collections.singletonList(this.challenge.getRewardText()); description = new ArrayList<>(2);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.reward-text"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", "|" + this.challenge.getRewardText()));
icon = new ItemStack(Material.WRITTEN_BOOK); icon = new ItemStack(Material.WRITTEN_BOOK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new AnvilGUI(this.addon.getPlugin(), new AnvilGUI(this.addon.getPlugin(),
@ -877,15 +920,30 @@ public class EditChallengeGUI extends CommonGUI
} }
case REWARD_ITEM: case REWARD_ITEM:
{ {
List<String> values = new ArrayList<>(this.challenge.getRewardItems().size()); name = this.user.getTranslation("challenges.gui.buttons.admin.reward-items");
description = new ArrayList<>(this.challenge.getRewardItems().size() + 1);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.reward-items"));
for (ItemStack itemStack : this.challenge.getRewardItems()) for (ItemStack itemStack : this.challenge.getRewardItems())
{ {
values.add(itemStack.getType().name() + " " + itemStack.getAmount()); description.add(this.user.getTranslation("challenges.gui.descriptions.item",
"[item]", itemStack.getType().name(),
"[count]", Integer.toString(itemStack.getAmount())));
if (itemStack.hasItemMeta() && itemStack.getEnchantments().isEmpty())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.item-meta",
"[meta]", itemStack.getItemMeta().toString()));
}
for (Map.Entry<Enchantment, Integer> entry : itemStack.getEnchantments().entrySet())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.item-enchant",
"[enchant]", entry.getKey().getKey().getKey(), "[level]", Integer.toString(entry.getValue())));
}
} }
name = this.user.getTranslation("challenges.gui.admin.buttons.reward-items");
description = values;
icon = new ItemStack(Material.CHEST); icon = new ItemStack(Material.CHEST);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new ItemSwitchGUI(this.user, this.challenge.getRewardItems(), lineLength, (status, value) -> { new ItemSwitchGUI(this.user, this.challenge.getRewardItems(), lineLength, (status, value) -> {
@ -904,11 +962,11 @@ public class EditChallengeGUI extends CommonGUI
} }
case REWARD_EXPERIENCE: case REWARD_EXPERIENCE:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.reward-exp"); name = this.user.getTranslation("challenges.gui.buttons.admin.reward-experience");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.reward-exp", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.reward-experience"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challenge.getRewardExperience()))); "[value]", Integer.toString(this.challenge.getRewardExperience())));
icon = new ItemStack(Material.EXPERIENCE_BOTTLE); icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challenge.getRewardExperience(), 0, (status, value) -> { new NumberGUI(this.user, this.challenge.getRewardExperience(), 0, (status, value) -> {
@ -927,11 +985,11 @@ public class EditChallengeGUI extends CommonGUI
} }
case REWARD_MONEY: case REWARD_MONEY:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.reward-money"); name = this.user.getTranslation("challenges.gui.buttons.admin.reward-money");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.reward-money", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.reward-money"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challenge.getRewardMoney()))); "[value]", Integer.toString(this.challenge.getRewardMoney())));
if (this.addon.isEconomyProvided()) if (this.addon.isEconomyProvided())
{ {
@ -960,8 +1018,16 @@ public class EditChallengeGUI extends CommonGUI
} }
case REWARD_COMMANDS: case REWARD_COMMANDS:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.reward-command"); name = this.user.getTranslation("challenges.gui.buttons.admin.reward-commands");
description = this.challenge.getRewardCommands(); description = new ArrayList<>(this.challenge.getRewardCommands().size() + 1);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.reward-commands"));
for (String command : this.challenge.getRewardCommands())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.command",
"[command]", command));
}
icon = new ItemStack(Material.COMMAND_BLOCK); icon = new ItemStack(Material.COMMAND_BLOCK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new StringListGUI(this.user, this.challenge.getRewardCommands(), lineLength, (status, value) -> { new StringListGUI(this.user, this.challenge.getRewardCommands(), lineLength, (status, value) -> {
@ -981,16 +1047,14 @@ public class EditChallengeGUI extends CommonGUI
case REPEATABLE: case REPEATABLE:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.repeatable"); name = this.user.getTranslation("challenges.gui.buttons.admin.repeatable");
description = new ArrayList<>(2);
if (this.challenge.isRepeatable()) description.add(this.user.getTranslation("challenges.gui.descriptions.admin.repeatable"));
{ description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.enabled")); "[value]",
} this.challenge.isRepeatable() ?
else this.user.getTranslation("challenges.gui.descriptions.enabled") :
{ this.user.getTranslation("challenges.gui.descriptions.disabled")));
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.disabled"));
}
icon = new ItemStack(Material.LEVER); icon = new ItemStack(Material.LEVER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
@ -1004,11 +1068,12 @@ public class EditChallengeGUI extends CommonGUI
} }
case REPEAT_COUNT: case REPEAT_COUNT:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.repeat-count"); name = this.user.getTranslation("challenges.gui.buttons.admin.repeat-count");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.repeat-count", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.repeat-count"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challenge.getMaxTimes()))); "[value]", Integer.toString(this.challenge.getMaxTimes())));
icon = new ItemStack(Material.COBBLESTONE_WALL); icon = new ItemStack(Material.COBBLESTONE_WALL);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challenge.getMaxTimes(), 0, (status, value) -> { new NumberGUI(this.user, this.challenge.getMaxTimes(), 0, (status, value) -> {
@ -1028,8 +1093,12 @@ public class EditChallengeGUI extends CommonGUI
case REPEAT_REWARD_TEXT: case REPEAT_REWARD_TEXT:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.repeat-reward-text"); name = this.user.getTranslation("challenges.gui.buttons.admin.repeat-reward-text");
description = Collections.singletonList(this.challenge.getRepeatRewardText()); description = new ArrayList<>(2);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.repeat-reward-text"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", "|" + this.challenge.getRepeatRewardText()));
icon = new ItemStack(Material.WRITTEN_BOOK); icon = new ItemStack(Material.WRITTEN_BOOK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new AnvilGUI(this.addon.getPlugin(), new AnvilGUI(this.addon.getPlugin(),
@ -1048,15 +1117,30 @@ public class EditChallengeGUI extends CommonGUI
} }
case REPEAT_REWARD_ITEM: case REPEAT_REWARD_ITEM:
{ {
List<String> values = new ArrayList<>(this.challenge.getRepeatItemReward().size()); name = this.user.getTranslation("challenges.gui.buttons.admin.repeat-reward-items");
description = new ArrayList<>(this.challenge.getRepeatItemReward().size() + 1);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.repeat-reward-items"));
for (ItemStack itemStack : this.challenge.getRepeatItemReward()) for (ItemStack itemStack : this.challenge.getRepeatItemReward())
{ {
values.add(itemStack.getType().name() + " " + itemStack.getAmount()); description.add(this.user.getTranslation("challenges.gui.descriptions.item",
"[item]", itemStack.getType().name(),
"[count]", Integer.toString(itemStack.getAmount())));
if (itemStack.hasItemMeta() && itemStack.getEnchantments().isEmpty())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.item-meta",
"[meta]", itemStack.getItemMeta().toString()));
}
for (Map.Entry<Enchantment, Integer> entry : itemStack.getEnchantments().entrySet())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.item-enchant",
"[enchant]", entry.getKey().getKey().getKey(), "[level]", Integer.toString(entry.getValue())));
}
} }
name = this.user.getTranslation("challenges.gui.admin.buttons.repeat-reward-items");
description = values;
icon = new ItemStack(Material.TRAPPED_CHEST); icon = new ItemStack(Material.TRAPPED_CHEST);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new ItemSwitchGUI(this.user, this.challenge.getRepeatItemReward(), lineLength, (status, value) -> { new ItemSwitchGUI(this.user, this.challenge.getRepeatItemReward(), lineLength, (status, value) -> {
@ -1075,11 +1159,12 @@ public class EditChallengeGUI extends CommonGUI
} }
case REPEAT_REWARD_EXPERIENCE: case REPEAT_REWARD_EXPERIENCE:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.repeat-reward-exp"); name = this.user.getTranslation("challenges.gui.buttons.admin.repeat-reward-experience");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.repeat-reward-exp", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.repeat-reward-experience"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challenge.getRepeatExperienceReward()))); "[value]", Integer.toString(this.challenge.getRepeatExperienceReward())));
icon = new ItemStack(Material.GLASS_BOTTLE); icon = new ItemStack(Material.GLASS_BOTTLE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challenge.getRepeatExperienceReward(), 0, (status, value) -> { new NumberGUI(this.user, this.challenge.getRepeatExperienceReward(), 0, (status, value) -> {
@ -1098,11 +1183,11 @@ public class EditChallengeGUI extends CommonGUI
} }
case REPEAT_REWARD_MONEY: case REPEAT_REWARD_MONEY:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.repeat-reward-money"); name = this.user.getTranslation("challenges.gui.buttons.admin.repeat-reward-money");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.repeat-reward-money", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.repeat-reward-money"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challenge.getRepeatMoneyReward()))); "[value]", Integer.toString(this.challenge.getRepeatMoneyReward())));
if (this.addon.isEconomyProvided()) if (this.addon.isEconomyProvided())
{ {
@ -1134,8 +1219,16 @@ public class EditChallengeGUI extends CommonGUI
} }
case REPEAT_REWARD_COMMANDS: case REPEAT_REWARD_COMMANDS:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.repeat-reward-command"); name = this.user.getTranslation("challenges.gui.buttons.admin.repeat-reward-commands");
description = this.challenge.getRepeatRewardCommands(); description = new ArrayList<>(this.challenge.getRepeatRewardCommands().size() + 1);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.repeat-reward-commands"));
for (String command : this.challenge.getRepeatRewardCommands())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.command",
"[command]", command));
}
icon = new ItemStack(Material.COMMAND_BLOCK); icon = new ItemStack(Material.COMMAND_BLOCK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new StringListGUI(this.user, this.challenge.getRepeatRewardCommands(), lineLength, (status, value) -> { new StringListGUI(this.user, this.challenge.getRepeatRewardCommands(), lineLength, (status, value) -> {

View File

@ -3,10 +3,12 @@ package world.bentobox.challenges.panel.admin;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import net.wesjd.anvilgui.AnvilGUI; import net.wesjd.anvilgui.AnvilGUI;
import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.PanelItem;
@ -80,7 +82,7 @@ public class EditLevelGUI extends CommonGUI
public void build() public void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name( PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
this.user.getTranslation("challenges.gui.admin.edit-level-title")); this.user.getTranslation("challenges.gui.title.admin.edit-level-title"));
GuiUtils.fillBorder(panelBuilder); GuiUtils.fillBorder(panelBuilder);
@ -200,7 +202,7 @@ public class EditLevelGUI extends CommonGUI
{ {
ItemStack icon; ItemStack icon;
String name; String name;
List<String> description; String description;
boolean glow; boolean glow;
PanelItem.ClickHandler clickHandler; PanelItem.ClickHandler clickHandler;
@ -208,8 +210,8 @@ public class EditLevelGUI extends CommonGUI
{ {
case PROPERTIES: case PROPERTIES:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.properties"); name = this.user.getTranslation("challenges.gui.buttons.admin.properties");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.properties");
icon = new ItemStack(Material.CRAFTING_TABLE); icon = new ItemStack(Material.CRAFTING_TABLE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.currentMenuType = MenuType.PROPERTIES; this.currentMenuType = MenuType.PROPERTIES;
@ -222,8 +224,8 @@ public class EditLevelGUI extends CommonGUI
} }
case CHALLENGES: case CHALLENGES:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.challenges"); name = this.user.getTranslation("challenges.gui.buttons.admin.challenges");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.challenges");
icon = new ItemStack(Material.RAIL); icon = new ItemStack(Material.RAIL);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.currentMenuType = MenuType.CHALLENGES; this.currentMenuType = MenuType.CHALLENGES;
@ -236,8 +238,8 @@ public class EditLevelGUI extends CommonGUI
} }
case REWARDS: case REWARDS:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.rewards"); name = this.user.getTranslation("challenges.gui.buttons.admin.rewards");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.rewards");
icon = new ItemStack(Material.DROPPER); icon = new ItemStack(Material.DROPPER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.currentMenuType = MenuType.REWARDS; this.currentMenuType = MenuType.REWARDS;
@ -305,8 +307,11 @@ public class EditLevelGUI extends CommonGUI
{ {
case NAME: case NAME:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.name"); name = this.user.getTranslation("challenges.gui.buttons.admin.name");
description = Collections.singletonList(this.challengeLevel.getFriendlyName()); description = new ArrayList<>(2);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.name-level"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", this.challengeLevel.getFriendlyName()));
icon = new ItemStack(Material.DROPPER); icon = new ItemStack(Material.DROPPER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new AnvilGUI(this.addon.getPlugin(), new AnvilGUI(this.addon.getPlugin(),
@ -325,8 +330,9 @@ public class EditLevelGUI extends CommonGUI
} }
case ICON: case ICON:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.icon"); name = this.user.getTranslation("challenges.gui.buttons.admin.icon");
description = Collections.emptyList(); description = Collections.singletonList(this.user.getTranslation(
"challenges.gui.descriptions.admin.icon-challenge"));
icon = this.challengeLevel.getIcon(); icon = this.challengeLevel.getIcon();
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new AnvilGUI(this.addon.getPlugin(), new AnvilGUI(this.addon.getPlugin(),
@ -355,8 +361,11 @@ public class EditLevelGUI extends CommonGUI
} }
case UNLOCK_MESSAGE: case UNLOCK_MESSAGE:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.description"); name = this.user.getTranslation("challenges.gui.buttons.admin.description");
description = Collections.singletonList(this.challengeLevel.getUnlockMessage()); description = new ArrayList<>(2);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.description"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", "|" + this.challengeLevel.getUnlockMessage()));
icon = new ItemStack(Material.WRITABLE_BOOK); icon = new ItemStack(Material.WRITABLE_BOOK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new AnvilGUI(this.addon.getPlugin(), new AnvilGUI(this.addon.getPlugin(),
@ -374,11 +383,11 @@ public class EditLevelGUI extends CommonGUI
} }
case ORDER: case ORDER:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.order"); name = this.user.getTranslation("challenges.gui.buttons.admin.order");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.order", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.order"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challengeLevel.getOrder()))); "[value]", Integer.toString(this.challengeLevel.getOrder())));
icon = new ItemStack(Material.DROPPER); icon = new ItemStack(Material.DROPPER);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challengeLevel.getOrder(), -1, 54, (status, value) -> { new NumberGUI(this.user, this.challengeLevel.getOrder(), -1, 54, (status, value) -> {
@ -397,11 +406,12 @@ public class EditLevelGUI extends CommonGUI
} }
case WAIVER_AMOUNT: case WAIVER_AMOUNT:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.waiver-amount"); name = this.user.getTranslation("challenges.gui.buttons.admin.waiver-amount");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.waiver-amount", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.waiver-amount"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challengeLevel.getWaiverAmount()))); "[value]", Integer.toString(this.challengeLevel.getWaiverAmount())));
icon = new ItemStack(Material.REDSTONE_TORCH); icon = new ItemStack(Material.REDSTONE_TORCH);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challengeLevel.getWaiverAmount(), 0, (status, value) -> { new NumberGUI(this.user, this.challengeLevel.getWaiverAmount(), 0, (status, value) -> {
@ -421,8 +431,11 @@ public class EditLevelGUI extends CommonGUI
case REWARD_DESCRIPTION: case REWARD_DESCRIPTION:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.reward-text"); name = this.user.getTranslation("challenges.gui.buttons.admin.reward-text");
description = Collections.singletonList(this.challengeLevel.getRewardText()); description = new ArrayList<>(2);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.reward-text-level"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", "|" + this.challengeLevel.getRewardText()));
icon = new ItemStack(Material.WRITTEN_BOOK); icon = new ItemStack(Material.WRITTEN_BOOK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new AnvilGUI(this.addon.getPlugin(), new AnvilGUI(this.addon.getPlugin(),
@ -440,15 +453,30 @@ public class EditLevelGUI extends CommonGUI
} }
case REWARD_ITEM: case REWARD_ITEM:
{ {
List<String> values = new ArrayList<>(this.challengeLevel.getRewardItems().size()); name = this.user.getTranslation("challenges.gui.buttons.admin.reward-items");
description = new ArrayList<>(this.challengeLevel.getRewardItems().size() + 1);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.reward-items"));
for (ItemStack itemStack : this.challengeLevel.getRewardItems()) for (ItemStack itemStack : this.challengeLevel.getRewardItems())
{ {
values.add(itemStack.getType().name() + " " + itemStack.getAmount()); description.add(this.user.getTranslation("challenges.gui.descriptions.item",
"[item]", itemStack.getType().name(),
"[count]", Integer.toString(itemStack.getAmount())));
if (itemStack.hasItemMeta() && itemStack.getEnchantments().isEmpty())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.item-meta",
"[meta]", itemStack.getItemMeta().toString()));
}
for (Map.Entry<Enchantment, Integer> entry : itemStack.getEnchantments().entrySet())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.item-enchant",
"[enchant]", entry.getKey().getKey().getKey(), "[level]", Integer.toString(entry.getValue())));
}
} }
name = this.user.getTranslation("challenges.gui.admin.buttons.reward-items");
description = values;
icon = new ItemStack(Material.CHEST); icon = new ItemStack(Material.CHEST);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new ItemSwitchGUI(this.user, this.challengeLevel.getRewardItems(), lineLength, (status, value) -> { new ItemSwitchGUI(this.user, this.challengeLevel.getRewardItems(), lineLength, (status, value) -> {
@ -467,11 +495,11 @@ public class EditLevelGUI extends CommonGUI
} }
case REWARD_EXPERIENCE: case REWARD_EXPERIENCE:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.reward-exp"); name = this.user.getTranslation("challenges.gui.buttons.admin.reward-experience");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.reward-exp", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.reward-experience"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challengeLevel.getRewardExperience()))); "[value]", Integer.toString(this.challengeLevel.getRewardExperience())));
icon = new ItemStack(Material.EXPERIENCE_BOTTLE); icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challengeLevel.getRewardExperience(), 0, (status, value) -> { new NumberGUI(this.user, this.challengeLevel.getRewardExperience(), 0, (status, value) -> {
@ -490,11 +518,11 @@ public class EditLevelGUI extends CommonGUI
} }
case REWARD_MONEY: case REWARD_MONEY:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.reward-money"); name = this.user.getTranslation("challenges.gui.buttons.admin.reward-money");
description = Collections.singletonList( description = new ArrayList<>(2);
this.user.getTranslation("challenges.gui.admin.descriptions.reward-money", description.add(this.user.getTranslation("challenges.gui.descriptions.admin.reward-money"));
"[value]", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
Integer.toString(this.challengeLevel.getRewardMoney()))); "[value]", Integer.toString(this.challengeLevel.getRewardMoney())));
if (this.addon.isEconomyProvided()) if (this.addon.isEconomyProvided())
{ {
@ -523,8 +551,16 @@ public class EditLevelGUI extends CommonGUI
} }
case REWARD_COMMANDS: case REWARD_COMMANDS:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.reward-command"); name = this.user.getTranslation("challenges.gui.buttons.admin.reward-commands");
description = this.challengeLevel.getRewardCommands(); description = new ArrayList<>(this.challengeLevel.getRewardCommands().size() + 1);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.reward-commands"));
for (String command : this.challengeLevel.getRewardCommands())
{
description.add(this.user.getTranslation("challenges.gui.descriptions.command",
"[command]", command));
}
icon = new ItemStack(Material.COMMAND_BLOCK); icon = new ItemStack(Material.COMMAND_BLOCK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new StringListGUI(this.user, this.challengeLevel.getRewardCommands(), lineLength, (status, value) -> { new StringListGUI(this.user, this.challengeLevel.getRewardCommands(), lineLength, (status, value) -> {
@ -544,8 +580,8 @@ public class EditLevelGUI extends CommonGUI
case ADD_CHALLENGE: case ADD_CHALLENGE:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.add-challenge"); name = this.user.getTranslation("challenges.gui.buttons.admin.add-challenge");
description = Collections.emptyList(); description = Collections.singletonList(this.user.getTranslation("challenges.gui.descriptions.admin.add-challenge"));
icon = new ItemStack(Material.WATER_BUCKET); icon = new ItemStack(Material.WATER_BUCKET);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
ChallengesManager manager = this.addon.getChallengesManager(); ChallengesManager manager = this.addon.getChallengesManager();
@ -570,8 +606,8 @@ public class EditLevelGUI extends CommonGUI
} }
case REMOVE_CHALLENGE: case REMOVE_CHALLENGE:
{ {
name = this.user.getTranslation("challenges.gui.admin.buttons.remove-challenge"); name = this.user.getTranslation("challenges.gui.buttons.admin.remove-challenge");
description = Collections.emptyList(); description = Collections.singletonList(this.user.getTranslation("challenges.gui.descriptions.admin.remove-challenge"));
icon = new ItemStack(Material.LAVA_BUCKET); icon = new ItemStack(Material.LAVA_BUCKET);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
ChallengesManager manager = this.addon.getChallengesManager(); ChallengesManager manager = this.addon.getChallengesManager();

View File

@ -4,6 +4,9 @@ package world.bentobox.challenges.panel.admin;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import java.util.ArrayList;
import java.util.List;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder; import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder; import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.api.user.User;
@ -60,15 +63,24 @@ public class EditSettingsGUI extends CommonGUI
public void build() public void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name( PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
this.user.getTranslation("challenges.gui.admin.settings-title")); this.user.getTranslation("challenges.gui.title.admin.settings-title"));
final int lineLength = this.addon.getChallengesSettings().getLoreLineLength(); final int lineLength = this.addon.getChallengesSettings().getLoreLineLength();
GuiUtils.fillBorder(panelBuilder); GuiUtils.fillBorder(panelBuilder);
// resetChallenges // resetChallenges
List<String> description = new ArrayList<>(2);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.reset-on-new"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]",
this.addon.getChallengesSettings().isResetChallenges() ?
this.user.getTranslation("challenges.gui.descriptions.enabled") :
this.user.getTranslation("challenges.gui.descriptions.disabled")));
panelBuilder.item(19, new PanelItemBuilder(). panelBuilder.item(19, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.reset")). name(this.user.getTranslation("challenges.gui.buttons.admin.reset-on-new")).
description(GuiUtils.stringSplit(this.user.getTranslation("challenges.gui.admin.descriptions.reset"), lineLength)). description(GuiUtils.stringSplit(description, lineLength)).
icon(Material.LAVA_BUCKET). icon(Material.LAVA_BUCKET).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
this.addon.getChallengesSettings().setResetChallenges( this.addon.getChallengesSettings().setResetChallenges(
@ -80,9 +92,17 @@ public class EditSettingsGUI extends CommonGUI
build()); build());
// broadcastMessages // broadcastMessages
description.clear();
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.broadcast"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]",
this.addon.getChallengesSettings().isBroadcastMessages() ?
this.user.getTranslation("challenges.gui.descriptions.enabled") :
this.user.getTranslation("challenges.gui.descriptions.disabled")));
panelBuilder.item(20, new PanelItemBuilder(). panelBuilder.item(20, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.broadcast")). name(this.user.getTranslation("challenges.gui.buttons.admin.broadcast")).
description(GuiUtils.stringSplit(this.user.getTranslation("challenges.gui.admin.descriptions.broadcast"), lineLength)). description(GuiUtils.stringSplit(description, lineLength)).
icon(Material.JUKEBOX). icon(Material.JUKEBOX).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
this.addon.getChallengesSettings().setBroadcastMessages( this.addon.getChallengesSettings().setBroadcastMessages(
@ -94,9 +114,17 @@ public class EditSettingsGUI extends CommonGUI
build()); build());
// removeCompleteOneTimeChallenges // removeCompleteOneTimeChallenges
description.clear();
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.remove-completed"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]",
this.addon.getChallengesSettings().isRemoveCompleteOneTimeChallenges() ?
this.user.getTranslation("challenges.gui.descriptions.enabled") :
this.user.getTranslation("challenges.gui.descriptions.disabled")));
panelBuilder.item(21, new PanelItemBuilder(). panelBuilder.item(21, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.remove-on-complete")). name(this.user.getTranslation("challenges.gui.buttons.admin.remove-completed")).
description(GuiUtils.stringSplit(this.user.getTranslation("challenges.gui.admin.descriptions.remove-on-complete"), lineLength)). description(GuiUtils.stringSplit(description, lineLength)).
icon(Material.MAGMA_BLOCK). icon(Material.MAGMA_BLOCK).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
this.addon.getChallengesSettings().setRemoveCompleteOneTimeChallenges( this.addon.getChallengesSettings().setRemoveCompleteOneTimeChallenges(
@ -108,9 +136,17 @@ public class EditSettingsGUI extends CommonGUI
build()); build());
// addCompletedGlow // addCompletedGlow
description.clear();
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.glow"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]",
this.addon.getChallengesSettings().isAddCompletedGlow() ?
this.user.getTranslation("challenges.gui.descriptions.enabled") :
this.user.getTranslation("challenges.gui.descriptions.disabled")));
panelBuilder.item(22, new PanelItemBuilder(). panelBuilder.item(22, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.glow")). name(this.user.getTranslation("challenges.gui.buttons.admin.glow")).
description(GuiUtils.stringSplit(this.user.getTranslation("challenges.gui.admin.descriptions.glow"), lineLength)). description(GuiUtils.stringSplit(description, lineLength)).
icon(Material.GLOWSTONE). icon(Material.GLOWSTONE).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
this.addon.getChallengesSettings().setAddCompletedGlow( this.addon.getChallengesSettings().setAddCompletedGlow(
@ -122,9 +158,17 @@ public class EditSettingsGUI extends CommonGUI
build()); build());
// freeChallengesAtTheTop // freeChallengesAtTheTop
description.clear();
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.free-at-top"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]",
this.addon.getChallengesSettings().isAddCompletedGlow() ?
this.user.getTranslation("challenges.gui.descriptions.enabled") :
this.user.getTranslation("challenges.gui.descriptions.disabled")));
panelBuilder.item(23, new PanelItemBuilder(). panelBuilder.item(23, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.free-challenges")). name(this.user.getTranslation("challenges.gui.buttons.admin.free-at-top")).
description(GuiUtils.stringSplit(this.user.getTranslation("challenges.gui.admin.descriptions.free-challenges"), lineLength)). description(GuiUtils.stringSplit(description, lineLength)).
icon(Material.FILLED_MAP). icon(Material.FILLED_MAP).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
this.addon.getChallengesSettings().setFreeChallengesFirst( this.addon.getChallengesSettings().setFreeChallengesFirst(
@ -136,9 +180,13 @@ public class EditSettingsGUI extends CommonGUI
build()); build());
// Lore line length // Lore line length
panelBuilder.item(23, new PanelItemBuilder(). description = new ArrayList<>(2);
name(this.user.getTranslation("challenges.gui.admin.buttons.lore-length")). description.add(this.user.getTranslation("challenges.gui.descriptions.admin.line-length"));
description(GuiUtils.stringSplit(this.user.getTranslation("challenges.gui.admin.descriptions.lore-length"), lineLength)). description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", Integer.toString(this.addon.getChallengesSettings().getLoreLineLength())));
panelBuilder.item(24, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.buttons.admin.line-length")).
description(GuiUtils.stringSplit(description, lineLength)).
icon(Material.ANVIL). icon(Material.ANVIL).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
new NumberGUI(this.user, new NumberGUI(this.user,

View File

@ -71,7 +71,7 @@ public class ListChallengesGUI extends CommonGUI
public void build() public void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name( PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
this.user.getTranslation("challenges.gui.admin.choose-challenge-title")); this.user.getTranslation("challenges.gui.title.admin.choose-challenge-title"));
if (this.currentMode.equals(Mode.DELETE)) if (this.currentMode.equals(Mode.DELETE))
{ {

View File

@ -71,7 +71,7 @@ public class ListLevelsGUI extends CommonGUI
public void build() public void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name( PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
this.user.getTranslation("challenges.gui.admin.choose-level-title")); this.user.getTranslation("challenges.gui.title.admin.choose-level-title"));
if (this.currentMode.equals(Mode.DELETE)) if (this.currentMode.equals(Mode.DELETE))
{ {

View File

@ -114,7 +114,7 @@ public class ListUsersGUI extends CommonGUI
public void build() public void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name( PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
this.user.getTranslation("challenges.gui.admin.choose-user-title")); this.user.getTranslation("challenges.gui.title.admin.choose-user-title"));
GuiUtils.fillBorder(panelBuilder); GuiUtils.fillBorder(panelBuilder);
@ -262,20 +262,18 @@ public class ListUsersGUI extends CommonGUI
*/ */
private PanelItem createToggleButton() private PanelItem createToggleButton()
{ {
List<String> values = new ArrayList<>(ViewMode.values().length); List<String> description = new ArrayList<>(ViewMode.values().length + 1);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.toggle-user-list"));
for (int i = 0; i < ViewMode.values().length; i++) description.add((ViewMode.ONLINE == ViewMode.values()[this.modeIndex] ? "&2" : "&c") +
{ this.user.getTranslation("challenges.gui.descriptions.admin.mode-online"));
values.add((this.modeIndex == i ? "&2" : "&c") + description.add((ViewMode.WITH_ISLAND == ViewMode.values()[this.modeIndex] ? "&2" : "&c") +
this.user.getTranslation("challenges.gui.admin.descriptions." + this.user.getTranslation("challenges.gui.descriptions.admin.mode-in-world"));
ViewMode.values()[i].name().toLowerCase())); description.add((ViewMode.IN_WORLD == ViewMode.values()[this.modeIndex] ? "&2" : "&c") +
} this.user.getTranslation("challenges.gui.descriptions.admin.mode-with-island"));
return new PanelItemBuilder(). return new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.toggle-users", name(this.user.getTranslation("challenges.gui.buttons.admin.toggle-user-list")).
"[value]", description(GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength())).
this.user.getTranslation("challenges.gui.admin.descriptions." + ViewMode.values()[this.modeIndex].name().toLowerCase()))).
description(GuiUtils.stringSplit(values, this.addon.getChallengesSettings().getLoreLineLength())).
icon(Material.STONE_BUTTON). icon(Material.STONE_BUTTON).
clickHandler( clickHandler(
(panel, user1, clickType, slot) -> { (panel, user1, clickType, slot) -> {

View File

@ -54,7 +54,7 @@ public class ManageBlocksGUI extends CommonGUI
public void build() public void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user). PanelBuilder panelBuilder = new PanelBuilder().user(this.user).
name(this.user.getTranslation("challenges.gui.admin.manage-blocks")); name(this.user.getTranslation("challenges.gui.title.admin.manage-blocks"));
// Create nice border. // Create nice border.
GuiUtils.fillBorder(panelBuilder); GuiUtils.fillBorder(panelBuilder);
@ -116,7 +116,7 @@ public class ManageBlocksGUI extends CommonGUI
switch (button) switch (button)
{ {
case ADD: case ADD:
builder.name(this.user.getTranslation("challenges.gui.button.add")); builder.name(this.user.getTranslation("challenges.gui.buttons.admin.add"));
builder.icon(Material.BUCKET); builder.icon(Material.BUCKET);
builder.clickHandler((panel, user1, clickType, slot) -> { builder.clickHandler((panel, user1, clickType, slot) -> {
@ -133,7 +133,8 @@ public class ManageBlocksGUI extends CommonGUI
}); });
break; break;
case REMOVE: case REMOVE:
builder.name(this.user.getTranslation("challenges.gui.button.remove-selected")); builder.name(this.user.getTranslation("challenges.gui.buttons.admin.remove-selected"));
builder.description(this.user.getTranslation("challenges.gui.descriptions.admin.remove-selected"));
builder.icon(Material.LAVA_BUCKET); builder.icon(Material.LAVA_BUCKET);
builder.clickHandler((panel, user1, clickType, slot) -> { builder.clickHandler((panel, user1, clickType, slot) -> {
this.materialMap.keySet().removeAll(this.selectedMaterials); this.materialMap.keySet().removeAll(this.selectedMaterials);
@ -158,6 +159,8 @@ public class ManageBlocksGUI extends CommonGUI
return new PanelItemBuilder(). return new PanelItemBuilder().
name(WordUtils.capitalize(material.name().toLowerCase().replace("_", " "))). name(WordUtils.capitalize(material.name().toLowerCase().replace("_", " "))).
icon(GuiUtils.getMaterialItem(material, this.materialMap.get(material))). icon(GuiUtils.getMaterialItem(material, this.materialMap.get(material))).
description(this.selectedMaterials.contains(material) ?
this.user.getTranslation("challenges.gui.descriptions.admin.selected") : "").
clickHandler((panel, user1, clickType, slot) -> { clickHandler((panel, user1, clickType, slot) -> {
// On right click change which entities are selected for deletion. // On right click change which entities are selected for deletion.
if (clickType.isRightClick()) if (clickType.isRightClick())

View File

@ -53,7 +53,7 @@ public class ManageEntitiesGUI extends CommonGUI
public void build() public void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user). PanelBuilder panelBuilder = new PanelBuilder().user(this.user).
name(this.user.getTranslation("challenges.gui.admin.edit-entities")); name(this.user.getTranslation("challenges.gui.title.admin.manage-entities"));
// create border // create border
GuiUtils.fillBorder(panelBuilder); GuiUtils.fillBorder(panelBuilder);
@ -116,7 +116,7 @@ public class ManageEntitiesGUI extends CommonGUI
switch (button) switch (button)
{ {
case ADD: case ADD:
builder.name(this.user.getTranslation("challenges.gui.button.add")); builder.name(this.user.getTranslation("challenges.gui.buttons.admin.add"));
builder.icon(Material.BUCKET); builder.icon(Material.BUCKET);
builder.clickHandler((panel, user1, clickType, slot) -> { builder.clickHandler((panel, user1, clickType, slot) -> {
new SelectEntityGUI(this.user, Collections.emptySet(), this.asEggs, (status, entity) -> { new SelectEntityGUI(this.user, Collections.emptySet(), this.asEggs, (status, entity) -> {
@ -135,7 +135,8 @@ public class ManageEntitiesGUI extends CommonGUI
}); });
break; break;
case REMOVE: case REMOVE:
builder.name(this.user.getTranslation("challenges.gui.button.remove-selected")); builder.name(this.user.getTranslation("challenges.gui.buttons.admin.remove-selected"));
builder.description(this.user.getTranslation("challenges.gui.descriptions.admin.remove-selected"));
builder.icon(Material.LAVA_BUCKET); builder.icon(Material.LAVA_BUCKET);
builder.clickHandler((panel, user1, clickType, slot) -> { builder.clickHandler((panel, user1, clickType, slot) -> {
this.requiredEntities.keySet().removeAll(this.selectedEntities); this.requiredEntities.keySet().removeAll(this.selectedEntities);
@ -145,7 +146,8 @@ public class ManageEntitiesGUI extends CommonGUI
}); });
break; break;
case SWITCH: case SWITCH:
builder.name(this.user.getTranslation("challenges.gui.button.show-eggs")); builder.name(this.user.getTranslation("challenges.gui.buttons.admin.show-eggs"));
builder.description(this.user.getTranslation("challenges.gui.descriptions.admin.show-eggs"));
builder.icon(this.asEggs ? Material.EGG : Material.PLAYER_HEAD); builder.icon(this.asEggs ? Material.EGG : Material.PLAYER_HEAD);
builder.clickHandler((panel, user1, clickType, slot) -> { builder.clickHandler((panel, user1, clickType, slot) -> {
this.asEggs = !this.asEggs; this.asEggs = !this.asEggs;
@ -168,6 +170,8 @@ public class ManageEntitiesGUI extends CommonGUI
{ {
return new PanelItemBuilder(). return new PanelItemBuilder().
name(WordUtils.capitalize(entity.name().toLowerCase().replace("_", " "))). name(WordUtils.capitalize(entity.name().toLowerCase().replace("_", " "))).
description(this.selectedEntities.contains(entity) ?
this.user.getTranslation("challenges.gui.descriptions.admin.selected") : "").
icon(this.asEggs ? icon(this.asEggs ?
GuiUtils.getEntityEgg(entity, this.requiredEntities.get(entity)) : GuiUtils.getEntityEgg(entity, this.requiredEntities.get(entity)) :
GuiUtils.getEntityHead(entity, this.requiredEntities.get(entity))). GuiUtils.getEntityHead(entity, this.requiredEntities.get(entity))).

View File

@ -3,9 +3,11 @@ package world.bentobox.challenges.panel.user;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder; import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
@ -82,7 +84,7 @@ public class ChallengesGUI extends CommonGUI
} }
PanelBuilder panelBuilder = new PanelBuilder().user(this.user). PanelBuilder panelBuilder = new PanelBuilder().user(this.user).
name(this.user.getTranslation("challenges.gui.title")); name(this.user.getTranslation("challenges.gui.title.challenges"));
// TODO: get last completed level. // TODO: get last completed level.
@ -372,14 +374,14 @@ public class ChallengesGUI extends CommonGUI
{ {
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
result.add(this.user.getTranslation("challenges.level", result.add(this.user.getTranslation("challenges.gui.challenge-description.level",
"[level]", this.challengesManager.getLevel(challenge).getFriendlyName())); "[level]", this.challengesManager.getLevel(challenge).getFriendlyName()));
boolean completed = this.challengesManager.isChallengeComplete(this.user, challenge); boolean completed = this.challengesManager.isChallengeComplete(this.user, challenge);
if (completed) if (completed)
{ {
result.add(this.user.getTranslation("challenges.complete")); result.add(this.user.getTranslation("challenges.gui.challenge-description.completed"));
} }
if (challenge.isRepeatable()) if (challenge.isRepeatable())
@ -391,7 +393,8 @@ public class ChallengesGUI extends CommonGUI
{ {
if (doneTimes < maxTimes) if (doneTimes < maxTimes)
{ {
result.add(this.user.getTranslation("challenges.completed-times", result.add(this.user.getTranslation(
"challenges.gui.challenge-description.completed-times-of",
"[donetimes]", String.valueOf(doneTimes), "[donetimes]", String.valueOf(doneTimes),
"[maxtimes]", String.valueOf(maxTimes))); "[maxtimes]", String.valueOf(maxTimes)));
@ -400,14 +403,14 @@ public class ChallengesGUI extends CommonGUI
} }
else else
{ {
result.add(this.user.getTranslation("challenges.maxed-reached", result.add(this.user.getTranslation("challenges.gui.challenge-description.maxed-reached",
"[donetimes]", String.valueOf(doneTimes), "[donetimes]", String.valueOf(doneTimes),
"[maxtimes]", String.valueOf(maxTimes))); "[maxtimes]", String.valueOf(maxTimes)));
} }
} }
else else
{ {
result.add(this.user.getTranslation("challenges.completed-times", result.add(this.user.getTranslation("challenges.gui.challenge-description.completed-times",
"[donetimes]", String.valueOf(doneTimes))); "[donetimes]", String.valueOf(doneTimes)));
// Change value to false, as max count not reached. // Change value to false, as max count not reached.
@ -423,28 +426,31 @@ public class ChallengesGUI extends CommonGUI
{ {
if (challenge.isTakeItems()) if (challenge.isTakeItems())
{ {
result.add(this.user.getTranslation("challenges.item-take-warning")); result.add(this.user.getTranslation(
"challenges.gui.challenge-description.warning-items-take"));
} }
} }
else if (challenge.getChallengeType().equals(Challenge.ChallengeType.ISLAND)) else if (challenge.getChallengeType().equals(Challenge.ChallengeType.ISLAND))
{ {
result.add(this.user.getTranslation("challenges.items-closeby")); result.add(this.user.getTranslation("challenges.gui.challenge-description.objects-close-by"));
if (challenge.isRemoveEntities() && !challenge.getRequiredEntities().isEmpty()) if (challenge.isRemoveEntities() && !challenge.getRequiredEntities().isEmpty())
{ {
result.add(this.user.getTranslation("challenges.entities-kill-warning")); result.add(this.user.getTranslation(
"challenges.gui.challenge-description.warning-entities-kill"));
} }
if (challenge.isRemoveBlocks() && !challenge.getRequiredBlocks().isEmpty()) if (challenge.isRemoveBlocks() && !challenge.getRequiredBlocks().isEmpty())
{ {
result.add(this.user.getTranslation("challenges.blocks-take-warning")); result.add(this.user.getTranslation(
"challenges.gui.challenge-description.warning-blocks-remove"));
} }
} }
} }
if (completed) if (completed)
{ {
result.add(this.user.getTranslation("challenges.not-repeatable")); result.add(this.user.getTranslation("challenges.gui.challenge-description.not-repeatable"));
} }
else else
{ {
@ -467,18 +473,24 @@ public class ChallengesGUI extends CommonGUI
String rewardText; String rewardText;
double rewardMoney; double rewardMoney;
int rewardExperience; int rewardExperience;
List<ItemStack> rewardItems;
List<String> rewardCommands;
if (!this.challengesManager.isChallengeComplete(this.user, challenge)) if (!this.challengesManager.isChallengeComplete(this.user, challenge))
{ {
rewardText = challenge.getRewardText(); rewardText = challenge.getRewardText();
rewardMoney = challenge.getRewardMoney(); rewardMoney = challenge.getRewardMoney();
rewardExperience = challenge.getRewardExperience(); rewardExperience = challenge.getRewardExperience();
rewardItems = challenge.getRewardItems();
rewardCommands = challenge.getRewardCommands();
} }
else else
{ {
rewardText = challenge.getRepeatRewardText(); rewardText = challenge.getRepeatRewardText();
rewardMoney = challenge.getRepeatMoneyReward(); rewardMoney = challenge.getRepeatMoneyReward();
rewardExperience = challenge.getRepeatExperienceReward(); rewardExperience = challenge.getRepeatExperienceReward();
rewardItems = challenge.getRepeatItemReward();
rewardCommands = challenge.getRepeatRewardCommands();
} }
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
@ -489,15 +501,48 @@ public class ChallengesGUI extends CommonGUI
// Add message about reward XP // Add message about reward XP
if (rewardExperience > 0) if (rewardExperience > 0)
{ {
result.add(this.user.getTranslation("challenges.exp-reward", result.add(this.user.getTranslation("challenges.gui.challenge-description.experience-reward",
"[reward]", Integer.toString(rewardExperience))); "[value]", Integer.toString(rewardExperience)));
} }
// Add message about reward money // Add message about reward money
if (this.addon.getPlugin().getSettings().isUseEconomy() && rewardMoney > 0) if (this.addon.getPlugin().getSettings().isUseEconomy() && rewardMoney > 0)
{ {
result.add(this.user.getTranslation("challenges.money-reward", result.add(this.user.getTranslation("challenges.gui.challenge-description.money-reward",
"[reward]", Double.toString(rewardMoney))); "[value]", Double.toString(rewardMoney)));
}
// Add message about reward items
if (!rewardItems.isEmpty())
{
for (ItemStack itemStack : rewardItems)
{
result.add(this.user.getTranslation("challenges.gui.descriptions.item",
"[item]", itemStack.getType().name(),
"[count]", Integer.toString(itemStack.getAmount())));
if (itemStack.hasItemMeta() && itemStack.getEnchantments().isEmpty())
{
result.add(this.user.getTranslation("challenges.gui.descriptions.item-meta",
"[meta]", itemStack.getItemMeta().toString()));
}
for (Map.Entry<Enchantment, Integer> entry : itemStack.getEnchantments().entrySet())
{
result.add(this.user.getTranslation("challenges.gui.descriptions.item-enchant",
"[enchant]", entry.getKey().getKey().getKey(), "[level]", Integer.toString(entry.getValue())));
}
}
}
// Add message about reward commands
if (!rewardCommands.isEmpty())
{
for (String command : rewardCommands)
{
result.add(this.user.getTranslation("challenges.gui.descriptions.command",
"[command]", command.replace("[player]", this.user.getName()).replace("[SELF]", "")));
}
} }
return result; return result;
@ -525,7 +570,7 @@ public class ChallengesGUI extends CommonGUI
{ {
icon = level.getLevel().getIcon(); icon = level.getLevel().getIcon();
description = GuiUtils.stringSplit( description = GuiUtils.stringSplit(
this.user.getTranslation("challenges.navigation", "[level]", name), this.user.getTranslation("challenges.gui.descriptions.level-unlocked", "[level]", name),
this.addon.getChallengesSettings().getLoreLineLength()); this.addon.getChallengesSettings().getLoreLineLength());
clickHandler = (panel, user1, clickType, slot) -> { clickHandler = (panel, user1, clickType, slot) -> {
this.lastSelectedLevel = level; this.lastSelectedLevel = level;
@ -544,9 +589,9 @@ public class ChallengesGUI extends CommonGUI
icon = new ItemStack(Material.BOOK); icon = new ItemStack(Material.BOOK);
description = GuiUtils.stringSplit( description = GuiUtils.stringSplit(
this.user.getTranslation("challenges.to-complete", this.user.getTranslation("challenges.gui.descriptions.level-locked",
"[challengesToDo]", Integer.toString(level.getNumberOfChallengesStillToDo()), "[count]", Integer.toString(level.getNumberOfChallengesStillToDo()),
"[thisLevel]", level.getPreviousLevel().getFriendlyName()), "[level]", level.getPreviousLevel().getFriendlyName()),
this.addon.getChallengesSettings().getLoreLineLength()); this.addon.getChallengesSettings().getLoreLineLength());
clickHandler = null; clickHandler = null;

View File

@ -37,7 +37,7 @@ public class ConfirmationGUI
*/ */
public void build() public void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.admin.confirm-title")); PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.title.admin.confirm-title"));
GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE); GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);

View File

@ -37,7 +37,7 @@ public class ItemSwitchGUI
*/ */
private void build() private void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.change-items")); PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.title.admin.manage-items"));
// Size of inventory that user can set via GUI. // Size of inventory that user can set via GUI.
panelBuilder.size(45); panelBuilder.size(45);
@ -78,7 +78,7 @@ public class ItemSwitchGUI
{ {
case SAVE: case SAVE:
{ {
name = this.user.getTranslation("challenges.gui.buttons.save"); name = this.user.getTranslation("challenges.gui.buttons.admin.save");
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.COMMAND_BLOCK); icon = new ItemStack(Material.COMMAND_BLOCK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
@ -104,7 +104,7 @@ public class ItemSwitchGUI
} }
case CANCEL: case CANCEL:
{ {
name = this.user.getTranslation("challenges.gui.buttons.cancel"); name = this.user.getTranslation("challenges.gui.buttons.admin.cancel");
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.IRON_DOOR); icon = new ItemStack(Material.IRON_DOOR);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {

View File

@ -4,7 +4,6 @@ package world.bentobox.challenges.panel.util;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import net.wesjd.anvilgui.AnvilGUI; import net.wesjd.anvilgui.AnvilGUI;
@ -55,7 +54,7 @@ public class NumberGUI
*/ */
private void build() private void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.edit-number-title")); PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.title.admin.manage-numbers"));
GuiUtils.fillBorder(panelBuilder); GuiUtils.fillBorder(panelBuilder);
@ -105,7 +104,7 @@ public class NumberGUI
{ {
ItemStack icon; ItemStack icon;
String name; String name;
List<String> description; String description;
PanelItem.ClickHandler clickHandler; PanelItem.ClickHandler clickHandler;
boolean glow; boolean glow;
@ -113,8 +112,8 @@ public class NumberGUI
{ {
case SAVE: case SAVE:
{ {
name = this.user.getTranslation("challenges.gui.buttons.save"); name = this.user.getTranslation("challenges.gui.buttons.admin.save");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.save");
icon = new ItemStack(Material.COMMAND_BLOCK); icon = new ItemStack(Material.COMMAND_BLOCK);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.consumer.accept(true, this.value); this.consumer.accept(true, this.value);
@ -125,8 +124,8 @@ public class NumberGUI
} }
case CANCEL: case CANCEL:
{ {
name = this.user.getTranslation("challenges.gui.buttons.cancel"); name = this.user.getTranslation("challenges.gui.buttons.admin.cancel");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.cancel");
icon = new ItemStack(Material.OAK_DOOR); icon = new ItemStack(Material.OAK_DOOR);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.consumer.accept(false, this.value); this.consumer.accept(false, this.value);
@ -137,8 +136,8 @@ public class NumberGUI
} }
case INPUT: case INPUT:
{ {
name = this.user.getTranslation("challenges.gui.buttons.input"); name = this.user.getTranslation("challenges.gui.buttons.admin.input");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.input");
icon = new ItemStack(Material.ANVIL); icon = new ItemStack(Material.ANVIL);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
new AnvilGUI(BentoBox.getInstance(), new AnvilGUI(BentoBox.getInstance(),
@ -151,7 +150,7 @@ public class NumberGUI
if (this.value > this.maxValue || this.value < this.minValue) if (this.value > this.maxValue || this.value < this.minValue)
{ {
this.user.sendMessage("challenges.error.not-valid-integer", this.user.sendMessage("challenges.errors.not-valid-integer",
"[value]", reply, "[value]", reply,
"[min]", Integer.toString(this.minValue), "[min]", Integer.toString(this.minValue),
"[max]", Integer.toString(this.maxValue)); "[max]", Integer.toString(this.maxValue));
@ -164,7 +163,7 @@ public class NumberGUI
catch (Exception e) catch (Exception e)
{ {
reply = Integer.toString(this.value); reply = Integer.toString(this.value);
this.user.sendMessage("challenges.error.not-a-integer", "[value]", reply); this.user.sendMessage("challenges.errors.not-a-integer", "[value]", reply);
} }
return reply; return reply;
@ -177,8 +176,8 @@ public class NumberGUI
} }
case VALUE: case VALUE:
{ {
name = this.user.getTranslation("challenges.gui.buttons.value"); name = this.user.getTranslation("challenges.gui.buttons.admin.value");
description = Collections.singletonList(Integer.toString(this.value)); description = this.user.getTranslation("challenges.gui.descriptions.current-value", "[value]", Integer.toString(this.value));
icon = new ItemStack(Material.PAPER); icon = new ItemStack(Material.PAPER);
clickHandler = (panel, user, clickType, slot) -> true; clickHandler = (panel, user, clickType, slot) -> true;
glow = false; glow = false;
@ -186,8 +185,8 @@ public class NumberGUI
} }
case SET: case SET:
{ {
name = this.user.getTranslation("challenges.gui.buttons.set"); name = this.user.getTranslation("challenges.gui.buttons.admin.set");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.set");
icon = new ItemStack(Material.WHITE_STAINED_GLASS_PANE); icon = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.currentOperation = Button.SET; this.currentOperation = Button.SET;
@ -199,8 +198,8 @@ public class NumberGUI
} }
case INCREASE: case INCREASE:
{ {
name = this.user.getTranslation("challenges.gui.buttons.increase"); name = this.user.getTranslation("challenges.gui.buttons.admin.increase");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.increase");
icon = new ItemStack(Material.GREEN_STAINED_GLASS_PANE); icon = new ItemStack(Material.GREEN_STAINED_GLASS_PANE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.currentOperation = Button.INCREASE; this.currentOperation = Button.INCREASE;
@ -212,8 +211,8 @@ public class NumberGUI
} }
case REDUCE: case REDUCE:
{ {
name = this.user.getTranslation("challenges.gui.buttons.reduce"); name = this.user.getTranslation("challenges.gui.buttons.admin.reduce");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.reduce");
icon = new ItemStack(Material.RED_STAINED_GLASS_PANE); icon = new ItemStack(Material.RED_STAINED_GLASS_PANE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.currentOperation = Button.REDUCE; this.currentOperation = Button.REDUCE;
@ -225,8 +224,8 @@ public class NumberGUI
} }
case MULTIPLY: case MULTIPLY:
{ {
name = this.user.getTranslation("challenges.gui.buttons.multiply"); name = this.user.getTranslation("challenges.gui.buttons.admin.multiply");
description = Collections.emptyList(); description = this.user.getTranslation("challenges.gui.descriptions.admin.multiply");
icon = new ItemStack(Material.BLUE_STAINED_GLASS_PANE); icon = new ItemStack(Material.BLUE_STAINED_GLASS_PANE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.currentOperation = Button.MULTIPLY; this.currentOperation = Button.MULTIPLY;
@ -257,14 +256,14 @@ public class NumberGUI
{ {
case SET: case SET:
{ {
itemBuilder.name(this.user.getTranslation("biomes.gui.buttons.set","[number]", Integer.toString(number))); itemBuilder.name(this.user.getTranslation("challenges.gui.buttons.admin.number","[number]", Integer.toString(number)));
itemBuilder.icon(Material.WHITE_STAINED_GLASS_PANE); itemBuilder.icon(Material.WHITE_STAINED_GLASS_PANE);
itemBuilder.clickHandler((panel, user1, clickType, i) -> { itemBuilder.clickHandler((panel, user1, clickType, i) -> {
this.value = number; this.value = number;
if (this.value > this.maxValue) if (this.value > this.maxValue)
{ {
this.user.sendMessage("challenges.error.not-valid-integer", this.user.sendMessage("challenges.errors.not-valid-integer",
"[value]", Integer.toString(this.value), "[value]", Integer.toString(this.value),
"[min]", Integer.toString(this.minValue), "[min]", Integer.toString(this.minValue),
"[max]", Integer.toString(this.maxValue)); "[max]", Integer.toString(this.maxValue));
@ -274,7 +273,7 @@ public class NumberGUI
if (this.value < this.minValue) if (this.value < this.minValue)
{ {
this.user.sendMessage("challenges.error.not-valid-integer", this.user.sendMessage("challenges.errors.not-valid-integer",
"[value]", Integer.toString(this.value), "[value]", Integer.toString(this.value),
"[min]", Integer.toString(this.minValue), "[min]", Integer.toString(this.minValue),
"[max]", Integer.toString(this.maxValue)); "[max]", Integer.toString(this.maxValue));
@ -290,14 +289,14 @@ public class NumberGUI
} }
case INCREASE: case INCREASE:
{ {
itemBuilder.name(this.user.getTranslation("biomes.gui.buttons.increase","[number]", Integer.toString(number))); itemBuilder.name(this.user.getTranslation("challenges.gui.buttons.admin.number","[number]", Integer.toString(number)));
itemBuilder.icon(Material.GREEN_STAINED_GLASS_PANE); itemBuilder.icon(Material.GREEN_STAINED_GLASS_PANE);
itemBuilder.clickHandler((panel, user1, clickType, i) -> { itemBuilder.clickHandler((panel, user1, clickType, i) -> {
this.value += number; this.value += number;
if (this.value > this.maxValue) if (this.value > this.maxValue)
{ {
this.user.sendMessage("challenges.error.not-valid-integer", this.user.sendMessage("challenges.errors.not-valid-integer",
"[value]", Integer.toString(this.value), "[value]", Integer.toString(this.value),
"[min]", Integer.toString(this.minValue), "[min]", Integer.toString(this.minValue),
"[max]", Integer.toString(this.maxValue)); "[max]", Integer.toString(this.maxValue));
@ -313,14 +312,14 @@ public class NumberGUI
} }
case REDUCE: case REDUCE:
{ {
itemBuilder.name(this.user.getTranslation("biomes.gui.buttons.reduce","[number]", Integer.toString(number))); itemBuilder.name(this.user.getTranslation("challenges.gui.buttons.admin.number","[number]", Integer.toString(number)));
itemBuilder.icon(Material.RED_STAINED_GLASS_PANE); itemBuilder.icon(Material.RED_STAINED_GLASS_PANE);
itemBuilder.clickHandler((panel, user1, clickType, i) -> { itemBuilder.clickHandler((panel, user1, clickType, i) -> {
this.value -= number; this.value -= number;
if (this.value < this.minValue) if (this.value < this.minValue)
{ {
this.user.sendMessage("challenges.error.not-valid-integer", this.user.sendMessage("challenges.errors.not-valid-integer",
"[value]", Integer.toString(this.value), "[value]", Integer.toString(this.value),
"[min]", Integer.toString(this.minValue), "[min]", Integer.toString(this.minValue),
"[max]", Integer.toString(this.maxValue)); "[max]", Integer.toString(this.maxValue));
@ -336,14 +335,14 @@ public class NumberGUI
} }
case MULTIPLY: case MULTIPLY:
{ {
itemBuilder.name(this.user.getTranslation("biomes.gui.buttons.multiply","[number]", Integer.toString(number))); itemBuilder.name(this.user.getTranslation("challenges.gui.buttons.admin.number","[number]", Integer.toString(number)));
itemBuilder.icon(Material.BLUE_STAINED_GLASS_PANE); itemBuilder.icon(Material.BLUE_STAINED_GLASS_PANE);
itemBuilder.clickHandler((panel, user1, clickType, i) -> { itemBuilder.clickHandler((panel, user1, clickType, i) -> {
this.value *= number; this.value *= number;
if (this.value > this.maxValue) if (this.value > this.maxValue)
{ {
this.user.sendMessage("challenges.error.not-valid-integer", this.user.sendMessage("challenges.errors.not-valid-integer",
"[value]", Integer.toString(this.value), "[value]", Integer.toString(this.value),
"[min]", Integer.toString(this.minValue), "[min]", Integer.toString(this.minValue),
"[max]", Integer.toString(this.maxValue)); "[max]", Integer.toString(this.maxValue));

View File

@ -71,7 +71,7 @@ public class SelectBlocksGUI
public void build(int pageIndex) public void build(int pageIndex)
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user). PanelBuilder panelBuilder = new PanelBuilder().user(this.user).
name(this.user.getTranslation("challenges.gui.admin.select-block")); name(this.user.getTranslation("challenges.gui.title.admin.select-block"));
GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE); GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
@ -110,7 +110,7 @@ public class SelectBlocksGUI
panelBuilder.item(4, panelBuilder.item(4,
new PanelItemBuilder(). new PanelItemBuilder().
icon(Material.RED_STAINED_GLASS_PANE). icon(Material.RED_STAINED_GLASS_PANE).
name(this.user.getTranslation("challenges.gui.buttons.cancel")). name(this.user.getTranslation("challenges.gui.buttons.admin.cancel")).
clickHandler( (panel, user1, clickType, slot) -> { clickHandler( (panel, user1, clickType, slot) -> {
this.consumer.accept(false, null); this.consumer.accept(false, null);
return true; return true;

View File

@ -34,7 +34,7 @@ public class SelectChallengeGUI
*/ */
private void build(int pageIndex) private void build(int pageIndex)
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.choose-challenge-title")); PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.title.admin.select-challenge"));
GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE); GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);

View File

@ -59,7 +59,7 @@ public class SelectEntityGUI
*/ */
private void build(int pageIndex) private void build(int pageIndex)
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.choose-entity-title")); PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.title.admin.select-entity"));
GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE); GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
@ -84,7 +84,7 @@ public class SelectEntityGUI
panelBuilder.item(4, panelBuilder.item(4,
new PanelItemBuilder(). new PanelItemBuilder().
icon(Material.RED_STAINED_GLASS_PANE). icon(Material.RED_STAINED_GLASS_PANE).
name(this.user.getTranslation("challenges.gui.buttons.cancel")). name(this.user.getTranslation("challenges.gui.buttons.admin.cancel")).
clickHandler( (panel, user1, clickType, slot) -> { clickHandler( (panel, user1, clickType, slot) -> {
this.consumer.accept(false, null); this.consumer.accept(false, null);
return true; return true;

View File

@ -34,12 +34,12 @@ public class SelectEnvironmentGUI
*/ */
private void build() private void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.admin.environment-title")); PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(this.user.getTranslation("challenges.gui.title.admin.toggle-environment"));
GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE); GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
panelBuilder.item(3, new PanelItemBuilder(). panelBuilder.item(3, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.save")). name(this.user.getTranslation("challenges.gui.buttons.admin.save")).
icon(Material.GREEN_STAINED_GLASS_PANE). icon(Material.GREEN_STAINED_GLASS_PANE).
clickHandler((panel, user1, clickType, index) -> { clickHandler((panel, user1, clickType, index) -> {
this.consumer.accept(true, this.values); this.consumer.accept(true, this.values);
@ -48,7 +48,7 @@ public class SelectEnvironmentGUI
build()); build());
panelBuilder.item(5, new PanelItemBuilder(). panelBuilder.item(5, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.cancel")). name(this.user.getTranslation("challenges.gui.buttons.admin.cancel")).
icon(Material.RED_STAINED_GLASS_PANE). icon(Material.RED_STAINED_GLASS_PANE).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
this.consumer.accept(false, Collections.emptySet()); this.consumer.accept(false, Collections.emptySet());
@ -57,7 +57,7 @@ public class SelectEnvironmentGUI
build()); build());
panelBuilder.item(20, new PanelItemBuilder(). panelBuilder.item(20, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.nether")). name(World.Environment.NETHER.name()).
icon(Material.NETHERRACK). icon(Material.NETHERRACK).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
if (this.values.contains(World.Environment.NETHER)) if (this.values.contains(World.Environment.NETHER))
@ -75,7 +75,7 @@ public class SelectEnvironmentGUI
glow(this.values.contains(World.Environment.NETHER)). glow(this.values.contains(World.Environment.NETHER)).
build()); build());
panelBuilder.item(22, new PanelItemBuilder(). panelBuilder.item(22, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.normal")). name(World.Environment.NORMAL.name()).
icon(Material.DIRT). icon(Material.DIRT).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
if (this.values.contains(World.Environment.NORMAL)) if (this.values.contains(World.Environment.NORMAL))
@ -93,7 +93,7 @@ public class SelectEnvironmentGUI
glow(this.values.contains(World.Environment.NORMAL)). glow(this.values.contains(World.Environment.NORMAL)).
build()); build());
panelBuilder.item(24, new PanelItemBuilder(). panelBuilder.item(24, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.end")). name(World.Environment.THE_END.name()).
icon(Material.END_STONE). icon(Material.END_STONE).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
if (this.values.contains(World.Environment.THE_END)) if (this.values.contains(World.Environment.THE_END))
@ -113,7 +113,7 @@ public class SelectEnvironmentGUI
panelBuilder.item(44, new PanelItemBuilder(). panelBuilder.item(44, new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons.return")). name(this.user.getTranslation("challenges.gui.buttons.return")).
icon(Material.OAK_DOOR). icon(Material.OAK_DOOR).
clickHandler((panel, user1, clickType, i) -> { clickHandler((panel, user1, clickType, i) -> {
this.consumer.accept(false, Collections.emptySet()); this.consumer.accept(false, Collections.emptySet());

View File

@ -55,7 +55,7 @@ public class StringListGUI
private void build() private void build()
{ {
PanelBuilder panelBuilder = new PanelBuilder().user(this.user). PanelBuilder panelBuilder = new PanelBuilder().user(this.user).
name(this.user.getTranslation("challenges.gui.text-edit-title")); name(this.user.getTranslation("challenges.gui.title.admin.edit-text-fields"));
GuiUtils.fillBorder(panelBuilder, Material.BLACK_STAINED_GLASS_PANE); GuiUtils.fillBorder(panelBuilder, Material.BLACK_STAINED_GLASS_PANE);
@ -101,8 +101,8 @@ public class StringListGUI
{ {
case SAVE: case SAVE:
{ {
name = this.user.getTranslation("challenges.gui.buttons.save"); name = this.user.getTranslation("challenges.gui.buttons.admin.save");
description = Collections.emptyList(); description = Collections.singletonList(this.user.getTranslation("challenges.gui.descriptions.admin.save"));
icon = new ItemStack(Material.GREEN_STAINED_GLASS_PANE); icon = new ItemStack(Material.GREEN_STAINED_GLASS_PANE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.consumer.accept(true, this.value); this.consumer.accept(true, this.value);
@ -113,8 +113,8 @@ public class StringListGUI
} }
case CANCEL: case CANCEL:
{ {
name = this.user.getTranslation("challenges.gui.buttons.cancel"); name = this.user.getTranslation("challenges.gui.buttons.admin.cancel");
description = Collections.emptyList(); description = Collections.singletonList(this.user.getTranslation("challenges.gui.descriptions.admin.cancel"));
icon = new ItemStack(Material.OAK_DOOR); icon = new ItemStack(Material.OAK_DOOR);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
this.consumer.accept(false, this.value); this.consumer.accept(false, this.value);
@ -125,15 +125,17 @@ public class StringListGUI
} }
case VALUE: case VALUE:
{ {
name = this.user.getTranslation("challenges.gui.buttons.value"); name = this.user.getTranslation("challenges.gui.buttons.admin.value");
description = this.value; description = new ArrayList<>();
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value", "[value]", ""));
description.addAll(this.value);
icon = new ItemStack(Material.PAPER); icon = new ItemStack(Material.PAPER);
clickHandler = (panel, user, clickType, slot) -> true; clickHandler = (panel, user, clickType, slot) -> true;
break; break;
} }
case ADD: case ADD:
{ {
name = this.user.getTranslation("challenges.gui.buttons.add"); name = this.user.getTranslation("challenges.gui.buttons.admin.add");
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.WHITE_STAINED_GLASS_PANE); icon = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
@ -151,7 +153,7 @@ public class StringListGUI
} }
case CLEAR: case CLEAR:
{ {
name = this.user.getTranslation("challenges.gui.buttons.clear"); name = this.user.getTranslation("challenges.gui.buttons.admin.clear");
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.RED_STAINED_GLASS_PANE); icon = new ItemStack(Material.RED_STAINED_GLASS_PANE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {
@ -163,7 +165,7 @@ public class StringListGUI
} }
case REMOVE: case REMOVE:
{ {
name = this.user.getTranslation("challenges.gui.buttons.remove"); name = this.user.getTranslation("challenges.gui.buttons.admin.remove-empty");
description = Collections.emptyList(); description = Collections.emptyList();
icon = new ItemStack(Material.BLUE_STAINED_GLASS_PANE); icon = new ItemStack(Material.BLUE_STAINED_GLASS_PANE);
clickHandler = (panel, user, clickType, slot) -> { clickHandler = (panel, user, clickType, slot) -> {

View File

@ -7,216 +7,281 @@
# Tastybento: maintainer # Tastybento: maintainer
challenges: challenges:
admin: commands:
challenge-created: '[challenge] created!'
complete:
description: Mark challenge complete
parameters: <player> <unique challenge name>
unknown-challenge: '&cUnknown challenge'
create:
description: '&6Collect:'
description-item-color: '&B'
inventory:
description: create an inventory challenge
parameters: '[challenge name]'
surrounding:
description: create a surrounding challenge
hit-things: Hit things to add them to the list of things required. Right click when done.
parameters: '[challenge name]'
description: challenges admin
error:
no-name: You must include a challenge name
gui-title: '&aChallenges Admin'
import:
add: 'Adding new challenge: [object]'
description: import challenges from challenges.yml
imported: Imported '[challenge]'
levels: 'Importing levels: [levels]'
no-file: '&cCould not find challenges.yml file to import!'
no-levels: 'Warning: No levels defined in challenges.yml'
no-load: '&cError: Could not load challenges.yml. [message]'
number: Imported [number] challenges
overwriting: Overwriting '[challenge]'
parameters: '[overwrite]'
skipping: '''[challenge]'' already exists - skipping'
parameters: ''
reload:
description: reload challenges from the database
parameters: ''
reset:
description: Reset challenge to 0 times / incomplete
parameters: <player> <unique challenge name>
seticon:
description: sets the challenge icon to inhand item
error:
no-such-challenge: '&cNo such challenge name'
parameters: '[challenge name]'
you-added: You added one [thing] to the challenge
blocks-take-warning: Blocks will be removed.
challenge:
format: '[description]'
complete: '&BComplete'
completechallenge:
challange-completed: 'Challenge: [challengename] has been completed for [name]'
completed-times: Completed [donetimes] out of [maxtimes]
description: Open the challenges menu
entities-kill-warning: Entities will be killed.
error:
could-not-save: '&cCould not save the challenge!'
island-level: '&cYour island must be level [number] to complete this challenge!'
items-not-there: '&cAll required items must be close to you on your island!'
no-items-clicked: '&cYou did not click on anything. Cancelling.'
not-close-enough: '&cYou must be standing within [number] blocks of all required
items.'
not-enough-items: '&cYou do not have enough [items] to complete this challenge!'
not-on-island: '&cYou must be on your island to do that!'
reward-problem: '&cThere was a problem giving your reward. Ask Admin to check
log!'
you-still-need: '&cYou still need [amount] x [item]'
not-deployed: '&cChallenge is not deployed.'
errors:
challenge-level-not-available: You have not unlocked level to complete this challenge.
unique-id: Unique ID [id] is already taken. Choose different.
wrong-environment: You are in wrong environment!
wrong-icon: Material [icon] is not recognized
exp-reward: '&6Exp reward: [reward]'
first-time-rewards: '&6First time reward(s)'
gui:
admin: admin:
buttons: main:
add-challenge: Create Challenge parameters: ''
add-level: Create Level description: 'Main admin command. Opens GUI.'
blocks: Blocks complete:
broadcast: Broadcast Messages description: 'Mark challenge complete'
challenges: Challenges parameters: '<player> <unique challenge name>'
complete: Complete create:
delete-challenge: Delete Challenge description: 'Opens GUI that allows to create challenge.'
delete-level: Delete Level parameters: '<unique challenge name>'
deployed: Deployment status surrounding:
description: Description description: 'Create a surrounding challenge.'
edit-challenge: Edit Challenge parameters: '<challenge name>'
edit-level: Edit Level import:
entities: Entities description: 'Import challenges from challenges.yml'
environment: Environment parameters: '<overwrite>'
free-challenges: Free Challenges Position reload:
glow: Completion Glowing description: 'Reload challenges from the database'
icon: Icon parameters: ''
name: Name reset:
order: Order Number description: 'Reset challenge to 0 times / incomplete'
permissions: Permissions parameters: '<player> <unique challenge name>'
properties: Properties show:
remove-blocks: Remove Blocks description: 'This method prints in chat all challenges that exist in world.'
remove-challenge: Remove Challenge parameters: ''
remove-entities: Remove Entities user:
remove-exp: Take Experience description: 'This method opens Challenges GUI.'
remove-items: Remove items parameters: ''
remove-money: Remove Money gui:
remove-on-complete: Remove on completion title:
repeat-count: Repeat Count admin:
repeat-reward-command: Repeat Reward Command gui-title: '&aChallenges Admin'
repeat-reward-exp: Repeat Reward Experience edit-challenge-title: '&aEdit Challenge'
repeat-reward-items: Repeat Reward Items edit-level-title: '&aEdit Level'
repeat-reward-money: Repeat Reward Money settings-title: '&aEdit Settings'
repeat-reward-text: Repeat Reward Text choose-challenge-title: '&aChoose Challenge'
repeatable: Repeatable choose-level-title: '&aChoose Level'
required-exp: Required Experience choose-user-title: '&aChoose Player'
required-items: Required items manage-blocks: '&aManage Blocks'
required-level: Required Island Level manage-entities: '&aManage Entities'
required-money: Required Money confirm-title: '&aConfirmation'
requirements: Requirements manage-items: '&aManage Items'
reset: Reset manage-numbers: '&aNumber Pad'
reward-command: Reward Command select-block: '&aSelect Block'
reward-exp: Reward Experience select-challenge: '&aSelect Challenge'
reward-items: Reward Items select-entity: '&aSelect Entity'
reward-money: Reward Money toggle-environment: '&aToggle Environment'
reward-text: Reward Text edit-text-fields: '&aEdit Text Fields'
rewards: Rewards challenges: '&aChallenges'
search-radius: Search radius
settings: Settings
toggle-users: Choose players
type: 'Challenge Type: [value]'
waiver-amount: Waiver Amount
import: Import from ASkyBlock Challenges
backward: Import from Older ChallengesAddon
choose-challenge-title: Challenges List
choose-level-title: Levels List
choose-user-title: Users List
descriptions:
broadcast: Broadcast 1st time challenge completion messages to all players.
disabled: disabled
enabled: enabled
free-challenges: This indicate if free challenges must be at the start (true) or at the end (false) of list.
glow: Add enchanted glow to completed challenges
in_world: In World
inventory: This type of challenges allows to define inventory item requirements.
island: This type of challenges allows to define blocks and entities on island requirements.
nether: Nether
normal: Normal
online: Online
order: Current order [value]
other: This type of challenges allows to define Money, Experience or island level requirements.
remove-on-complete: Remove non-repeatable challenges from the challenge GUI when complete.
repeat-count: 'Current value: [value]'
repeat-reward-exp: 'Current value: [value]'
repeat-reward-money: 'Current value: [value]'
required-exp: Current necessary [value]
required-level: 'Current value: [value]'
required-money: 'Current value: [value]'
reset: Reset Challenges - if this is true, player's challenges will reset when they reset an island or if they are kicked or leave a team
reward-exp: 'Current value: [value]'
reward-money: 'Current value: [value]'
search-radius: Current radius [value]
the_end: The End
waiver-amount: 'Current value: [value]'
with_island: With Island
edit-challenge-title: Edit Challenge
edit-entities: Manage Entities
edit-level-title: Edit Levels
manage-blocks: Manage Blocks
settings-title: Edit Settings
button:
add: Add
remove-selected: Remove Selected
show-eggs: Toogle Mob View
buttons: buttons:
back: Return admin:
next: Next complete: 'Complete user challenge'
previous: Previous reset: 'Reset user challenge'
title: '"Challenges GUI"' create-challenge: 'Add new challenge'
gui-title: '&aChallenges' create-level: 'Add new level'
help: edit-challenge: 'Edit challenge'
command: '/challenges: &fshow challenges' edit-level: 'Edit level'
config-reloaded: Configuration reloaded from file. delete-challenge: 'Remove challenge'
reset-all-challenges: resets all of the player's challenges delete-level: 'Remove level'
reset-challenge: marks a challenge as incomplete import: 'Import ASkyblock Challenges'
reset-challenge-for-all: globally resets a challenge for every player with an optional repetition backward: 'Import 0.3.0 Challenges'
incomplete: Incomplete settings: 'Edit Settings'
item-take-warning: '&cAll required items are|&ctaken when you complete|&cthis properties: 'Properties'
challenge!' requirements: 'Requirements'
items-closeby: '&cAll required items|&cmust be close to you|&con your island!' rewards: 'Rewards'
level: '&FLevel: [level]' challenges: 'Challenges'
max-reached: Max reached [donetimes] out of [maxtimes] type: 'Challenge Type'
maxed-reached: Completed [donetimes] out of [maxtimes] deployment: 'Deployment'
money-reward: '&6Money reward: $[reward]' icon: 'Icon'
name: Challenge Name description: 'Description'
name-has-completed: '[name] has completed the [challenge] challenge!' order: 'Order'
name-has-completed-level: '[name] completed all challenges in [level]!' environment: 'Environment'
navigation: Click to see [level] challenges! remove-on-complete: 'Remove after completion'
not-enough-exp: It is necessary to have [xp] EXP to complete challenge. name: 'Friendly Name'
not-enough-money: It is necessary to have [money] on your account to complete the challenge. required-entities: 'Required Entities'
not-repeatable: This challenge is not repeatable! remove-entities: 'Remove Entities'
parameters: '[Level]' required-blocks: 'Required Blocks'
repeat-rewards: '&6Repeat reward(s)' remove-blocks: 'Remove Blocks'
repeatable: This challenge can be repeated [maxtimes] times search-radius: 'Search Radius'
resetallchallenges: required-permissions: 'Required Permissions'
success: '[name] has had all challenges reset.' required-items: 'Required Items'
resetchallenge: remove-items: 'Remove Items'
challenge-reset: 'Challenge: [challengename] has been reset for [name]' required-experience: 'Required experience'
error-challenge-does-not-exist: Challenge doesn't exist or isn't yet completed remove-experience: 'Remove experience'
rewards: '&FReward(s)' required-level: 'Required island level'
to-complete: Complete [challengesToDo] more [thisLevel] challenges to unlock this level! required-money: 'Required money'
you-completed: You completed the [challenge] challenge! remove-money: 'Remove money'
you-completed-level: Congratulations, you complete [level]! reward-text: 'Reward message'
you-repeated: You repeated the [challenge] challenge! reward-items: 'Reward items'
missing-addon: It is not possible to complete challenge. Plugin or addon is missing. reward-experience: 'Reward experience'
incorrect: Current challenge is corupted. reward-money: 'Reward money'
reward-commands: 'Reward commands'
repeatable: 'Repeatable'
repeat-count: 'Max Times'
repeat-reward-text: 'Repeat reward message'
repeat-reward-items: 'Repeat reward items'
repeat-reward-experience: 'Repeat reward experience'
repeat-reward-money: 'Repeat reward money'
repeat-reward-commands: 'Repeat reward commands'
waiver-amount: 'Waiver Amount'
add-challenge: 'Add Challenge'
remove-challenge: 'Remove Challenge'
reset-on-new: 'Reset On New Island'
broadcast: 'Broadcast Completion'
remove-completed: 'Remove after complete'
glow: 'Glow when completed'
free-at-top: 'Free challenges first'
line-length: 'Lore line length'
toggle-user-list: 'User List'
remove-selected: 'Remove Selected'
add: 'Add'
show-eggs: 'Switch View mode'
accept: 'Accept'
decline: 'Decline'
save: 'Save'
cancel: 'Cancel'
input: 'Input'
value: 'Value'
set: '='
increase: '+'
reduce: '-'
multiply: '*'
clear: 'Clear'
remove-empty: 'Remove empty'
number: '[number]'
next: 'Next'
previous: 'Previous'
return: 'Return'
descriptions:
admin:
save: 'Save and return to previous GUI.'
cancel: 'Return to previous GUI. Changes will not be saved.'
input: 'Open text field input.'
set: 'Set operation. Clicking on numbers will change value to selected number.'
increase: 'Increase operation. Clicking on numbers will increase value by selected number.'
reduce: 'Reduce operation. Clicking on numbers will reduce value by selected number.'
multiply: 'Multiply operation. Clicking on numbers will multiply value by selected number.'
import: 'Allows to import ASkyblock Challenges.|On right click it enables/disables overwrite mode.'
complete: 'Allows to complete challenges for any user.|User will not get reward for completion.'
reset: 'Allows to reset completed user challenges.|Right click enables/disables Reset all functionality.'
create-challenge: 'Allows to add new Challenge.|By default it will be in free challenges list.'
create-level: 'Allows to add new Level.'
edit-challenge: 'Allows to edit any Challenge settings.'
edit-level: 'Allows to edit any Level settings.'
delete-challenge: 'Allows remove any Challenge.'
delete-level: 'Allows remove any Level.'
backward: 'Allows to import challenges from 0.3.0 and below addon version.'
settings: 'Allows to change addon settings.'
properties: 'Allows to change general properties'
requirements: 'Allows to manage requirements'
rewards: 'Allows to manage rewards'
challenges: 'Allows to manage level challenges (add / remove).'
deployment: 'Allows users to complete (view) challenge.'
icon-challenge: 'Icon that will be displayed in GUI panels for this challenge.'
icon-level: 'Icon that will be displayed in GUI panels for this level.'
description: 'Allows to edit description.'
order: 'Allows to change order number.'
environment: 'Allows to change environment where challenge operates.'
type: 'Allows change challenge type. Each type has their own requirements.'
remove-on-complete: 'Allows to remove challenge from player GUI after it is completed.'
name-challenge: 'Allows to change challenge display name.'
name-level: 'Allows to change level display name.'
required-entities: 'Allows to add/edit/remove required entities.|Entities:|'
remove-entities: 'Allows to remove (kill) entities on challenge completion.'
required-blocks: 'Allows to add/edit/remove required blocks.|Blocks:|'
remove-blocks: 'Allows to remove (replace with air) blocks on challenge completion.'
search-radius: 'Radius around player location where required entities and blocks will be searched.'
required-permissions: 'Required permissions for player to be able to complete challenge.|Permission:'
required-items: 'Required items in player"s inventory.|Items:'
remove-items: 'Allows to remove items from player inventory after challenge completion.'
required-experience: 'Allows to define required experience for user to complete challenge.'
remove-experience: 'Allows to remove remove required experience.'
required-level: 'Allows to define required island level for this challenge.|&cRequires Level addon.'
required-money: 'Allows to define required money in player"s account.|&cRequires Vault and Economy plugin.'
remove-money: 'Allows to remove required money from player"s account.|&cRequires Vault and Economy plugin.'
reward-text: 'Allows to change message that will be sent to player after challenges completion.'
reward-items: 'Allows to change first time completion reward items.|Items:'
reward-experience: 'Allows to change first time completion reward Experience.'
reward-money: 'Allows to change first time completion reward Money.|&cRequires Vault and Economy plugin.'
reward-commands: 'Allows to define reward commands that will be called after first time completion.|***Adding "[SELF]" at the start means that command will be run by player, f.e. "/kill"|***String "[player]" will be replaced with player name, f.e. "/kill [player]" will be transformed to "/kill BONNe1704"|Commands:'
repeatable: 'Allows to define if challenge is repeatable or not.'
repeat-count: 'Allows to define maximal repeat count. If value is set 0 or smaller, then there are no limitations.'
repeat-reward-text: 'Allows to change message that will be sent to player after challenge repeated completion.'
repeat-reward-items: 'Allows to change repeated completion reward items.|Items:'
repeat-reward-experience: 'Allows to change repeated completion reward Experience.'
repeat-reward-money: 'Allows to change repeated completion reward Money.|&cRequires Vault and Economy plugin.'
repeat-reward-commands: 'Allows to define reward commands that will be called after challenge repeated completion.|***Adding "[SELF]" at the start means that command will be run by player, f.e. "/kill"|***String "[player]" will be replaced with player name, f.e. "/kill [player]" will be transformed to "/kill BONNe1704"|Commands:'
waiver-amount: 'Allows to set how many challenges can be left undone to unlock next level.'
reward-text-level: 'Allows to change message that will be sent to player after completing all challenges in level.'
add-challenge: 'Allows to add existing challenge to current level.'
remove-challenge: 'Allows remove any challenge from current level.'
reset-on-new: 'Enables/Disables option, that resets all player challenges if player restarts island, leave island or was kicked out.'
broadcast: 'Enables/Disables broadcast to online players about first time challenge completion.'
remove-completed: 'Enables/Disables hiding challenges that are completed and cannot be repeated.'
glow: 'Enables/Disables glowing effect for completed challenges.'
free-at-top: 'Allows to change free challenges location. True mean that challenges will be first, otherwise they will be last.'
line-length: 'Allows to modify maximal line length in lore box. Will not affect stored objects.'
toggle-user-list: 'Switch to different player list.'
mode-online: 'Players which currently are online.'
mode-in-world: 'Players which is in GameMode world.'
mode-with-island: 'Players which has island in GameMode.'
selected: 'Selected'
remove-selected: 'Remove selected elements.|You can select elements with right mouse button.'
show-eggs: 'Switch entity view between Egg mode or Head mode.'
current-value: '|&6Current value: [value].'
enabled: 'Active'
disabled: 'Disabled'
type:
island: '- Island Type:| (allows to require blocks or mobs around player)'
inventory: '- Inventory Type:| (allows to require items in players inventory)'
other: '- Other Type:| (allows to require things from other plugins/addons)'
the-end: '- The End'
nether: '- Nether'
normal: '- Overworld'
entity: '- [entity] : [count]'
block: '- [block] : [count]'
permission: '- [permission]'
item: '- [count] x [item]'
item-meta: ' ([meta])'
item-enchant: ' - [enchant] [level]'
command: '- [command]'
level-unlocked: 'Click to see [level] challenges!'
level-locked: 'Complete [count] more [level] challenges to unlock this level!'
challenge-description:
level: '&FLevel: [level]'
completed: '&BCompleted'
completed-times-of: 'Completed [donetimes] out of [maxtimes]'
maxed-reached: 'Completed [donetimes] out of [maxtimes]'
completed-times: 'Completed [donetimes]'
warning-items-take: '&cAll required items are taken when you complete this challenge!'
objects-close-by: '&cAll required blocks and entities must be close to you on your island!'
warning-entities-kill: '&cAll required entities will be killed when you complete this challenge!'
warning-blocks-remove: '&cAll required blocks will be removed when you complete this challenge!'
not-repeatable: '&cThis challenge is not repeatable!'
experience-reward: '&6Exp reward: [value]'
money-reward: '&6Money reward: $[value]'
messages:
admin:
hit-things: 'Hit things to add them to the list of things required. Right click when done.'
you-added: 'You added one [thing] to the challenge'
challenge-created: '[challenge] created!'
you-completed-challenge: '&2You completed the [value] challenge!'
you-repeated-challenge: '&2You repeated the [value] challenge!'
you-completed-level: '&2You completed the [value] level!'
name-has-completed-challenge: '&5[name] has completed the [value] challenge!'
name-has-completed-level: '&5[name] has completed the [value] level!'
import-levels: 'Start importing Levels'
import-challenges: 'Start importing Challenges'
no-levels: 'Warning: No levels defined in challenges.yml'
import-number: 'Imported [number] challenges'
load-skipping: '"[value]" already exists - skipping'
load-overwriting: 'Overwriting "[value]"'
load-add: 'Adding new object: [value]'
errors:
no-name: '&cMissing challenge name'
unknown-challenge: '&cUnknown challenge'
unique-id: '&cUniqueID "[id]" is not valid.'
wrong-icon: '&cGiven material "[value]" is not valid and cannot be used as icon.'
not-valid-integer: '&cGiven integer "[value]" is not valid!|Value should be between [min] and [max].'
not-a-integer: '&cGiven value "[value]" is not integer!'
not-deployed: '&cChallenge is not deployed!'
not-on-island: '&cYou must be on your island to do that!'
challenge-level-not-available: '&cYou have not unlocked level to complete this challenge.'
not-repeatable: '&cThis challenge is not repeatable!'
wrong-environment: '&cYou are in wrong environment!'
not-enough-items: '&cYou do not have enough [items] to complete this challenge!'
not-close-enough: '&cYou must be standing within [number] blocks of all required items.'
you-still-need: '&cYou still need [amount] x [item]'
missing-addon: '&cCannot complete challenge. Required addon or plugin is missing.'
incorrect: '&cCannot complete challenge. Requirements are incorrect.'
not-enough-money: '&cIt is necessary to have [value] on your account to complete the challenge.'
not-enough-experience: '&cIt is necessary to have [value] EXP to complete challenge.'
island-level: '&cYour island must be level [number] to complete this challenge!'
import-no-file: '&cCould not find challenges.yml file to import!'
no-load: '&cError: Could not load challenges.yml. [message]'
load-error: '&cError: Cannot load [value].'
version: 2