Skip to content
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

Rework the /origin command #584

Merged
merged 5 commits into from
Sep 4, 2022

Conversation

eggohito
Copy link
Collaborator

@eggohito eggohito commented Aug 10, 2022

This PR refactors the old code for the pre-existing sub-commands of the /origin command. It also adds a new sub-command, random with <targets> <layer> as its arguments; it randomizes the origin of the specified target(s) in the specified origin layer.

e.g:

#  Randomize the origin of the current player in the `origins:origin` origin layer:
origin random @s origins:origin


#  You can also randomize the origin of certain players in other origin layers, like so:
origin random @a[sort = random, limit = 3] origins-classes:class

origin random @a[tag = test] origins:origin

origin random @a example:custom_layer

+ Added a new `... random <targets> <layer>` sub-command
* Refactored the old code for pre-existing sub-commands
* Fixed apace100#583
@eggohito
Copy link
Collaborator Author

Converting the PR as draft for now since I haven't tested it extensively yet

@eggohito eggohito marked this pull request as draft August 10, 2022 14:32
* Providing a non-existent origin layer in a layer argument type now properly throws an exception
* Surrounded a try-catch block for the list suggestions of the origin argument type
@eggohito
Copy link
Collaborator Author

eggohito commented Aug 11, 2022

This PR should also fix some issues regarding the origin and origin layer argument types.
(OriginArgumentType and LayerArgumentType respectively)

  • Trying to reference an invalid origin layer should now properly throw an exception.
    (Previously, it wasn't throwing an exception which can cause some interesting issues such as preventing the NBT of the player from being saved)

  • The suggestions list of the origin argument type should now depend on the specified origin layer of the origin layer argument type (e.g: only origins registered in the origin layer will be displayed). If the origin layer does not exist, it'll display nothing.
    ([BUG] All origins are displayed in the list suggestions for the <origin> argument of the /origin command #583)

@eggohito eggohito marked this pull request as ready for review August 11, 2022 09:07
* The `random` sub-command now allows randomizing the origins of all origin layers
* Both sub-commands now allow for optional target selectors
@MerchantPug
Copy link
Contributor

Ignore the two above references, I was just stating how I was missing this implementation in my porting process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants