mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Eject players from Minecarts if they cast a fishing rod (Anti-AFK)
This commit is contained in:
parent
6d19239db7
commit
b68bbad766
@ -34,6 +34,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.minecart.PoweredMinecart;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -649,6 +650,12 @@ public class PlayerListener implements Listener {
|
||||
{
|
||||
if(heldItem.getType() == Material.FISHING_ROD || player.getInventory().getItemInOffHand().getType() == Material.FISHING_ROD)
|
||||
{
|
||||
if(player.isInsideVehicle() && (player.getVehicle() instanceof Minecart || player.getVehicle() instanceof PoweredMinecart))
|
||||
{
|
||||
player.getVehicle().eject();
|
||||
player.setVelocity(player.getEyeLocation().getDirection().multiply(10));
|
||||
}
|
||||
|
||||
mcMMOPlayer.getFishingManager().setFishingRodCastTimestamp();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user