Skip to content

Conversation

NotSoDelayed
Copy link
Contributor

Problem

Skript is lacking a few portal related features, while some still consists of legacy code.

Solution

This PR adds some missing portal related features (refer to section below), enhances existing ones, and finally they all reunite into its a single module as part of modernizing Skript registrations.

Changes

  • Adds a new classinfo: PortalType -- an enum of portal types, to differentiate the portal type in all portal events (except 'portal exit') via event-portaltype
  • Adds support of 'End Gateway' into existing portal event
  • Adds event values into existing 'Portal Create' event: event-location, event-portaltype
  • Adds 'Portal Exit' event and its event values: (values inherited from EntityTeleportEvent), past event-vector, event-vector (mutable)
  • Renamed ExprPortal to ExprPortalBlocks due to former name was ambiguous
  • Optimizes existing portal related features to current Skript standards

Testing Completed

JUnit tests were implemented at EvtPortalTest.java and PortalTest.sk, covering every portal related events and expressions supported.

Supporting Information

At this date of PR creation, this PR was designed ahead of time with proposed Skript 2.14 standards, which includes dropping Spigot support and Minecraft versions below 1.21, which is why tests below 1.21 will fail.


Completes: none
Related: none

@NotSoDelayed NotSoDelayed requested review from a team as code owners September 28, 2025 10:40
@NotSoDelayed NotSoDelayed requested review from UnderscoreTud, cheeezburga and erenkarakal and removed request for a team September 28, 2025 10:40
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Sep 28, 2025
""")
@Since("2.4")
@Events("portal_create")
public class ExprPortalBlocks extends SimpleExpression<Block> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sovde's request on converting to EVE

.examples(
"on portal exit:",
"\tbroadcast \"%event-entity% is exiting a portal at %event-location%\"",
"\tadd 2 to vector y of event-vector")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs explanation for what event-vector is

Comment on lines +25 to +42
Skript.registerEvent("Portal / End Gateway", EvtPortal.class, events, "[player] portal", "entity portal")
.description(
"Called when a player or an entity uses a nether portal, end portal or end gateway. Note that events with keyword 'entity' does not apply to players.",
"<a href='#EffCancelEvent'>Cancel the event</a> to prevent the entity from teleporting."
).keywords(
"player", "entity"
).examples(
"on portal:",
"\tbroadcast \"%player% has entered a %event-portaltype%!\"",
"",
"on player portal:",
"\tplayer's world is world(\"wilderness\")",
"\tset world of event-location to player's world",
"\tadd 9000 to x-pos of event-location",
"",
"on entity portal:",
"\tbroadcast \"A %type of event-entity% has entered a portal!"
).since("1.0, 2.5.3 (entities), INSERT VERSION (location changers, end gateway)");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Skript.registerEvent("Portal / End Gateway", EvtPortal.class, events, "[player] portal", "entity portal")
.description(
"Called when a player or an entity uses a nether portal, end portal or end gateway. Note that events with keyword 'entity' does not apply to players.",
"<a href='#EffCancelEvent'>Cancel the event</a> to prevent the entity from teleporting."
).keywords(
"player", "entity"
).examples(
"on portal:",
"\tbroadcast \"%player% has entered a %event-portaltype%!\"",
"",
"on player portal:",
"\tplayer's world is world(\"wilderness\")",
"\tset world of event-location to player's world",
"\tadd 9000 to x-pos of event-location",
"",
"on entity portal:",
"\tbroadcast \"A %type of event-entity% has entered a portal!"
).since("1.0, 2.5.3 (entities), INSERT VERSION (location changers, end gateway)");
Skript.registerEvent("Portal / End Gateway", EvtPortal.class, events, "[player] portal", "entity portal")
.description(
"Called when a player or an entity uses a nether portal, end portal or end gateway. Note that events with keyword 'entity' does not apply to players.",
"<a href='#EffCancelEvent'>Cancel the event</a> to prevent the entity from teleporting.")
.keywords("player", "entity")
.examples(
"on portal:",
"\tbroadcast \"%player% has entered a %event-portaltype%!\"",
"",
"on player portal:",
"\tplayer's world is world(\"wilderness\")",
"\tset world of event-location to player's world",
"\tadd 9000 to x-pos of event-location",
"",
"on entity portal:",
"\tbroadcast \"A %type of event-entity% has entered a portal!")
.since("1.0, 2.5.3 (entities), INSERT VERSION (location changers, end gateway)");

you should also use the """ text blocks here to clean it up.

on portal:
wait 1 tick
set portal cooldown of event-entity to 5 seconds
""")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
""")
""")

@sovdeeth sovdeeth added enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature Pull request adding a new feature. labels Sep 28, 2025
@sovdeeth sovdeeth moved this to In Review in 2.14 Releases Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature Pull request adding a new feature. needs reviews A PR that needs additional reviews

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants