use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.
the class RewardEditPotions method open.
@Override
public void open(Player player, RewardEditData reward) {
EditGUI inv = new EditGUI("Edit Potions: " + reward.getName());
inv.addData("Reward", reward);
ArrayList<String> potionEffects = new ArrayList<String>();
for (PotionEffectType effect : PotionEffectType.values()) {
potionEffects.add(effect.toString());
}
inv.addButton(new EditGUIButton(new EditGUIValueInventory("Potions") {
@Override
public void openInventory(ClickEvent clickEvent) {
new ValueRequestBuilder(new StringListener() {
@Override
public void onInput(Player player, String value) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
reward.createSection("Potions." + value);
reloadAdvancedCore();
open(player, reward);
}
}, ArrayUtils.getInstance().convert(potionEffects)).usingMethod(InputMethod.INVENTORY).request(clickEvent.getPlayer());
}
}).setName("&aAdd potion effect"));
inv.addButton(new EditGUIButton(new EditGUIValueInventory("Potions") {
@Override
public void openInventory(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
if (reward.hasPath("Potions")) {
openRemove(player, reward);
}
}
}).setName("&aRemove potion"));
inv.addButton(new EditGUIButton(new EditGUIValueInventory("Potions") {
@Override
public void openInventory(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
if (reward.hasPath("Potions")) {
openEditSub(player, reward);
}
}
}).setName("&aEdit potion effect"));
inv.addButton(getBackButton(reward));
inv.openInventory(player);
}
use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.
the class RewardEditPotions method openEditSub.
public void openEditSub(Player player, RewardEditData reward, String potion) {
EditGUI inv = new EditGUI("Edit Potions Edit " + potion + ": " + reward.getName());
inv.addData("Reward", reward);
inv.addButton(getIntButton("Potions." + potion + ".Duration", reward));
inv.addButton(getIntButton("Potions." + potion + ".Amplifier", reward));
inv.addButton(getBackButtonCustom(reward, new EditGUIValueInventory("") {
@Override
public void openInventory(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
open(player, reward);
}
}));
inv.openInventory(player);
}
use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.
the class RewardEditSpecialChance method openRename.
public void openRename(Player player, RewardEditData reward) {
EditGUI inv = new EditGUI("Edit SpecialChance Rename: " + reward.getName());
inv.addData("Reward", reward);
for (String key : reward.getData().getConfigurationSection("SpecialChance").getKeys(false)) {
inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER).setName("&a" + key).addLoreLine("&aClick to rename")) {
@Override
public void onClick(ClickEvent clickEvent) {
new ValueRequestBuilder(new NumberListener() {
@Override
public void onInput(Player player, Number value) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
reward.setValue("SpecialChance." + value.intValue(), reward.getData().getConfigurationSection("SpecialChance." + key));
reward.setValue("SpecialChance." + key, null);
reloadAdvancedCore();
open(player, reward);
}
}, new Number[] {}).usingMethod(InputMethod.CHAT).request(clickEvent.getPlayer());
}
});
}
inv.addButton(getBackButtonCustom(reward, new EditGUIValueInventory("") {
@Override
public void openInventory(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
open(player, reward);
}
}));
inv.openInventory(player);
}
use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.
the class RewardEditSpecialChance method openEditSub.
public void openEditSub(Player player, RewardEditData reward) {
EditGUI inv = new EditGUI("Edit SpecialChance Edit Sub: " + reward.getName());
inv.addData("Reward", reward);
for (String key : reward.getData().getConfigurationSection("SpecialChance").getKeys(false)) {
inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER).setName("&a" + key).addLoreLine("&aClick to edit")) {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
openSubReward(clickEvent.getPlayer(), "SpecialChance." + key, reward);
}
});
}
inv.addButton(getBackButtonCustom(reward, new EditGUIValueInventory("") {
@Override
public void openInventory(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
open(player, reward);
}
}));
inv.openInventory(player);
}
Aggregations