-
-
Notifications
You must be signed in to change notification settings - Fork 406
Fixes vehicle register #8092
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
base: dev/patch
Are you sure you want to change the base?
Fixes vehicle register #8092
Conversation
Co-authored-by: SirSmurfy2 <82696841+Absolutionism@users.noreply.github.com>
…s/Skript into fix/vehicle-register
@Example(""" | ||
set the vehicle of {game::players::*} to a saddled pig | ||
give {game::players::*} a carrot on a stick | ||
""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""") | |
""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is not proper Java standards. Avoids the addition of a blank line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation of the block string is determined by the location of the left-most non-space character, OR the ending """. If you put the """ all the way to the left like that, you cause the example string to be indented by a tab. We don't want that, so the """ needs to be on the same column as the example text.
See https://www.baeldung.com/java-text-blocks#indentation for examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you randomly put a new line break at the end. The existing annotations don't do this. This would essentially force a documentation page to check if the example ended with a new line break or not to differ between the annotations. Just keep it standardized and don't include a random new line break at the end of the returned string so the documentation page doesn't have to worry about varation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This formatting still contains a line break at the end. If you wanted no line break, you would write:
@Example("""
set the vehicle of {game::players::*} to a saddled pig
give {game::players::*} a carrot on a stick""")
which is pretty ugly.
The difference between
@Example("""
set the vehicle of {game::players::*} to a saddled pig
give {game::players::*} a carrot on a stick
""")
and
@Example("""
set the vehicle of {game::players::*} to a saddled pig
give {game::players::*} a carrot on a stick
""")
is simply indentation, and the second is what we want. The first causes the lines to have a tab at the front, the second doesn't have tabs.
if (object instanceof Entity entity) { | ||
entity.eject(); | ||
for (Entity passenger : passengers) { | ||
// Avoid infinity mounting | ||
if (event instanceof VehicleExitEvent && predicate.test(passenger) && passenger.equals(((VehicleExitEvent) event).getExited())) | ||
continue; | ||
if (event instanceof EntityDismountEvent && predicate.test(passenger) && passenger.equals(((EntityDismountEvent) event).getEntity())) | ||
continue; | ||
assert passenger != null; | ||
passenger.leaveVehicle(); | ||
entity.addPassenger(passenger); | ||
} | ||
} else if (object instanceof EntityData entityData) { | ||
VehicleExitEvent vehicleExitEvent = event instanceof VehicleExitEvent ? (VehicleExitEvent) event : null; | ||
EntityDismountEvent entityDismountEvent = event instanceof EntityDismountEvent ? (EntityDismountEvent) event : null; | ||
for (Entity passenger : passengers) { | ||
// Avoid infinity mounting | ||
if (vehicleExitEvent != null && predicate.test(passenger) && passenger.equals(vehicleExitEvent.getExited())) | ||
continue; | ||
if (entityDismountEvent != null && predicate.test(passenger) && passenger.equals(entityDismountEvent.getEntity())) | ||
continue; | ||
Entity vehicle = entityData.spawn(passenger.getLocation()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure about these checks within the loops, same reasoning as with #get
Would like thoughts from other team members
@Example(""" | ||
set the vehicle of {game::players::*} to a saddled pig | ||
give {game::players::*} a carrot on a stick | ||
""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This formatting still contains a line break at the end. If you wanted no line break, you would write:
@Example("""
set the vehicle of {game::players::*} to a saddled pig
give {game::players::*} a carrot on a stick""")
which is pretty ugly.
The difference between
@Example("""
set the vehicle of {game::players::*} to a saddled pig
give {game::players::*} a carrot on a stick
""")
and
@Example("""
set the vehicle of {game::players::*} to a saddled pig
give {game::players::*} a carrot on a stick
""")
is simply indentation, and the second is what we want. The first causes the lines to have a tab at the front, the second doesn't have tabs.
Description
vehicle
itself cannot be used within anon mount
event.The only change is the
registerDefault
and removal of Delay.isDelayed because setTime handles this. The rest is code standards.Errors:

Target Minecraft Versions: any
Requirements: none
Related Issues: none