mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-18 00:20:44 +00:00
Prevent usage inside vehicle
This commit is contained in:
@@ -6,6 +6,8 @@ import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Optional;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -20,6 +22,11 @@ public class CardinalCommand extends BaseCommand {
|
||||
Player player = (Player) commandSender;
|
||||
Location currLocation = player.getLocation();
|
||||
|
||||
if (player.isInsideVehicle()) {
|
||||
player.sendMessage(Component.text("You cannot run this command from inside a vehicle!", NamedTextColor.RED));
|
||||
return;
|
||||
}
|
||||
|
||||
if(targetDirection == null){
|
||||
double newYaw = Math.rint(currLocation.getYaw() / 45) * 45;
|
||||
player.teleport(new Location(player.getWorld(), currLocation.getX(), currLocation.getY(),
|
||||
|
||||
Reference in New Issue
Block a user