use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method modifyProperty.
/**
* Opens the Pane for the Player.
* This Pane is for modifying NBT Propterties.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void modifyProperty(final Player player, final ItemMap itemMap, final String key) {
Interface modifyProperty = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
Map<String, String> properties = itemMap.getNBTValues();
modifyProperty.addButton(new Button(fillerPaneGItem), 3);
modifyProperty.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, false, "&c&l&nModify", "&7", "&7*Modify this NBT Property.", "&7", "&9&lProperty: &a" + "&f" + key + ":" + properties.get(key)), 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(":")) {
properties.remove(key);
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);
}));
modifyProperty.addButton(new Button(fillerPaneGItem));
modifyProperty.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&c&l&nDelete", "&7", "&7*Delete this custom NBT Property.", "&7", "&9&lProperty: &a" + "&f" + key + ":" + properties.get(key)), event -> {
properties.remove(key);
itemMap.setNBTValues(properties);
nbtPane(player, itemMap);
}));
modifyProperty.addButton(new Button(fillerPaneGItem), 3);
modifyProperty.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the NBT Properties menu."), event -> nbtPane(player, itemMap)));
modifyProperty.addButton(new Button(fillerPaneBItem), 7);
modifyProperty.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the NBT Properties menu."), event -> nbtPane(player, itemMap)));
});
modifyProperty.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method triggerPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying an items triggers.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void triggerPane(final Player player, final ItemMap itemMap) {
Interface triggerPane = new Interface(false, 3, GUIName, player);
SchedulerUtils.runAsync(() -> {
triggerPane.addButton(new Button(fillerPaneBItem), 3);
triggerPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "FILLED_MAP" : "MAP"), 1, itemMap.isOnlyFirstJoin(), "&e&l&nFirst Join", "&7", "&7*Gives the item when the", "&7player logs into the server", "&7for the first time only.", "&7This will overwrite any triggers", "&7such as respawn, and world-switch.", "&9&lENABLED: &a" + (itemMap.isOnlyFirstJoin() + "").toUpperCase()), event -> {
if (itemMap.isOnlyFirstJoin()) {
itemMap.setOnlyFirstJoin(false);
} else {
itemMap.setOnlyFirstJoin(true);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(ItemHandler.getItem("STONE_SWORD", 1, itemMap.isOnlyFirstWorld(), "&e&l&nFirst World", "&7", "&7*Gives the item when the", "&7player enters each of the defined", "&7worlds for the first time.", "&7", "&7This flag overwrites any triggers", "&7such as respawn, and join.", "&9&lENABLED: &a" + (itemMap.isOnlyFirstWorld() + "").toUpperCase()), event -> {
if (itemMap.isOnlyFirstWorld()) {
itemMap.setOnlyFirstWorld(false);
} else {
itemMap.setOnlyFirstWorld(true);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(ItemHandler.getItem(ServerUtils.hasSpecificUpdate("1_13") ? "TOTEM_OF_UNDYING" : "322:1", 1, itemMap.isOnlyFirstLife(), "&e&l&nFirst Life", "&7", "&7*Gives the item when the", "&7player logs into the server", "&7for the first time only,", "&7but will give the item", "&7EVERY TIME on player RESPAWN.", "&7This flag overwrites any triggers", "&7such as respawn, and join.", "&9&lENABLED: &a" + (itemMap.isOnlyFirstWorld() + "").toUpperCase()), event -> {
if (itemMap.isOnlyFirstWorld()) {
itemMap.setOnlyFirstWorld(false);
} else {
itemMap.setOnlyFirstWorld(true);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(fillerPaneBItem), 3);
triggerPane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, itemMap.isGiveOnDisabled(), "&c&l&nDISABLED", "&7", "&7*Prevents the item from given", "&7through the use of triggers.", "&7", "&7Useful to only get the item", "&7using &l/itemjoin get <item>", "&9&lENABLED: &a" + (itemMap.isGiveOnDisabled() + "").toUpperCase()), event -> {
if (itemMap.isGiveOnDisabled()) {
itemMap.setGiveOnDisabled(false);
} else {
itemMap.setGiveOnJoin(false);
itemMap.setOnlyFirstJoin(false);
itemMap.setOnlyFirstWorld(false);
itemMap.setOnlyFirstLife(false);
itemMap.setGiveOnRespawn(false);
itemMap.setGiveOnWorldSwitch(false);
itemMap.setUseOnLimitSwitch(false);
itemMap.setGiveOnRegionEnter(false);
itemMap.setGiveOnRegionLeave(false);
itemMap.setGiveOnRegionAccess(false);
itemMap.setGiveOnRegionEgress(false);
itemMap.setGiveOnDisabled(true);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "OAK_SIGN" : "323"), 1, itemMap.isGiveOnJoin(), "&e&l&nJoin", "&7", "&7*Gives the item when the", "&7player logs into the server.", "&9&lENABLED: &a" + (itemMap.isGiveOnJoin() + "").toUpperCase()), event -> {
if (itemMap.isGiveOnJoin()) {
itemMap.setGiveOnJoin(false);
} else {
itemMap.setGiveOnJoin(true);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(ItemHandler.getItem("DIAMOND", 1, itemMap.isGiveOnRespawn(), "&e&l&nRespawn", "&7", "&7*Gives the item when the", "&7player respawns from a death event.", "&9&lENABLED: &a" + (itemMap.isGiveOnRespawn() + "").toUpperCase()), event -> {
if (itemMap.isGiveOnRespawn()) {
itemMap.setGiveOnRespawn(false);
} else {
itemMap.setGiveOnRespawn(true);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(ItemHandler.getItem("STONE_BUTTON", 1, itemMap.isGiveOnWorldSwitch(), "&e&l&nWorld Switch", "&7", "&7*Gives the item when the", "&7player teleports to one", "&7of the specified worlds.", "&9&lENABLED: &a" + (itemMap.isGiveOnWorldSwitch() + "").toUpperCase()), event -> {
if (itemMap.isGiveOnWorldSwitch()) {
itemMap.setGiveOnWorldSwitch(false);
} else {
itemMap.setGiveOnWorldSwitch(true);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(ItemHandler.getItem("LEVER", 1, itemMap.isUseOnLimitSwitch(), "&e&l&nGamemode Switch", "&7", "&7*Gives the item when the", "&7player changes gamemodes to any", "&7of the defined limit-modes.", "&9&lENABLED: &a" + (itemMap.isUseOnLimitSwitch() + "").toUpperCase()), event -> {
if (itemMap.isUseOnLimitSwitch()) {
itemMap.setUseOnLimitSwitch(false);
} else {
itemMap.setUseOnLimitSwitch(true);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(ItemHandler.getItem("MINECART", 1, itemMap.isGiveOnRegionEnter(), "&e&l&nRegion Enter", "&7", "&7*Gives the item when the", "&7player enters any of the enabled-regions.", "&9&lENABLED: &a" + (itemMap.isGiveOnRegionEnter() + "").toUpperCase()), event -> {
if (itemMap.isGiveOnRegionEnter()) {
itemMap.setGiveOnRegionEnter(false);
} else {
itemMap.setGiveOnRegionEnter(true);
itemMap.setGiveOnRegionAccess(false);
itemMap.setGiveOnRegionEgress(false);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "HOPPER_MINECART" : "408"), 1, itemMap.isGiveOnRegionLeave(), "&e&l&nRegion Leave", "&7", "&7*Removes the item when the", "&7player leaves any of the enabled-regions.", "&9&lENABLED: &a" + (itemMap.isGiveOnRegionLeave() + "").toUpperCase()), event -> {
if (itemMap.isGiveOnRegionLeave()) {
itemMap.setGiveOnRegionLeave(false);
} else {
itemMap.setGiveOnRegionLeave(true);
itemMap.setGiveOnRegionAccess(false);
itemMap.setGiveOnRegionEgress(false);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "TNT_MINECART" : "407"), 1, itemMap.isGiveOnRegionAccess(), "&e&l&nRegion Access", "&7", "&7*Gives the item when the", "&7player enters any of the enabled-regions", "&7and removes the item when leaving", "&7any of the enabled-regions.", "&9&lENABLED: &a" + (itemMap.isGiveOnRegionAccess() + "").toUpperCase()), event -> {
if (itemMap.isGiveOnRegionAccess()) {
itemMap.setGiveOnRegionAccess(false);
} else {
itemMap.setGiveOnRegionAccess(true);
itemMap.setGiveOnRegionEnter(false);
itemMap.setGiveOnRegionLeave(false);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CHEST_MINECART" : "342"), 1, itemMap.isGiveOnRegionEgress(), "&e&l&nRegion Engress", "&7", "&7*Removes the item when the", "&7player enters any of the enabled-regions", "&7and gives the item when leaving", "&7any of the enabled-regions.", "&9&lENABLED: &a" + (itemMap.isGiveOnRegionEgress() + "").toUpperCase()), event -> {
if (itemMap.isGiveOnRegionEgress()) {
itemMap.setGiveOnRegionEgress(false);
} else {
itemMap.setGiveOnRegionEgress(true);
itemMap.setGiveOnRegionEnter(false);
itemMap.setGiveOnRegionLeave(false);
}
triggerPane(player, itemMap);
}));
triggerPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu"), event -> {
setTriggers(itemMap);
creatingPane(player, itemMap);
}));
triggerPane.addButton(new Button(fillerPaneBItem), 7);
triggerPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu"), event -> {
setTriggers(itemMap);
creatingPane(player, itemMap);
}));
});
triggerPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method enchantLevelPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying an echantment level.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void enchantLevelPane(final Player player, final ItemMap itemMap, final Enchantment enchant) {
Interface enchantLevelPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
enchantLevelPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the enchant selection menu."), event -> {
enchantPane(player, itemMap);
}));
enchantLevelPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Count", "&7", "&7*Click to set a custom damage", "&7value for the item."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "ENCHANT LEVEL";
placeHolders[15] = "86";
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()))) {
Map<String, Integer> enchantments = (itemMap.getEnchantments() != null) ? itemMap.getEnchantments() : new HashMap<String, Integer>();
enchantments.put(ItemHandler.getEnchantName(enchant).toUpperCase(), Integer.parseInt(ChatColor.stripColor(event.getMessage())));
itemMap.setEnchantments(enchantments);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "ENCHANT LEVEL";
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);
}
enchantPane(event.getPlayer(), itemMap);
}));
for (int i = 1; i <= 64; i++) {
final int k = i;
enchantLevelPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), k, false, "&9&lLevel: &a&l" + k, "&7", "&7*Click to set the", "&7level of the item enchantment.", "&7", "&7This will be &l" + ItemHandler.getEnchantName(enchant).toUpperCase() + ":" + k), event -> {
Map<String, Integer> enchantments = (itemMap.getEnchantments() != null) ? itemMap.getEnchantments() : new HashMap<String, Integer>();
enchantments.put(ItemHandler.getEnchantName(enchant).toUpperCase(), k);
itemMap.setEnchantments(enchantments);
enchantPane(player, itemMap);
}));
}
});
enchantLevelPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method countPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting an items stack size.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void countPane(final Player player, final ItemMap itemMap) {
Interface countPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
countPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> {
creatingPane(player, itemMap);
}));
for (int i = 1; i <= 64; i++) {
final int k = i;
countPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), k, false, "&9&lCount: &a&l" + k, "&7", "&7*Click to set the", "&7count of the item."), event -> {
itemMap.setCount(k + "");
creatingPane(player, itemMap);
}));
}
});
countPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method potionPane.
/**
* Opens the Pane for the Player.
* This Pane is for selecting the Potion Type.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void potionPane(final Player player, final ItemMap itemMap, final int stage) {
Interface potionPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
if (stage != 1) {
potionPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
} else {
potionPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the other settings menu."), event -> otherPane(player, itemMap)));
}
for (PotionEffectType potion : PotionEffectType.values()) {
if (potion != null) {
String potionString = "NONE";
if (StringUtils.nullCheck(itemMap.getPotionEffect().toString()) != "NONE") {
for (PotionEffect potions : itemMap.getPotionEffect()) {
if (potions.getType() == potion) {
potionString = potions.getType().getName().toUpperCase() + ":" + potions.getAmplifier() + ":" + (potions.getDuration());
break;
}
}
}
final String checkPotion = potionString;
potionPane.addButton(new Button(ItemHandler.getItem("GLASS_BOTTLE", 1, (checkPotion != "NONE" ? true : false), "&f" + potion.getName(), "&7", "&7*Add this potion effect", "&7to the item.", (checkPotion != "NONE" ? "&9&lInformation: &a" + checkPotion : "")), event -> {
if (checkPotion != "NONE") {
List<PotionEffect> potionEffects = itemMap.getPotionEffect();
if (StringUtils.nullCheck(itemMap.getPotionEffect().toString()) != "NONE") {
for (PotionEffect potions : potionEffects) {
if (potions.getType() == potion) {
potionEffects.remove(potions);
itemMap.setPotionEffect(potionEffects);
break;
}
}
}
potionPane(player, itemMap, stage);
} else {
levelPane(player, itemMap, potion, stage);
}
}));
}
}
});
potionPane.open(player);
}
Aggregations