Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
paper-only entity enter/exit area event
and impl item scriptname tag deprecation adds #1996
- Loading branch information
1 parent
95290eb
commit b40b588
Showing
5 changed files
with
121 additions
and
76 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
37 changes: 37 additions & 0 deletions
37
...c/main/java/com/denizenscript/denizen/paper/events/AreaEnterExitScriptEventPaperImpl.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,37 @@ | ||
package com.denizenscript.denizen.paper.events; | ||
|
||
import com.denizenscript.denizen.events.player.AreaEnterExitScriptEvent; | ||
import com.denizenscript.denizen.objects.EntityTag; | ||
import com.denizenscript.denizencore.objects.ObjectTag; | ||
import com.denizenscript.denizencore.objects.core.ElementTag; | ||
import io.papermc.paper.event.entity.EntityMoveEvent; | ||
import org.bukkit.event.EventHandler; | ||
|
||
public class AreaEnterExitScriptEventPaperImpl extends AreaEnterExitScriptEvent { | ||
|
||
@Override | ||
public ObjectTag getContext(String name) { | ||
if (name.equals("cause") && currentEvent instanceof EntityMoveEvent) { | ||
return new ElementTag("WALK"); | ||
} | ||
return super.getContext(name); | ||
} | ||
|
||
@Override | ||
public void registerCorrectClass() { | ||
if (onlyTrackPlayers) { | ||
initListener(new SpigotListeners()); | ||
} | ||
else { | ||
initListener(new PaperListeners()); | ||
} | ||
} | ||
|
||
public class PaperListeners extends SpigotListeners { | ||
|
||
@EventHandler | ||
public void onEntityMove(EntityMoveEvent event) { | ||
processNewPosition(new EntityTag(event.getEntity()), event.getTo(), event); | ||
} | ||
} | ||
} |
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