Enable Level and Money editing, even when required addons or plugins are not provided.

This commit is contained in:
BONNe 2019-04-26 21:27:52 +03:00
parent a41859459f
commit c05015716f
2 changed files with 66 additions and 113 deletions

View File

@ -824,27 +824,19 @@ public class EditChallengeGUI extends CommonGUI
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", Long.toString(this.challenge.getRequiredIslandLevel()))); "[value]", Long.toString(this.challenge.getRequiredIslandLevel())));
if (this.addon.isLevelProvided()) icon = new ItemStack(this.addon.isLevelProvided() ? Material.BEACON : Material.BARRIER);
{ clickHandler = (panel, user, clickType, slot) -> {
icon = new ItemStack(Material.BEACON); new NumberGUI(this.user, (int) this.challenge.getRequiredIslandLevel(), lineLength, (status, value) -> {
clickHandler = (panel, user, clickType, slot) -> { if (status)
new NumberGUI(this.user, (int) this.challenge.getRequiredIslandLevel(), lineLength, (status, value) -> { {
if (status) this.challenge.setRequiredIslandLevel(value);
{ }
this.challenge.setRequiredIslandLevel(value);
}
this.build(); this.build();
}); });
return true; return true;
}; };
}
else
{
icon = new ItemStack(Material.BARRIER);
clickHandler = null;
}
glow = false; glow = false;
break; break;
@ -857,26 +849,18 @@ public class EditChallengeGUI extends CommonGUI
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", Long.toString(this.challenge.getRequiredIslandLevel()))); "[value]", Long.toString(this.challenge.getRequiredIslandLevel())));
if (this.addon.isEconomyProvided()) icon = new ItemStack(this.addon.isEconomyProvided() ? Material.GOLD_INGOT : Material.BARRIER);
{ clickHandler = (panel, user, clickType, slot) -> {
icon = new ItemStack(Material.GOLD_INGOT); new NumberGUI(this.user, this.challenge.getRequiredMoney(), 0, lineLength, (status, value) -> {
clickHandler = (panel, user, clickType, slot) -> { if (status)
new NumberGUI(this.user, this.challenge.getRequiredMoney(), 0, lineLength, (status, value) -> { {
if (status) this.challenge.setRequiredMoney(value);
{ }
this.challenge.setRequiredMoney(value);
}
this.build(); this.build();
}); });
return true; return true;
}; };
}
else
{
icon = new ItemStack(Material.BARRIER);
clickHandler = null;
}
glow = false; glow = false;
break; break;
@ -892,21 +876,13 @@ public class EditChallengeGUI extends CommonGUI
this.user.getTranslation("challenges.gui.descriptions.enabled") : this.user.getTranslation("challenges.gui.descriptions.enabled") :
this.user.getTranslation("challenges.gui.descriptions.disabled"))); this.user.getTranslation("challenges.gui.descriptions.disabled")));
if (this.addon.isEconomyProvided()) icon = new ItemStack(this.addon.isEconomyProvided() ? Material.LEVER : Material.BARRIER);
{ clickHandler = (panel, user, clickType, slot) -> {
icon = new ItemStack(Material.LEVER); this.challenge.setTakeMoney(!this.challenge.isTakeMoney());
clickHandler = (panel, user, clickType, slot) -> {
this.challenge.setTakeMoney(!this.challenge.isTakeMoney());
this.build(); this.build();
return true; return true;
}; };
}
else
{
icon = new ItemStack(Material.BARRIER);
clickHandler = null;
}
glow = this.challenge.isTakeMoney(); glow = this.challenge.isTakeMoney();
break; break;
@ -1009,27 +985,20 @@ public class EditChallengeGUI extends CommonGUI
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", Integer.toString(this.challenge.getRewardMoney()))); "[value]", Integer.toString(this.challenge.getRewardMoney())));
if (this.addon.isEconomyProvided()) icon = new ItemStack(this.addon.isEconomyProvided() ? Material.GOLD_INGOT : Material.BARRIER);
{ clickHandler = (panel, user, clickType, slot) -> {
icon = new ItemStack(Material.GOLD_INGOT); new NumberGUI(this.user, this.challenge.getRewardMoney(), 0, lineLength, (status, value) -> {
clickHandler = (panel, user, clickType, slot) -> { if (status)
new NumberGUI(this.user, this.challenge.getRewardMoney(), 0, lineLength, (status, value) -> { {
if (status) this.challenge.setRewardMoney(value);
{ }
this.challenge.setRewardMoney(value);
}
this.build(); this.build();
}); });
return true;
};
return true;
};
}
else
{
icon = new ItemStack(Material.BARRIER);
clickHandler = null;
}
glow = false; glow = false;
break; break;
@ -1207,31 +1176,23 @@ public class EditChallengeGUI extends CommonGUI
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", Integer.toString(this.challenge.getRepeatMoneyReward()))); "[value]", Integer.toString(this.challenge.getRepeatMoneyReward())));
if (this.addon.isEconomyProvided()) icon = new ItemStack(this.addon.isEconomyProvided() ? Material.GOLD_NUGGET : Material.BARRIER);
{ clickHandler = (panel, user, clickType, slot) -> {
icon = new ItemStack(Material.GOLD_NUGGET); new NumberGUI(this.user,
clickHandler = (panel, user, clickType, slot) -> { this.challenge.getRepeatMoneyReward(),
new NumberGUI(this.user, 0,
this.challenge.getRepeatMoneyReward(), lineLength,
0, (status, value) -> {
lineLength, if (status)
(status, value) -> { {
if (status) this.challenge.setRepeatMoneyReward(value);
{ }
this.challenge.setRepeatMoneyReward(value);
}
this.build(); this.build();
}); });
return true; return true;
}; };
}
else
{
icon = new ItemStack(Material.BARRIER);
clickHandler = null;
}
glow = false; glow = false;
break; break;

View File

@ -584,27 +584,19 @@ public class EditLevelGUI extends CommonGUI
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value", description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", Integer.toString(this.challengeLevel.getRewardMoney()))); "[value]", Integer.toString(this.challengeLevel.getRewardMoney())));
if (this.addon.isEconomyProvided()) icon = new ItemStack(this.addon.isEconomyProvided() ? Material.GOLD_INGOT : Material.BARRIER);
{ clickHandler = (panel, user, clickType, slot) -> {
icon = new ItemStack(Material.GOLD_INGOT); new NumberGUI(this.user, this.challengeLevel.getRewardMoney(), 0, lineLength, (status, value) -> {
clickHandler = (panel, user, clickType, slot) -> { if (status)
new NumberGUI(this.user, this.challengeLevel.getRewardMoney(), 0, lineLength, (status, value) -> { {
if (status) this.challengeLevel.setRewardMoney(value);
{ }
this.challengeLevel.setRewardMoney(value);
}
this.build(); this.build();
}); });
return true; return true;
}; };
}
else
{
icon = new ItemStack(Material.BARRIER);
clickHandler = null;
}
glow = false; glow = false;
break; break;