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,9 +824,7 @@ public class EditChallengeGUI extends CommonGUI
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", Long.toString(this.challenge.getRequiredIslandLevel())));
if (this.addon.isLevelProvided())
{
icon = new ItemStack(Material.BEACON);
icon = new ItemStack(this.addon.isLevelProvided() ? Material.BEACON : Material.BARRIER);
clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, (int) this.challenge.getRequiredIslandLevel(), lineLength, (status, value) -> {
if (status)
@ -839,12 +837,6 @@ public class EditChallengeGUI extends CommonGUI
return true;
};
}
else
{
icon = new ItemStack(Material.BARRIER);
clickHandler = null;
}
glow = false;
break;
@ -857,9 +849,7 @@ public class EditChallengeGUI extends CommonGUI
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", Long.toString(this.challenge.getRequiredIslandLevel())));
if (this.addon.isEconomyProvided())
{
icon = new ItemStack(Material.GOLD_INGOT);
icon = new ItemStack(this.addon.isEconomyProvided() ? Material.GOLD_INGOT : Material.BARRIER);
clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challenge.getRequiredMoney(), 0, lineLength, (status, value) -> {
if (status)
@ -871,12 +861,6 @@ public class EditChallengeGUI extends CommonGUI
});
return true;
};
}
else
{
icon = new ItemStack(Material.BARRIER);
clickHandler = null;
}
glow = false;
break;
@ -892,21 +876,13 @@ public class EditChallengeGUI extends CommonGUI
this.user.getTranslation("challenges.gui.descriptions.enabled") :
this.user.getTranslation("challenges.gui.descriptions.disabled")));
if (this.addon.isEconomyProvided())
{
icon = new ItemStack(Material.LEVER);
icon = new ItemStack(this.addon.isEconomyProvided() ? Material.LEVER : Material.BARRIER);
clickHandler = (panel, user, clickType, slot) -> {
this.challenge.setTakeMoney(!this.challenge.isTakeMoney());
this.build();
return true;
};
}
else
{
icon = new ItemStack(Material.BARRIER);
clickHandler = null;
}
glow = this.challenge.isTakeMoney();
break;
@ -1009,9 +985,7 @@ public class EditChallengeGUI extends CommonGUI
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", Integer.toString(this.challenge.getRewardMoney())));
if (this.addon.isEconomyProvided())
{
icon = new ItemStack(Material.GOLD_INGOT);
icon = new ItemStack(this.addon.isEconomyProvided() ? Material.GOLD_INGOT : Material.BARRIER);
clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challenge.getRewardMoney(), 0, lineLength, (status, value) -> {
if (status)
@ -1024,12 +998,7 @@ public class EditChallengeGUI extends CommonGUI
return true;
};
}
else
{
icon = new ItemStack(Material.BARRIER);
clickHandler = null;
}
glow = false;
break;
@ -1207,9 +1176,7 @@ public class EditChallengeGUI extends CommonGUI
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]", Integer.toString(this.challenge.getRepeatMoneyReward())));
if (this.addon.isEconomyProvided())
{
icon = new ItemStack(Material.GOLD_NUGGET);
icon = new ItemStack(this.addon.isEconomyProvided() ? Material.GOLD_NUGGET : Material.BARRIER);
clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user,
this.challenge.getRepeatMoneyReward(),
@ -1226,12 +1193,6 @@ public class EditChallengeGUI extends CommonGUI
return true;
};
}
else
{
icon = new ItemStack(Material.BARRIER);
clickHandler = null;
}
glow = false;
break;

View File

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