use of me.RockinChaos.itemjoin.ItemJoin in project ItemJoin by RockinChaos.
the class Menu method flagPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying an items itemflags.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void flagPane(final Player player, final ItemMap itemMap) {
Interface flagPane = new Interface(true, 5, GUIName, player);
flagPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> {
setItemFlags(itemMap);
creatingPane(player, itemMap);
}));
SchedulerUtils.runAsync(() -> {
flagPane.addButton(new Button(ItemHandler.getItem("DIAMOND", 1, itemMap.isOpBypass(), "&a&l&nAllowOpBypass", "&7", "&a&lTrue&f:&7 Allows players who are OP to", "&7bypass any itemflags that add", "&7restrictions for this item.", "&7", "&c&lFalse&f:&7 Players who are OP will be", "&7restricted by itemflags that add", "&7restrictions for this item.", "&7", "&9&lENABLED: &a" + (itemMap.isOpBypass() + "").toUpperCase()), event -> {
if (itemMap.isOpBypass()) {
itemMap.setOpBypass(false);
} else {
itemMap.setOpBypass(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem(itemMap.isCreativeBypass() ? (ServerUtils.hasSpecificUpdate("1_13") ? "ENCHANTED_GOLDEN_APPLE" : "322:1") : "GOLDEN_APPLE", 1, itemMap.isCreativeBypass(), "&a&l&nCreativeBypass", "&7", "&a&lTrue&f:&7 Allows players who are in Creative", "&7to bypass any itemflags that add", "&7restrictions for this item.", "&7", "&c&lFalse&f:&7 Players who are in Creative will", "&7be restricted by itemflags that add", "&7restrictions for this item.", "&7", "&9&lENABLED: &a" + (itemMap.isCreativeBypass() + "").toUpperCase()), event -> {
if (itemMap.isCreativeBypass()) {
itemMap.setCreativeBypass(false);
} else {
itemMap.setCreativeBypass(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "LAPIS_LAZULI" : "351:4"), 1, itemMap.isGlowing(), "&a&l&nGlowing", "&7", "&a&lTrue&f:&7 The item will glow as if it was enchanted!", "&7", "&c&lFalse&f:&7 The item will not glow.", "&7", "&9&lENABLED: &a" + (itemMap.isGlowing() + "").toUpperCase()), event -> {
if (itemMap.isGlowing()) {
itemMap.setGlowing(false);
} else {
itemMap.setGlowing(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "DIAMOND_SHOVEL" : "277"), 7, itemMap.isStackable(), "&a&l&nStackable", "&7", "&a&lTrue&f:&7 The item will be stackable with itself!", "&7", "&c&lFalse&f:&7 The item stack only if it did in vanilla.", "&7", "&9&lENABLED: &a" + (itemMap.isStackable() + "").toUpperCase()), event -> {
if (itemMap.isStackable()) {
itemMap.setStackable(false);
} else {
itemMap.setStackable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "POPPY" : "38"), 1, itemMap.isInventoryClose(), "&a&l&nInventory Close", "&7", "&a&lTrue&f:&7 Closes the players current", "&7inventory when clicking the item.", "&7", "&c&lFalse&f:&7 The current inventory will not", "&7be closed when clicking the item.", "&7", "&9&lENABLED: &a" + (itemMap.isInventoryClose() + "").toUpperCase()), event -> {
if (itemMap.isInventoryClose()) {
itemMap.setCloseInventory(false);
} else {
itemMap.setCloseInventory(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, itemMap.isAutoRemove(), "&a&l&nAuto Remove", "&7", "&a&lTrue&f:&7 Automatically removes the", "&7item from the players inventory", "&7when entering or joining a", "&7world that is not defined", "&7under the enabled-worlds.", "&7", "&c&lFalse&f:&7 The player will keep the", "&7item when entering or joining", "&7an undefined world.", "&7", "&9&lENABLED: &a" + (itemMap.isAutoRemove() + "").toUpperCase()), event -> {
if (itemMap.isAutoRemove()) {
itemMap.setAutoRemove(false);
} else {
itemMap.setAutoRemove(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "WRITABLE_BOOK" : "386"), 1, itemMap.isOverwritable(), "&a&l&nOverwrite", "&7", "&a&lTrue&f: &7Allows the item to overwrite", "&7any existing items in the defined slot.", "&7", "&c&lFalse&f:&7 The item will not overwrite other items.", "&7When the slot is full it", "&7will fail to give the item, unless", "&7the give-next or move-next flag is set to &a&lTrue&7.", "&7", "&9&lENABLED: &a" + (itemMap.isOverwritable() + "").toUpperCase()), event -> {
if (itemMap.isOverwritable()) {
itemMap.setOverwritable(false);
} else {
itemMap.setOverwritable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("CACTUS", 1, itemMap.isDisposable(), "&a&l&nDisposable", "&7", "&a&lTrue&f:&7 If the item has a command", "&7defined, running the command", "&7will remove x1 of the item.", "&7", "&c&lFalse&f:&7 Running item commands will", "&7not lower the items count.", "&7", "&9&lENABLED: &a" + (itemMap.isDisposable() + "").toUpperCase()), event -> {
if (itemMap.isDisposable()) {
itemMap.setDisposable(false);
} else {
itemMap.setDisposable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "WOODEN_SWORD" : "268"), 1, itemMap.isVanilla(), "&a&l&nVanilla", "&7", "&a&lTrue&f:&7 The item will be given as a default no-name item.", "&cNOTE: &7Itemflags and commands will NOT work", "&7unless the vanilla-status or vanilla-control", "&7itemflags are defined.", "&7", "&c&lFalse&f:&7 The item will be given", "&7as an custom item, allowing all", "&7ItemJoin properties to continue working.", "&7", "&9&lENABLED: &a" + (itemMap.isVanilla() + "").toUpperCase()), event -> {
if (itemMap.isVanilla()) {
itemMap.setVanilla(false);
} else {
itemMap.setVanilla(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("LEATHER_HELMET", 1, itemMap.isVanillaStatus(), "&a&l&nVanilla Status", "&7", "&a&lTrue&f: &7Allows the Vanilla itemflag to retain", "&7ItemJoin properties without", "&7making it only a ItemJoin specific item.", "&cNOTE: &7Useful for trying to implement", "&7ItemJoin items into other plugins.", "&7", "&c&lFalse&f:&7 The item will be given", "&7as a custom item, allowing all", "&7ItemJoin properties to continue working.", "&7", "&9&lENABLED: &a" + (itemMap.isVanillaStatus() + "").toUpperCase()), event -> {
if (itemMap.isVanillaStatus()) {
itemMap.setVanillaStatus(false);
} else {
itemMap.setVanillaStatus(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "WOODEN_PICKAXE" : "270"), 1, itemMap.isVanillaControl(), "&a&l&nVanilla Control", "&7", "&a&lTrue&f: &7Allows the Vanilla itemflag to retain", "&7the use of commands and itemflags.", "&7", "&c&lFalse&f:&7 The item will be given", "&7as an custom item, allowing all", "&7ItemJoin properties to continue working.", "&7", "&9&lENABLED: &a" + (itemMap.isVanillaControl() + "").toUpperCase()), event -> {
if (itemMap.isVanillaControl()) {
itemMap.setVanillaControl(false);
} else {
itemMap.setVanillaControl(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("PAPER", 1, itemMap.isIpLimted(), "&a&l&nIP Limit", "&7", "&a&lTrue&f:&7 The item will be tied to the players IP.", "&7No other players using the same IP will receive the item.", "&7Useful to prevent item duplication.", "&7", "&c&lFalse&f:&7 The item will not be tied to a players IP.", "&7Other player accounts using the same IP will receive the item.", "&7", "&9&lENABLED: &a" + (itemMap.isIpLimted() + "").toUpperCase()), event -> {
if (itemMap.isIpLimted()) {
itemMap.setIpLimited(false);
} else {
itemMap.setIpLimited(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem(itemMap.isUnbreakable() ? "ENCHANTED_BOOK" : "BOOK", 1, itemMap.isUnbreakable(), "&a&l&nUnbreakable", "&7", "&a&lTrue&f:&7 Allows the item to be unbreakable or INDESTRUCTIBLE!", "&7", "&c&lFalse&f:&7 The item will be damageable when being used.", "&7", "&7This flag only takes effect on items which have durability.", "&7", "&9&lENABLED: &a" + (itemMap.isUnbreakable() + "").toUpperCase()), event -> {
if (itemMap.isUnbreakable()) {
itemMap.setUnbreakable(false);
} else {
itemMap.setUnbreakable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "FILLED_MAP" : "358"), 1, itemMap.isFlagsInfo(), "&a&l&nHide Flags", "&7", "&a&lTrue&f: &7Hides all information tags from the item", "&7such as firework colors, damage values, enchants, etc.", "&7", "&c&lFalse&f:&7 The item will have information tags visible.", "&7", "&9&lENABLED: &a" + (itemMap.isFlagsInfo() + "").toUpperCase()), event -> {
if (itemMap.isFlagsInfo()) {
itemMap.setFlagsInfo(false);
} else {
itemMap.setFlagsInfo(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "ENDER_EYE" : "381"), 1, itemMap.isAttributesInfo(), "&a&l&nHide Attributes", "&7", "&a&lTrue&f: &7Hides all attribute tags from the item", "&7such damage values, attack speed, hit points, etc.", "&7Typically this is the information that", "&7starts with (When in Main Hand:).", "&7", "&c&lFalse&f:&7 The item will have information tags visible.", "&7", "&9&lENABLED: &a" + (itemMap.isAttributesInfo() + "").toUpperCase()), event -> {
if (itemMap.isAttributesInfo()) {
itemMap.setAttributesInfo(false);
} else {
itemMap.setAttributesInfo(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("IRON_SWORD", 1, itemMap.isDurabilityBar(), "&a&l&nHide Durability", "&7", "&a&lTrue&f:&7 The durability bar of the damageable ", "&7item will be hidden.", "&cNOTE: &7Items with this flag will still break,", "&7unless the unbreakable flag is set to &a&lTrue&7.", "&7", "&c&lFalse&f:&7 The durability bar of the", "&7damageable item will be shown as normal.", "&7", "&9&lENABLED: &a" + (itemMap.isDurabilityBar() + "").toUpperCase()), event -> {
if (itemMap.isDurabilityBar()) {
itemMap.setDurabilityBar(false);
} else {
itemMap.setDurabilityBar(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("COBBLESTONE", 1, itemMap.isPlaceable(), "&a&l&nPlacement", "&7", "&a&lTrue&f: &7Prevents the item from being", "&7placed on the ground,", "&7in any item-frames, and entities.", "&7", "&c&lFalse&f: &7Item will be able to be placed.", "&7", "&9&lENABLED: &a" + (itemMap.isPlaceable() + "").toUpperCase()), event -> {
if (itemMap.isPlaceable()) {
itemMap.setPlaceable(false);
} else {
itemMap.setPlaceable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("BEDROCK", 1, itemMap.isMovement(), "&a&l&nInventory Modify", "&7", "&a&lTrue&f: &7Prevents the item from being", "&7moved or switched to other slots", "&7and blocks placement in item-frames.", "&7", "&c&lFalse&f:&7 Allows the item to be moved", "&7freely inside the players inventory.", "&7", "&9&lENABLED: &a" + (itemMap.isMovement() + "").toUpperCase()), event -> {
if (itemMap.isMovement()) {
itemMap.setMovement(false);
} else {
itemMap.setMovement(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("DIAMOND_HELMET", 1, itemMap.isEquip(), "&a&l&nCancel Equip", "&7", "&a&lTrue&f: &7Prevents the item from being", "&7moved or switched to armor slots.", "&7", "&c&lFalse&f:&7 Allows the item to be moved", "&7freely inside the players inventory.", "&7", "&9&lENABLED: &a" + (itemMap.isEquip() + "").toUpperCase()), event -> {
if (itemMap.isEquip()) {
itemMap.setEquip(false);
} else {
itemMap.setEquip(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, itemMap.isDynamic(), "&a&l&nDynamic", "&7", "&a&lTrue&f: &7Allows the item to dynamically", "&7update every 100 ticks", "&7Useful for updating placeholders.", "&7", "&c&lFalse&f: &7Item will not update its name, lore, etc.", "&7", "&9&lENABLED: &a" + (itemMap.isDynamic() + "").toUpperCase()), event -> {
if (itemMap.isDynamic()) {
itemMap.setDynamic(false);
} else {
itemMap.setDynamic(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("EGG", 1, itemMap.isAnimated(), "&a&l&nAnimate", "&7", "&a&lTrue&f: &7Allows the item to animate between", "&7its different iterations defined", "&7under the animations tab.", "&7", "&c&lFalse&f: &7Item will not animate.", "&7", "&9&lENABLED: &a" + (itemMap.isAnimated() + "").toUpperCase()), event -> {
if (itemMap.isAnimated()) {
itemMap.setAnimate(false);
} else {
itemMap.setAnimate(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CHEST_MINECART" : "342"), 1, itemMap.isItemStore(), "&a&l&nItem Store", "&7", "&a&lTrue&f:&7 Prevents the storage of the item in any containers.", "&7Such as chests, armor stands, anvils, etc.", "&7", "&c&lFalse&f:&7 The item can be stored in containers.", "&7", "&9&lENABLED: &a" + (itemMap.isItemStore() + "").toUpperCase()), event -> {
if (itemMap.isItemStore()) {
itemMap.setItemStore(false);
} else {
itemMap.setItemStore(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "OAK_DOOR" : (ServerUtils.hasSpecificUpdate("1_8") ? "324" : "64")), 1, itemMap.isCountLock(), "&a&l&nCount Lock", "&7", "&a&lTrue&f:&7 The item can be used indefinitely.", "&7Useful to give a player infinite apples.", "&cNOTE: &7This will overwrite the disposable flag.", "&7", "&c&lFalse&f:&7 The item will be removed from the inventory on use.", "&7", "&9&lENABLED: &a" + (itemMap.isCountLock() + "").toUpperCase()), event -> {
if (itemMap.isCountLock()) {
itemMap.setCountLock(false);
} else {
itemMap.setCountLock(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("CHEST", 1, itemMap.isDeathKeepable(), "&a&l&nDeath Keep", "&7", "&a&lTrue&f:&7 On death, the item will remain", "&7in players inventory on respawn.", "&7", "&c&lFalse&f:&7 On death, the item will be dropped", "&7at the death location as normal.", "&7", "&9&lENABLED: &a" + (itemMap.isDeathKeepable() + "").toUpperCase()), event -> {
if (itemMap.isDeathKeepable()) {
itemMap.setDeathKeepable(false);
} else {
itemMap.setDeathKeepable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("BONE", 1, itemMap.isDeathDroppable(), "&a&l&nDeath Drops", "&7", "&a&lTrue&f:&7 On death, the item will be removed", "&7from the players inventory.", "&7", "&c&lFalse&f:&7 On death, the item will be dropped", "&7at the death location as normal.", "&7", "&9&lENABLED: &a" + (itemMap.isDeathDroppable() + "").toUpperCase()), event -> {
if (itemMap.isDeathDroppable()) {
itemMap.setDeathDroppable(false);
} else {
itemMap.setDeathDroppable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("HOPPER", 1, itemMap.isSelfDroppable(), "&a&l&nSelf Drops", "&7", "&a&lTrue&f: &7Prevents the item from being dropped", "&7by the player, returns it back to their inventory.", "&7", "&c&lFalse&f: &7Allows the item to be dropped.", "&7", "&9&lENABLED: &a" + (itemMap.isSelfDroppable() + "").toUpperCase()), event -> {
if (itemMap.isSelfDroppable()) {
itemMap.setSelfDroppable(false);
} else {
itemMap.setSelfDroppable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("FURNACE", 1, itemMap.isItemModify(), "&a&l&nItem Modifiable", "&7", "&a&lTrue&f: &7Blocks the item from being", "&7repaired or enchanted in-game.", "&7", "&c&lFalse&f: &7Allows items to", "&7be repaired and enchanted.", "&7", "&9&lENABLED: &a" + (itemMap.isItemModify() + "").toUpperCase()), event -> {
if (itemMap.isItemModify()) {
itemMap.setItemModify(false);
} else {
itemMap.setItemModify(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("ANVIL", 1, itemMap.isItemRepairable(), "&a&l&nItem Repairable", "&7", "&a&lTrue&f: &7Blocks the item from being", "&7used in an anvil or repaired.", "&7", "&c&lFalse&f: &7Allows the item to be repaired.", "&7", "&9&lENABLED: &a" + (itemMap.isItemRepairable() + "").toUpperCase()), event -> {
if (itemMap.isItemRepairable()) {
itemMap.setItemRepairable(false);
} else {
itemMap.setItemRepairable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 1, itemMap.isItemCraftable(), "&a&l&nItem Craftable", "&7", "&a&lTrue&f: &7Blocks the item from being", "&7used in a crafting recipe.", "&7", "&c&lFalse&f: &7Item will be usable in", "&7a crafting recipe.", "&7", "&9&lENABLED: &a" + (itemMap.isItemCraftable() + "").toUpperCase()), event -> {
if (itemMap.isItemCraftable()) {
itemMap.setItemCraftable(false);
} else {
itemMap.setItemCraftable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("BOW", 1, itemMap.isCancelEvents(), "&a&l&nCancel Events", "&7", "&a&lTrue&f: &7Prevents almost any event from executing", "&7when right-clicking the item.", "&7", "&c&lFalse&f: &7Allows item events to be executed freely.", "&7", "&9&lENABLED: &a" + (itemMap.isCancelEvents() + "").toUpperCase()), event -> {
if (itemMap.isCancelEvents()) {
itemMap.setCancelEvents(false);
} else {
itemMap.setCancelEvents(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "WHEAT_SEEDS" : "295"), 1, itemMap.isAlwaysGive(), "&a&l&nAlways Give", "&7", "&a&lTrue&f: &7Gives the item every time the player", "&7performs one of the triggers actions.", "&7regardless of already having the item.", "&7", "&cNOTE: &7Don't use this if you want only ONE instance of the item.", "&7", "&c&lFalse&f: &7Normal item restrictions will apply.", "&7", "&9&lENABLED: &a" + (itemMap.isAlwaysGive() + "").toUpperCase()), event -> {
if (itemMap.isAlwaysGive()) {
itemMap.setAlwaysGive(false);
} else {
itemMap.setAlwaysGive(true);
}
flagPane(player, itemMap);
}));
if (itemMap.getMaterial().toString().contains("TIPPED_ARROW") || itemMap.getMaterial().toString().contains("ARROW")) {
flagPane.addButton(new Button(ItemHandler.getItem("ENDER_PEARL", 1, itemMap.isTeleport(), "&a&l&nTeleport", "&7", "&a&lTrue&f: &7Teleports the Player to the location", "&7that the arrow landed.", "&cNOTE: &7This only works if the arrow is fired by a Bow.", "&9&lENABLED: &a" + (itemMap.isTeleport() + "").toUpperCase()), event -> {
if (itemMap.isTeleport()) {
itemMap.setTeleport(false);
} else {
itemMap.setTeleport(true);
}
flagPane(player, itemMap);
}));
} else {
flagPane.addButton(new Button(fillerPaneBItem));
}
flagPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "ENCHANTING_TABLE" : "116"), 1, itemMap.isItemChangable(), "&a&l&nAllow Modifications", "&7", "&a&lTrue&f: &7Allows the players to modify the item", "&7while retaining all properties.", "&7", "&c&lFalse&f: &7Item will not be modifiable.", "&7", "&9&lENABLED: &a" + (itemMap.isItemChangable() + "").toUpperCase()), event -> {
if (itemMap.isItemChangable()) {
itemMap.setItemChangable(false);
} else {
itemMap.setItemChangable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("ITEM_FRAME", 1, itemMap.isGiveNext(), "&a&l&nGive Next", "&7", "&a&lTrue&f: &7Gives the item to the next available slot", "&7only if the defined slot already has an existing item.", "&cNOTE: &7The overwrite flag will not work.", "&7", "&c&lFalse&f:&7 The item will be only given in the defined slot.", "&7If an item is already in the slot the", "&7item wont be given, unless the overwrite", "&7flag is set to &l&aTrue&7.", "&7", "&9&lENABLED: &a" + (itemMap.isGiveNext() + "").toUpperCase()), event -> {
if (itemMap.isGiveNext()) {
itemMap.setGiveNext(false);
} else {
itemMap.setGiveNext(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("MINECART", 1, itemMap.isMoveNext(), "&a&l&nMove Next", "&7", "&a&lTrue&f: &7Moves the existing item to the next available slot", "&7only if the defined slot already has an existing item.", "&cNOTE: &7The overwrite flag will not work.", "&7", "&c&lFalse&f: &7The item will be only given in the defined slot.", "&7If an item is already in the slot the", "&7item wont be given, unless the overwrite", "&7flag is set to &l&aTrue&7.", "&7", "&9&lENABLED: &a" + (itemMap.isMoveNext() + "").toUpperCase()), event -> {
if (itemMap.isMoveNext()) {
itemMap.setMoveNext(false);
} else {
itemMap.setMoveNext(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("DIAMOND_SWORD", 1, itemMap.isDropFull(), "&a&l&nDrop Full", "&7", "&a&lTrue&f: &7Drops the item on the ground if", "&7the players inventory is full.", "&7", "&c&lFalse&f: &7Fails to give the item", "&7if the players inventory is full.", "&7", "&9&lENABLED: &a" + (itemMap.isDropFull() + "").toUpperCase()), event -> {
if (itemMap.isDropFull()) {
itemMap.setDropFull(false);
} else {
itemMap.setDropFull(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, itemMap.isSelectable(), "&a&l&nSelectable", "&7", "&a&lTrue&f: &7Prevents the item from being", "&7held in the players hand.", "&7", "&c&lFalse&f: &7Allows the item to be selected.", "&7", "&9&lENABLED: &a" + (itemMap.isSelectable() + "").toUpperCase()), event -> {
if (itemMap.isSelectable()) {
itemMap.setSelectable(false);
} else {
itemMap.setSelectable(true);
}
flagPane(player, itemMap);
}));
flagPane.addButton(new Button(fillerPaneBItem), 35);
});
flagPane.open(player);
}
use of me.RockinChaos.itemjoin.ItemJoin in project ItemJoin by RockinChaos.
the class Menu method clearPane.
/**
* Opens the Pane for the Player.
*
* @param player - The Player to have the Pane opened.
*/
private static void clearPane(final Player player) {
Interface clearPane = new Interface(false, 3, GUIName, player);
SchedulerUtils.runAsync(() -> {
clearPane.addButton(new Button(fillerPaneBItem), 3);
clearPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GRASS_BLOCK" : "2"), 1, ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Type").equalsIgnoreCase("ALL"), "&bType: &a&lALL", "&7", "&7*ALL items including other plugin(s)", "&7and vanilla items should be cleared", "&7upon performing a trigger.", "&9&lENABLED: &a" + (ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Type").equalsIgnoreCase("ALL") + "").toUpperCase()), event -> {
if (!ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Type").equalsIgnoreCase("ALL")) {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Clear-Items.Type", "ALL");
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> clearPane(player));
}
}));
clearPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CLOCK" : "342"), 1, false, "&b&lClear Delay", "&7", "&7*The number of second(s)", "&7to wait before clearing", "&7items from the player inventory.", "&9&lDelay: &a" + (ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Delay-Tick") + "").toUpperCase()), event -> numberPane(player, 3)));
clearPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "PISTON" : "33"), 1, ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Type").equalsIgnoreCase("ITEMJOIN"), "&bType: &a&lITEMJOIN", "&7", "&7*Only ItemJoin (custom items)", "&7should be cleared upon", "&7performing a trigger.", "&9&lENABLED: &a" + (ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Type").equalsIgnoreCase("ITEMJOIN") + "").toUpperCase()), event -> {
if (!ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Type").equalsIgnoreCase("ITEMJOIN")) {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Clear-Items.Type", "ITEMJOIN");
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> clearPane(player));
}
}));
clearPane.addButton(new Button(fillerPaneBItem), 3);
clearPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "OAK_SIGN" : "323"), 1, false, "&c&l&nJoin", "&7", "&7*Clears the items from the", "&7player upon joining the server.", "&9&lENABLED: &a" + ((!StringUtils.containsIgnoreCase(ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Join"), "DISABLE") ? ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Join") : "FALSE")).toUpperCase()), event -> worldPane(player, "Clear-Items.Join")));
clearPane.addButton(new Button(ItemHandler.getItem("LAVA_BUCKET", 1, false, "&c&l&nQuit", "&7", "&7*Clears the items from the", "&7player upon quiting the server.", "&9&lENABLED: &a" + ((!StringUtils.containsIgnoreCase(ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Quit"), "DISABLE") ? ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Quit") : "FALSE")).toUpperCase()), event -> worldPane(player, "Clear-Items.Quit")));
clearPane.addButton(new Button(fillerPaneBItem));
clearPane.addButton(new Button(ItemHandler.getItem("STONE_BUTTON", 1, false, "&c&l&nWorld-Switch", "&7", "&7*Clears the items from the", "&7player upon changing worlds.", "&9&lENABLED: &a" + ((!StringUtils.containsIgnoreCase(ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.World-Switch"), "DISABLE") ? ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.World-Switch") : "FALSE")).toUpperCase()), event -> worldPane(player, "Clear-Items.World-Switch")));
clearPane.addButton(new Button(fillerPaneBItem));
clearPane.addButton(new Button(ItemHandler.getItem("MINECART", 1, false, "&c&l&nRegion-Enter", "&7", "&7*Clears the items from the", "&7player upon entering", "&7a WorldGuard region.", (DependAPI.getDepends(false).getGuard().guardEnabled() ? "&9&lENABLED: &a" + ((!StringUtils.containsIgnoreCase(ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Region-Enter"), "DISABLE") ? ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Region-Enter") : "FALSE")).toUpperCase() : ""), (DependAPI.getDepends(false).getGuard().guardEnabled() ? "" : "&7"), (DependAPI.getDepends(false).getGuard().guardEnabled() ? "" : "&c&lERROR: &7WorldGuard was NOT found."), (DependAPI.getDepends(false).getGuard().guardEnabled() ? "" : "&7This button will do nothing...")), event -> {
if (DependAPI.getDepends(false).getGuard().guardEnabled()) {
worldPane(player, "Clear-Items.Region-Enter");
}
}));
clearPane.addButton(new Button(fillerPaneBItem));
clearPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "COMMAND_BLOCK" : "137"), 1, false, "&b&lOptions", "&7", "&7*Actions to apply to", "&7the clear items triggers", "&7such as OP bypass.", "&9&lENABLED: &a" + ((!StringUtils.containsIgnoreCase(ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Options"), "DISABLE") ? ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Options") : "FALSE")).toUpperCase()), event -> optionPane(player)));
clearPane.addButton(new Button(ItemHandler.getItem("CHEST", 1, false, "&b&lBlackList", "&7", "&7*Materials, Slots, or Item Names", "&7to be blacklisted from being", "&7cleared upon performing a trigger.", "&9&lENABLED: &a" + (!ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Blacklist").isEmpty() + "").toUpperCase()), event -> blacklistPane(player)));
clearPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item settings menu."), event -> itemSettings(player)));
clearPane.addButton(new Button(fillerPaneBItem), 7);
clearPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item settings menu."), event -> itemSettings(player)));
});
clearPane.open(player);
}
use of me.RockinChaos.itemjoin.ItemJoin 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.ItemJoin in project ItemJoin by RockinChaos.
the class Menu method configSettings.
/**
* Opens the CONFIG SETTINGS PANE for the Player.
*
* @param player - The Player to have the Pane opened.
*/
private static void configSettings(final Player player) {
Interface configPane = new Interface(false, 3, GUIName, player);
SchedulerUtils.runAsync(() -> {
configPane.addButton(new Button(fillerPaneBItem), 3);
configPane.addButton(new Button(ItemHandler.getItem("PAPER", 1, false, "&6Language", "&7", "&7*The selected lang.yml language.", "&7This is for messages sent", "&7from the plugin to the player.", "&9&lLANG: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getString("Language")).toUpperCase()), event -> languagePane(player)));
configPane.addButton(new Button(fillerPaneBItem));
configPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "COMMAND_BLOCK" : "137"), 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Database.MySQL"), "&bMySQL Database", "&7", "&7*If the plugin should use", "&7a MySQL Database instead", "&7of the locale SQLite Database.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Database.MySQL")).toUpperCase()), event -> databasePane(player)));
configPane.addButton(new Button(fillerPaneBItem), 4);
configPane.addButton(new Button(ItemHandler.getItem("BUCKET", 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.CheckforUpdates"), "&bCheck for Updates", "&7", "&7*If the plugin should check", "&7for updates at start-up.", "&7This includes the use of the", "&7/itemjoin updates/upgrade command(s).", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.CheckforUpdates")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("General.CheckforUpdates", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.CheckforUpdates"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> configSettings(player));
}));
configPane.addButton(new Button(ItemHandler.getItem("COMPASS", 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Metrics-Logging"), "&bMetrics Logging", "&7", "&7*If the plugin is allowed", "&7to log plugin data such as", "&7the server(s) Java version.", "&7It is recommended to keep this", "&7set to true as it improves", "&7the quality of plugin updates.", "&7", "&7You can view the logged data", "&7Here: https://bstats.org/plugin/bukkit/ItemJoin", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Metrics-Logging")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("General.Metrics-Logging", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Metrics-Logging"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> configSettings(player));
}));
configPane.addButton(new Button(ItemHandler.getItem("STICK", 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Debugging"), "&bDebugging", "&7", "&7*Allows for more detailed", "&7CONSOLE messages from the plugin.", "&7Typically only used by the", "&7plugin developer to determine", "&7issues or bugs with the plugin.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Debugging")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("General.Debugging", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Debugging"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> configSettings(player));
}));
configPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GRASS_BLOCK" : "2"), 1, ((ConfigHandler.getConfig().getFile("config.yml").getStringList("Active-Commands.commands").size() != 0 && !StringUtils.containsIgnoreCase(ConfigHandler.getConfig().getFile("config.yml").getString("Active-Commands.enabled-worlds"), "DISABLED"))), "&bActive Commands", "&7", "&7*Specify a list of commands", "&7to be executed upon performing a trigger.", "&7These commands are not related to", "&7custom items, rather the server itself.", "&9&lENABLED: &a" + ((ConfigHandler.getConfig().getFile("config.yml").getStringList("Active-Commands.commands").size() != 0 && !StringUtils.containsIgnoreCase(ConfigHandler.getConfig().getFile("config.yml").getString("Active-Commands.enabled-worlds"), "DISABLED")) ? "YES" : "NO")), event -> activeCommands(player)));
configPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GOLDEN_APPLE" : "322"), 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Commands-OP"), "&bPlugin Commands &c&l[OP PLAYERS]", "&7", "&7*If the plugin should check", "&7if the OP player has the", "&7proper permissions set to", "&7use the plugin commands.", "&7OP Players will no longer get", "&7access to all plugin commands", "&7by default.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Commands-OP")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Permissions.Commands-OP", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Commands-OP"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> configSettings(player));
}));
configPane.addButton(new Button(ItemHandler.getItem("BOOK", 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Commands-Get"), "&bGet Commands", "&7", "&7*If the get and getAll", "&7commands should check for item", "&c&lpermissions &7before giving the item.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Commands-Get")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Permissions.Commands-Get", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Commands-Get"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> configSettings(player));
}));
configPane.addButton(new Button(ItemHandler.getItem("BEDROCK", 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Movement-Bypass"), "&bMovement Bypass", "&7", "&7*Enables the use of the", "&aitemjoin.bypass.inventorymodify", "&7permission-node, used to ignore", "&7the global itemMovement prevention", "&7or a custom items itemflag.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Movement-Bypass")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Permissions.Movement-Bypass", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Movement-Bypass"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> configSettings(player));
}));
configPane.addButton(new Button(fillerPaneBItem));
configPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the main menu."), event -> startMenu(player)));
configPane.addButton(new Button(fillerPaneBItem), 7);
configPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the main menu."), event -> startMenu(player)));
});
configPane.open(player);
}
use of me.RockinChaos.itemjoin.ItemJoin in project ItemJoin by RockinChaos.
the class Menu method itemSettings.
/**
* Opens the ITEM SETTINGS PANE for the Player.
*
* @param player - The Player to have the Pane opened.
*/
private static void itemSettings(final Player player) {
Interface itemPane = new Interface(false, 3, GUIName, player);
SchedulerUtils.runAsync(() -> {
itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CLOCK" : "347"), 1, false, "&bTrigger Delay", "&7", "&7*This is the delay in half-seconds", "&7that ItemJoin will wait", "&7to give you the items.", "&7", "&cNOTE: &7It is recommended to", "&7set this to 2 or 3 half-seconds.", "&9&lDELAY: &a" + String.valueOf(ConfigHandler.getConfig().getFile("items.yml").getString("items-Delay")).toUpperCase() + " half-second(s)"), event -> numberPane(player, 1)));
itemPane.addButton(new Button(fillerPaneBItem));
final String defaultTriggers = ConfigHandler.getConfig().getFile("config.yml").getString("Settings.Default-Triggers");
itemPane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&bDefault Triggers", "&7", "&7*This will be the default", "&7triggers used if a custom", "&7item is defined without", "&7specifying any triggers.", "&9&lENABLED: &a" + String.valueOf((defaultTriggers != null && !defaultTriggers.isEmpty() && !StringUtils.containsIgnoreCase(defaultTriggers, "DISABLE")) ? defaultTriggers : "FALSE").toUpperCase()), event -> triggerPane(player, 0)));
itemPane.addButton(new Button(fillerPaneBItem));
itemPane.addButton(new Button(ItemHandler.getItem("COOKIE", 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items"), "&bItem Permissions", "&7", "&7*If custom items should require", "&7the player to have specific", "&7permissions to receive the item.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Permissions.Obtain-Items", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> itemSettings(player));
}));
itemPane.addButton(new Button(fillerPaneBItem));
itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "PISTON" : "33"), 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items-OP"), "&bItem Permissions &c&l[OP PLAYERS]", "&7", "&7*If custom items should require", "&7the &c&lOP player(s)&7 to have specific", "&7permissions to receive the item.", "&c&lNOTE: &7This only applies to &c&lOP player(s)&7.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items-OP")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Permissions.Obtain-Items-OP", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items-OP"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> itemSettings(player));
}));
itemPane.addButton(new Button(fillerPaneBItem));
itemPane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-Overwrite"), "&bOverwrite", "&7", "&7*Setting this to true will allow", "&7all custom items to overwrite", "&7any custom or vanilla items.", "&7", "&cNOTE: &7If set to false, the", "&7overwrite itemflag will still", "&7function normally.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("items.yml").getString("items-Overwrite")).toUpperCase()), event -> overwritePane(player)));
itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "OAK_FENCE" : "85"), 1, ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-Spamming"), "&bSpamming", "&7", "&7*Setting this to false will prevent", "&7players from macro spamming", "&7the use of item commands.", "&7", "&cNOTE: &7It is recommended to", "&7leave this set to false.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-Spamming")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "items.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("items-Spamming", !ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-Spamming"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "items.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> itemSettings(player));
}));
itemPane.addButton(new Button(ItemHandler.getItem("DIAMOND", 1, ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-RestrictCount"), "&bRestrict Count", "&7", "&7*Settings this to true will", "&7allow players to have their items", "&7refreshed (topped up) if they have", "&7used/consumed some of the given", "&7stack of custom items.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-RestrictCount")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "items.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("items-RestrictCount", !ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-RestrictCount"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "items.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> itemSettings(player));
}));
itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "OAK_WOOD" : "17"), 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Log-Commands"), "&bLog Commands", "&7", "&7*If the plugin prevent CONSOLE", "&7from logging any executed", "&7comamnd from the custom items.", "&7This only works for item command(s).", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Log-Commands")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("General.Log-Commands", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Log-Commands"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> itemSettings(player));
}));
itemPane.addButton(new Button(ItemHandler.getItem("IRON_HELMET", 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.HeldItem-Animations"), "&bHeld Item Animations", "&7", "&7*If the animate or dynamic", "&7itemflags should update the item", "&7while the player is holding the item.", "&7", "&7This essentially prevents the", "&7glitchy held item animation", "&7from the item constantly updating.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.HeldItem-Animations")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Settings.HeldItem-Animations", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.HeldItem-Animations"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().reloadConfigs(true);
SchedulerUtils.runLater(2L, () -> itemSettings(player));
}));
final int heldSlot = ConfigHandler.getConfig().getFile("config.yml").getInt("Settings.HeldItem-Slot");
itemPane.addButton(new Button(ItemHandler.getItem("DIAMOND_SWORD", (heldSlot > 0 ? heldSlot : 1), false, "&bHeld Item Slot", "&7", "&7*This is the hotbar slot that", "&7the player will automatically", "&7have selected upon performing", "&7one of the held item triggers.", "&9&lSLOT: &a" + String.valueOf((heldSlot >= 0 ? heldSlot : "NONE"))), event -> numberPane(player, 2)));
final String heldTriggers = ConfigHandler.getConfig().getFile("config.yml").getString("Settings.HeldItem-Triggers");
itemPane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&bHeld Item Triggers", "&7", "&7*When these trigger(s)", "&7are performed, the held item", "&7slot will be set.", "&9&lENABLED: &a" + String.valueOf((heldTriggers != null && !heldTriggers.isEmpty() && !StringUtils.containsIgnoreCase(heldTriggers, "DISABLE")) ? heldTriggers : "FALSE").toUpperCase()), event -> triggerPane(player, 1)));
itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "ENCHANTING_TABLE" : "116"), 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.DataTags"), "&bDataTags", "&7", "&7*If custom items should use", "&7data tags (NBTTags) to distinguish", "&7each custom item, making them unqiue.", "&c&lNOTE: &7This only works on Minecraft 1.8+", "&7It is recommended to keep", "&7this set to TRUE.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.DataTags")).toUpperCase()), event -> {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Settings.DataTags", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.DataTags"));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().reloadConfigs(true);
SchedulerUtils.runLater(2L, () -> itemSettings(player));
}));
itemPane.addButton(new Button(ItemHandler.getItem("LAVA_BUCKET", 1, false, "&bClear Items", "&7", "&7*Modify settings for clearing", "&7specific items when a player", "&7performed a specified action."), event -> clearPane(player)));
itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "COMMAND_BLOCK" : "137"), 1, false, "&bPrevent Actions", "&7", "&7*Disable certain actions", "&7with items for players."), event -> preventPane(player)));
itemPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the main menu."), event -> startMenu(player)));
itemPane.addButton(new Button(fillerPaneBItem), 7);
itemPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the main menu."), event -> startMenu(player)));
});
itemPane.open(player);
}
Aggregations