Solved Build Command

Discussion in 'Plugin Development' started by PhilDEV_Acc, Jan 7, 2020.

  1. Offline


    Hello Im trying to code a /build command that ignors the InventoryMoveEvent. How can I code it?

    public boolean onCommand(CommandSender sender, Command befehl, String befehlsname , String[] args) {
            if (sender instanceof Player) {
                Player spieler = (Player) sender;
                if (spieler.hasPermission("")) {
                }else {
                    spieler.sendMessage(ChatColor.RED + "Du hast keine berechtigung auf diesen Befehl");
            }else {
                this.getLogger().info("Dieser Befehl kann nur von Spielern ausgeführt werden");
    Thanks for helping.
    Last edited: Jan 7, 2020
  2. Offline


    @PhilDEV_Acc Could you explain a little more? What should the command do, why does it need to ignore an event, and which event is it? (There's no InventoryMoveEvent)
  3. Offline


    So I disabled for my Lobby plugin the InventoryClickEvent and the PlayerDropItemEvent so you cant move items but now you cant take blocks out of the creative Inventory so you cant build. The command should deactivate this so you can take Items in your inventory.
  4. Offline


    If you mean to un-cancel these events, you can do: (for each event)
    @EventHandler(priority = EventPriority.LOW)
    public void onClick(PlayerInventoryClickEvent e) {
        if (e.getPlayer().hasPermission("")) {
    Also, the easiest way to stop players building is to cancel BlockPlaceEvent
  5. Offline


    Add the players (or their uuids) to a list and check in the events for them

Share This Page