use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method limitPane.
// ===========================================================================================================================================================================================================================================================
/**
* Opens the Pane for the Player.
* This Pane is for setting the Limit Gamemodes.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void limitPane(final Player player, final ItemMap itemMap) {
Interface limitPane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
List<String> limitModes = new ArrayList<String>();
if (StringUtils.containsIgnoreCase(itemMap.getLimitModes(), "ADVENTURE")) {
limitModes.add("ADVENTURE");
}
if (StringUtils.containsIgnoreCase(itemMap.getLimitModes(), "SURVIVAL")) {
limitModes.add("SURVIVAL");
}
if (StringUtils.containsIgnoreCase(itemMap.getLimitModes(), "CREATIVE")) {
limitModes.add("CREATIVE");
}
limitPane.addButton(new Button(fillerPaneGItem), 3);
limitPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "FILLED_MAP" : "MAP"), 1, limitModes.contains("ADVENTURE"), "&a&l&nADVENTURE", "&7", "&7*Limits the item to ADVENTURE mode.", "&9&lENABLED: &a" + (limitModes.contains("ADVENTURE") + "").toUpperCase()), event -> {
if (limitModes.contains("ADVENTURE")) {
limitModes.remove("ADVENTURE");
} else {
limitModes.add("ADVENTURE");
}
itemMap.setLimitModes(limitModes.toString().substring(0, limitModes.toString().length() - 1).substring(1));
limitPane(player, itemMap);
}));
limitPane.addButton(new Button(ItemHandler.getItem("STONE_SWORD", 1, limitModes.contains("SURVIVAL"), "&b&l&nSURVIVAL", "&7", "&7*Limits the item to SURVIVAL mode.", "&9&lENABLED: &a" + (limitModes.contains("SURVIVAL") + "").toUpperCase()), event -> {
if (limitModes.contains("SURVIVAL")) {
limitModes.remove("SURVIVAL");
} else {
limitModes.add("SURVIVAL");
}
itemMap.setLimitModes(limitModes.toString().substring(0, limitModes.toString().length() - 1).substring(1));
limitPane(player, itemMap);
}));
limitPane.addButton(new Button(ItemHandler.getItem(limitModes.contains("CREATIVE") ? (ServerUtils.hasSpecificUpdate("1_13") ? "ENCHANTED_GOLDEN_APPLE" : "322:1") : "GOLDEN_APPLE", 1, false, "&6&l&nCREATIVE", "&7", "&7*Limits the item to CREATIVE mode.", "&9&lENABLED: &a" + (limitModes.contains("CREATIVE") + "").toUpperCase()), event -> {
if (limitModes.contains("CREATIVE")) {
limitModes.remove("CREATIVE");
} else {
limitModes.add("CREATIVE");
}
itemMap.setLimitModes(limitModes.toString().substring(0, limitModes.toString().length() - 1).substring(1));
limitPane(player, itemMap);
}));
limitPane.addButton(new Button(fillerPaneGItem), 3);
limitPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
limitPane.addButton(new Button(fillerPaneBItem), 7);
limitPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
});
limitPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method conditionsPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the item conditions.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void conditionsPane(final Player player, final ItemMap itemMap) {
Interface conditionsPane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
conditionsPane.addButton(new Button(fillerPaneBItem), 3);
conditionsPane.addButton(new Button(ItemHandler.getItem("BOOK", 1, false, "&b&l&nCommand&b&l Conditions", "&7", "&7*Condition(s) that must be met", "&7in order to execute item commands.", "&7", "&9&lENABLED: " + String.valueOf((StringUtils.nullCheck(itemMap.getCommandConditions() + "") != "NONE")).toUpperCase()), event -> commandActionPane(player, itemMap)));
conditionsPane.addButton(new Button(ItemHandler.getItem("CACTUS", 1, false, "&b&l&nDisposable&b&l Conditions", "&7", "&7*Condition(s) that must be met", "&7in order for the disposable", "&7itemflag to function.", "&7", "&c&l&nNOTE:&7 The disposable itemflag", "&7must be defined for this", "&7condition to function.", "&7", "&9&lENABLED: " + String.valueOf((StringUtils.nullCheck(itemMap.getDisposableConditions() + "") != "NONE")).toUpperCase()), event -> disposableCPane(player, itemMap)));
conditionsPane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&b&l&nTrigger&b&l Conditions", "&7", "&7*Condition(s) that must be met", "&7in order to to receive the", "&7item when performing a trigger.", "&7", "&9&lENABLED: " + String.valueOf((StringUtils.nullCheck(itemMap.getTriggerConditions() + "") != "NONE")).toUpperCase()), event -> triggerCPane(player, itemMap)));
conditionsPane.addButton(new Button(fillerPaneBItem), 3);
conditionsPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
conditionsPane.addButton(new Button(fillerPaneBItem), 7);
conditionsPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
});
conditionsPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method togglePane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the custom toggle commands.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void togglePane(final Player player, final ItemMap itemMap) {
Interface togglePane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
togglePane.addButton(new Button(fillerPaneBItem), 2);
togglePane.addButton(new Button(ItemHandler.getItem("BOOK", 1, false, "&e&lCommands", "&7", "&7*Define specific commands which", "&7players can use to enable or disable", "&7the custom item upon execution."), event -> altCommandPane(player, itemMap, 0)));
togglePane.addButton(new Button(fillerPaneBItem));
togglePane.addButton(new Button(ItemHandler.getItem("PAPER", 1, (StringUtils.nullCheck(itemMap.getToggleMessage()) != "NONE"), "&b&lMessage", "&7", "&7*Set a custom message that", "&7will be sent to the player", "&7upon executing a toggle command.", "&9&lMESSAGE: &f" + StringUtils.nullCheck(itemMap.getToggleMessage())), event -> {
if (StringUtils.nullCheck(itemMap.getToggleMessage()) != "NONE") {
itemMap.setToggleMessage(null);
togglePane(player, itemMap);
} else {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "TOGGLE MESSAGE";
placeHolders[15] = "&a%item% has been toggled!";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}
}, event -> {
itemMap.setToggleMessage(ChatColor.stripColor(event.getMessage()));
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "TOGGLE MESSAGE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
togglePane(event.getPlayer(), itemMap);
}));
togglePane.addButton(new Button(fillerPaneBItem));
togglePane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, (StringUtils.nullCheck(itemMap.getToggleNode()) != "NONE"), "&b&lPermissions", "&7", "&7*Set a custom permissions node", "&7that each player needs in order", "&7to execute the toggle commands.", "&9&lPERMISSIONS: &f" + StringUtils.nullCheck(itemMap.getToggleNode())), event -> {
if (StringUtils.nullCheck(itemMap.getToggleNode()) != "NONE") {
itemMap.setTogglePerm(null);
togglePane(player, itemMap);
} else {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "TOGGLE PERMISSION";
placeHolders[15] = "itemjoin.toggle";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}
}, event -> {
itemMap.setTogglePerm(ChatColor.stripColor(event.getMessage()));
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "TOGGLE PERMISSION";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
togglePane(event.getPlayer(), itemMap);
}));
togglePane.addButton(new Button(fillerPaneBItem), 2);
togglePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
togglePane.addButton(new Button(fillerPaneBItem), 7);
togglePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
});
togglePane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method durationPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the Potion Duration.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void durationPane(final Player player, final ItemMap itemMap, final PotionEffectType potion, int level, final int stage) {
Interface durationPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
durationPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the potion effect menu."), event -> potionPane(player, itemMap, stage)));
durationPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Duration", "&7", "&7*Click to set a custom duration", "&7value for the potion effect."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "EFFECT DURATION";
placeHolders[15] = "110";
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()))) {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "EFFECT DURATION";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
potionPane(event.getPlayer(), itemMap, stage);
} else {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = ChatColor.stripColor(event.getMessage());
LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
durationPane(event.getPlayer(), itemMap, potion, level, stage);
}
}));
for (int i = 1; i <= 64; i++) {
final int k = i;
durationPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), k, false, "&9&lDuration: &a&l" + k + " Second(s)", "&7", "&7*Click to set the", "&7duration of the potion effect."), event -> {
List<PotionEffect> effects = itemMap.getPotionEffect();
effects.add(new PotionEffect(potion, k, level));
itemMap.setPotionEffect(effects);
potionPane(player, itemMap, stage);
}));
}
});
durationPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method patternPane.
/**
* Opens the Pane for the Player.
* This Pane is for selecting the Banner Pattern.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void patternPane(final Player player, final ItemMap itemMap, final PatternType pattern) {
Interface colorPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
colorPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the banner patterns menu."), event -> bannerPane(player, itemMap)));
for (DyeColor color : DyeColor.values()) {
colorPane.addButton(new Button(ItemHandler.getItem("GRAY_DYE", 1, false, "&f" + color.name(), "&7", "&7*This will be the color", "&7of your banner pattern."), event -> {
List<Pattern> patterns = itemMap.getBannerPatterns();
patterns.add(new Pattern(color, pattern));
itemMap.setBannerPatterns(patterns);
bannerPane(player, itemMap);
}));
}
});
colorPane.open(player);
}
Aggregations