-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad53eed
commit cc819ad
Showing
7 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/com/github/mori01231/lifecore/event/AsyncPlayerPreInteractEntityEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.github.mori01231.lifecore.event; | ||
|
||
import net.minecraft.server.v1_15_R1.Entity; | ||
import net.minecraft.server.v1_15_R1.PacketPlayInUseEntity; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.event.player.PlayerEvent; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class AsyncPlayerPreInteractEntityEvent extends PlayerEvent implements Cancellable { | ||
private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
private final PacketPlayInUseEntity.EnumEntityUseAction action; | ||
private final Entity interactedEntity; | ||
private boolean cancelled = false; | ||
|
||
public AsyncPlayerPreInteractEntityEvent(@NotNull Player player, @NotNull PacketPlayInUseEntity.EnumEntityUseAction action, @NotNull Entity interactedEntity) { | ||
super(player, true); | ||
this.action = action; | ||
this.interactedEntity = interactedEntity; | ||
} | ||
|
||
@NotNull | ||
public PacketPlayInUseEntity.EnumEntityUseAction getAction() { | ||
return action; | ||
} | ||
|
||
@NotNull | ||
public Entity getInteractedEntity() { | ||
return interactedEntity; | ||
} | ||
|
||
@Override | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean cancel) { | ||
cancelled = cancel; | ||
} | ||
|
||
@Override | ||
public @NotNull HandlerList getHandlers() { | ||
return HANDLER_LIST; | ||
} | ||
|
||
@SuppressWarnings("unused") // required for bukkit | ||
@NotNull | ||
public static HandlerList getHandlerList() { | ||
return HANDLER_LIST; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters