-
-
Notifications
You must be signed in to change notification settings - Fork 407
Setters for Event Locations in Teleport Events #8197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Absolutionism
merged 7 commits into
SkriptLang:dev/feature
from
NotSoDelayed:feature/player-portal-location-changer
Sep 23, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1f1cbf5
Add setters for event-location of move events
NotSoDelayed b86d9d4
Merge player and entity portal events
NotSoDelayed 388dfa2
Added more details on event desc
NotSoDelayed ccd2079
Added more details on examples
NotSoDelayed 8cbbcf9
Moved setters to teleport events
NotSoDelayed 8cd2dde
Merge branch 'dev/feature' into feature/player-portal-location-changer
Efnilite e725aee
Merge branch 'dev/feature' into feature/player-portal-location-changer
Absolutionism File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,57 @@ | ||
package ch.njol.skript.events; | ||
|
||
import org.bukkit.event.Event; | ||
import org.bukkit.event.entity.EntityPortalEvent; | ||
import org.bukkit.event.player.PlayerPortalEvent; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.lang.Literal; | ||
import ch.njol.skript.lang.SkriptEvent; | ||
import ch.njol.skript.lang.SkriptParser.ParseResult; | ||
import ch.njol.util.coll.CollectionUtils; | ||
|
||
public class EvtPortal extends SkriptEvent { | ||
|
||
static { | ||
Skript.registerEvent("Portal", EvtPortal.class, CollectionUtils.array(PlayerPortalEvent.class, EntityPortalEvent.class), "[player] portal", "entity portal") | ||
.description( | ||
"Called when a player or an entity uses a nether or end portal. Note that 'on entity portal' event 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 portal!\"", | ||
"", | ||
"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)"); | ||
} | ||
|
||
private boolean isPlayer; | ||
|
||
@Override | ||
public boolean init(Literal<?>[] args, int matchedPattern, ParseResult parseResult) { | ||
isPlayer = matchedPattern == 0; | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean check(Event event) { | ||
if (isPlayer) | ||
return event instanceof PlayerPortalEvent; | ||
return event instanceof EntityPortalEvent; | ||
} | ||
|
||
@Override | ||
public String toString(@Nullable Event event, boolean debug) { | ||
return (isPlayer ? "player" : "entity") + " portal"; | ||
} | ||
|
||
} |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.