use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method delayPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting an items command delay duration.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
* @param action - The action to be matched.
*/
private static void delayPane(final Player player, final ItemMap itemMap, final Action action) {
Interface delayPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
delayPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the executors menu."), event -> {
executorPane(player, itemMap, action);
}));
delayPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Cooldown", "&7", "&7*Click to set a custom", "&7delay for the next command."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "DELAY";
placeHolders[15] = "180";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
if (StringUtils.isInt(ChatColor.stripColor(event.getMessage()))) {
modifyCommands(itemMap, ItemCommand.fromString("delay: " + Integer.parseInt(ChatColor.stripColor(event.getMessage())), action, itemMap, Integer.parseInt(ChatColor.stripColor(event.getMessage())), null), true);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "DELAY";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
} else {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = ChatColor.stripColor(event.getMessage());
LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
}
commandListPane(event.getPlayer(), itemMap, action);
}));
for (int i = 1; i <= 64; i++) {
final int k = i;
delayPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "LIGHT_GRAY_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:8"), k, false, "&9&lDelay: &a&l" + k + " Tick(s)", "&7", "&7*Click to set the", "&7delay of the next command."), event -> {
modifyCommands(itemMap, ItemCommand.fromString("delay: " + k, action, itemMap, k, null), true);
commandListPane(player, itemMap, action);
}));
}
});
delayPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method nbtPane.
/**
* Opens the Pane for the Player.
* This Pane is for creating NBT Properties.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void nbtPane(final Player player, final ItemMap itemMap) {
Interface nbtPane = new Interface(true, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
Map<String, String> properties = itemMap.getNBTValues();
nbtPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
nbtPane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, true, "&e&l&nNew Property", "&7", "&7*Add a new NBT Property to the custom item."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "NBT PROPERTY";
placeHolders[15] = "TranslatableDisplayName:&aUltra &cItem";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
if (ChatColor.stripColor(event.getMessage()).contains(":")) {
String[] propertyParts = ChatColor.stripColor(event.getMessage()).split(":");
properties.put(propertyParts[0], propertyParts[1]);
}
itemMap.setNBTValues(properties);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "NBT PROPERTY";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
nbtPane(event.getPlayer(), itemMap);
}));
for (String key : properties.keySet()) {
nbtPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "COMMAND_BLOCK" : "137"), 1, false, "&f" + key + ":" + properties.get(key), "&7", "&7*Click to modify or delete", "&7this custom NBT Property."), event -> modifyProperty(player, itemMap, key)));
}
});
nbtPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method receivePane.
/**
* Opens the Pane for the Player.
* This Pane is for an items command item currency.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void receivePane(final Player player, final ItemMap itemMap) {
Interface receivePane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
receivePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item commands menu."), event -> {
commandPane(player, itemMap);
}));
receivePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Receive", "&7", "&7*Click to set a custom commands-receive", "&7value for the item."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND RECEIVE";
placeHolders[15] = "10";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
if (StringUtils.isInt(ChatColor.stripColor(event.getMessage()))) {
itemMap.setCommandReceive(Integer.parseInt(ChatColor.stripColor(event.getMessage())));
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND RECEIVE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
} else {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = ChatColor.stripColor(event.getMessage());
LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
}
commandPane(event.getPlayer(), itemMap);
}));
for (int i = 0; i <= 64; i++) {
final int k = i;
receivePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), (k == 0 ? 1 : k), false, "&9&lReceive: &a#&l" + k, "&7", "&7*Click to set the", "&7commands-receive of the item."), event -> {
itemMap.setCommandReceive(k);
commandPane(player, itemMap);
}));
}
});
receivePane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method executorPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting an items command executor.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
* @param action - THe action to be matched,
*/
private static void executorPane(final Player player, final ItemMap itemMap, final Action action) {
Interface executorPane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
executorPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GUNPOWDER" : "289"), 1, false, "&f")));
executorPane.addButton(new Button(ItemHandler.getItem("BOOK", 1, false, "&e&lPlayer", "&7", "&7*Executes the command", "&7as the player."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "PLAYER COMMAND";
placeHolders[15] = "spawn";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
modifyCommands(itemMap, ItemCommand.fromString("player: " + ChatColor.stripColor(event.getMessage()), action, itemMap, 0L, null), true);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "PLAYER COMMAND";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
commandListPane(event.getPlayer(), itemMap, action);
}));
executorPane.addButton(new Button(ItemHandler.getItem("BOOK", 1, true, "&e&lOp", "&7", "&7*Executes the command as if the", "&7player has /op (admin permissions)."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "OP COMMAND";
placeHolders[15] = "broadcast I am &cADMIN!";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
modifyCommands(itemMap, ItemCommand.fromString("op: " + ChatColor.stripColor(event.getMessage()), action, itemMap, 0L, null), true);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND LINE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
commandListPane(event.getPlayer(), itemMap, action);
}));
executorPane.addButton(new Button(ItemHandler.getItem("EMERALD", 1, false, "&e&lConsole", "&7", "&7*Executes the command", "&7in the console window."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "CONSOLE COMMAND";
placeHolders[15] = "gamemode creative %player%";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
modifyCommands(itemMap, ItemCommand.fromString("console: " + ChatColor.stripColor(event.getMessage()), action, itemMap, 0L, null), true);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "OP COMMAND";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
commandListPane(event.getPlayer(), itemMap, action);
}));
executorPane.addButton(new Button(ItemHandler.getItem("HOPPER", 1, false, "&e&lServer", "&7", "&7*Switches the player to", "&7the defined server name.", "&7", "&7&lNote: &7This is the name", "&7defined in the BungeeCord config."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SERVER SWITCH";
placeHolders[15] = "survival";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
modifyCommands(itemMap, ItemCommand.fromString("server: " + ChatColor.stripColor(event.getMessage()), action, itemMap, 0L, null), true);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SERVER SWITCH";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
commandListPane(event.getPlayer(), itemMap, action);
}));
executorPane.addButton(new Button(ItemHandler.getItem("OBSIDIAN", 1, false, "&e&lBungee", "&7", "&7*Executes a BungeeCord specific command."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "BUNGEE COMMAND";
placeHolders[15] = "survival";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
modifyCommands(itemMap, ItemCommand.fromString("bungee: " + ChatColor.stripColor(event.getMessage()), action, itemMap, 0L, null), true);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "BUNGEE COMMAND";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
commandListPane(event.getPlayer(), itemMap, action);
}));
executorPane.addButton(new Button(ItemHandler.getItem("PAPER", 1, false, "&e&lMessage", "&7", "&7*Sends the player a custom message."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "MESSAGE";
placeHolders[15] = "&eWelcome to the Server!";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
modifyCommands(itemMap, ItemCommand.fromString("message: " + ChatColor.stripColor(event.getMessage()), action, itemMap, 0L, null), true);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "MESSAGE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
commandListPane(event.getPlayer(), itemMap, action);
}));
executorPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "REPEATER" : "356"), 1, false, "&e&lSwap-Item", "&7", "&7*Swaps the item to another defined item."), event -> swapPane(player, itemMap, action)));
executorPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CLOCK" : "347"), 1, false, "&e&lDelay", "&7", "&7*Adds a delay between command lines."), event -> delayPane(player, itemMap, action)));
executorPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the command lines menu."), event -> commandListPane(player, itemMap, action)));
executorPane.addButton(new Button(fillerPaneBItem), 7);
executorPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the command lines menu."), event -> commandListPane(player, itemMap, action)));
});
executorPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method recipePane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the custom recipe.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void recipePane(final Player player, final ItemMap itemMap) {
Interface recipePane = new Interface(false, 4, GUIName, player);
SchedulerUtils.runAsync(() -> {
recipePane.addButton(new Button(fillerPaneBItem), 3);
for (int i = 0; i < 9; i++) {
final int k = i;
String stack = "CHEST";
ItemStack stack1 = null;
if (itemMap.getRecipe().size() > i && itemMap.getRecipe().get(i) != 'X') {
final ItemMap copyMap = ItemUtilities.getUtilities().getItemMap(null, itemMap.getIngredients().get(itemMap.getRecipe().get(i)).toString(), null);
if (copyMap != null) {
stack1 = copyMap.getItemStack(player);
} else {
stack = itemMap.getIngredients().get(itemMap.getRecipe().get(i)).toString();
}
}
if (stack1 != null) {
stack1 = ItemHandler.addLore(stack1, "&9&lDISPLAY: &f" + stack1.getItemMeta().getDisplayName(), "&7", "&7*Create a recipe that can be used.");
ItemMeta meta = stack1.getItemMeta();
meta.setDisplayName(StringUtils.translateLayout((itemMap.getRecipe().size() > i ? "&e&l" + itemMap.getRecipe().get(i) : "&e&lX"), player));
stack1.setItemMeta(meta);
recipePane.addButton(new Button(stack1, event -> {
if ((itemMap.getRecipe().size() > k && itemMap.getRecipe().get(k) != 'X')) {
setIngredients(player, itemMap, "AIR", k);
} else {
ingredientPane(player, itemMap, k);
}
}));
if (i == 2) {
recipePane.addButton(new Button(fillerPaneBItem), 6);
} else if (i == 5) {
recipePane.addButton(new Button(fillerPaneBItem));
recipePane.addButton(new Button(headerStack(player, itemMap)));
recipePane.addButton(new Button(fillerPaneBItem), 4);
} else if (i == 8) {
recipePane.addButton(new Button(fillerPaneBItem), 3);
}
} else {
recipePane.addButton(new Button(ItemHandler.getItem(stack, 1, false, (itemMap.getRecipe().size() > i ? "&e&l" + itemMap.getRecipe().get(i) : "&e&lX"), "&7", "&7*Create a recipe that can be used."), event -> {
if ((itemMap.getRecipe().size() > k && itemMap.getRecipe().get(k) != 'X')) {
setIngredients(player, itemMap, "AIR", k);
} else {
ingredientPane(player, itemMap, k);
}
}));
if (i == 2) {
recipePane.addButton(new Button(fillerPaneBItem), 6);
} else if (i == 5) {
recipePane.addButton(new Button(fillerPaneBItem));
recipePane.addButton(new Button(headerStack(player, itemMap)));
recipePane.addButton(new Button(fillerPaneBItem), 4);
} else if (i == 8) {
recipePane.addButton(new Button(fillerPaneBItem), 3);
}
}
}
recipePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
recipePane.addButton(new Button(fillerPaneBItem), 7);
recipePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
});
recipePane.open(player);
}
Aggregations