Java Code Examples for org.bukkit.event.inventory.ClickType#SHIFT_RIGHT
The following examples show how to use
org.bukkit.event.inventory.ClickType#SHIFT_RIGHT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChestGUIListener.java From NovaGuilds with GNU General Public License v3.0 | 6 votes |
@EventHandler public void onInventoryClick(InventoryClickEvent event) { Inventory inventory = CompatibilityUtils.getClickedInventory(event); if(inventory == null || event.getCurrentItem() == null || (!inventory.equals(event.getView().getTopInventory()) && event.getClick() != ClickType.SHIFT_LEFT && event.getClick() != ClickType.SHIFT_RIGHT)) { return; } Player player = (Player) event.getWhoClicked(); NovaPlayer nPlayer = PlayerManager.getPlayer(player); GUIInventory guiInventory = nPlayer.getGuiInventory(); if(guiInventory != null) { event.setCancelled(true); if(event.getSlot() == inventory.getSize() - 1 && event.getCurrentItem().equals(Message.INVENTORY_GUI_BACK.getItemStack())) { player.closeInventory(); return; } if(event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR) { guiInventory.onClick(event); } } }
Example 2
Source File: EventFilterMatchModule.java From PGM with GNU Affero General Public License v3.0 | 5 votes |
ClickType convertClick(ClickType clickType, Player player) { if (clickType == ClickType.RIGHT && player.isSneaking()) { return ClickType.SHIFT_RIGHT; } else { return clickType; } }
Example 3
Source File: EventFilterMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
ClickType convertClick(ClickType clickType, Player player) { if(clickType == ClickType.RIGHT && player.isSneaking()) { return ClickType.SHIFT_RIGHT; } else { return clickType; } }
Example 4
Source File: ExtractionPipeSettingsInventory.java From Transport-Pipes with MIT License | 4 votes |
@Override protected boolean click(Player p, int rawSlot, ClickType ct) { ExtractionPipe pipe = (ExtractionPipe) duct; // clicked change extract direction if (rawSlot == 2) { save(p); pipe.updateExtractDirection(true); return true; } // clicked change extract amount if (rawSlot == 4) { save(p); pipe.setExtractAmount(pipe.getExtractAmount().next()); populate(); return true; } // clicked change extract condition if (rawSlot == 6) { save(p); pipe.setExtractCondition(pipe.getExtractCondition().next()); populate(); return true; } // clicked filtering mode wool if (rawSlot == 18) { if (ct == ClickType.LEFT || ct == ClickType.SHIFT_LEFT) { pipe.getItemFilter().setFilterMode(pipe.getItemFilter().getFilterMode().next()); } else if (ct == ClickType.RIGHT || ct == ClickType.SHIFT_RIGHT) { pipe.getItemFilter().setFilterStrictness(pipe.getItemFilter().getFilterStrictness().next()); } save(p); populate(); return true; } // clicked scroll left if (rawSlot == 19) { save(p); if (scrollValue > 0) { scrollValue--; } populate(); return true; } // clicked scroll right if (rawSlot == 26) { save(p); if (scrollValue < ItemFilter.MAX_ITEMS_PER_ROW - 6) { scrollValue++; } populate(); return true; } return false; }
Example 5
Source File: ArmorStandGUI.java From ArmorStandTools with MIT License | 4 votes |
@EventHandler public void onInventoryClick(InventoryClickEvent event) { if(!event.getInventory().equals(i)) return; Player p = (Player) event.getWhoClicked(); if(event.getClick() == ClickType.SHIFT_LEFT || event.getClick() == ClickType.SHIFT_RIGHT || event.getClick() == ClickType.NUMBER_KEY) { event.setCancelled(true); return; } int slot = event.getRawSlot(); if(slot > i.getSize()) return; if(invSlots.contains(slot)) { if(plugin.checkBlockPermission(p, as.getLocation().getBlock())) { updateInventory(); } else { event.setCancelled(true); p.sendMessage(ChatColor.RED + Config.wgNoPerm); } return; } event.setCancelled(true); if(!(event.getWhoClicked() instanceof Player)) return; ArmorStandTool t = ArmorStandTool.get(event.getCurrentItem()); if(t == null) return; if (!plugin.playerHasPermission(p, as.getLocation().getBlock(), t)) { p.sendMessage(ChatColor.RED + Config.generalNoPerm); return; } switch (t) { case INVIS: as.setVisible(!as.isVisible()); Utils.actionBarMsg(p, Config.asVisible + ": " + (as.isVisible() ? Config.isTrue : Config.isFalse)); break; case CLONE: p.closeInventory(); plugin.pickUpArmorStand(Main.nms.clone(as), p, true); Utils.actionBarMsg(p, Config.carrying); break; case SAVE: if(Config.requireCreative && p.getGameMode() != GameMode.CREATIVE) { p.sendMessage(ChatColor.RED + Config.creativeRequired); } else { Main.nms.generateCmdBlock(p.getLocation(), as); Utils.actionBarMsg(p, Config.cbCreated); } break; case SIZE: as.setSmall(!as.isSmall()); Utils.actionBarMsg(p, Config.size + ": " + (as.isSmall() ? Config.small : Config.normal)); break; case BASE: as.setBasePlate(!as.hasBasePlate()); Utils.actionBarMsg(p, Config.basePlate + ": " + (as.hasBasePlate() ? Config.isOn : Config.isOff)); break; case GRAV: as.setGravity(!as.hasGravity()); Utils.actionBarMsg(p, Config.gravity + ": " + (as.hasGravity() ? Config.isOn : Config.isOff)); break; case ARMS: as.setArms(!as.hasArms()); Utils.actionBarMsg(p, Config.arms + ": " + (as.hasArms() ? Config.isOn : Config.isOff)); break; case NAME: p.closeInventory(); plugin.setName(p, as); break; case PHEAD: p.closeInventory(); plugin.setPlayerSkull(p, as); break; case INVUL: Utils.actionBarMsg(p, Config.invul + ": " + (Utils.toggleInvulnerability(as) ? Config.isOn : Config.isOff)); break; case SLOTS: Utils.actionBarMsg(p, Config.equip + ": " + (Main.nms.toggleSlotsDisabled(as) ? Config.locked : Config.unLocked)); break; case MOVE: p.closeInventory(); UUID uuid = p.getUniqueId(); if(plugin.carryingArmorStand.containsKey(uuid)) { plugin.carryingArmorStand.remove(uuid); Utils.actionBarMsg(p, Config.asDropped); } else { plugin.pickUpArmorStand(as, p, false); Utils.actionBarMsg(p, Config.carrying); } break; case GLOW: Utils.actionBarMsg(p, Config.glow + ": " + (Utils.toggleGlow(as) ? Config.isOn : Config.isOff)); break; default: return; } i.setItem(t.getSlot(), updateLore(t)); }