Use Spigot only events. (#2029)

I missed that EntityMoveEvent is only Paper. Interesting why Spigot does not have such...

Fixes #2028
This commit is contained in:
BONNe 2022-10-01 01:50:32 +03:00 committed by GitHub
parent 52bca66149
commit b263c92c13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,12 +18,12 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityPortalEnterEvent; import org.bukkit.event.entity.EntityPortalEnterEvent;
import org.bukkit.event.entity.EntityPortalEvent; import org.bukkit.event.entity.EntityPortalEvent;
import org.bukkit.event.entity.EntityPortalExitEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNull;
import java.util.UUID; import java.util.UUID;
import io.papermc.paper.event.entity.EntityMoveEvent;
import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.lists.Flags; import world.bentobox.bentobox.lists.Flags;
import world.bentobox.bentobox.util.Util; import world.bentobox.bentobox.util.Util;
@ -170,21 +170,17 @@ public class EntityTeleportListener extends AbstractTeleportListener implements
* @param event entity move event * @param event entity move event
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityExitPortal(EntityMoveEvent event) public void onEntityExitPortal(EntityPortalExitEvent event)
{ {
if (!this.inPortal.contains(event.getEntity().getUniqueId())) if (!this.inPortal.contains(event.getEntity().getUniqueId()))
{ {
return; return;
} }
if (!event.getTo().getBlock().getType().equals(Material.NETHER_PORTAL))
{
// Player exits nether portal.
this.inPortal.remove(event.getEntity().getUniqueId()); this.inPortal.remove(event.getEntity().getUniqueId());
this.inTeleport.remove(event.getEntity().getUniqueId()); this.inTeleport.remove(event.getEntity().getUniqueId());
this.teleportOrigin.remove(event.getEntity().getUniqueId()); this.teleportOrigin.remove(event.getEntity().getUniqueId());
} }
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------