[SPIGOT-7615] PlayerLeashEntityEvent cancelled eats lead Created: 18/Apr/24  Updated: 25/Dec/24  Resolved: 27/Apr/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Anonymous Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Attachments: PNG File Untitled.png    
Version: 1.20.4-R0.1-SNAPSHOT
Plugin: Skyline
Guidelines Read: Yes

 Description   

When PlayerLeashEntityEvent is cancelled it eats the lead. (The lead disappears)

    @EventHandler
    public void onLeash(PlayerLeashEntityEvent event) {
        Player player = event.getPlayer();
        ItemStack itemStack = player.getInventory().getItemInMainHand();
        if(itemStack.hasItemMeta() && hookHandler.isHook(itemStack)) { //Todo: the item vanishes.
            event.setCancelled(true);
        }
    } 

 

Was bit unsure if spigot or buildtools was the correct place, but afterthought... 



 Comments   
Comment by Marvin Rieple [ 27/Apr/24 ]

Made a PR for this: craftbukkit#1388

You can test it with BuildTools:

java -jar BuildTools.jar --rev 4129 --compile spigot --pr craftbukkit:1388 
Comment by Anonymous [ 22/Apr/24 ]

I am leashing a pig, as a player (Player to entity). when I cancel the PlayerLeashEntityEvent it makes the item into a ghost item.

Version: [09:48:48] [Server thread/INFO]: This server is running CraftBukkit version 4085-Spigot-b754dcc-d9209ed (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT)
[09:48:48] [Server thread/INFO]: You are running the latest version

Comment by md_5 [ 21/Apr/24 ]

Please explain what you are leashing - entity to entity, player to entity, block to entity, etc.
What does /version say?

Generated at Sat Dec 13 13:36:33 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.