[SPIGOT-794] Method to get player from VehicleCreateEvent Created: 12/Apr/15 Updated: 15/Sep/20 Resolved: 19/Dec/19 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor |
| Reporter: | xtechgamer735 | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 3 |
| Labels: | Event, VehicleCreateEvent | ||
| Environment: |
All |
||
| Description |
|
Have a method of getting a player who placed the vehicle in the VehicleCreateEvent. Even though they can be placed with dispensers etc... It would be easy to filter out a null value for it. Im sure many other developers would like to use this feature. |
| Comments |
| Comment by md_5 [ 19/Dec/19 ] |
|
EntityPlaceEvent has this now |
| Comment by D S [ 13/Jan/18 ] |
|
How about a getCreator() and that would return an entity or null. |
| Comment by xtechgamer735 [ 01/Nov/15 ] |
|
I completely agree |
| Comment by BillyGalbreath [ 05/Oct/15 ] |
|
I dont see why this method doesn't have a getPlayer() or similar method. The opposite event (VehicleDestoryEvent) has a getAttacker() which returns an entity or null. Also, would be nice to have this event cancellable like the destroy event is. Consistency wasn't the old Bukkit team's string point. Lets not continue that stride now that Spigot is in control. |
| Comment by xtechgamer735 [ 17/Apr/15 ] |
|
It is entirely possible using the above method, but its not the most efficient way since wrong players might be targeted. |
| Comment by Hex [ 16/Apr/15 ] |
|
Couldn't you just listen to a PlayerInteractEvent? |
| Comment by xtechgamer735 [ 12/Apr/15 ] |
|
I forgot to add, currently the only way to achieve a similar effect is via a PlayerInteractEvent. You must get the entities in a radius of the vehicle, check for a player then perform an action on that player. |
| Comment by SpigotMC [ 12/Apr/15 ] |
|
Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 23 version(s) behind. CraftBukkit is 42 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue. |