use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.
the class RewardEditAdvancedWorld method openRemove.
public void openRemove(Player player, RewardEditData reward) {
EditGUI inv = new EditGUI("Edit AdvancedWorld Remove: " + reward.getName());
inv.addData("Reward", reward);
for (String key : reward.getData().getConfigurationSection("AdvancedWorld").getKeys(false)) {
inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER).setName("&c" + key).addLoreLine("&cClick to remove")) {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
reward.setValue("AdvancedWorld." + key, null);
reloadAdvancedCore();
open(player, 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 RewardEditAdvancedWorld method open.
@Override
public void open(Player player, RewardEditData reward) {
EditGUI inv = new EditGUI("Edit AdvancedWorld: " + reward.getName());
inv.addData("Reward", reward);
inv.addButton(new EditGUIButton(new EditGUIValueInventory("AdvancedWorld") {
@Override
public void openInventory(ClickEvent clickEvent) {
ArrayList<String> worlds = new ArrayList<String>();
for (World w : Bukkit.getWorlds()) {
worlds.add(w.getName());
}
new ValueRequestBuilder(new StringListener() {
@Override
public void onInput(Player player, String value) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
reward.createSection("AdvancedWorld." + value);
reloadAdvancedCore();
open(player, reward);
}
}, ArrayUtils.getInstance().convert(worlds)).usingMethod(InputMethod.CHAT).allowCustomOption(true).request(clickEvent.getPlayer());
}
}).setName("&aAdd sub reward").addLore("Rewards execute in order of addition"));
inv.addButton(new EditGUIButton(new EditGUIValueInventory("AdvancedWorld") {
@Override
public void openInventory(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
if (reward.hasPath("AdvancedWorld")) {
openRemove(player, reward);
}
}
}).setName("&aRemove sub reward"));
inv.addButton(new EditGUIButton(new EditGUIValueInventory("AdvancedWorld") {
@Override
public void openInventory(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
if (reward.hasPath("AdvancedWorld")) {
openRename(player, reward);
}
}
}).setName("&aRename sub reward"));
inv.addButton(new EditGUIButton(new EditGUIValueInventory("AdvancedWorld") {
@Override
public void openInventory(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
if (reward.hasPath("AdvancedWorld")) {
openEditSub(player, reward);
}
}
}).setName("&aEdit sub reward"));
inv.addButton(getBackButton(reward));
inv.openInventory(player);
}
use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.
the class RewardEditChoices method openRename.
public void openRename(Player player, RewardEditData reward) {
EditGUI inv = new EditGUI("Edit Choices Rename: " + reward.getName());
inv.addData("Reward", reward);
for (String key : reward.getData().getConfigurationSection("Choices").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 StringListener() {
@Override
public void onInput(Player player, String value) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
reward.setValue("Choices." + value, reward.getData().getConfigurationSection("Choices." + key));
reward.setValue("Choices." + key, null);
reloadAdvancedCore();
open(player, reward);
}
}, new String[] {}).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 RewardEditChoices method open.
@Override
public void open(Player player, RewardEditData reward) {
EditGUI inv = new EditGUI("Edit Choices: " + reward.getName());
inv.addData("Reward", reward);
inv.addButton(getBooleanButton("EnableChoices", reward).addLore("Enable choice rewards"));
inv.addButton(new EditGUIButton(new EditGUIValueInventory("Choices") {
@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("Choices." + value);
reloadAdvancedCore();
open(player, reward);
}
}, new String[] {}).usingMethod(InputMethod.CHAT).request(clickEvent.getPlayer());
}
}).setName("&aAdd sub reward"));
inv.addButton(new EditGUIButton(new EditGUIValueInventory("Choices") {
@Override
public void openInventory(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
if (reward.hasPath("Choices")) {
openRemove(player, reward);
}
}
}).setName("&aRemove sub reward"));
inv.addButton(new EditGUIButton(new EditGUIValueInventory("Choices") {
@Override
public void openInventory(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
if (reward.hasPath("Choices")) {
openRename(player, reward);
}
}
}).setName("&aRename sub reward"));
inv.addButton(new EditGUIButton(new EditGUIValueInventory("Choices") {
@Override
public void openInventory(ClickEvent clickEvent) {
RewardEditData reward = (RewardEditData) getInv().getData("Reward");
if (reward.hasPath("Choices")) {
openEditSub(player, reward);
}
}
}).setName("&aEdit sub reward"));
inv.addButton(getBackButton(reward));
inv.openInventory(player);
}
use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.
the class RewardEditItems method openEdit.
public void openEdit(Player player, RewardEditData reward) {
EditGUI inv = new EditGUI("Edit Item Edit: " + reward.getName());
inv.addData("Reward", reward);
for (String key : reward.getData().getConfigurationSection("Items").getKeys(false)) {
inv.addButton(new BInventoryButton(new ItemBuilder(reward.getData().getConfigurationSection("Items." + key)).setName("&c" + key).addLoreLine("&cClick to edit")) {
@Override
public void onClick(ClickEvent clickEvent) {
String key = (String) getData("key");
openEditItem(player, key, reward);
}
}.addData("key", key));
}
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