mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2025-01-20 07:02:04 +01:00
Disable Money and Level buttons in admin panel, if EconomyPlugin or Level addon is missing.
This commit is contained in:
parent
c3b87da88e
commit
96cb4488c3
@ -11,7 +11,6 @@ import net.wesjd.anvilgui.AnvilGUI;
|
|||||||
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;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
import world.bentobox.bentobox.util.ItemParser;
|
|
||||||
import world.bentobox.challenges.ChallengesAddon;
|
import world.bentobox.challenges.ChallengesAddon;
|
||||||
import world.bentobox.challenges.database.object.Challenge;
|
import world.bentobox.challenges.database.object.Challenge;
|
||||||
import world.bentobox.challenges.panel.CommonGUI;
|
import world.bentobox.challenges.panel.CommonGUI;
|
||||||
@ -25,9 +24,6 @@ import world.bentobox.challenges.utils.GuiUtils;
|
|||||||
/**
|
/**
|
||||||
* This class contains all necessary methods that creates GUI and allow to edit challenges
|
* This class contains all necessary methods that creates GUI and allow to edit challenges
|
||||||
* properties.
|
* properties.
|
||||||
*
|
|
||||||
* TODO: In current class set that MONEY are availabe only if ECONOMY exist.
|
|
||||||
* TODO: In current class set that ISLAND LEVEL are availabe only if LEVEL ADDON exist.
|
|
||||||
*/
|
*/
|
||||||
public class EditChallengeGUI extends CommonGUI
|
public class EditChallengeGUI extends CommonGUI
|
||||||
{
|
{
|
||||||
@ -762,19 +758,29 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
this.user.getTranslation("challenges.gui.admin.descriptions.required-level",
|
this.user.getTranslation("challenges.gui.admin.descriptions.required-level",
|
||||||
"[value]",
|
"[value]",
|
||||||
Long.toString(this.challenge.getRequiredIslandLevel())));
|
Long.toString(this.challenge.getRequiredIslandLevel())));
|
||||||
icon = new ItemStack(Material.BEACON);
|
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
|
||||||
new NumberGUI(this.user, (int) this.challenge.getRequiredIslandLevel(), (status, value) -> {
|
|
||||||
if (status)
|
|
||||||
{
|
|
||||||
this.challenge.setRequiredIslandLevel(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.build();
|
if (this.addon.isLevelProvided())
|
||||||
});
|
{
|
||||||
|
icon = new ItemStack(Material.BEACON);
|
||||||
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
|
new NumberGUI(this.user, (int) this.challenge.getRequiredIslandLevel(), (status, value) -> {
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRequiredIslandLevel(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
icon = new ItemStack(Material.BARRIER);
|
||||||
|
clickHandler = null;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
glow = false;
|
glow = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -785,18 +791,28 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
this.user.getTranslation("challenges.gui.admin.descriptions.required-money",
|
this.user.getTranslation("challenges.gui.admin.descriptions.required-money",
|
||||||
"[value]",
|
"[value]",
|
||||||
Integer.toString(this.challenge.getRequiredMoney())));
|
Integer.toString(this.challenge.getRequiredMoney())));
|
||||||
icon = new ItemStack(Material.GOLD_INGOT);
|
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
|
||||||
new NumberGUI(this.user, this.challenge.getRequiredMoney(), 0, (status, value) -> {
|
|
||||||
if (status)
|
|
||||||
{
|
|
||||||
this.challenge.setRequiredMoney(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.build();
|
if (this.addon.isEconomyProvided())
|
||||||
});
|
{
|
||||||
return true;
|
icon = new ItemStack(Material.GOLD_INGOT);
|
||||||
};
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
|
new NumberGUI(this.user, this.challenge.getRequiredMoney(), 0, (status, value) -> {
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRequiredMoney(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
icon = new ItemStack(Material.BARRIER);
|
||||||
|
clickHandler = null;
|
||||||
|
}
|
||||||
|
|
||||||
glow = false;
|
glow = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -806,20 +822,31 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
|
|
||||||
if (this.challenge.isTakeMoney())
|
if (this.challenge.isTakeMoney())
|
||||||
{
|
{
|
||||||
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.enabled"));
|
description = Collections.singletonList(this.user
|
||||||
|
.getTranslation("challenges.gui.admin.descriptions.enabled"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
description = Collections.singletonList(this.user.getTranslation("challenges.gui.admin.descriptions.disabled"));
|
description = Collections.singletonList(this.user
|
||||||
|
.getTranslation("challenges.gui.admin.descriptions.disabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
icon = new ItemStack(Material.LEVER);
|
if (this.addon.isEconomyProvided())
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
{
|
||||||
this.challenge.setTakeMoney(!this.challenge.isTakeMoney());
|
icon = new ItemStack(Material.LEVER);
|
||||||
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
|
this.challenge.setTakeMoney(!this.challenge.isTakeMoney());
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
icon = new ItemStack(Material.BARRIER);
|
||||||
|
clickHandler = null;
|
||||||
|
}
|
||||||
|
|
||||||
this.build();
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
glow = this.challenge.isTakeMoney();
|
glow = this.challenge.isTakeMoney();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -901,19 +928,29 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
this.user.getTranslation("challenges.gui.admin.descriptions.reward-money",
|
this.user.getTranslation("challenges.gui.admin.descriptions.reward-money",
|
||||||
"[value]",
|
"[value]",
|
||||||
Integer.toString(this.challenge.getRewardMoney())));
|
Integer.toString(this.challenge.getRewardMoney())));
|
||||||
icon = new ItemStack(Material.GOLD_INGOT);
|
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
|
||||||
new NumberGUI(this.user, this.challenge.getRewardMoney(), 0, (status, value) -> {
|
|
||||||
if (status)
|
|
||||||
{
|
|
||||||
this.challenge.setRewardMoney(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.build();
|
if (this.addon.isEconomyProvided())
|
||||||
});
|
{
|
||||||
|
icon = new ItemStack(Material.GOLD_INGOT);
|
||||||
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
|
new NumberGUI(this.user, this.challenge.getRewardMoney(), 0, (status, value) -> {
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRewardMoney(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
icon = new ItemStack(Material.BARRIER);
|
||||||
|
clickHandler = null;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
glow = false;
|
glow = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1062,19 +1099,32 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
this.user.getTranslation("challenges.gui.admin.descriptions.repeat-reward-money",
|
this.user.getTranslation("challenges.gui.admin.descriptions.repeat-reward-money",
|
||||||
"[value]",
|
"[value]",
|
||||||
Integer.toString(this.challenge.getRepeatMoneyReward())));
|
Integer.toString(this.challenge.getRepeatMoneyReward())));
|
||||||
icon = new ItemStack(Material.GOLD_NUGGET);
|
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
|
||||||
new NumberGUI(this.user, this.challenge.getRepeatMoneyReward(), 0, (status, value) -> {
|
|
||||||
if (status)
|
|
||||||
{
|
|
||||||
this.challenge.setRepeatMoneyReward(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.build();
|
if (this.addon.isEconomyProvided())
|
||||||
});
|
{
|
||||||
|
icon = new ItemStack(Material.GOLD_NUGGET);
|
||||||
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
|
new NumberGUI(this.user,
|
||||||
|
this.challenge.getRepeatMoneyReward(),
|
||||||
|
0,
|
||||||
|
(status, value) -> {
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
this.challenge.setRepeatMoneyReward(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
icon = new ItemStack(Material.BARRIER);
|
||||||
|
clickHandler = null;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
glow = false;
|
glow = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ import world.bentobox.challenges.utils.GuiUtils;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains all necessary elements to create Levels Edit GUI.
|
* This class contains all necessary elements to create Levels Edit GUI.
|
||||||
* TODO: In current class set that MONEY are availabe only if ECONOMY exist.
|
|
||||||
*/
|
*/
|
||||||
public class EditLevelGUI extends CommonGUI
|
public class EditLevelGUI extends CommonGUI
|
||||||
{
|
{
|
||||||
@ -493,19 +492,29 @@ public class EditLevelGUI extends CommonGUI
|
|||||||
this.user.getTranslation("challenges.gui.admin.descriptions.reward-money",
|
this.user.getTranslation("challenges.gui.admin.descriptions.reward-money",
|
||||||
"[value]",
|
"[value]",
|
||||||
Integer.toString(this.challengeLevel.getRewardMoney())));
|
Integer.toString(this.challengeLevel.getRewardMoney())));
|
||||||
icon = new ItemStack(Material.GOLD_INGOT);
|
|
||||||
clickHandler = (panel, user, clickType, slot) -> {
|
|
||||||
new NumberGUI(this.user, this.challengeLevel.getRewardMoney(), 0, (status, value) -> {
|
|
||||||
if (status)
|
|
||||||
{
|
|
||||||
this.challengeLevel.setRewardMoney(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.build();
|
if (this.addon.isEconomyProvided())
|
||||||
});
|
{
|
||||||
|
icon = new ItemStack(Material.GOLD_INGOT);
|
||||||
|
clickHandler = (panel, user, clickType, slot) -> {
|
||||||
|
new NumberGUI(this.user, this.challengeLevel.getRewardMoney(), 0, (status, value) -> {
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
this.challengeLevel.setRewardMoney(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build();
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
icon = new ItemStack(Material.BARRIER);
|
||||||
|
clickHandler = null;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
glow = false;
|
glow = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user