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
[B+C] HangingType and VehicleType enums. Adds BUKKIT-5778. #1109
base: master
Are you sure you want to change the base?
Conversation
Unknown is needed because for whatever reason, CraftHanging can be initalized.
You can use EntityType or instanceof. |
No worries, I |
I understand what you mean by instanceof, but not using entitytype. One can certainly check if an entity is a hanging/vehicle with I don't understand how one could use EntityType in these situations. EntityType would include values that do not match valid vehicles and hangings, which means that there are values that do not match. |
Your situations are not very strong.
This can be done with a tab completer with some permissions and a configuration file. It's a trivial case. I'm unsure of the full use case for this PR as this PR seems more of a unneeded convenience due to the problem scope mentioned. What is the full use case? Thus far there is no non-trivial solution that would push this PR forward. Edit: Not to mention that an item in the world can be a vehicle. |
There is no location where this is absolutely required; it is mainly for convenience. But one place where this is useful is checking if an EntityType is a hanging - One cannot do I don't believe there is a place where this is absolutely required - A switch statement could do most of these things, but if mojang creates a new vehicle, that's not going to be in plugins that aren't updated.
I don't get what you mean - While all entities (and I assume you mean entities and not items) do have a getPassenger function, they aren't acceptable in VehicleEvent's getVehicle method, as they don't extend vehicle. |
Why wouldn't Your problem scope is still unclear and I don't think this PR solves the problem you appear to be trying to solve in a plugin that you are working on. If you are working on a plugin, I suggest you hop into #bukkitdev on IRC so many more people can try to assist. If you are not working on a plugin, then you really do need to spell out a solid use case for this PR. |
@Pokechu22 Vehicle.class.isAssignableFrom(EntityType.MINECART.getEntityClass()) This should also be used in the tests to ensure that all |
Wouldn't it just make sense to have all the entity types in the |
@bendem I guess they are, aren't they? Which one is missing? |
I was referring to that yeah, sounds kinda weird now that I think of it. |
I guess creating this kind of methods is useless because there are so much types that have to be covered by this methods but all of them can be easyly covered by |
True |
The Issue:
There are no HangingType nor VehicleType enums.
Justification for this PR:
There are several places where Hanging/Vehicle enums would be useful:
PR Breakdown:
In Bukkit:
Added
getVehicleType()
method to Vehicle and VehicleEvent, andgetHangingType()
method to Hanging and HangingEvent.Added tests for HangingType and VehicleType enums.
In CraftBukkit:
getVehicleType()
andgetHangingType()
to the necessary classes.Testing Results and Materials:
See org.bukkit.HangingTypeTest.java and org.bukkit.VehicleTypeTest.java. These tests cover the HangingType and VehicleType enums only, not the getters on the events or entities themselves.
Relevant PR(s):
B-1107 - #1107 - Adds a parsing method to EntityType, which I
stoleborrowed for use in VehicleType and HangingType. (BUKKIT-5777)B-1109 - #1109 - This Pull Request
CB-1411 - Bukkit/CraftBukkit#1411 - CraftBukkit Counterpart of this Pull Request
JIRA Ticket:
BUKKIT-5778 - https://bukkit.atlassian.net/browse/BUKKIT-5778
EDITS: