mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-09-30 07:37:31 +02:00
Properly protect chest_boats as vehicles
This commit is contained in:
parent
6efdb1089e
commit
0d2ed8205f
@ -101,8 +101,20 @@ public static boolean isRiddenOnUse(Entity entity) {
|
|||||||
* @return true if the type is a vehicle type
|
* @return true if the type is a vehicle type
|
||||||
*/
|
*/
|
||||||
public static boolean isVehicle(EntityType type) {
|
public static boolean isVehicle(EntityType type) {
|
||||||
return type == EntityType.BOAT
|
return isBoat(type) || isMinecart(type);
|
||||||
|| isMinecart(type);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether the given entity type is a Boat type.
|
||||||
|
*
|
||||||
|
* @param type the type
|
||||||
|
* @return true if the type is a Boat type
|
||||||
|
*/
|
||||||
|
public static boolean isBoat(EntityType type) {
|
||||||
|
return switch(type) {
|
||||||
|
case BOAT, CHEST_BOAT -> true;
|
||||||
|
default -> false;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,13 +124,11 @@ public static boolean isVehicle(EntityType type) {
|
|||||||
* @return true if the type is a Minecart type
|
* @return true if the type is a Minecart type
|
||||||
*/
|
*/
|
||||||
public static boolean isMinecart(EntityType type) {
|
public static boolean isMinecart(EntityType type) {
|
||||||
return type == EntityType.MINECART
|
return switch(type) {
|
||||||
|| type == EntityType.MINECART_CHEST
|
case MINECART, MINECART_CHEST, MINECART_COMMAND, MINECART_FURNACE,
|
||||||
|| type == EntityType.MINECART_COMMAND
|
MINECART_HOPPER, MINECART_MOB_SPAWNER, MINECART_TNT -> true;
|
||||||
|| type == EntityType.MINECART_FURNACE
|
default -> false;
|
||||||
|| type == EntityType.MINECART_HOPPER
|
};
|
||||||
|| type == EntityType.MINECART_MOB_SPAWNER
|
|
||||||
|| type == EntityType.MINECART_TNT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user