[SPIGOT-5731] PortalCreateEvent#getEntity returns null for nether portals ignited by flint and steel Created: 09/May/20  Updated: 27/Jul/24  Resolved: 27/Jul/24

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

Type: Bug Priority: Minor
Reporter: Maxim Chernykh Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: 1.15.2, Portal, api, event, problem, spigot
Environment:

Java 8 build 1.8.0_251-b08

Win10 Version 10.0.18363.778

Spigot git-Spigot-2f5d615-d07a78b (MC: 1.15.2) - latest on 9 may 2020


Issue Links:
Duplicate
is duplicated by SPIGOT-7851 PortalCreateEvent#getEntity returns n... Resolved
Version: git-Spigot-2f5d615-d07a78b (MC: 1.15.2)
Guidelines Read: Yes

 Description   

Event PortalCreateEvent has method .getEntity() that shoud return value like Player?

but in this case when I create a portal (use Flint and Steel) it returns null.

public class PreventPortal extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents((Listener) this, (Plugin) this);

    }

    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onPortalOpen(PortalCreateEvent event) {
        if (event.getEntity() == null) {
            String lox = "Hello this is cant be null because im a player!";
            getLogger().info(lox);
        }
    }
}


 Comments   
Comment by Vadim Sokolov [ 10/May/20 ]

сам ты lox

Comment by md_5 [ 10/May/20 ]

The method is nullable.
A player will be available eg when a player is travelling to/from the nether and a portal is made.
It will not be available when a player is lighting a frame with flint, that is a very hard thing to add.

Generated at Sat Apr 05 09:38:23 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.