Skip to content

Commit

Permalink
Fixed enter event
Browse files Browse the repository at this point in the history
Closes #312
  • Loading branch information
Lorenzo0111 committed Nov 8, 2024
1 parent ed13412 commit 9d7138f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repositories {
mavenCentral()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://jitpack.io")
maven("https://repo.dmulloy2.net/nexus/repository/public/")
maven("https://repo.dmulloy2.net/repository/public/")
maven("https://repo.citizensnpcs.co/")
maven("https://repo.glaremasters.me/repository/towny/")
maven("https://mvn.lumine.io/repository/maven-public/") {
Expand Down Expand Up @@ -43,7 +43,7 @@ dependencies {
compileOnly("org.spigotmc:spigot-api:1.20.6-R0.1-SNAPSHOT")

// Compatibilities
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0")
compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0")
compileOnly("me.zombie_striker:QualityArmory:2.0.15")
compileOnly("com.github.TownyAdvanced:Towny:0.100.4.7")
compileOnly("com.github.MilkBowl:VaultAPI:1.7.1")
Expand Down
17 changes: 12 additions & 5 deletions src/main/java/me/zombie_striker/qav/api/QualityArmoryVehicles.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,19 @@ public static void setAddPassager(VehicleEntity vehicleEntity, Player clicker, i

@SuppressWarnings("deprecation")
public static void addPlayerToCar(VehicleEntity ve, Player player, boolean allowDriverSeat) {
PlayerEnterQAVehicleEvent event = new PlayerEnterQAVehicleEvent(ve, player);
Bukkit.getPluginManager().callEvent(event);
if (event.isCanceled()) {
return;
}
if (ve == null)
return;
if (ve.getDriverSeat() == null) {
return;
}
if ((ve.getDriverSeat().getPassenger() == null && allowDriverSeat)
&& (!Main.requirePermissionToDrive || PermissionHandler.canDrive(player, ve.getType()))) {
PlayerEnterQAVehicleEvent event = new PlayerEnterQAVehicleEvent(ve, player);
Bukkit.getPluginManager().callEvent(event);
if (event.isCanceled()) {
return;
}

if (ve.getOwner() == null && Main.setOwnerIfNoneExist) {
ve.setOwner(player.getUniqueId());
if (MessagesConfig.MESSAGE_NOW_OWN_CAR.length() > 1) {
Expand All @@ -240,6 +241,12 @@ public static void addPlayerToCar(VehicleEntity ve, Player player, boolean allow
if (seatId < 0)
return;

PlayerEnterQAVehicleEvent event = new PlayerEnterQAVehicleEvent(ve, player);
Bukkit.getPluginManager().callEvent(event);
if (event.isCanceled()) {
return;
}

ve.getType().playAnimation(ve, Animation.AnimationType.ENTER, seatId + "");
setAddPassager(ve, player, seatId);
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2.3.10
Changelog:
- Performance fixes
- Added target for remove command
- Bump dependencies

2.3.9
Changelog:
- 1.21 support
Expand Down

0 comments on commit 9d7138f

Please sign in to comment.